:root {
  --ink: #17202a;
  --paper: #f7f3e8;
  --mint: #2f8f83;
  --amber: #f2b544;
  --coral: #d95f4a;
  --blue: #4267ac;
  --line: rgba(23, 32, 42, 0.14);
  --muted: rgba(23, 32, 42, 0.64);
  --panel: rgba(255, 252, 244, 0.82);
  --shadow: 0 18px 45px rgba(23, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100%;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 32, 42, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 42px 42px;
}

.rail {
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  align-items: center;
  color: inherit;
  display: flex;
  gap: 12px;
  text-decoration: none;
}

.brand span {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

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

.nav-tab {
  background: transparent;
  border: 1px solid rgba(247, 243, 232, 0.14);
  border-radius: 7px;
  color: rgba(247, 243, 232, 0.72);
  padding: 11px 12px;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-tab:hover,
.nav-tab.is-active {
  background: rgba(247, 243, 232, 0.12);
  color: var(--paper);
  transform: translateX(2px);
}

.rail-note {
  border-top: 1px solid rgba(247, 243, 232, 0.16);
  color: rgba(247, 243, 232, 0.72);
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.rail-note b {
  color: var(--amber);
}

.workspace {
  min-width: 0;
  padding: 24px;
}

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

.eyebrow {
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(28px, 3vw, 48px);
  line-height: 0.98;
  margin-bottom: 0;
  max-width: 780px;
}

h2 {
  font-size: 22px;
  line-height: 1.05;
  margin-bottom: 0;
}

h3 {
  font-size: 14px;
  margin-bottom: 8px;
}

.top-actions {
  align-items: end;
  display: flex;
  gap: 10px;
}

.search {
  display: grid;
  gap: 6px;
}

.search span {
  color: var(--muted);
  font-size: 12px;
}

.search input {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 7px;
  min-height: 42px;
  min-width: min(320px, 45vw);
  padding: 0 12px;
}

.icon-button,
.primary-button,
.proof-button,
.status-button {
  border: 0;
  border-radius: 7px;
  min-height: 42px;
}

.icon-button {
  background: var(--ink);
  color: var(--paper);
  font-size: 22px;
  width: 44px;
}

.metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(120px, 0.7fr));
  margin-bottom: 18px;
}

.metric {
  background: rgba(255, 252, 244, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 94px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 31px;
  line-height: 1;
}

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

.metric.primary span {
  color: rgba(247, 243, 232, 0.7);
}

.metric.warn strong {
  color: var(--amber);
}

.metric.danger strong {
  color: var(--coral);
}

.meter {
  background: rgba(247, 243, 232, 0.16);
  border-radius: 999px;
  height: 7px;
  margin-top: 18px;
  overflow: hidden;
}

.meter i {
  background: var(--mint);
  display: block;
  height: 100%;
  transition: width 260ms ease;
  width: 0;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.planner {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.portfolio,
.detail,
.wide-panel,
.import-panel,
.public-status {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.portfolio {
  min-width: 0;
  padding: 16px;
}

.section-head,
.lane-head {
  align-items: end;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.chip {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  min-height: 32px;
  padding: 0 12px;
}

.chip.is-active {
  background: var(--mint);
  border-color: var(--mint);
  color: white;
}

.route-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.route-tile {
  background: #fffaf0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 154px;
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.route-tile:hover {
  box-shadow: 0 14px 26px rgba(23, 32, 42, 0.12);
  transform: translateY(-2px);
}

.route-zone,
.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-self: start;
  padding: 5px 8px;
  text-transform: uppercase;
}

.route-zone {
  background: rgba(47, 143, 131, 0.12);
  color: var(--mint);
}

.route-tile strong {
  font-size: 18px;
  line-height: 1.08;
}

.route-tile small {
  color: var(--muted);
}

.route-row {
  background: rgba(23, 32, 42, 0.08);
  border-radius: 999px;
  display: block;
  height: 8px;
  overflow: hidden;
}

.route-row i {
  background: var(--amber);
  display: block;
  height: 100%;
}

.route-meta,
.stop-foot {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.route-meta em,
.stop-foot em,
.stop-foot b {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.lane-board {
  border-top: 1px solid var(--line);
  min-width: 0;
  padding-top: 14px;
}

.lanes {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
  width: 100%;
}

.lane {
  background: rgba(23, 32, 42, 0.045);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 180px;
  padding: 10px;
}

.lane header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.lane header span {
  font-size: 13px;
  font-weight: 800;
}

.lane header b {
  background: var(--paper);
  border-radius: 999px;
  font-size: 12px;
  padding: 2px 7px;
}

.lane-stack {
  display: grid;
  gap: 8px;
}

.stop-card {
  background: #fffdf8;
  border: 1px solid transparent;
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  color: var(--ink);
  display: grid;
  gap: 7px;
  min-height: 126px;
  padding: 10px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.stop-card:hover {
  border-color: rgba(23, 32, 42, 0.18);
  transform: translateY(-1px);
}

.stop-card strong {
  font-size: 14px;
  line-height: 1.15;
}

.stop-card small,
.stop-time {
  color: var(--muted);
  font-size: 12px;
}

.status-passed {
  border-left-color: var(--mint);
}

.status-flagged {
  border-left-color: var(--amber);
}

.status-blocked {
  border-left-color: var(--coral);
}

.detail {
  min-height: 620px;
  padding: 18px;
  position: sticky;
  top: 24px;
}

.empty-detail {
  align-content: center;
  color: var(--muted);
  display: grid;
  min-height: 560px;
  place-items: center;
  text-align: center;
}

.empty-detail p {
  max-width: 260px;
}

.cube-mark {
  background:
    linear-gradient(135deg, transparent 0 18px, var(--amber) 18px),
    var(--mint);
  display: block;
  height: 64px;
  margin-bottom: 18px;
  transform: rotate(45deg);
  width: 64px;
}

.detail-top {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.detail-top h2 {
  font-size: 28px;
  margin: 12px 0 8px;
}

.detail-top p {
  color: var(--muted);
  margin-bottom: 0;
}

.badge {
  background: rgba(66, 103, 172, 0.12);
  color: var(--blue);
}

.badge.status-passed {
  background: rgba(47, 143, 131, 0.14);
  color: var(--mint);
}

.badge.status-flagged {
  background: rgba(242, 181, 68, 0.18);
  color: #946318;
}

.badge.status-blocked {
  background: rgba(217, 95, 74, 0.14);
  color: var(--coral);
}

.facts {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin: 16px 0;
}

.facts div {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.facts dt {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.facts dd {
  font-weight: 750;
  margin: 0;
}

.standard {
  background: rgba(47, 143, 131, 0.08);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 14px;
}

.standard p {
  line-height: 1.45;
  margin-bottom: 10px;
}

.standard small {
  color: var(--muted);
}

.status-actions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 8px;
}

.status-button {
  background: var(--ink);
  color: var(--paper);
  font-weight: 750;
}

.status-button.is-current {
  background: var(--mint);
}

.proof-button,
.primary-button {
  background: var(--amber);
  color: var(--ink);
  font-weight: 800;
  width: 100%;
}

.analytics-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1.2fr 0.8fr;
}

.wide-panel,
.import-panel,
.public-status {
  padding: 18px;
}

.heatmap {
  display: grid;
  gap: 14px;
}

.heat-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 100px minmax(0, 1fr) 54px;
}

.heat-track {
  background: rgba(23, 32, 42, 0.08);
  border-radius: 999px;
  display: flex;
  height: 28px;
  overflow: hidden;
}

.heat-track i {
  display: block;
  min-width: 4px;
}

.heat-pass {
  background: var(--mint);
}

.heat-flag {
  background: var(--amber);
}

.heat-block {
  background: var(--coral);
}

.proof-stream {
  display: grid;
  gap: 10px;
}

.proof-item {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 54px minmax(0, 1fr);
  padding-bottom: 10px;
}

.proof-thumb {
  background:
    linear-gradient(135deg, rgba(47, 143, 131, 0.82), rgba(242, 181, 68, 0.82)),
    #ddd;
  border-radius: 7px;
  height: 54px;
}

.proof-item p {
  color: var(--muted);
  margin: 4px 0;
}

.proof-item small {
  color: var(--muted);
}

.import-panel {
  max-width: 760px;
}

.import-panel p {
  color: var(--muted);
  line-height: 1.5;
  max-width: 620px;
}

.import-panel pre {
  background: var(--ink);
  border-radius: 8px;
  color: var(--paper);
  margin: 16px 0 0;
  min-height: 120px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

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

.public-row {
  align-items: center;
  background: #fffdf8;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) 78px 94px;
  padding: 14px;
}

.public-row strong,
.public-row span {
  display: block;
}

.public-row span {
  color: var(--muted);
  margin-top: 3px;
}

.public-row b {
  font-size: 24px;
}

.public-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.empty-copy {
  color: var(--muted);
  margin: 0;
}

.toast {
  background: var(--ink);
  border-radius: 7px;
  bottom: 18px;
  color: var(--paper);
  left: 50%;
  opacity: 0;
  padding: 12px 16px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 10;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

  .rail {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
    position: static;
  }

  .nav-tabs {
    display: flex;
    flex-wrap: wrap;
  }

  .rail-note {
    display: none;
  }

  .planner,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .detail {
    min-height: 0;
    position: static;
  }

  .empty-detail {
    min-height: 260px;
  }
}

@media (max-width: 760px) {
  .workspace {
    padding: 16px;
  }

  .rail {
    align-items: stretch;
    padding: 14px;
  }

  .brand {
    flex: 1 0 100%;
  }

  .brand span {
    font-size: 15px;
  }

  .topbar,
  .top-actions,
  .section-head,
  .lane-head {
    align-items: stretch;
    flex-direction: column;
  }

  .search input {
    min-width: 100%;
    width: 100%;
  }

  .metrics,
  .route-grid {
    grid-template-columns: 1fr;
  }

  .facts,
  .status-actions,
  .heat-row,
  .public-row {
    grid-template-columns: 1fr;
  }

  .public-row em {
    text-align: left;
  }

  .nav-tab {
    flex: 1 1 130px;
    text-align: center;
  }
}
