:root {
  color-scheme: dark;
  --bg: #0f1310;
  --panel: #171c19;
  --panel-strong: #1e2521;
  --panel-soft: #202925;
  --line: #2a352f;
  --line-strong: #36443d;
  --text: #f2f4ef;
  --text-dim: #aab4ab;
  --text-soft: #7f8c82;
  --green: #72c66b;
  --green-strong: #8ed57f;
  --amber: #c9a15a;
  --red: #c66d63;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(114, 198, 107, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(201, 161, 90, 0.08), transparent 24%),
    linear-gradient(180deg, #0f1310 0%, #111713 100%);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body {
  padding: 20px;
}

.shell {
  max-width: 1560px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h1,
.surface-header h2,
.map-header h3,
.side-panel h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.eyebrow,
.surface-kicker {
  margin: 0 0 6px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}

.status-cluster,
.surface-meta,
.metric-value-line,
.map-header,
.command-grid,
.overview-grid,
.overview-lower,
.isobus-grid {
  display: flex;
}

.status-cluster,
.surface-meta {
  gap: 10px;
}

.status-chip,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  font-size: 0.9rem;
}

.status-chip-live,
.tag-positive {
  color: var(--green-strong);
  border-color: rgba(114, 198, 107, 0.26);
  background: rgba(114, 198, 107, 0.09);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(114, 198, 107, 0.13);
}

.layout {
  display: grid;
  gap: 18px;
}

.surface {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 26%), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 22px;
}

.surface-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.surface-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.overview-grid {
  gap: 14px;
  margin-bottom: 14px;
}

.metric-panel,
.map-panel,
.sidebar-panel,
.side-panel,
.machine-panel {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.metric-panel {
  flex: 1;
  min-width: 0;
  padding: 18px;
}

.metric-panel-primary {
  background: linear-gradient(135deg, rgba(114, 198, 107, 0.15), rgba(114, 198, 107, 0.03)), var(--panel-strong);
}

.metric-label,
.metric-note,
.stat-list dt,
.command-sub {
  color: var(--text-dim);
}

.metric-label {
  margin: 0 0 10px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value-line {
  align-items: baseline;
  gap: 8px;
}

.metric-value {
  font-size: clamp(1.9rem, 4vw, 3.4rem);
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.metric-unit {
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.metric-note {
  margin: 12px 0 0;
  font-size: 0.95rem;
}

.gauge-track {
  margin-top: 16px;
  height: 10px;
  background: #121713;
  border-radius: 999px;
  overflow: hidden;
}

.gauge-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4c8548, var(--green-strong));
}

.overview-lower {
  gap: 14px;
}

.map-panel {
  flex: 1.35;
  padding: 18px;
}

.sidebar-panel {
  flex: 0.75;
  padding: 18px;
  display: grid;
  gap: 18px;
}

.field-map {
  position: relative;
  height: 320px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(90deg, #436f3f 0 24%, #739c44 24% 46%, #6f9440 46% 56%, #5a8039 56% 75%, #84a33f 75% 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.field-lane {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background: rgba(255, 236, 138, 0.26);
}

.field-lane-1 { left: 22%; }
.field-lane-2 { left: 49%; }
.field-lane-3 { left: 71%; }

.tractor-marker {
  position: absolute;
  left: 56%;
  top: 38%;
  width: 82px;
  height: 84px;
  transform: translate(-50%, -50%);
}

.tractor-body,
.tractor-implement {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 12px;
}

.tractor-body {
  top: 8px;
  width: 38px;
  height: 44px;
  background: #2b3530;
  border: 2px solid #d4dbd5;
}

.tractor-implement {
  top: 56px;
  width: 76px;
  height: 16px;
  background: rgba(114, 198, 107, 0.85);
}

.coverage-red {
  position: absolute;
  left: 44%;
  top: 46%;
  width: 74px;
  height: 38px;
  border-radius: 10px;
  background: rgba(198, 109, 99, 0.82);
}

.stat-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.stat-list.compact {
  gap: 10px;
}

.stat-list div,
.connection-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-list dt,
.stat-list dd,
.connection-list {
  margin: 0;
}

.stat-list dd,
.connection-list strong {
  color: var(--text);
  font-weight: 600;
}

.connection-list {
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.isobus-grid {
  gap: 14px;
  align-items: stretch;
}

.left-column,
.right-column {
  flex: 0.9;
  display: grid;
  gap: 14px;
}

.machine-panel {
  flex: 1.6;
  padding: 16px;
}

.side-panel {
  padding: 16px;
}

.machine-frame {
  background: linear-gradient(180deg, #1a211d, #141915);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 22px;
  padding: 14px;
}

.machine-svg {
  display: block;
  width: 100%;
  height: auto;
}

.machine-body,
.machine-link,
.machine-center,
.machine-wing,
.machine-tank,
.machine-cover,
.machine-wheel,
.machine-row {
  transition: fill 180ms ease, opacity 180ms ease, transform 220ms ease;
}

.machine-body,
.machine-center,
.machine-link,
.machine-wing {
  fill: #d9ddd7;
}

.machine-tank {
  fill: #c5cbc4;
}

.machine-cover {
  fill: #8f9891;
}

.machine-wheel {
  fill: #495048;
}

.machine-row {
  fill: #6a726c;
}

.machine-row.active {
  fill: var(--green);
}

.machine-cover.open {
  fill: var(--amber);
}

.section-strip {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.section-pill {
  min-height: 18px;
  border-radius: 999px;
  background: #39423b;
}

.section-pill.active {
  background: var(--green);
}

.stack-list {
  display: grid;
  gap: 12px;
}

.fill-card {
  padding: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
}

.fill-card strong {
  display: block;
  margin-bottom: 10px;
}

.fill-bar {
  height: 10px;
  background: #111512;
  border-radius: 999px;
  overflow: hidden;
}

.fill-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #446f41, var(--green-strong));
}

.fill-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.command-log {
  display: grid;
  gap: 10px;
  min-height: 168px;
}

.command-entry {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
}

.command-entry strong {
  display: block;
  margin-bottom: 6px;
}

.command-grid {
  gap: 12px;
  margin-top: 16px;
}

.command-button {
  width: 100%;
  min-width: 0;
  min-height: 90px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent), var(--panel-strong);
  color: var(--text);
  text-align: left;
  padding: 18px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.command-button:hover,
.command-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(114, 198, 107, 0.34);
  outline: none;
}

.command-title {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
  font-weight: 600;
}

.nav-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.nav-item {
  min-height: 72px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-size: 0.94rem;
}

.nav-item-active,
.nav-item-highlight {
  color: var(--text);
  border-color: rgba(114, 198, 107, 0.3);
}

.nav-item-highlight {
  background: rgba(114, 198, 107, 0.1);
}

@media (max-width: 1200px) {
  .overview-grid,
  .overview-lower,
  .isobus-grid,
  .command-grid {
    flex-direction: column;
  }

  .command-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    padding: 12px;
  }

  .surface,
  .metric-panel,
  .map-panel,
  .sidebar-panel,
  .side-panel,
  .machine-panel {
    border-radius: 20px;
  }

  .topbar,
  .surface-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .surface-meta,
  .status-cluster {
    justify-content: flex-start;
  }

  .overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .overview-grid,
  .command-grid,
  .nav-bar {
    grid-template-columns: 1fr;
  }

  .field-map {
    height: 220px;
  }
}
