:root {
  color-scheme: light;
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --muted: #66736f;
  --line: #dce2de;
  --rose: #c9ada7;
  --green: #4a7c59;
  --gold: #c99a45;
  --risk: #a9473f;
  --white: #ffffff;
  --shadow: 0 20px 60px rgba(15, 31, 28, 0.12);
  font-family: "Arial Narrow", "Roboto Condensed", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(201, 173, 167, 0.16), transparent 28%),
    linear-gradient(180deg, #f8f9fa 0%, #edf1ee 100%);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

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

.brand strong,
.brand small,
.source-box strong,
.source-box span,
.kicker,
.metrics span,
.section-title span,
.sheet-label,
.case-code {
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: rgba(248, 249, 250, 0.64);
  font-size: 11px;
}

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

.nav-tab,
.icon-button,
.vote-button {
  border: 0;
  border-radius: 8px;
}

.nav-tab {
  min-height: 42px;
  padding: 0 14px;
  color: rgba(248, 249, 250, 0.72);
  background: transparent;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0;
  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(2px);
}

.source-box {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(248, 249, 250, 0.16);
  border-radius: 8px;
}

.source-box span {
  display: block;
  color: rgba(248, 249, 250, 0.58);
  font-size: 11px;
}

.source-box strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  font-size: 12px;
}

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

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

.kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 52px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.2;
}

p {
  line-height: 1.65;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(420px, 100%);
}

.search {
  flex: 1;
  display: grid;
  gap: 5px;
}

.search span {
  color: var(--muted);
  font-size: 12px;
}

.search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.icon-button {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  color: var(--paper);
  background: var(--green);
  font-size: 20px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow);
}

.metrics article {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.metrics article:last-child {
  border-right: 0;
}

.metrics span,
.section-title span,
.sheet-label,
.case-code {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.metrics strong {
  display: block;
  margin: 7px 0 2px;
  font-size: 34px;
  line-height: 1;
}

.metrics small {
  color: var(--muted);
  line-height: 1.45;
}

.metrics .accent strong {
  color: var(--green);
}

.metrics .warning strong {
  color: var(--risk);
}

.view {
  display: none;
  margin-top: 22px;
  animation: rise 240ms ease both;
}

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

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

.timeline-panel,
.decision-zone,
.appointment-main,
.audit-timeline,
.report-panel {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.timeline-panel,
.decision-zone,
.appointment-main,
.audit-timeline,
.report-panel,
.detail-sheet {
  border-radius: 8px;
}

.timeline-panel,
.decision-zone {
  padding: 18px;
}

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

.section-title h2 {
  margin-bottom: 0;
}

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

.stage {
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  border: 1px solid rgba(15, 31, 28, 0.08);
  border-radius: 8px;
  padding: 15px;
  color: var(--ink);
  background: var(--white);
  text-align: left;
  animation: stageIn 360ms ease both;
  animation-delay: var(--delay);
}

.stage strong {
  font-size: 42px;
  line-height: 0.9;
}

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

.tone-booking {
  border-top: 5px solid var(--rose);
}

.tone-visit {
  border-top: 5px solid var(--green);
}

.tone-plan {
  border-top: 5px solid var(--gold);
}

.tone-follow {
  border-top: 5px solid var(--ink);
}

.detail-sheet {
  min-width: 0;
  padding: 22px;
  color: var(--paper);
  background: var(--ink);
}

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

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

.detail-sheet dt,
.facts-grid span {
  color: rgba(248, 249, 250, 0.56);
  font-size: 12px;
}

.detail-sheet dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.vote-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.vote-button {
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--rose);
  font-weight: 700;
}

.vote-button.ghost {
  color: var(--paper);
  background: rgba(248, 249, 250, 0.12);
}

.decision-zone {
  margin-top: 18px;
}

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

.case-card {
  display: grid;
  min-width: 0;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  overflow: hidden;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.case-card:hover,
.case-card.is-selected {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 0 14px 34px rgba(15, 31, 28, 0.1);
}

.case-hit {
  min-width: 0;
  border: 0;
  padding: 16px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.case-hit h3,
.case-hit p {
  overflow-wrap: anywhere;
}

.case-hit p {
  margin-bottom: 0;
  color: var(--muted);
}

.case-meta,
.case-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 14px;
  color: var(--muted);
  font-size: 13px;
}

.risk {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--green);
  background: rgba(74, 124, 89, 0.12);
  font-size: 12px;
  font-weight: 800;
}

.risk.watch {
  color: #8a651f;
  background: rgba(201, 154, 69, 0.16);
}

.risk.risk {
  color: var(--risk);
  background: rgba(169, 71, 63, 0.14);
}

.appointment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.appointment-main,
.audit-timeline,
.report-panel {
  padding: 18px;
}

.appointment-hero {
  min-height: 220px;
  display: grid;
  align-content: end;
  border-radius: 8px;
  padding: 22px;
  color: var(--paper);
  background:
    linear-gradient(135deg, rgba(15, 31, 28, 0.96), rgba(74, 124, 89, 0.84)),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(248, 249, 250, 0.1) 27px 28px);
}

.appointment-hero span {
  color: var(--rose);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.appointment-hero p {
  max-width: 680px;
  margin-bottom: 0;
  color: rgba(248, 249, 250, 0.76);
}

.facts-grid {
  margin-top: 14px;
}

.facts-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.facts-grid span {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
}

.facts-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.audit-timeline {
  display: grid;
  gap: 10px;
  align-content: start;
}

.audit-item {
  border-left: 3px solid var(--rose);
  padding-left: 12px;
}

.audit-item span {
  color: var(--muted);
  font-size: 12px;
}

.audit-item strong {
  display: block;
  margin: 4px 0;
}

.audit-item p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.slot {
  min-height: 180px;
  display: grid;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--white);
  animation: stageIn 320ms ease both;
  animation-delay: var(--delay);
}

.slot time {
  color: var(--green);
  font-weight: 800;
}

.slot p {
  margin-bottom: 12px;
  color: var(--muted);
}

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

.report-panel h3 {
  margin-bottom: 18px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) minmax(0, 1fr) 58px;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.report-row span {
  display: block;
  color: var(--muted);
}

.report-row em {
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: #e5e9e6;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.approval-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  border-top: 1px solid var(--line);
}

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

.approval-pill strong {
  font-size: 26px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

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

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1180px) {
  .case-list,
  .calendar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .split-board,
  .appointment-layout,
  .report-grid {
    grid-template-columns: 1fr;
  }
}

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

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

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

  .nav-tab {
    min-height: 38px;
    padding: 0 8px;
    text-align: center;
    font-size: 11px;
  }

  .workspace {
    padding: 16px;
  }

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

  .toolbar {
    min-width: 0;
  }

  .metrics,
  .case-list,
  .calendar-grid,
  .journey,
  .detail-sheet dl,
  .facts-grid,
  .vote-panel {
    grid-template-columns: 1fr;
  }

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

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

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

  .report-row em {
    text-align: left;
  }
}

