:root {
  --ink: #1b1b3a;
  --paper: #fbfefb;
  --coral: #ff6b6b;
  --mint: #4ecdc4;
  --line: rgba(27, 27, 58, 0.16);
  --muted: rgba(27, 27, 58, 0.62);
  --panel: #ffffff;
  --shadow: 0 18px 42px rgba(27, 27, 58, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(78, 205, 196, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(27, 27, 58, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.filter-pane {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px;
  color: var(--paper);
  background: var(--ink);
  border-right: 1px solid rgba(251, 254, 251, 0.16);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.05;
}

.brand small,
.source-box span,
.mono,
.eyebrow {
  color: rgba(251, 254, 251, 0.66);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.screen-tabs,
.stage-filter {
  display: grid;
  gap: 8px;
}

.screen-tab,
.stage-chip,
.icon-button,
.primary-button {
  border: 0;
  border-radius: 8px;
}

.screen-tab,
.stage-chip {
  min-height: 42px;
  padding: 10px 12px;
  color: rgba(251, 254, 251, 0.76);
  text-align: left;
  background: rgba(251, 254, 251, 0.07);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.screen-tab:hover,
.stage-chip:hover,
.screen-tab.is-active,
.stage-chip.is-active {
  color: var(--ink);
  background: var(--mint);
  transform: translateX(2px);
}

.filter-block {
  display: grid;
  gap: 14px;
  padding-top: 6px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 8px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.24);
}

.source-box {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(251, 254, 251, 0.18);
}

.source-box strong {
  display: block;
  margin-top: 4px;
  color: var(--mint);
  font-size: 14px;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
}

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

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

h2 {
  margin-bottom: 6px;
  font-size: 19px;
  line-height: 1.1;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--paper);
  background: var(--ink);
  transition: transform 180ms ease;
}

.icon-button:hover {
  transform: rotate(18deg);
}

.primary-button {
  min-height: 42px;
  padding: 10px 14px;
  color: var(--ink);
  font-weight: 900;
  background: var(--mint);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-button:hover {
  box-shadow: 0 10px 24px rgba(78, 205, 196, 0.28);
  transform: translateY(-1px);
}

.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, 255, 255, 0.82);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin: 6px 0 2px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
}

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

.metric.mint strong {
  color: #16877f;
}

.view {
  display: none;
  animation: viewIn 180ms ease both;
}

.view.is-visible {
  display: block;
}

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

.blueprint-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.blueprint-step {
  min-height: 112px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.blueprint-step:hover,
.blueprint-step.is-active {
  background: #ffffff;
  border-color: var(--mint);
  transform: translateY(-2px);
}

.step-index,
.blueprint-step strong,
.blueprint-step small {
  display: block;
}

.step-index {
  margin-bottom: 8px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 900;
}

.blueprint-step strong {
  font-size: 18px;
}

.blueprint-step small {
  margin: 5px 0 13px;
  color: var(--muted);
}

.progress-line,
.meter,
.finance-bar {
  display: block;
  overflow: hidden;
  height: 8px;
  background: rgba(27, 27, 58, 0.1);
  border-radius: 999px;
}

.progress-line i,
.meter i,
.finance-bar i {
  display: block;
  height: 100%;
  background: var(--mint);
}

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

.portfolio-pane,
.drill-panel,
.create-board,
.ledger,
.finance-board {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.portfolio-pane {
  padding: 18px;
}

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

.section-head p {
  margin-bottom: 0;
}

.section-head .mono,
.drill-panel .mono {
  color: var(--muted);
  white-space: nowrap;
}

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

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

.route-card:hover,
.route-card.is-selected {
  border-color: var(--coral);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.route-top,
.route-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.priority {
  flex: 0 0 auto;
  padding: 4px 7px;
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  background: rgba(78, 205, 196, 0.25);
  border-radius: 999px;
}

.priority.blocker {
  background: rgba(255, 107, 107, 0.28);
}

.priority.watch {
  background: rgba(255, 209, 102, 0.38);
}

.guest {
  font-size: 17px;
  font-weight: 900;
  line-height: 1.16;
}

.room,
.route-foot small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drill-panel {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 14px;
  padding: 18px;
}

.drill-panel p {
  margin-bottom: 0;
}

dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

dl div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

dd {
  min-width: 0;
  margin: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.stop-row {
  display: grid;
  gap: 3px;
  padding: 10px;
  background: rgba(27, 27, 58, 0.04);
  border-left: 4px solid var(--mint);
  border-radius: 7px;
}

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

.stop-row span,
.stop-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quick-proof {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.create-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 840px;
  padding: 22px;
}

.form-copy {
  grid-row: span 3;
  padding-right: 18px;
}

.form-copy .mono {
  color: var(--muted);
}

.wide,
.form-status {
  grid-column: 2;
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.ledger,
.finance-board {
  display: grid;
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.ledger-row,
.finance-row {
  display: grid;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
}

.ledger-row {
  grid-template-columns: 110px minmax(0, 1fr) 150px;
}

.finance-row {
  grid-template-columns: minmax(0, 300px) minmax(130px, 1fr) 120px;
}

.ledger-row strong,
.finance-row strong,
.ledger-row small,
.finance-row small {
  display: block;
}

.ledger-row small,
.finance-row small,
.ledger-row time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.doc-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  background: rgba(78, 205, 196, 0.24);
  border-radius: 999px;
}

.doc-state.missing,
.doc-state.open {
  background: rgba(255, 107, 107, 0.24);
}

.empty {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-weight: 800;
}

.empty.compact {
  padding: 6px 0;
}

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

  .filter-pane {
    position: static;
    height: auto;
  }

  .screen-tabs,
  .stage-filter {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .source-box {
    margin-top: 0;
  }

  .split-workspace {
    grid-template-columns: 1fr;
  }

  .drill-panel {
    position: static;
  }
}

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

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

  .metric-strip,
  .blueprint-map,
  .route-grid,
  .create-board {
    grid-template-columns: 1fr;
  }

  .screen-tabs,
  .stage-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wide,
  .form-status {
    grid-column: auto;
  }

  .form-copy {
    grid-row: auto;
    padding-right: 0;
  }

  .ledger-row,
  .finance-row,
  dl div {
    grid-template-columns: 1fr;
  }
}

