:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f7fb;
  color: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.app-shell {
  max-width: 1920px;
  margin: 0 auto;
  padding: 24px;
}

header {
  margin-bottom: 20px;
}

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 2.5vw, 2.8rem);
}

p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

label,
button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

label {
  font-weight: 600;
  color: #0f172a;
}

input[type="file"] {
  display: block;
}

input[type="number"] {
  width: 140px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  transition: background 0.18s ease;
}

button:hover:not(:disabled) {
  background: #1d4ed8;
}

button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.status-panel {
  margin-bottom: 20px;
}

.status-panel #status {
  padding: 14px 16px;
  border-radius: 16px;
  background: #e2e8f0;
  color: #0f172a;
}

.plots {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.plot-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px;
}

.plot-card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.1rem;
}

#tracePlot,
#diffPlot {
  min-height: 320px;
  width: 100%;
}

.results {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.result-panel {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px;
}

.result-panel h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #0f172a;
}

#modbusOutput {
  color: #0f172a;
}

.message-block {
  margin-bottom: 20px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.message-type {
  display: flex;
  gap: 8px;
  align-items: center;
}

.message-type label {
  font-weight: 500;
}

.message-content {
  font-family: monospace;
  font-size: 14px;
  line-height: 1.4;
}

@media (min-width: 900px) {
  .plots {
    grid-template-columns: 1fr 1fr;
  }

  .results {
    grid-template-columns: 1fr 1fr;
  }
}
