:root {
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --rose: #c9ada7;
  --leaf: #4a7c59;
  --line: rgba(15, 31, 28, 0.14);
  --muted: rgba(15, 31, 28, 0.64);
  --amber: #d7a548;
  --blue: #426a8c;
  --white: #ffffff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  line-height: 1.55;
  background:
    linear-gradient(90deg, rgba(74, 124, 89, 0.1) 1px, transparent 1px),
    linear-gradient(180deg, rgba(201, 173, 167, 0.17) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

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

.brand strong {
  display: block;
  font-size: 20px;
  line-height: 1;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: rgba(248, 249, 250, 0.68);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

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

.nav-tab {
  border: 1px solid rgba(248, 249, 250, 0.16);
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 249, 250, 0.78);
  padding: 10px 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.nav-tab.is-active {
  color: var(--paper);
  background: rgba(201, 173, 167, 0.16);
  border-color: var(--rose);
}

.rail-note {
  margin-top: auto;
  border-top: 1px solid rgba(248, 249, 250, 0.18);
  padding-top: 18px;
  color: rgba(248, 249, 250, 0.76);
  font-size: 14px;
  line-height: 1.6;
}

.note-mark,
.atlas-mini {
  display: block;
  width: 52px;
  height: 38px;
  margin-bottom: 10px;
  background:
    linear-gradient(135deg, transparent 0 32%, var(--rose) 33% 66%, transparent 67%),
    linear-gradient(45deg, var(--leaf) 0 50%, var(--amber) 50%);
  clip-path: polygon(0 18%, 36% 0, 100% 22%, 82% 100%, 24% 78%);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--leaf);
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.1em;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 0.98;
  max-width: 720px;
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.search input {
  width: min(270px, 70vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

.ghost-button,
.stage-chip,
.action-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 10px 13px;
}

.ghost-button:hover,
.stage-chip:hover,
.action-button:hover {
  border-color: var(--leaf);
  transform: translateY(-1px);
}

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

.metric-strip article {
  min-width: 0;
  padding: 18px;
  background: rgba(255, 255, 255, 0.74);
}

.metric-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-strip strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
  animation: rise 260ms ease-out;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.timeline-panel,
.detail-sheet,
.calendar-grid,
.report-layout {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.panel-head,
.section-head {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.panel-head p,
.section-head p,
.detail-lead {
  margin-bottom: 0;
  color: var(--muted);
}

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

.stage-chip {
  padding: 8px 10px;
  font-size: 13px;
}

.stage-chip.is-active {
  color: var(--paper);
  background: var(--leaf);
  border-color: var(--leaf);
}

.stage-line {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.stage-step {
  padding: 12px;
  background: rgba(248, 249, 250, 0.9);
}

.stage-step span,
.item-kicker,
.detail-top,
.facts dt,
.decision-card span,
.calendar-item time {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.stage-step strong {
  display: block;
  margin: 5px 0 7px;
  font-size: 22px;
}

.meter,
.report-track {
  height: 6px;
  overflow: hidden;
  background: rgba(15, 31, 28, 0.11);
}

.meter i,
.report-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--leaf), var(--rose), var(--amber));
}

.timeline {
  display: grid;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 16px 18px;
  text-align: left;
  color: inherit;
}

.timeline-item:hover,
.timeline-item.is-active {
  background: rgba(201, 173, 167, 0.18);
}

.node {
  width: 14px;
  height: 14px;
  border: 3px solid var(--leaf);
  background: var(--paper);
  transform: rotate(45deg);
}

.item-main {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.item-main strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.item-main > span:last-child {
  color: var(--muted);
}

.quality {
  min-width: 54px;
  text-align: right;
  font-weight: 700;
  color: var(--leaf);
}

.detail-sheet {
  position: sticky;
  top: 24px;
  min-height: 520px;
  padding: 20px;
}

.detail-empty {
  min-height: 470px;
  display: grid;
  align-content: center;
  justify-items: start;
}

.detail-content {
  animation: fade 220ms ease-out;
}

.detail-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.status {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--paper);
}

.status-ready {
  color: var(--leaf);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 20px 0;
  background: var(--line);
  border: 1px solid var(--line);
}

.facts div {
  min-width: 0;
  background: rgba(248, 249, 250, 0.92);
  padding: 12px;
}

.facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.vote-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.vote-strip span {
  border-left: 4px solid var(--rose);
  padding: 8px 10px;
  background: rgba(201, 173, 167, 0.17);
}

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

.action-button:first-child {
  color: var(--paper);
  background: var(--leaf);
  border-color: var(--leaf);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.calendar-item {
  min-height: 150px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.83);
  display: grid;
  align-content: space-between;
  gap: 20px;
}

.calendar-item strong,
.calendar-item span {
  display: block;
  overflow-wrap: anywhere;
}

.calendar-item span {
  color: var(--muted);
  margin-top: 4px;
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 1px;
  background: var(--line);
}

.report-bars,
.decision-board {
  min-width: 0;
  background: rgba(255, 255, 255, 0.82);
  padding: 18px;
}

.report-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.report-row span {
  overflow-wrap: anywhere;
}

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

.decision-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 13px;
  min-width: 0;
}

.decision-card strong,
.decision-card p {
  overflow-wrap: anywhere;
}

.decision-card p {
  margin: 8px 0;
  color: var(--muted);
}

.decision-card small {
  color: var(--leaf);
  font-weight: 700;
}

.decision-pending small {
  color: var(--amber);
}

.decision-revision small {
  color: #9f4d45;
}

.empty-state {
  padding: 28px 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

  .rail {
    position: static;
    height: auto;
    padding: 16px;
  }

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

  .rail-note {
    display: none;
  }

  .workspace {
    padding: 18px;
  }

  .topbar,
  .panel-head {
    display: grid;
  }

  .toolbar {
    justify-content: start;
  }

  .metric-strip,
  .stage-line,
  .calendar-grid,
  .report-layout,
  .split {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .workspace {
    padding: 12px;
  }

  .nav-tabs,
  .facts,
  .action-grid,
  .decision-board {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 18px minmax(0, 1fr);
  }

  .quality {
    grid-column: 2;
    text-align: left;
  }

  .report-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
}
