:root {
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --rose: #c9ada7;
  --green: #4a7c59;
  --muted: #6f7a75;
  --line: rgba(15, 31, 28, 0.14);
  --panel: #ffffff;
  --warning: #b75d69;
  color-scheme: light;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.rail {
  min-height: 100vh;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  color: var(--paper);
  background:
    linear-gradient(145deg, rgba(74, 124, 89, 0.26), transparent 38%),
    var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand img {
  flex: 0 0 auto;
}

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

.nav-tab,
.icon-button,
.action-stack button,
.calendar-row {
  border: 0;
  border-radius: 8px;
}

.nav-tab {
  padding: 13px 12px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
  color: rgba(248, 249, 250, 0.72);
  background: transparent;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-tab:hover,
.nav-tab.is-active {
  color: var(--paper);
  background: rgba(248, 249, 250, 0.1);
  transform: translateX(3px);
}

.rail-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(248, 249, 250, 0.18);
  line-height: 1.7;
}

.rail-kicker,
.eyebrow,
.sheet-label,
.card-kicker {
  display: block;
  margin: 0 0 7px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--muted);
}

.rail-kicker {
  color: var(--rose);
}

.workspace {
  min-width: 0;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.topbar,
.pane-head,
.sheet-head,
.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1,
.pane-head h2,
.record-block h3,
.report-head h3 {
  margin: 0;
  line-height: 1.05;
}

.topbar h1 {
  font-size: clamp(34px, 5vw, 64px);
}

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

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

.search input {
  width: min(32vw, 320px);
  min-width: 190px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
  outline: 0;
}

.search input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.14);
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--paper);
  background: var(--ink);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  min-height: 86px;
  padding: 16px 18px;
  display: grid;
  align-content: center;
  gap: 6px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  color: var(--muted);
}

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

.split-dashboard {
  min-height: 590px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
}

.timeline-pane,
.detail-sheet {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.timeline-pane {
  padding: 20px;
  overflow: hidden;
}

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

.pane-head h2 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 48px);
}

.stage-badge {
  flex: 0 0 auto;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--paper);
  background: var(--green);
  white-space: nowrap;
}

.screen-mount {
  min-height: 460px;
  animation: liftIn 260ms ease both;
}

.case-board {
  display: grid;
  grid-template-columns: minmax(250px, 0.74fr) minmax(280px, 1fr);
  gap: 18px;
  padding-top: 18px;
}

.decision-card {
  min-height: 360px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 8px;
  color: var(--paper);
  background:
    linear-gradient(155deg, rgba(201, 173, 167, 0.22), transparent 42%),
    linear-gradient(28deg, rgba(74, 124, 89, 0.7), transparent 60%),
    var(--ink);
}

.decision-card h3 {
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.98;
}

.decision-card p {
  max-width: 34ch;
  margin: 12px 0;
  line-height: 1.7;
  color: rgba(248, 249, 250, 0.78);
}

.stage-flow {
  display: grid;
  gap: 8px;
}

.stage-flow span {
  padding: 10px 0;
  border-top: 1px solid rgba(248, 249, 250, 0.18);
  color: rgba(248, 249, 250, 0.65);
}

.stage-flow .is-current {
  color: var(--paper);
}

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.timeline li {
  position: relative;
  padding: 14px 14px 14px 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.timeline li:before {
  position: absolute;
  left: 16px;
  top: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--rose);
  content: "";
}

.timeline li.is-done:before {
  background: var(--green);
  border-color: var(--green);
}

.timeline span,
.timeline time {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.timeline strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.timeline p {
  margin: 7px 0;
  line-height: 1.6;
  color: #33403b;
}

.detail-sheet {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quality-ring {
  display: grid;
  place-items: center;
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: 240px;
  margin: 0 auto;
}

.quality-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.quality-ring circle {
  fill: none;
  stroke: rgba(15, 31, 28, 0.09);
  stroke-width: 10;
}

#qualityArc {
  stroke: var(--green);
  stroke-dasharray: 307.88;
  stroke-dashoffset: 307.88;
  stroke-linecap: round;
  transition: stroke-dashoffset 420ms ease, stroke 180ms ease;
}

.quality-ring div {
  position: absolute;
  display: grid;
  place-items: center;
  gap: 4px;
}

.quality-ring span {
  font-size: 44px;
  font-weight: 800;
}

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

.sheet-facts {
  margin: 0;
  display: grid;
  gap: 10px;
}

.sheet-facts div,
.record-block dl div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  min-width: 0;
}

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

.vote-strip span {
  padding: 10px;
  border-radius: 8px;
  background: #f1f3f1;
  color: var(--muted);
  text-align: center;
}

.vote-strip b {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.action-stack {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.action-stack button {
  min-height: 42px;
  padding: 10px 12px;
  color: var(--paper);
  background: var(--ink);
  transition: transform 150ms ease, background 150ms ease;
}

.action-stack button:hover {
  transform: translateY(-1px);
  background: var(--green);
}

.record-view {
  padding-top: 18px;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1fr);
  gap: 14px;
}

.record-block {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.record-block.notes {
  grid-row: span 2;
}

.record-block dl {
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.record-block article {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.record-block article:last-child {
  border-bottom: 0;
}

.record-block p {
  margin: 6px 0;
  line-height: 1.65;
}

.record-block article span {
  color: var(--muted);
  font-size: 13px;
}

.calendar-view {
  padding-top: 18px;
  display: grid;
  gap: 8px;
}

.calendar-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 140px minmax(150px, 1.2fr) minmax(120px, 0.8fr) 110px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  transition: border-color 160ms ease, transform 160ms ease;
}

.calendar-row:hover {
  border-color: var(--green);
  transform: translateX(3px);
}

.calendar-row time,
.calendar-row span,
.calendar-row em {
  color: var(--muted);
  font-style: normal;
}

.report-view {
  padding-top: 18px;
}

.report-head p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

table {
  width: 100%;
  margin-top: 18px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.score-pill {
  display: inline-block;
  min-width: 58px;
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--paper);
  text-align: center;
  background: var(--green);
}

.empty-state {
  margin-top: 18px;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.7;
}

body:after {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 5;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 18px 60px rgba(15, 31, 28, 0.22);
  content: attr(data-toast);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

body[data-toast]:after {
  opacity: 1;
  transform: translateY(0);
}

.is-busy .workspace {
  cursor: progress;
}

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

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

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

  .nav-tabs {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    flex: 1 1 460px;
  }

  .rail-note {
    display: none;
  }

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

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

  .topbar,
  .topbar-actions,
  .pane-head,
  .report-head {
    display: grid;
    width: 100%;
  }

  .search input {
    width: 100%;
  }

  .metrics,
  .case-board,
  .record-view {
    grid-template-columns: 1fr;
  }

  .metric {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

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

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

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (max-width: 460px) {
  .rail {
    padding: 16px;
  }

  .brand {
    width: 100%;
  }

  .timeline-pane,
  .detail-sheet,
  .decision-card,
  .record-block {
    padding: 14px;
  }

  .sheet-facts div,
  .record-block dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

