:root {
  --cedar: #0f1f1c;
  --paper: #f8f9fa;
  --dust: #c9ada7;
  --leaf: #4a7c59;
  --ink: #17201d;
  --muted: #66716d;
  --line: rgba(15, 31, 28, 0.14);
  --warm: #b7814c;
  --blue: #315c78;
  --shadow: 0 18px 60px rgba(15, 31, 28, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(201, 173, 167, 0.22), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #eef3ef 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

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

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

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

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

.brand small {
  display: block;
  margin-top: 5px;
  color: rgba(248, 249, 250, 0.68);
  line-height: 1.25;
}

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

.tab {
  width: 100%;
  border: 1px solid rgba(248, 249, 250, 0.14);
  background: transparent;
  color: rgba(248, 249, 250, 0.76);
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.tab:hover,
.tab.is-active {
  background: rgba(248, 249, 250, 0.1);
  color: #fff;
  transform: translateX(2px);
}

.source-box {
  margin-top: auto;
  border-top: 1px solid rgba(248, 249, 250, 0.15);
  padding-top: 18px;
}

.source-box strong {
  display: block;
  margin-top: 6px;
  color: var(--dust);
}

.mono,
.eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--muted);
}

.rail .mono,
.rail .eyebrow {
  color: rgba(248, 249, 250, 0.56);
}

.workspace {
  min-width: 0;
  padding: 28px clamp(18px, 3vw, 42px) 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(20px, 2vw, 28px);
  line-height: 1.12;
}

h3 {
  margin-bottom: 7px;
  line-height: 1.2;
}

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

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

.search input {
  width: min(280px, 44vw);
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 0 14px;
  color: var(--cedar);
  outline: none;
}

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

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--cedar);
  font-size: 20px;
}

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

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

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

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

.metric-accent strong {
  color: var(--leaf);
}

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

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

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

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

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

.timeline-panel,
.detail-sheet,
.records-table,
.calendar-list,
.report-item,
.audit-feed {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.timeline-panel {
  padding: 20px;
}

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

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

.lane-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.lane {
  min-width: 190px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.lane-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.lane-title span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.lane-bar,
.vote-meter {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 31, 28, 0.1);
}

.lane-bar i,
.vote-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--leaf), var(--dust));
  transition: width 220ms ease;
}

.decision-card {
  width: 100%;
  min-height: 190px;
  border: 1px solid rgba(15, 31, 28, 0.13);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  padding: 14px;
  display: grid;
  gap: 12px;
  text-align: left;
  box-shadow: none;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.decision-card:hover,
.decision-card.is-selected {
  border-color: var(--leaf);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 31, 28, 0.12);
}

.card-top,
.card-line,
.card-bottom {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.card-top b,
.card-top em {
  min-width: 0;
  font-style: normal;
  color: var(--muted);
  font-size: 13px;
}

.decision-card > strong {
  font-size: 18px;
  line-height: 1.18;
}

.card-line,
.card-bottom {
  color: var(--muted);
  font-size: 13px;
}

.card-bottom small {
  color: var(--cedar);
}

.detail-sheet {
  position: sticky;
  top: 24px;
  padding: 22px;
  background: var(--cedar);
  color: var(--paper);
}

.detail-sheet .mono,
.detail-sheet p {
  color: rgba(248, 249, 250, 0.64);
}

.detail-sheet h2 {
  margin-top: 8px;
  color: #fff;
}

dl {
  margin: 0;
}

.detail-sheet dl,
.report-item dl {
  display: grid;
  gap: 1px;
  margin-top: 18px;
  border: 1px solid rgba(248, 249, 250, 0.14);
  border-radius: 8px;
  overflow: hidden;
}

.detail-sheet dl div,
.report-item dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
}

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

.detail-sheet dt {
  color: rgba(248, 249, 250, 0.56);
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.vote-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.vote {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(248, 249, 250, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.vote.yes {
  background: var(--leaf);
  border-color: var(--leaf);
}

.vote.no {
  color: var(--dust);
}

.records-table {
  overflow: hidden;
}

.table-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  display: grid;
  grid-template-columns: 1.1fr 1.5fr 0.8fr 0.75fr 0.7fr 0.9fr;
  gap: 12px;
  padding: 14px 16px;
  text-align: left;
  align-items: center;
}

.table-row:hover {
  background: rgba(201, 173, 167, 0.14);
}

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

.table-head {
  background: var(--cedar);
  color: rgba(248, 249, 250, 0.68);
  text-transform: uppercase;
  font-size: 12px;
}

.calendar-list {
  display: grid;
  overflow: hidden;
}

.calendar-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.calendar-item time {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 74px;
  color: var(--cedar);
}

.calendar-item time b {
  font-size: 26px;
}

.calendar-item time span,
.calendar-item p {
  color: var(--muted);
}

.kind,
.vote-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(74, 124, 89, 0.12);
  color: var(--leaf);
  font-size: 12px;
  text-transform: uppercase;
}

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

.report-item {
  padding: 18px;
}

.report-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.big-score {
  margin: 18px 0 10px;
  font-size: clamp(42px, 6vw, 70px);
  line-height: 0.95;
  color: var(--leaf);
}

.report-item dl {
  border-color: var(--line);
}

.report-item dl div {
  background: rgba(15, 31, 28, 0.04);
}

.audit-feed {
  margin-top: 14px;
  padding: 18px;
}

.audit-feed h2 {
  margin-bottom: 12px;
}

.audit-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.audit-item p {
  margin-bottom: 2px;
}

.audit-item small {
  color: var(--muted);
}

.vote-chip.no {
  background: rgba(183, 129, 76, 0.14);
  color: var(--warm);
}

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

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

  .rail {
    position: relative;
    height: auto;
    padding: 18px;
  }

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

  .tab {
    text-align: center;
    padding: 0 8px;
  }

  .source-box {
    display: none;
  }

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

  .detail-sheet {
    position: relative;
    top: auto;
  }

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

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

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

  .toolbar,
  .search input {
    width: 100%;
  }

  .metric-strip,
  .report-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    padding: 14px;
  }

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

  .lane-board {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .table-head {
    display: none;
  }

  .calendar-item,
  .audit-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 440px) {
  .metric-strip,
  .report-grid,
  .vote-panel {
    grid-template-columns: 1fr;
  }

  .brand {
    grid-template-columns: 38px minmax(0, 1fr);
  }

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