/* =========================================================
   Trestle — team inbox
   A dispatch ledger: pine rail, ruled paper, stamped states.
   ========================================================= */

@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("./assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("./assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f0e5;
  --surface: #fcfaf4;
  --ink: #1d221e;
  --muted: #63695f;
  --muted-2: #666d60;
  --rule: #dcd4c1;
  --rule-strong: #c6bca6;
  --pine: #123c31;
  --pine-2: #1a5746;
  --pine-soft: #dce6df;
  --cream: #f2edde;
  --cream-muted: #aac0b4;
  --focus: #a34712;
  --focus-light: #f2c079;

  --st-todo: #35536b;
  --st-todo-bg: #e4ebf0;
  --st-progress: #7a5100;
  --st-progress-bg: #f5e6c2;
  --st-blocked: #992c1c;
  --st-blocked-bg: #f6ddd4;
  --st-done: #1c5e43;
  --st-done-bg: #dcebe1;

  --font-display: "Space Grotesk", "Arial Narrow", system-ui, sans-serif;
  --font-body: "DM Sans", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --rail-w: 236px;
  --detail-w: 420px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--pine);
  color: var(--cream);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 200;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 18px;
  background: var(--surface);
  color: var(--pine);
  font-family: var(--font-mono);
  font-size: 12px;
  border: 2px solid var(--pine);
  transform: translateY(-160%);
  transition: transform 160ms var(--ease);
}
.skip-link:focus {
  transform: translateY(0);
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
}

/* ---------- Shell ---------- */

.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 18px 20px;
  background: var(--pine);
  color: var(--cream);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid #0b2a22;
}

.rail-head {
  padding-bottom: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  color: var(--cream);
  text-decoration: none;
  border-radius: 2px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  color: var(--cream);
  background: rgba(242, 237, 222, 0.06);
  border: 1px solid rgba(242, 237, 222, 0.22);
  border-radius: 2px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.brand-sub {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.rail-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-muted);
  margin-bottom: 9px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: #dbe5de;
  text-align: left;
  transition: background-color 150ms var(--ease), color 150ms var(--ease),
    transform 120ms var(--ease);
}

.view-btn.is-active {
  background: var(--cream);
  border-color: var(--cream);
  color: var(--pine);
}

.view-name {
  font-size: 13.5px;
  font-weight: 500;
  flex: 1;
}

.view-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--cream-muted);
}

.view-btn.is-active .view-count {
  color: var(--pine);
}

.view-dot {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
}

.status-bg-todo { background: #8db4d2; }
.status-bg-in-progress { background: #e0b24b; }
.status-bg-blocked { background: #ea8b74; }
.status-bg-done { background: #6fbd97; }

.view-btn.is-active .view-dot {
  box-shadow: 0 0 0 1px rgba(18, 60, 49, 0.15);
}

.rail-team {
  min-height: 0;
}

.roster {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.roster li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(242, 237, 222, 0.1);
}

.roster li:last-child {
  border-bottom: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  border-radius: 50%;
  background: rgba(242, 237, 222, 0.12);
  border: 1px solid rgba(242, 237, 222, 0.18);
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
}

.roster-name {
  flex: 1;
  font-size: 12.5px;
  color: #dbe5de;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roster-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cream-muted);
  font-variant-numeric: tabular-nums;
}

.rail-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(242, 237, 222, 0.18);
}

.rail-open {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--cream);
}

.rail-open span:first-child {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rail-open span:last-child {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

.rail-week {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cream-muted);
}

/* ---------- Workspace head ---------- */

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 28px 36px 20px;
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar h1 {
  margin-top: 7px;
  font-size: clamp(30px, 2.7vw, 40px);
  letter-spacing: -0.035em;
  line-height: 1;
}

.topbar-sub {
  margin-top: 8px;
  max-width: 56ch;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.tallies {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
  padding-bottom: 3px;
}

.tally {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.tally strong {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.tally .view-dot {
  width: 5px;
  height: 5px;
}

/* ---------- Toolbar ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 13px 36px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.field label .kbd {
  margin-left: 1px;
}

.field-search {
  flex: 0 1 320px;
  min-width: 200px;
}

.search-wrap,
.select-wrap {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

input[type="search"],
select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}

input[type="search"] {
  padding-left: 36px;
  appearance: none;
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

input::placeholder {
  color: #6b7064;
  opacity: 1;
}

select {
  appearance: none;
  padding-right: 36px;
  cursor: pointer;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.field-status,
.field-sort {
  flex: 0 0 158px;
}

.result-count {
  margin-left: auto;
  padding-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.result-count strong {
  font-weight: 400;
  color: var(--ink);
}

.clear-btn {
  min-height: 44px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--pine);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}

/* ---------- Content split ---------- */

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--detail-w);
  align-items: start;
}

.list-pane {
  min-width: 0;
  padding-bottom: 56px;
  border-right: 1px solid var(--rule);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 36px 12px;
  border-bottom: 1px solid var(--rule);
}

.list-head h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.list-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.list-note {
  color: var(--muted-2);
}

.list {
  list-style: none;
}

.loading-note {
  padding: 28px 36px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.content:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.row {
  border-bottom: 1px solid var(--rule);
}

.row-btn {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 112px 16px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 90px;
  padding: 16px 30px;
  background: transparent;
  border: 0;
  text-align: left;
  transition: background-color 150ms var(--ease), box-shadow 150ms var(--ease),
    transform 120ms var(--ease);
}

.row.is-open .row-btn {
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--pine);
}

.row-index {
  align-self: start;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  transition: color 150ms var(--ease);
}

.row-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.row-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.row[data-status="done"] .row-title {
  color: var(--muted);
}

.row.is-open .row-title {
  color: var(--pine);
}

.row-summary {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
  margin-top: 1px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-meta > span + span::before {
  content: "·";
  margin-right: 10px;
  color: var(--rule-strong);
}

.row-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.row-arrow {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--muted-2);
  transition: transform 150ms var(--ease), color 150ms var(--ease);
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.priority::before {
  content: "";
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
}

.priority.is-high {
  color: var(--ink);
  font-weight: 600;
}

.priority.is-high::before {
  background: currentColor;
}

.priority.is-medium::before {
  background: currentColor;
  opacity: 0.55;
}

/* ---------- Status chips ---------- */

.status-chip {
  --st: var(--st-todo);
  --st-bg: var(--st-todo-bg);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--st);
  background: var(--st-bg);
  border: 1px solid color-mix(in srgb, var(--st) 34%, transparent);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-chip .dot {
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: var(--st);
}

.status-todo {
  --st: var(--st-todo);
  --st-bg: var(--st-todo-bg);
}
.status-in-progress {
  --st: var(--st-progress);
  --st-bg: var(--st-progress-bg);
}
.status-blocked {
  --st: var(--st-blocked);
  --st-bg: var(--st-blocked-bg);
}
.status-done {
  --st: var(--st-done);
  --st-bg: var(--st-done-bg);
}

/* ---------- Detail ---------- */

.detail-pane {
  position: sticky;
  top: 87px;
  align-self: start;
  max-height: calc(100vh - 103px);
  padding: 22px 26px 48px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail {
  padding: 20px 22px 26px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  animation: detail-in 200ms var(--ease);
}

.detail:focus {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.detail-ref {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.close-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -8px -8px -8px 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--ink);
  transition: background-color 150ms var(--ease), color 150ms var(--ease),
    transform 120ms var(--ease);
}

.detail-titlebar {
  margin-top: 8px;
}

.detail-titlebar h2 {
  font-size: 25px;
  line-height: 1.14;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.detail-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.detail-perf {
  height: 1px;
  margin: 18px 0 0;
  background-image: repeating-linear-gradient(
    90deg,
    var(--rule-strong) 0 4px,
    transparent 4px 9px
  );
}

.status-zone {
  margin-top: 16px;
  padding: 12px;
  background: #f6f2e7;
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-row label {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-row .select-wrap {
  flex: 1;
  min-width: 0;
}

.status-row select {
  height: 44px;
  background: var(--surface);
  font-size: 13.5px;
}

.status-feedback {
  min-height: 18px;
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.status-feedback.is-fresh {
  color: var(--st-done);
}

.signoff-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.signoff {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 11px;
  color: var(--st-done);
  border: 2px solid var(--st-done);
  outline: 1px solid var(--st-done);
  outline-offset: 2px;
  background: color-mix(in srgb, var(--st-done-bg) 70%, transparent);
  transform: rotate(-4deg);
  font-family: var(--font-mono);
  text-transform: uppercase;
  animation: stamp-in 240ms var(--ease);
}

.signoff strong {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
}

.signoff span {
  font-size: 7.5px;
  letter-spacing: 0.12em;
  opacity: 0.8;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
  margin-top: 18px;
  border-top: 1px solid var(--rule);
}

.meta-item {
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.meta-item dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-item dd {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.meta-item dd.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.tag {
  padding: 2px 5px;
  border: 1px solid var(--rule-strong);
  border-radius: 1px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.brief {
  margin-top: 18px;
}

.brief-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.brief-body {
  margin-top: 9px;
  max-width: 60ch;
  font-size: 15px;
  line-height: 1.65;
  color: #2b302b;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}

.detail-foot p {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.close-link {
  min-height: 44px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--pine);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}

.match-note {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--rule-strong);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.match-note button {
  min-height: 44px;
  padding: 0 6px;
  background: transparent;
  border: 0;
  color: var(--pine);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Placeholder ---------- */

.placeholder {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 30px 24px 32px;
  border: 1px dashed var(--rule-strong);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(252, 250, 244, 0.55), rgba(252, 250, 244, 0));
}

.placeholder-art {
  color: var(--pine);
  opacity: 0.75;
  margin-bottom: 8px;
}

.placeholder .eyebrow {
  margin-top: 4px;
}

.placeholder h2 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.placeholder p {
  max-width: 38ch;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.placeholder-hint {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  width: 100%;
  font-family: var(--font-mono);
  font-size: 9.5px !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-2) !important;
}

.placeholder-hint kbd {
  font-size: 8px;
  height: 17px;
}

/* ---------- Empty & error ---------- */

.empty-state {
  padding: 64px 36px 72px;
  max-width: 540px;
}

.empty-mark {
  font-family: var(--font-display);
  font-size: 54px;
  line-height: 1;
  color: var(--rule-strong);
}

.empty-state h3 {
  margin-top: 16px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.empty-state > p:not(.empty-mark) {
  margin-top: 8px;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.primary-btn {
  min-height: 44px;
  margin-top: 20px;
  padding: 0 18px;
  background: var(--pine);
  color: var(--cream);
  border: 1px solid var(--pine);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}

.list-error {
  padding: 56px 36px;
  max-width: 520px;
}

.list-error h3 {
  font-size: 22px;
}

.list-error p {
  margin-top: 8px;
  color: var(--muted);
}

.noscript {
  margin: 24px 36px;
  padding: 20px;
  border: 1px dashed var(--rule-strong);
  font-size: 13px;
}

.noscript h3 {
  font-size: 18px;
}

.noscript p,
.noscript ol {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.noscript ol {
  padding-left: 20px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  right: 26px;
  bottom: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px 12px 16px;
  background: var(--pine);
  color: var(--cream);
  border: 1px solid #0b2a22;
  border-radius: 2px;
  box-shadow: 0 14px 34px rgba(15, 31, 25, 0.24);
  animation: toast-in 220ms var(--ease);
}

.toast-text {
  font-size: 12.5px;
  line-height: 1.45;
}

.toast-undo {
  min-height: 44px;
  padding: 0 8px;
  flex: none;
  background: transparent;
  border: 1px solid rgba(242, 237, 222, 0.35);
  border-radius: 2px;
  color: var(--cream);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background-color 150ms var(--ease), transform 120ms var(--ease);
}

/* ---------- Focus & press ---------- */

input:focus,
select:focus,
button:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.rail button:focus,
.rail button:focus-visible,
.rail a:focus,
.rail a:focus-visible {
  outline: 2px solid var(--focus-light);
  outline-offset: 2px;
}

.row-btn:focus,
.row-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -4px;
}

.detail .close-btn:focus,
.detail .close-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.primary-btn:active,
.toast-undo:active,
.clear-btn:active,
.close-btn:active,
.close-link:active,
.view-btn:active,
.brand:active,
.skip-link:active,
.match-note button:active {
  transform: scale(0.97);
}

.row-btn:active {
  background: #eee8d9;
}

/* ---------- Hover (pointer devices only) ---------- */

@media (hover: hover) and (pointer: fine) {
  .brand:hover .brand-mark {
    background: rgba(242, 237, 222, 0.14);
    border-color: rgba(242, 237, 222, 0.4);
  }

  .view-btn:hover {
    background: rgba(242, 237, 222, 0.09);
  }

  .view-btn.is-active:hover {
    background: var(--cream);
  }

  .row-btn:hover {
    background: #fbf8ef;
  }

  .row-btn:hover .row-arrow {
    transform: translateX(3px);
    color: var(--pine);
  }

  .row-btn:hover .row-index {
    color: var(--pine);
  }

  .clear-btn:hover {
    background: #eae4d5;
  }

  .primary-btn:hover {
    background: var(--pine-2);
  }

  .close-btn:hover {
    background: #eee7d7;
  }

  .close-link:hover {
    background: #eee7d7;
  }

  .toast-undo:hover {
    background: rgba(242, 237, 222, 0.14);
  }

  .match-note button:hover {
    color: var(--pine-2);
  }

  .input-wrap:hover input,
  .search-wrap:hover input,
  .select-wrap:hover select {
    border-color: #b0a68e;
  }

}

/* ---------- Motion ---------- */

@keyframes detail-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-4deg) scale(1.4); }
  to { opacity: 1; transform: rotate(-4deg) scale(1); }
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1280px) {
  .app {
    display: block;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 60;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 22px;
    overflow: visible;
  }

  .rail-head {
    flex: 1;
    padding: 0;
  }

  .rail-nav,
  .rail-team {
    display: none;
  }

  .rail-foot {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .rail-week {
    display: none;
  }

  .rail-open span:first-child {
    font-size: 20px;
  }

  .rail-open span:last-child {
    font-size: 9.5px;
    letter-spacing: 0.09em;
  }

  .toolbar {
    position: static;
  }

  .content {
    display: block;
  }

  .list-pane {
    border-right: 0;
    padding-bottom: 64px;
  }

  .detail-pane {
    display: none;
  }

  .detail-pane.has-detail {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    max-height: none;
    padding: 0;
    background: var(--paper);
    overflow-y: auto;
  }

  .detail {
    min-height: 100dvh;
    padding: 18px 22px 44px;
    border: 0;
    border-radius: 0;
    animation: sheet-in 220ms var(--ease);
  }

  .detail:focus {
    outline-offset: -2px;
  }

  .detail-top {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -18px -22px 16px;
    padding: 12px 22px;
    background: var(--surface);
    border-bottom: 1px solid var(--rule);
  }

  body.detail-open {
    overflow: hidden;
  }
}

@media (max-width: 760px) {
  .rail {
    padding: 8px 20px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 17px;
  }

  .topbar {
    padding: 20px 20px 16px;
    align-items: flex-start;
    gap: 18px;
  }

  .topbar-sub {
    font-size: 13px;
    max-width: 42ch;
  }

  .tallies {
    display: none;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    padding: 12px 20px 14px;
  }

  .field-search {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .field-status,
  .field-sort {
    min-width: 0;
  }

  .result-count {
    grid-column: 1 / 2;
    margin: 2px 0 0;
    padding: 0;
    align-self: center;
    white-space: normal;
    line-height: 1.4;
  }

  .clear-btn {
    grid-column: 2 / 3;
    justify-self: end;
    padding: 0 6px;
  }

  .list-head {
    padding: 14px 20px 11px;
    gap: 10px;
  }

  .list-meta {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 9.5px;
  }

  .row-btn {
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-areas:
      "idx main"
      "idx status";
    gap: 4px 10px;
    min-height: 0;
    padding: 15px 20px;
  }

  .row-index {
    grid-area: idx;
    margin-top: 3px;
  }

  .row-main {
    grid-area: main;
  }

  .row-status {
    grid-area: status;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    margin-top: 3px;
  }

  .row-arrow {
    display: none;
  }

  .row-title {
    font-size: 16px;
  }

  .row-summary {
    font-size: 12.5px;
  }

  .row-meta {
    font-size: 10px;
    gap: 2px 8px;
  }

  .row-meta > span + span::before {
    margin-right: 8px;
  }

  .empty-state {
    padding: 46px 20px 56px;
  }

  .list-error {
    padding: 40px 20px;
  }

  .detail {
    padding: 16px 20px 48px;
  }

  .detail-top {
    margin: -16px -20px 14px;
    padding: 10px 20px;
  }

  .detail-titlebar h2 {
    font-size: 23px;
  }

  .meta-grid {
    gap: 0 14px;
  }

  .brief-body {
    font-size: 14.5px;
    line-height: 1.65;
  }

  .toast {
    left: 20px;
    right: 20px;
    bottom: 16px;
    max-width: none;
  }

  .noscript {
    margin: 20px;
  }
}

@media (max-width: 420px) {
  .brand-sub {
    display: none;
  }

  .topbar h1 {
    font-size: 32px;
  }

  .topbar-sub {
    display: none;
  }

  .detail-badges {
    gap: 8px;
  }

  .signoff-row {
    justify-content: flex-start;
  }

  .detail-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .detail,
  .toast,
  .signoff {
    transform: none;
  }
}
