:root {
  --ink: #2b2d42;
  --paper: #edf2f4;
  --alert: #ef233c;
  --muted: #8d99ae;
  --line: rgba(43, 45, 66, 0.16);
  --gold: #f6bd60;
  --green: #2a9d8f;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(43, 45, 66, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(43, 45, 66, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(43, 45, 66, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  min-height: 100vh;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  color: var(--paper);
  background: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 22px;
  z-index: 5;
}

.brand-mark {
  color: inherit;
  text-decoration: none;
  display: grid;
  gap: 8px;
  justify-items: center;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand-mark img {
  width: 54px;
  height: 54px;
}

.rail-nav {
  display: grid;
  gap: 8px;
}

.rail-button {
  border: 1px solid rgba(237, 242, 244, 0.2);
  min-height: 46px;
  color: var(--paper);
  background: transparent;
  border-radius: 8px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.rail-button.active,
.rail-button:hover {
  color: var(--ink);
  background: var(--paper);
}

.rail-meta {
  margin-top: auto;
  display: grid;
  gap: 5px;
  color: rgba(237, 242, 244, 0.75);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.rail-meta strong {
  color: var(--paper);
  word-break: break-word;
}

.workspace {
  min-width: 0;
  padding: 18px 22px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(320px, 620px);
  gap: 22px;
  align-items: end;
  margin-bottom: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 20px;
}

.filters {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.9fr;
  gap: 10px;
}

.filters label {
  display: grid;
  gap: 5px;
}

.filters span {
  color: var(--muted);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.filters input,
.filters select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.alert-strip {
  min-height: 44px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.alert-item {
  min-width: 250px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  border-left: 4px solid var(--alert);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 24px rgba(43, 45, 66, 0.08);
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.alert-item strong,
.alert-item time {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.alert-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alert-item.muted {
  border-left-color: var(--green);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: rise 180ms ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.operation-room {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  min-height: 510px;
}

.map-canvas {
  position: relative;
  min-height: 510px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 20% 22%, rgba(246, 189, 96, 0.25), transparent 24%),
    radial-gradient(circle at 82% 28%, rgba(42, 157, 143, 0.22), transparent 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(237, 242, 244, 0.86));
  box-shadow: var(--shadow);
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(43, 45, 66, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 45, 66, 0.08) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.28));
}

.route {
  position: absolute;
  inset: 12% 12%;
  border: 2px solid rgba(43, 45, 66, 0.28);
  border-radius: 50%;
  transform: rotate(-12deg);
}

.route-b {
  inset: 22% 20%;
  border-color: rgba(239, 35, 60, 0.32);
  transform: rotate(22deg);
}

.zone-lane {
  position: absolute;
  min-width: 100px;
  border-top: 1px solid rgba(43, 45, 66, 0.25);
  color: var(--ink);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  text-transform: uppercase;
}

.zone-lane span {
  background: rgba(237, 242, 244, 0.9);
  padding-right: 8px;
}

.lane-north { left: 14%; top: 15%; width: 34%; }
.lane-center { left: 43%; top: 31%; width: 34%; }
.lane-west { left: 20%; top: 54%; width: 35%; }
.lane-south { left: 58%; top: 66%; width: 27%; }
.lane-east { left: 66%; top: 22%; width: 24%; }

.map-node {
  position: absolute;
  width: 98px;
  min-height: 62px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 8px;
  padding: 9px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 12px 22px rgba(43, 45, 66, 0.22);
  display: grid;
  gap: 3px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.map-node:hover {
  transform: translate(-50%, -52%) scale(1.03);
  box-shadow: 0 18px 30px rgba(43, 45, 66, 0.3);
}

.map-node span {
  color: rgba(237, 242, 244, 0.78);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.map-node strong {
  font-size: 16px;
}

.map-node.late {
  background: var(--alert);
}

.map-node.paid {
  background: var(--green);
}

.inspector {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
}

.inspector-head,
.metric-stack,
.action-log,
.chart-panel,
.import-layout,
.public-layout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 30px rgba(43, 45, 66, 0.08);
}

.inspector-head {
  padding: 14px;
  display: grid;
  gap: 5px;
}

.inspector-head span,
.metric-stack span,
.log-line span {
  color: var(--muted);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.inspector-head strong {
  line-height: 1.35;
}

.metric-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
}

.metric-stack div {
  min-height: 84px;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  align-content: space-between;
}

.metric-stack strong {
  font-size: 24px;
}

.action-log {
  padding: 14px;
  overflow: auto;
}

.log-line {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.log-line p {
  margin: 3px 0 0;
  line-height: 1.35;
}

.task-panel {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.task-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 140px 160px 230px;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.task-main {
  min-width: 0;
}

.task-main h3 {
  margin: 5px 0 4px;
  font-size: 16px;
}

.task-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.step-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--ink);
  background: rgba(141, 153, 174, 0.2);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.task-money,
.task-state {
  display: grid;
  gap: 4px;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.task-money strong {
  font-size: 20px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--alert);
}

.task-actions {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  gap: 8px;
}

.task-actions button,
.primary-action,
.ghost-action {
  min-height: 39px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  color: var(--paper);
  background: var(--ink);
  padding: 0 12px;
}

.task-actions button:last-child,
.ghost-action {
  color: var(--ink);
  background: transparent;
}

.analytics-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr;
  gap: 14px;
}

.chart-panel,
.import-layout,
.public-layout {
  padding: 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(120px, 1fr) 120px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.bar-row span,
.bar-row strong,
.status-row {
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.bar-row div {
  height: 14px;
  background: rgba(141, 153, 174, 0.18);
  border-radius: 999px;
  overflow: hidden;
}

.bar-row i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  border-radius: inherit;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.emphasis {
  color: var(--paper);
  background: var(--ink);
}

.big-number {
  margin-bottom: 10px;
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 800;
  line-height: 1;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.import-layout p,
.public-layout p {
  color: var(--muted);
  line-height: 1.55;
}

pre {
  grid-column: 1 / -1;
  margin: 0;
  min-height: 140px;
  overflow: auto;
  border-radius: 8px;
  padding: 14px;
  color: var(--paper);
  background: var(--ink);
  white-space: pre-wrap;
}

.public-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.public-list {
  display: grid;
  gap: 8px;
}

.public-list article {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.public-list span,
.public-list time {
  color: var(--muted);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.empty-state {
  border: 1px dashed var(--muted);
  border-radius: 8px;
  padding: 24px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

@media (max-width: 1080px) {
  .topbar,
  .operation-room,
  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .inspector {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }

  .action-log {
    grid-column: 1 / -1;
    max-height: 260px;
  }

  .task-row {
    grid-template-columns: 1fr 130px;
  }

  .task-actions,
  .task-state {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-rail {
    position: static;
    height: auto;
    padding: 10px;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
  }

  .brand-mark {
    grid-template-columns: auto auto;
    justify-items: start;
  }

  .brand-mark img {
    width: 42px;
    height: 42px;
  }

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

  .rail-button {
    min-height: 38px;
    padding: 0 4px;
  }

  .rail-meta {
    display: none;
  }

  .workspace {
    padding: 14px 12px 22px;
  }

  .filters,
  .inspector,
  .metric-stack,
  .import-layout {
    grid-template-columns: 1fr;
  }

  .map-canvas {
    min-height: 430px;
  }

  .map-node {
    width: 88px;
  }

  .task-row,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .task-money,
  .task-state,
  .task-actions {
    grid-column: auto;
  }
}
