:root {
  --ink: #0f1f1c;
  --paper: #f8f9fa;
  --rose: #c9ada7;
  --moss: #4a7c59;
  --line: rgba(15, 31, 28, 0.14);
  --muted: #65746f;
  --gold: #d3a94c;
  --blue: #315f7c;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(15, 31, 28, 0.05) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-size: 18px;
  font-weight: 800;
  line-height: 0.98;
  text-decoration: none;
}

.brand img {
  flex: 0 0 auto;
}

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

.nav-button {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(248, 249, 250, 0.14);
  border-radius: 8px;
  background: transparent;
  color: rgba(248, 249, 250, 0.74);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0;
}

.nav-button.is-active,
.nav-button:hover {
  background: var(--paper);
  color: var(--ink);
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: rgba(248, 249, 250, 0.62);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--moss);
  box-shadow: 0 0 0 4px rgba(74, 124, 89, 0.2);
}

.workspace {
  min-width: 0;
  padding: 26px clamp(16px, 3vw, 42px) 36px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4.6vw, 64px);
  line-height: 0.96;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.04;
  letter-spacing: 0;
}

.search {
  display: grid;
  gap: 7px;
}

.search label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.search input,
.timeline-head select {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

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

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

.metrics div {
  min-height: 88px;
  padding: 15px 18px;
  border-right: 1px solid var(--line);
}

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

.metrics span,
.metrics small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 0.95;
}

.board {
  display: grid;
  grid-template-columns: minmax(310px, 0.9fr) minmax(360px, 1.1fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: start;
}

.timeline,
.detail-sheet {
  min-width: 0;
}

.timeline-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.62);
}

.flow span {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-right: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.flow span:last-child {
  border-right: 0;
}

.case-list {
  display: grid;
  gap: 10px;
}

.case-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 92px;
  gap: 8px 14px;
  width: 100%;
  min-height: 112px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.case-row:hover,
.case-row.is-selected {
  transform: translateY(-1px);
  border-color: rgba(74, 124, 89, 0.52);
  background: var(--white);
}

.case-row strong {
  grid-column: 2 / 4;
  min-width: 0;
  font-size: 19px;
  line-height: 1.12;
}

.case-row > span:not(.stage-pill) {
  grid-column: 1 / 3;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

meter {
  grid-column: 3;
  width: 100%;
  height: 12px;
  align-self: center;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  width: max-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.stage-audition {
  background: var(--blue);
}

.stage-schedule {
  background: var(--rose);
  color: var(--ink);
}

.stage-practice {
  background: var(--moss);
}

.stage-concert {
  background: var(--gold);
  color: var(--ink);
}

.detail-sheet {
  position: sticky;
  top: 24px;
  min-height: 560px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid rgba(15, 31, 28, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(201, 173, 167, 0.22), transparent 35%),
    var(--white);
  box-shadow: 0 20px 70px rgba(15, 31, 28, 0.11);
}

.sheet-head {
  display: grid;
  gap: 13px;
}

.sheet-head p {
  margin: 0;
  max-width: 650px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.decision-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 28px 0;
  border-block: 1px solid var(--line);
}

.decision-strip div {
  min-height: 92px;
  padding: 14px;
  border-right: 1px solid var(--line);
}

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

.decision-strip span,
.vote-panel span,
.detail-list dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-strip strong,
.vote-panel strong,
.detail-list dd {
  display: block;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.vote-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.vote-panel strong,
.vote-panel p {
  color: var(--paper);
}

.vote-panel p {
  margin: 0;
  font-size: 14px;
}

.vote-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(248, 249, 250, 0.22);
}

.vote-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--moss), var(--gold));
  transition: width 240ms ease;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.actions button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  padding: 0 14px;
  font-weight: 800;
}

.actions button:nth-child(2) {
  background: var(--moss);
  border-color: var(--moss);
}

.actions button:nth-child(3) {
  background: transparent;
  color: var(--ink);
}

.actions button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.toast {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--moss);
  font-weight: 800;
}

.record-wave {
  display: grid;
  grid-template-columns: repeat(7, minmax(16px, 1fr));
  align-items: end;
  gap: 8px;
  height: 164px;
  margin: 28px 0;
  padding: 16px;
  border-radius: 8px;
  background: rgba(74, 124, 89, 0.1);
}

.record-wave i {
  display: block;
  border-radius: 8px 8px 0 0;
  background: var(--moss);
}

.record-wave i:nth-child(1) { height: 36%; }
.record-wave i:nth-child(2) { height: 72%; background: var(--rose); }
.record-wave i:nth-child(3) { height: 48%; }
.record-wave i:nth-child(4) { height: 88%; background: var(--gold); }
.record-wave i:nth-child(5) { height: 58%; }
.record-wave i:nth-child(6) { height: 66%; background: var(--blue); }
.record-wave i:nth-child(7) { height: 42%; }

.detail-list {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  margin: 0;
}

.detail-list dt,
.detail-list dd {
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 28px 0;
}

.day {
  min-height: 112px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 249, 250, 0.78);
}

.day strong,
.day span {
  display: block;
}

.day strong {
  font-size: 20px;
}

.day span {
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.35;
}

.day.is-busy {
  border-color: rgba(74, 124, 89, 0.42);
  background: rgba(74, 124, 89, 0.12);
}

.report-ring {
  display: grid;
  place-items: center;
  width: min(300px, 82vw);
  aspect-ratio: 1;
  margin: 28px auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--white) 0 54%, transparent 55%),
    conic-gradient(var(--moss) var(--arc), rgba(15, 31, 28, 0.1) 0);
}

.report-ring div {
  display: grid;
  gap: 4px;
  place-items: center;
  text-align: center;
}

.report-ring strong {
  font-size: 52px;
  line-height: 1;
}

.report-ring span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 160px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.55;
  text-align: center;
}

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

  .rail {
    position: static;
    height: auto;
    padding: 14px 16px;
    flex-direction: row;
    align-items: center;
    gap: 16px;
  }

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

  .rail-foot {
    display: none;
  }

  .nav-button {
    min-height: 38px;
    text-align: center;
    font-size: 12px;
  }

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

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

@media (max-width: 660px) {
  .rail {
    align-items: flex-start;
    flex-direction: column;
  }

  .rail-nav,
  .metrics,
  .timeline-head,
  .flow,
  .decision-strip,
  .calendar-grid,
  .detail-list {
    grid-template-columns: 1fr;
  }

  .metrics div,
  .decision-strip div,
  .flow span {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics div:last-child,
  .decision-strip div:last-child,
  .flow span:last-child {
    border-bottom: 0;
  }

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

  .case-row strong,
  .case-row > span:not(.stage-pill),
  meter {
    grid-column: 1;
  }

  h1 {
    font-size: clamp(28px, 11vw, 44px);
  }
}
