:root {
  --ink: #17202a;
  --paper: #f7f3e8;
  --paper-2: #efe7d4;
  --teal: #2f8f83;
  --amber: #f2b544;
  --violet: #8b5cf6;
  --line: rgba(23, 32, 42, 0.16);
  --muted: rgba(23, 32, 42, 0.66);
  --white: #fffdf7;
  --danger: #b94b4b;
  --shadow: 0 18px 52px rgba(23, 32, 42, 0.12);
}

* {
  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(23, 32, 42, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(23, 32, 42, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
  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: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  align-self: start;
  min-height: 100vh;
  padding: 22px;
  color: var(--paper);
  background: var(--ink);
  border-right: 1px solid rgba(247, 243, 232, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--paper);
  text-decoration: none;
  font-weight: 780;
  letter-spacing: 0;
}

.brand img {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
}

.tabs {
  display: grid;
  gap: 8px;
  margin-top: 32px;
}

.tab {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: rgba(247, 243, 232, 0.72);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: 150ms ease;
}

.tab:hover,
.tab.is-active {
  color: var(--paper);
  background: rgba(247, 243, 232, 0.1);
  border-color: rgba(247, 243, 232, 0.16);
}

.rail-note {
  position: absolute;
  right: 22px;
  bottom: 22px;
  left: 22px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: rgba(247, 243, 232, 0.66);
  font-size: 13px;
  line-height: 1.35;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 5px rgba(47, 143, 131, 0.16);
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  gap: 22px;
  align-items: end;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 14px;
  letter-spacing: 0;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(23, 32, 42, 0.07);
}

.searchbar input,
.searchbar select {
  min-width: 0;
  height: 38px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.searchbar input {
  padding: 0 12px;
}

.searchbar select {
  padding: 0 8px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metric {
  min-width: 0;
  padding: 16px;
  background: rgba(255, 253, 247, 0.78);
}

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

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 28px;
  line-height: 1;
}

.screen {
  display: none;
}

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

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

.portfolio,
.inspector,
.timeline-board,
.money-board,
.import-panel,
.public-panel {
  background: rgba(255, 253, 247, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.portfolio,
.timeline-board,
.public-panel {
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

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

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

.route-tile:hover,
.route-tile.is-selected {
  transform: translateY(-2px);
  border-color: rgba(47, 143, 131, 0.72);
  box-shadow: 0 16px 30px rgba(47, 143, 131, 0.14);
}

.tile-row,
.tile-footer,
.stop-head,
.money-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tile-row strong,
.tile-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tile-title {
  display: block;
  font-size: 18px;
  font-weight: 780;
  line-height: 1.12;
}

.tile-meta,
.tile-footer,
.stop-body span,
.notes,
.money-line,
.public-row span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.progress-track {
  position: relative;
  display: block;
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: var(--paper-2);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  border-radius: inherit;
  transition: width 220ms ease;
}

.progress-track.large {
  height: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--ink);
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 12px;
  line-height: 1;
}

.status-active {
  color: #0e5f55;
  background: rgba(47, 143, 131, 0.15);
  border-color: rgba(47, 143, 131, 0.28);
}

.status-done,
.status-approved {
  color: #176141;
  background: rgba(47, 143, 131, 0.2);
  border-color: rgba(47, 143, 131, 0.34);
}

.status-blocked,
.status-rejected {
  color: var(--danger);
  background: rgba(185, 75, 75, 0.12);
  border-color: rgba(185, 75, 75, 0.25);
}

.status-pending {
  color: #8a5b06;
  background: rgba(242, 181, 68, 0.2);
  border-color: rgba(242, 181, 68, 0.35);
}

.inspector {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
}

.inspector-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 14px;
  align-items: center;
}

.inspector-head h2 {
  margin-top: 8px;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.inspector-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.radial {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  background:
    radial-gradient(var(--white) 55%, transparent 57%),
    conic-gradient(var(--teal) calc(var(--value) * 1%), var(--paper-2) 0);
  border-radius: 50%;
}

.radial strong {
  font-size: 18px;
}

.money-line {
  margin: 18px 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.notes {
  margin-bottom: 14px;
}

.route-actions {
  margin-bottom: 16px;
}

.secondary-action,
.primary-action {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
  transition: 150ms ease;
}

.secondary-action {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.secondary-action:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.primary-action {
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
}

.primary-action:hover {
  background: #243240;
}

.stops {
  display: grid;
  gap: 10px;
}

.stop-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.stop-time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.stop-body {
  min-width: 0;
}

.stop-body p {
  margin: 7px 0 5px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.stop-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.25;
}

.stop-status {
  max-width: 112px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 7px;
  font-size: 12px;
}

.proofs {
  margin-top: 18px;
}

.proofs ul {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.proofs li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 243, 232, 0.55);
}

.proofs small {
  grid-column: 2;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 18px;
}

.lane-board {
  display: grid;
  gap: 16px;
}

.lane-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.lane-label {
  min-width: 0;
}

.lane-label strong,
.lane-label span {
  display: block;
  overflow-wrap: anywhere;
}

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

.lane-track {
  position: relative;
  height: 46px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent 64px, rgba(23, 32, 42, 0.07) 65px),
    var(--white);
}

.lane-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: rgba(47, 143, 131, 0.25);
}

.lane-blocked {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 8px;
  background: rgba(185, 75, 75, 0.35);
  border-radius: 999px;
}

.money-board,
.import-panel {
  padding: 20px;
}

.big-number {
  margin: 14px 0;
  font-size: clamp(48px, 7vw, 82px);
  font-weight: 820;
  line-height: 0.92;
  letter-spacing: 0;
}

.payment-meter p,
.import-panel p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

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

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

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

.public-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1fr) 62px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.public-row strong,
.public-row span {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.public-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.public-step {
  min-height: 28px;
  padding: 7px 8px;
  text-align: center;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.1;
}

.empty-state,
.error-state,
.inspector-empty {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.62);
}

.error-state {
  display: grid;
  gap: 8px;
  color: var(--danger);
}

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

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

  .rail {
    position: relative;
    min-height: auto;
    padding: 14px 16px;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 16px;
  }

  .tab {
    text-align: center;
  }

  .rail-note {
    position: static;
    margin-top: 14px;
  }

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

  .inspector {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 14px;
  }

  .tabs,
  .metric-strip,
  .portfolio-grid,
  .public-steps {
    grid-template-columns: 1fr;
  }

  .searchbar,
  .import-panel,
  .public-row,
  .lane-row {
    grid-template-columns: 1fr;
  }

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

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

  .stop-row {
    grid-template-columns: 1fr;
  }

  .stop-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stop-status {
    max-width: 100%;
    width: 100%;
  }
}

