:root {
  --ink: #14213d;
  --paper: #ffffff;
  --line: rgba(20, 33, 61, 0.14);
  --soft: #f5f2ec;
  --accent: #fca311;
  --signal: #2a9d8f;
  --muted: rgba(20, 33, 61, 0.62);
  --shadow: 0 18px 50px rgba(20, 33, 61, 0.12);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(20, 33, 61, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(20, 33, 61, 0.06) 1px, transparent 1px),
    var(--soft);
  background-size: 44px 44px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  display: flex;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 20px;
  color: var(--paper);
  background: var(--ink);
}

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

.brand span,
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
}

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

.nav-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--paper);
  background: transparent;
  text-align: left;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.nav-button:hover,
.nav-button.is-active {
  border-color: var(--accent);
  background: rgba(252, 163, 17, 0.14);
  transform: translateX(2px);
}

.rail-note {
  display: grid;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.rail-note span,
.eyebrow,
.record-kicker {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rail-note span {
  color: rgba(255, 255, 255, 0.56);
}

.rail-note strong {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.45;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
  gap: 18px;
  align-items: end;
}

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

h1 {
  font-size: clamp(34px, 5vw, 68px);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  font-size: 31px;
  line-height: 1;
}

h3 {
  font-size: 20px;
}

.search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
}

.search input {
  min-width: 0;
  border: 0;
  padding: 12px 12px;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.search button,
.accent-button {
  border: 0;
  border-radius: 6px;
  padding: 12px 16px;
  color: var(--ink);
  background: var(--accent);
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease;
}

.search button:hover,
.accent-button:hover {
  filter: saturate(1.08);
  transform: translateY(-1px);
}

.accent-button.full {
  width: 100%;
}

.accent-button:disabled {
  cursor: default;
  filter: grayscale(0.5);
  opacity: 0.62;
  transform: none;
}

.command-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.command-strip div {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.command-strip div:last-child {
  border-right: 0;
}

.command-strip span,
.item-row small,
.timeline-row span,
.certificate small,
.detail-line span {
  color: var(--muted);
  font-size: 12px;
}

.command-strip strong {
  overflow-wrap: anywhere;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
}

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

.board-main,
.inspector {
  border: 1px solid var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.board-main {
  min-height: 560px;
}

.inspector {
  position: sticky;
  top: 28px;
  display: grid;
  gap: 18px;
  padding: 20px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.item-list {
  display: grid;
}

.item-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) minmax(92px, auto) 82px;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: background 160ms ease, padding-left 160ms ease;
}

.item-row:hover,
.item-row.is-selected {
  background: rgba(252, 163, 17, 0.12);
  padding-left: 26px;
}

.item-mark {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 9px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.item-core {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.item-core strong,
.item-core small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-price,
.item-conversion {
  font-weight: 800;
  text-align: right;
}

.item-conversion {
  color: var(--signal);
}

.mini-metrics {
  display: grid;
  gap: 10px;
  margin: 0;
}

.mini-metrics div,
.detail-line,
.report-row,
.timeline-row,
.certificate {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.mini-metrics dt {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.mini-metrics dd {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 900;
}

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

.stage-track span {
  min-width: 0;
  border: 1px solid var(--line);
  padding: 7px 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.stage-track span.is-active {
  border-color: var(--signal);
  color: var(--ink);
  background: rgba(42, 157, 143, 0.12);
}

.detail-grid,
.report-grid,
.timeline {
  display: grid;
  gap: 0;
  padding: 20px;
}

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

.detail-line {
  display: grid;
  gap: 6px;
}

.detail-line.wide {
  grid-column: 1 / -1;
}

.detail-line strong {
  font-size: 22px;
}

.range-line {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.range-line input {
  width: 100%;
  accent-color: var(--accent);
}

.scenario-output {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.scenario-output strong {
  color: var(--ink);
  font-size: 28px;
}

.timeline-row,
.report-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 84px;
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
}

.timeline-row time,
.timeline-row em {
  font-weight: 900;
  font-style: normal;
}

.timeline-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-row {
  grid-template-columns: minmax(0, 1.2fr) repeat(3, minmax(72px, 0.5fr));
}

.certificate-list {
  display: grid;
  gap: 14px;
}

.certificate {
  display: grid;
  gap: 4px;
}

.empty-state,
.inspector-empty {
  padding: 22px;
  color: var(--muted);
}

.is-hidden {
  display: none;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid var(--ink);
  color: var(--ink);
  background: var(--accent);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

  .rail {
    position: static;
    height: auto;
    gap: 18px;
  }

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

  .nav-button {
    padding: 10px 8px;
    text-align: center;
  }

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

  .inspector {
    position: static;
  }
}

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

  .rail {
    padding: 18px 16px;
  }

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

  .command-strip div:nth-child(2) {
    border-right: 0;
  }

  .command-strip div {
    min-height: 86px;
  }

  .search {
    grid-template-columns: 1fr;
  }

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

  .item-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .item-mark,
  .item-price,
  .item-conversion {
    width: fit-content;
    text-align: left;
  }

  .detail-grid,
  .timeline-row,
  .report-row {
    grid-template-columns: 1fr;
  }
}

