/* daltrey triage workspace (PRD §16). One stylesheet, no build step. */

:root {
  --bg: #f4f5f0;
  --surface: #fff;
  --surface-2: #f0f3ee;
  --hover: #f5f9f5;
  --ink: #203a32;
  --ink-2: #454b48;
  --ink-3: #646a67;
  --line: #dfe6dd;
  --line-2: #cfd0ca;
  --accent: #25634d;
  --accent-hover: #164a3f;
  --accent-soft: #e4eeea;
  --in: #1c6b3b;
  --in-soft: #e3f1e7;
  --out: #9b3428;
  --out-soft: #f8e7e4;
  --watch: #7a5509;
  --watch-soft: #f7eed8;
  --focus: #2563d6;
  --radius: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
ol, ul { padding: 0; list-style: none; }

h1 { font-size: 34px; line-height: 1.3; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 13px; font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

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

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

.muted { color: var(--ink-3); }
.optional { color: var(--ink-3); font-weight: 400; }

.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: absolute; left: 12px; top: 8px; z-index: 20;
  padding: 8px 12px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius);
  clip-path: inset(50%);
}
.skip-link:focus { clip-path: none; }

kbd {
  display: inline-block; min-width: 18px; padding: 0 5px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); font: 11px/16px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center; color: var(--ink-2);
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  min-height: 72px; padding: 0 32px;
  background: #153e35; border-bottom: 1px solid #284f43;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 23px; letter-spacing: -.04em; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 10px; background: #d7edaf; color: #153e35; font-size: 24px; font-weight: 700;
}
.topnav { display: flex; gap: 6px; align-self: stretch; margin-left: 28px; }
.topnav a {
  display: flex; align-items: center; padding: 0 16px; color: #c5d6cb;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.topnav a:hover { color: #fff; background: #204a3e; text-decoration: none; }
.topnav a[aria-current="page"] { color: #edf8d7; border-bottom-color: #d7edaf; background: #204a3e; font-weight: 600; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.topbar-end a { color: #d6e3d9; font-size: 12px; }
.kbd-hint { border: 0; background: none; padding: 0; }

/* ---------- Page scaffolding ---------- */

.page { max-width: 1600px; margin: 0 auto; padding: 36px 32px 56px; }
.page-center { display: grid; place-items: start center; padding-top: 12vh; }

.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-count { color: var(--ink-3); font-size: 13px; }
.page-lede { color: var(--ink-2); margin: -4px 0 14px; }
.section-title { margin: 20px 0 8px; font-size: 14px; }

.notice, .alert {
  margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius); border: 1px solid;
}
.notice { background: var(--in-soft); border-color: #bfdcc8; color: var(--in); }
.alert { background: var(--out-soft); border-color: #e8c2bc; color: var(--out); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 3px 12px rgb(26 55 40 / 3%); }

.empty {
  padding: 72px 24px; text-align: center; background: var(--surface);
  border: 1px dashed var(--line-2); border-radius: 8px;
}
.empty h2 { font-size: 15px; margin-bottom: 4px; }
.empty p { color: var(--ink-3); margin-bottom: 12px; }

/* ---------- Controls ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font-weight: 550; white-space: nowrap;
}
.button:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.button-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-hover); color: #fff; }
.button-danger { color: var(--out); }
.button-danger:hover { color: var(--out); background: var(--out-soft); }
.button-quiet { border-color: transparent; background: none; color: var(--ink-2); }
.button-block { width: 100%; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }

.field { display: grid; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 550; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface);
}
.field textarea { resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #767c79; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 12px; }
.help { margin-top: 8px; font-size: 12px; color: var(--ink-3); }

/* ---------- Filters ---------- */

.filters { margin-bottom: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 3px 12px rgb(26 55 40 / 3%); }
.filters > summary {
  cursor: pointer; padding: 14px 18px; font-weight: 600; font-size: 12px; color: var(--ink-2);
}
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
  padding: 0 18px 18px; background: transparent;
}
.filter-bar .field { flex: 1 1 160px; }
.filter-bar .field-narrow { flex: 0 1 104px; }
.filter-actions { display: flex; gap: 4px; }

/* ---------- Badges, fit, due ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 10px; font-size: 12px; font-weight: 550; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-none { background: none; padding: 0; color: var(--ink-3); font-weight: 450; }
.badge-none::before { display: none; }
.badge-in, .badge-confirmed { background: var(--in-soft); color: var(--in); }
.badge-out, .badge-rejected { background: var(--out-soft); color: var(--out); }
.badge-watch, .badge-proposed { background: var(--watch-soft); color: var(--watch); }

.fit {
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; min-width: 40px; height: 32px; padding: 0 7px; border-radius: 8px;
  font-weight: 650; font-size: 13px;
}
.fit-high { background: var(--accent-soft); color: var(--accent); }
.fit-mid { background: var(--surface-2); color: var(--ink); }
.fit-low { color: var(--ink-3); background: #f3f3ef; }
.fit-none { display: inline-grid; gap: 0; height: auto; padding: 0; justify-content: start; color: var(--ink-3); font-weight: 500; }
.fit-label { font-size: 11px; }

.due { display: grid; line-height: 1.3; }
.due-label { font-weight: 550; }
.due time { font-size: 12px; color: var(--ink-3); }
.due-soon .due-label { color: var(--watch); }
.due-past .due-label { color: var(--out); }

.tag {
  display: inline-block; padding: 0 6px; border-radius: 4px;
  background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; line-height: 18px;
}

/* ---------- Tables ---------- */

.triage {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px;
}
.triage th {
  position: sticky; top: 72px; z-index: 1;
  padding: 12px 14px; text-align: left; font-size: 12px; font-weight: 550; color: var(--ink-3);
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.triage th:first-child { border-top-left-radius: 8px; }
.triage th:last-child { border-top-right-radius: 8px; }
.triage th a { color: inherit; }
.triage th[aria-sort] a { color: var(--ink); }
.triage td { padding: 15px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.triage tbody tr:last-child td { border-bottom: 0; }
.triage tbody tr:hover td { background: var(--hover); }
.triage tbody tr.is-current td { background: var(--accent-soft); }
.triage tbody tr.is-current td:first-child { box-shadow: inset 3px 0 0 var(--accent); }

.col-fit { width: 64px; }
.col-where { width: 18%; color: var(--ink-2); }
.col-due { width: 128px; }
.col-status { width: 120px; }
.col-decide { width: 1%; white-space: nowrap; }
.col-num { width: 110px; text-align: right; }
.col-id { width: 48px; }
.col-check { width: 36px; }
.col-check input { width: 16px; height: 16px; margin: 2px 0 0; }

.row-title { color: var(--ink); font-weight: 550; font-size: 14px; }
.row-title:hover { color: var(--accent); }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; margin-top: 7px; font-size: 12px; }
.row-meta a { color: var(--ink-3); }
.row-meta a:hover { color: var(--accent); }
.row-rationale { margin-top: 3px; color: var(--ink-3); font-size: 12px; max-width: 72ch; }
.row-notice { display: block; margin-top: 4px; font-size: 12px; color: var(--in); }

.decide { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.decide button {
  height: 32px; padding: 0 10px; border: 0; border-left: 1px solid var(--line-2);
  background: none; color: var(--ink-2); font-size: 12.5px; font-weight: 550;
}
.decide button:first-child { border-left: 0; }
.decide button:hover { background: var(--hover); color: var(--ink); }
.decide button:focus-visible { outline-offset: -2px; }
.decide .decide-in[aria-pressed="true"] { background: var(--in-soft); color: var(--in); }
.decide .decide-out[aria-pressed="true"] { background: var(--out-soft); color: var(--out); }
.decide .decide-watch[aria-pressed="true"] { background: var(--watch-soft); color: var(--watch); }
.decide[aria-busy="true"] { opacity: .6; }

.clusters .col-title { font-size: 14px; }

/* ---------- Pager & segmented ---------- */

.pager { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: 14px; font-size: 13px; }
.pager a, .pager span { padding: 4px 8px; border-radius: var(--radius); }
.pager span[aria-hidden] { color: var(--line-2); }
.pager a:hover { background: var(--surface); text-decoration: none; }
.pager-pos { color: var(--ink-3); }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin-bottom: 20px; background: var(--surface-2); border-radius: 7px; }
.segmented a { padding: 7px 14px; border-radius: 6px; color: var(--ink-2); font-size: 13px; }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); font-weight: 550; }

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

.detail-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; font-size: 13px; }
.detail-nav-step { display: flex; gap: 14px; align-items: center; }
.detail-head { margin-bottom: 26px; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.detail-head > p { font-size: 13px; margin-bottom: 2px; }
.detail-head h1 { font-size: 30px; max-width: 60ch; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 22px; }
.facts dt { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.facts dd { min-height: 22px; display: flex; align-items: center; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.detail-main { display: grid; gap: 18px; }
.detail-main section { padding: 24px; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; }
.detail-main h2 { margin-bottom: 6px; color: var(--ink-2); }
.detail-main p { color: var(--ink); }
.detail-main .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.detail-side { display: grid; gap: 12px; position: sticky; top: 90px; }
.detail-side h2 { margin-bottom: 10px; }
.detail-side .decide { display: flex; }
.deliverable { font-weight: 600; }
.deliverable-yes { color: var(--in); }
.deliverable-no { color: var(--out); }
.detail-side .decide button { flex: 1; height: 32px; }
.sources { display: grid; gap: 4px; }
.history { display: grid; gap: 10px; }
.history li { font-size: 13px; }
.history p { margin-top: 3px; color: var(--ink-2); }

.review-panel { margin-top: 16px; max-width: 720px; }
.review-panel h2 { font-size: 14px; margin-bottom: 4px; }
.review-panel > p { margin-bottom: 12px; }
.review-panel .field-row { grid-template-columns: 1fr 200px; }

/* ---------- Sign-in ---------- */

.login { width: 100%; max-width: 420px; display: grid; gap: 16px; padding: 36px; }
.login form { display: grid; gap: 12px; }

/* ---------- Shortcuts dialog ---------- */

.shortcuts { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgb(20 24 22 / 32%); }
.shortcuts[hidden] { display: none; }
.shortcuts-panel { width: min(360px, calc(100vw - 32px)); padding: 20px; background: var(--surface); border-radius: 10px; box-shadow: 0 12px 40px rgb(0 0 0 / 18%); }
.shortcuts-panel h2 { font-size: 15px; margin-bottom: 12px; }
.shortcuts-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin-bottom: 16px; align-items: center; }
.shortcuts-panel dd { color: var(--ink-2); }

/* ---------- Narrow screens ---------- */

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
}

@media (max-width: 720px) {
  .topbar { gap: 12px; padding: 0 16px; min-height: 64px; }
  .topnav a { padding: 0 6px; }
  .page { padding: 24px 16px 40px; }
  .filters > summary { display: block; }
  .filter-bar .field, .filter-bar .field-narrow { flex: 1 1 calc(50% - 5px); }
  .filter-actions { flex: 1 1 100%; }
  .filter-actions .button { flex: 1; }
  .review-panel .field-row { grid-template-columns: 1fr; }

  /* Tables become stacked rows: title first, then a compact facts line. */
  .triage, .triage tbody { display: block; }
  .triage thead { display: none; }
  .triage tbody tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    padding: 18px; border-bottom: 1px solid var(--line);
  }
  .triage tbody tr:last-child { border-bottom: 0; }
  .triage td { display: block; padding: 0; border: 0; width: auto; background: none !important; }
  .triage td.col-title { order: -1; flex: 1 1 100%; }
  .triage td.col-where { font-size: 12.5px; }
  .triage td.col-decide { flex: 1 1 100%; margin-top: 2px; }
  .triage td.col-decide .decide { display: flex; }
  .triage td.col-decide .decide button { flex: 1; height: 34px; }
  .triage .col-due .due { display: flex; gap: 6px; align-items: baseline; }
  .triage .col-num { text-align: left; }
  .triage .col-num::before { content: attr(data-label) " "; color: var(--ink-3); }
  .triage.members td.col-check { order: -2; }
  .triage.members td.col-title { flex: 1 1 calc(100% - 30px); }
  .triage tbody tr.is-current { box-shadow: inset 3px 0 0 var(--accent); }
}

/* Shared workspace identity and responsive refinements. */
.brand-divider { width: 1px; height: 20px; background: #567466; margin: 0 6px 0 12px; }
.workspace-label { font-size: 11px; letter-spacing: .03em; font-weight: 450; color: #c5d6cb; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; }
.page-description { color: var(--ink-3); margin-top: 8px; font-size: 14px; }
.page-count { border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px; background: #eef1e9; font-size: 12px; }
.filter-icon { display: inline-block; margin-right: 4px; color: var(--accent); }
.triage { box-shadow: 0 3px 12px rgb(26 55 40 / 3%); }
.triage th { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; }
.triage tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
.triage tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
.tag { border: 1px solid #e3e9de; background: #f4f7f0; }
.due { gap: 4px; }
.facts { padding-top: 20px; border-top: 1px solid var(--line); }
.detail-main h2, .detail-side h2 { font-size: 14px; margin-bottom: 12px; }
.detail-main p { line-height: 1.75; }
.login-mark { width: 46px; height: 46px; font-size: 32px; margin-bottom: 8px; }
.login h1 { font-size: 28px; }
.login .eyebrow { margin-bottom: -8px; }
.login .button { margin-top: 6px; }
.page-center { min-height: calc(100vh - 72px); background: radial-gradient(ellipse at 50% 20%, #e4ebda, transparent 65%); max-width: none; padding-top: 10vh; }
.shortcuts { backdrop-filter: blur(4px); }
@media (max-width: 1050px) {
  .workspace-label, .brand-divider { display: none; }
  .topnav { margin-left: 0; }
  .col-where { width: 15%; }
}
@media (max-width: 720px) {
  h1 { font-size: 28px; }
  .brand { font-size: 20px; }
  .brand-mark { width: 28px; height: 28px; font-size: 21px; }
  .topnav { gap: 0; font-size: 12px; }
  .topbar-end { gap: 8px; }
  .kbd-hint { display: none; }
  .page-head { margin-bottom: 20px; gap: 14px; }
  .page-count { font-size: 11px; }
  .filters > summary { display: list-item; margin-left: 18px; padding-left: 0; }
  .detail-head { padding: 20px; }
  .detail-head h1 { font-size: 25px; }
  .detail-main section { padding: 20px; }
  .facts { gap: 16px 24px; }
  .detail-nav { align-items: start; }
  .detail-nav-step { flex-wrap: wrap; justify-content: end; gap: 8px; }
  .triage tbody tr.is-current { background: var(--accent-soft); }
  .triage td.col-status { margin-left: auto; }
  .triage td.col-decide { margin-top: 8px; }
  .login { padding: 28px; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .decide button, .topnav a, .triage td { transition: background-color .15s ease, color .15s ease; }
}
