/* TaskAI — the dispatch desk.
   One stylesheet, phone width first (one column); wider screens get a
   sidebar and side-by-side lanes. Themes follow prefers-color-scheme.
   The one loud element is the "Waiting on a person" tray (signal amber);
   lane colours carry meaning (where a ticket is) and nothing else. */

:root {
  color-scheme: light dark;

  /* Base palette */
  --ink: #1e2a3a;          /* text */
  --paper: #f7f8f6;        /* page */
  --sheet: #ffffff;        /* cards, panels */
  --line: #dde1e6;         /* hairlines */
  --muted: #5b6676;        /* secondary text (AA on paper and sheet) */
  --signal: #f2b33d;       /* the tray: something needs a person */
  --signal-soft: #fdf3dc;
  --signal-ink: #3d2a00;
  --sprint: #e8730c;        /* sprint label fill: orange, both themes */
  --on-sprint: #1e2a3a;     /* text on the sprint fill: 4.7:1; literal, not --ink, so it stays dark in the dark theme */

  /* Lane meanings */
  --lane-in-progress: #1f7a72;
  --lane-ready: #4a5d7a;
  --lane-waiting: #8a8f98;
  --lane-pr-open: #6e4a8e;
  --lane-done: #3a7d44;
  --lane-failed: #b3261e;

  /* Roles */
  --bg: var(--paper);
  --fg: var(--ink);
  --surface: var(--sheet);
  --accent: #23508f;
  --accent-fg: #ffffff;
  --accent-soft: #e6eef9;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --danger-on: #ffffff;     /* text on a danger fill */
  --on-signal: #3d2a00;     /* text on a signal fill, both themes */
  --focus: #f2b33d;
  --side-bg: #0b3d91;   /* sidebar: heavy blue */
  --side-fg: #e9eef5;
  --side-muted: #a9b6c7;

  /* Shape and rhythm: radius grows with the size of the thing */
  --r-chip: 999px;
  --r-control: 0.5rem;
  --r-card: 0.625rem;
  --r-panel: 1rem;
  --gap: 1rem;

  /* Type: a rounded face where the system has one, else the system sans */
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --t-small: 0.875rem;
  --t-body: 1rem;
  --t-h3: 1.125rem;
  --t-h2: 1.25rem;
  --t-h1: 1.625rem;
  --t-display: 2.125rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ecf2;
    --paper: #10161f;
    --sheet: #18212c;
    --line: #2c3746;
    --muted: #9aa7b8;
    --signal: #f2b33d;
    --signal-soft: #2e2512;
    --signal-ink: #f8dca0;
    --lane-in-progress: #4fb8ad;
    --lane-ready: #8ea3c4;
    --lane-waiting: #8f97a3;
    --lane-pr-open: #b28fd6;
    --lane-done: #6fbf7b;
    --lane-failed: #ff8a80;
    --accent: #8db8f2;
    --accent-fg: #0d1a2c;
    --accent-soft: #1d2b40;
    --danger: #ff8a80;
    --danger-bg: #3a1714;
    --danger-on: #3a0d0a;
    --side-bg: #082a63;
    --side-fg: #e7ecf2;
    --side-muted: #8d9aab;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: var(--t-body)/1.5 var(--font);
  overflow-wrap: anywhere;
  font-feature-settings: "tnum" 0;
}
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: var(--t-h1); font-weight: 750; margin: 0 0 var(--gap); }
h2 { font-size: var(--t-h2); font-weight: 700; margin: 1.75rem 0 0.75rem; }
h3 { font-size: var(--t-h3); }
p { margin: 0.5rem 0; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
pre, code { font-family: var(--mono); font-size: 0.9em; }
pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); padding: 0.75rem; border-radius: var(--r-control); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: var(--t-small); color: var(--muted); font-weight: 650; }
.muted { color: var(--muted); }
.id, .count, .score, time { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Visible focus on every control. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 0.25rem; }

.skip { position: absolute; left: 0.5rem; top: -3rem; padding: 0.5rem 0.75rem; background: var(--surface); color: var(--fg); border-radius: var(--r-control); z-index: 10; }
.skip:focus { top: 0.5rem; }

/* ---------- Shell: top bar on a phone, sidebar on wide screens ---------- */
header.site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem var(--gap);
  padding: 0.75rem var(--gap);
  background: var(--side-bg);
  color: var(--side-fg);
}
header.site a { color: var(--side-fg); }
header.site .brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 800; font-size: 1.125rem; letter-spacing: -0.02em; text-decoration: none;
  margin-right: auto;
}
header.site .brand img { width: 1.75rem; height: 1.75rem; border-radius: 0.4rem; }
header.site nav { display: contents; }
header.site ul { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0; padding: 0; align-items: center; }
header.site .nav-main { order: 3; width: 100%; }
header.site .nav-main a, header.site .nav-account a {
  display: block; padding: 0.4rem 0.7rem; border-radius: var(--r-control); text-decoration: none; color: var(--side-muted); font-weight: 600;
}
header.site .nav-main a:hover, header.site .nav-account a:hover { color: var(--side-fg); background: rgb(255 255 255 / 0.08); }
header.site a[aria-current="page"] { color: var(--side-fg); background: rgb(255 255 255 / 0.12); }
header.site form { margin: 0; }
.new-ticket {
  order: 2;
  display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0.4rem 1rem;
  border-radius: var(--r-control); background: var(--signal); color: var(--on-signal) !important;
  font-weight: 750; text-decoration: none;
}
.new-ticket::before { content: "+"; font-size: 1.25em; line-height: 1; margin-right: 0.4rem; }
.new-ticket:hover { filter: brightness(1.05); }
header.site .nav-account { order: 1; }
header.site button.quiet { min-height: 2rem; padding: 0.3rem 0.7rem; background: transparent; border-color: rgb(255 255 255 / 0.25); color: var(--side-muted); }
header.site button.quiet:hover { color: var(--side-fg); border-color: var(--side-muted); }

main { padding: var(--gap); max-width: 90rem; }

@media (min-width: 720px) {
  main { padding: 1.5rem 2rem 3rem; }
}

@media (min-width: 1000px) {
  body.signed-in { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }
  body.signed-in header.site {
    position: sticky; top: 0; height: 100vh;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 1rem;
    padding: 1.25rem 0.875rem;
  }
  body.signed-in header.site .brand { margin: 0 0 0.5rem 0.35rem; }
  body.signed-in .new-ticket { order: 0; justify-content: center; }
  body.signed-in header.site nav { display: flex; flex-direction: column; flex: 1; gap: 1rem; }
  body.signed-in header.site ul { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
  body.signed-in header.site .nav-main { order: 0; width: auto; }
  body.signed-in header.site .nav-account { order: 0; margin-top: auto; border-top: 1px solid rgb(255 255 255 / 0.12); padding-top: 0.75rem; }
  body.signed-in header.site button.quiet { width: 100%; justify-content: flex-start; border-color: transparent; padding: 0.4rem 0.7rem; font-weight: 600; }
  main { padding: 2rem 2.5rem 4rem; }
}

/* ---------- Forms ---------- */
label { display: block; font-weight: 650; margin-top: 0.875rem; margin-bottom: 0.25rem; }
input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]), select, textarea {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input[type="file"] { display: block; padding: 0.4rem 0; }
input[type="file"]::file-selector-button {
  margin-right: 0.75rem; min-height: 2.25rem; padding: 0.3rem 0.9rem; font: inherit; font-weight: 650;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface); color: var(--accent); cursor: pointer;
}
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); vertical-align: -0.15em; }
textarea { min-height: 8rem; line-height: 1.5; }
::placeholder { color: var(--muted); opacity: 1; }
button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.45rem 1.05rem;
  border: 1px solid var(--accent);
  border-radius: var(--r-control);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.secondary, a.button {
  background: var(--surface); color: var(--accent); border-color: var(--line);
}
button.secondary:hover, a.button:hover { border-color: var(--accent); filter: none; }
button.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-on); }
.stack > button { margin-top: 1.25rem; }
.narrow { max-width: 26rem; }
fieldset { border: 1px solid var(--line); border-radius: var(--r-card); }
legend { font-weight: 650; padding: 0 0.35rem; }
label.choice { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; margin: 0.4rem 1.25rem 0 0; }

.error {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--danger);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  background: var(--danger-bg);
  color: var(--fg);
}
.notice {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  background: var(--accent-soft);
}
.notice p { margin: 0.15rem 0; }
.notice.blocked { border-left-color: var(--danger); background: var(--danger-bg); }
.warning { padding: 0.75rem 1rem; border-left: 4px solid var(--signal); border-radius: 0 var(--r-control) var(--r-control) 0; background: var(--signal-soft); }
.empty-projects { margin-bottom: 1.5rem; border-left-color: var(--signal); background: var(--signal-soft); }

/* Wider screens: page groups lay out in columns. */
.columns { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 720px) {
  .columns { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
}

/* ---------- Board ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1rem; }
.page-head h1 { font-size: var(--t-display); margin-bottom: 1rem; }
.page-head h1 .muted { font-weight: 600; }

.filters {
  display: grid; grid-template-columns: 1fr; gap: 0 var(--gap);
  padding: 0.25rem 1rem 1rem; margin-bottom: 1.5rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
}
.filters label { font-size: var(--t-small); color: var(--muted); }
.filters .actions { display: flex; align-items: center; gap: var(--gap); margin-top: 0.875rem; }
.filters input + input { margin-top: 0.4rem; }

.board-section h2, summary h2 { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0; }
.count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.75em; height: 1.5em; padding: 0 0.45em;
  border-radius: var(--r-chip);
  background: var(--bg); border: 1px solid var(--line);
  color: var(--muted); font-size: 0.8rem; font-weight: 700;
}

/* The tray: the one loud thing on the board. */
.tray {
  margin-bottom: 1.75rem;
  padding: 1rem 1.1rem 1.1rem;
  border-radius: var(--r-panel);
  background: var(--signal-soft);
  border: 2px solid var(--signal);
}
.tray h2 { font-size: var(--t-h1); color: var(--signal-ink); }
.tray .count { background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.tray .tray-note { margin: 0.35rem 0 0.75rem; color: var(--signal-ink); max-width: 40rem; }
.tray-empty { border-style: dashed; border-width: 1px; background: transparent; }
.tray-empty h2 { font-size: var(--t-h2); color: var(--fg); }
.tray-empty .count { background: var(--bg); border-color: var(--line); color: var(--muted); }
.tray-empty .tray-note { color: var(--muted); margin-bottom: 0; }

/* Lanes: stacked on a phone, side by side (scrolling) on wide screens. */
.lanes { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
.lane {
  --lane: var(--lane-waiting);
  min-width: 0;
  padding-top: 0.75rem;
  border-top: 4px solid var(--lane);
}
.lane-in-progress { --lane: var(--lane-in-progress); }
.lane-ready { --lane: var(--lane-ready); }
.lane-waiting { --lane: var(--lane-waiting); }
.lane-pr-open { --lane: var(--lane-pr-open); }
.lane-done { --lane: var(--lane-done); }
.lane-failed { --lane: var(--lane-failed); }
.lane h2 { font-size: var(--t-h3); }
.empty { color: var(--muted); font-size: var(--t-small); padding: 0.75rem 0; margin: 0; }

.cards { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
.card {
  position: relative;
  padding: 0.7rem 0.85rem 0.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--lane, var(--signal));
  border-radius: var(--r-card);
  background: var(--surface);
}
.card:hover { border-color: var(--muted); border-left-color: var(--lane, var(--signal)); }
.card:focus-within { border-color: var(--accent); border-left-color: var(--lane, var(--signal)); }
.card .title { display: block; font-weight: 700; color: var(--fg); text-decoration: none; line-height: 1.3; }
.card .title::after { content: ""; position: absolute; inset: 0; border-radius: var(--r-card); } /* the whole card opens the ticket */
.card .title:hover { text-decoration: underline; }
.card .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.75rem; margin-top: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.card .meta .id { font-weight: 700; color: var(--fg); }
.card .priority.critical { padding: 0 0.5rem; border-radius: var(--r-chip); color: var(--danger-on); background: var(--danger); font-weight: 750; }
.card.is-critical { border-left-color: var(--danger); }
.card .holder { padding: 0 0.5rem; border-radius: var(--r-chip); background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.card .sprint { padding: 0 0.5rem; border-radius: var(--r-chip); background: var(--sprint); color: var(--on-sprint); font-weight: 650; overflow-wrap: anywhere; }
.card .score { font-weight: 700; color: var(--fg); }
.card .labels { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; margin: 0.45rem 0 0; padding: 0; }
.card .labels li { padding: 0 0.55em; border: 1px solid var(--line); border-radius: var(--r-chip); font-size: 0.75rem; color: var(--muted); }
.card .reason { margin: 0.45rem 0 0; font-size: var(--t-small); color: var(--fg); }

details.cancelled { margin-top: 2rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
details.cancelled .cards { max-width: 36rem; }
summary { cursor: pointer; padding: 0.25rem 0; }

@media (min-width: 720px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  .filters .actions { margin-top: 0; padding-bottom: 0.1rem; }
  .tray .cards { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
  .lanes { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.5rem 1.25rem; }
}

@media (min-width: 1200px) {
  .filters { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
}

/* ---------- Ticket page ---------- */
.needs-you {
  margin: 0 0 1.5rem; padding: 0.9rem 1.1rem;
  border: 2px solid var(--signal); border-radius: var(--r-panel); background: var(--signal-soft); color: var(--signal-ink);
}
.needs-you p { margin: 0.2rem 0; max-width: 46rem; }
.needs-you .button { margin-top: 0.5rem; background: var(--signal); border-color: var(--signal); color: var(--on-signal); }
.ticket-head { margin-bottom: 1.25rem; }
.ticket-head h1 { font-size: var(--t-display); margin: 0.1rem 0 0.5rem; }
.crumbs { margin: 0; display: flex; gap: 0.6rem; color: var(--muted); font-size: var(--t-small); font-weight: 650; }
.ticket-head h1 .id { display: block; font-size: var(--t-small); font-weight: 700; color: var(--muted); letter-spacing: 0; margin-bottom: 0.2rem; }
.status-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0; }
.status-chip { padding: 0.15rem 0.75rem; border-radius: var(--r-chip); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--t-small); }
.status-chip[class*="status-waiting"], .status-chip[class*="approval"], .status-chip.status-review_decision { background: var(--signal-soft); color: var(--signal-ink); box-shadow: inset 0 0 0 1px var(--signal); }
.status-chip.status-done { background: color-mix(in srgb, var(--lane-done) 15%, transparent); color: var(--lane-done); }
.status-chip.status-failed, .status-chip.status-cancelled { background: var(--danger-bg); color: var(--danger); }

.ticket-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
.ticket-side > section, .ticket-main > section { min-width: 0; }
.ticket-side > section {
  padding: 1rem 1.1rem; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel);
}
.ticket-side h2 { margin-top: 0; font-size: var(--t-h3); }
.ticket-main > section { padding-bottom: 0.5rem; }
.ticket-main > section + section { border-top: 1px solid var(--line); }
.ticket-main h2 { margin-top: 1.5rem; }
.ticket-main > section:first-child h2 { margin-top: 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem 1rem; margin: 0; }
.facts dt { color: var(--muted); font-size: 0.8rem; font-weight: 650; }
.facts dd { margin: 0; font-weight: 600; }
.facts .priority.critical { color: var(--danger); font-weight: 800; }
.ticket-summary .notice { margin-top: 0.75rem; }
.ticket-summary .labels, .attachments, .refs, .history, .comments { margin: 0.5rem 0; padding-left: 1.25rem; }
.ticket-summary .labels { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin-top: 0.875rem; }
.ticket-summary .labels li { padding: 0.05rem 0.6em; border: 1px solid var(--line); border-radius: var(--r-chip); font-size: 0.8rem; }

#actions .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.action-forms { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
.action-forms > form { padding: 0; }
.action-forms > form label, .action-more label { margin-top: 0; }
.action-more select + label { margin-top: 0.5rem; }
.action-forms button { margin-top: 0.5rem; }
.action-more { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.action-more > summary { font-weight: 650; color: var(--accent); }
.action-more[open] > summary { margin-bottom: 0.5rem; }
.danger-zone > summary { color: var(--danger); }
form.inline { display: inline; }
form.inline button { min-height: 2rem; padding: 0.2rem 0.7rem; background: var(--surface); color: var(--danger); border-color: var(--line); font-size: var(--t-small); }

.markdown { max-width: 46rem; }
.markdown > :first-child { margin-top: 0; }
.attachments { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.attachments img { border-radius: var(--r-control); border: 1px solid var(--line); max-height: 16rem; }
.comments { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.comment { padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.comment .byline { margin: 0 0 0.25rem; color: var(--muted); font-size: var(--t-small); }
.comment .byline strong { color: var(--fg); }
.comment-edit { margin: 0.5rem 0; }
.badge { display: inline-block; padding: 0 0.55em; border-radius: var(--r-chip); background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; font-weight: 700; }
.history { list-style: none; padding: 0; font-size: var(--t-small); }
.history li { padding: 0.3rem 0; border-bottom: 1px dashed var(--line); }
.history time { color: var(--muted); margin-right: 0.4rem; }

@media (min-width: 1100px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr) 22rem; align-items: start; gap: 2.5rem; }
  .ticket-side { grid-column: 2; grid-row: 1; }
  .ticket-main { grid-column: 1; grid-row: 1; }
}

/* ---------- Create and edit forms ---------- */
.ticket-form { max-width: 46rem; }
.ticket-form fieldset { margin: 1rem 0 0; padding: 0.4rem 0.9rem 0.7rem; }
.ticket-form legend { font-weight: 650; }
.ticket-form label.choice { margin: 0.4rem 1.25rem 0 0; }
.ticket-form > button { margin-top: 1.25rem; }

/* ---------- Searchable picker (combobox.js) ----------
   The select stays in the form, hidden; the input and its listbox replace
   it on screen. No animation. */
.combobox { position: relative; }
select.combobox-native {
  position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; pointer-events: none;
}
.combobox-input { padding-right: 2.25rem !important; text-overflow: ellipsis; }
.combobox::after { /* the chevron: drawn with borders, the CSP allows no data: images */
  content: ""; position: absolute; right: 0.9rem; top: 50%; width: 0.45rem; height: 0.45rem;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}
.combobox-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 0.25rem);
  max-height: min(16rem, 50vh); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 0.25rem; list-style: none;
  background: var(--surface); border: 1px solid var(--muted); border-radius: var(--r-control);
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.16);
}
.combobox-list[hidden] { display: none; }
.combobox-list li {
  display: flex; align-items: center; gap: 0.5rem; min-height: 2.5rem; padding: 0.4rem 0.65rem;
  border-radius: 0.35rem; cursor: pointer; font-weight: 500;
}
.combobox-list li:hover { background: var(--bg); }
.combobox-list li.is-chosen { font-weight: 700; }
.combobox-list li.is-chosen::after { content: "\2713"; margin-left: auto; color: var(--accent); }
.combobox-list li[aria-selected="true"] { background: var(--accent-soft); color: var(--fg); outline: 2px solid var(--accent); outline-offset: -2px; }
.combobox-list li.combobox-empty { cursor: default; color: var(--muted); font-style: italic; }
.combobox-list li.combobox-empty:hover { background: transparent; }

/* Document editor and dependency picker */
pre.diff { white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-form textarea { width: 100%; min-height: 24rem; font-family: var(--mono); font-size: 0.9rem; }
.cycle-path { font-weight: 650; overflow-wrap: anywhere; }

/* Activity */
table.activity { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
table.activity th, table.activity td { padding: 0.5rem 0.75rem; }
table.activity tr:last-child td { border-bottom: 0; }
table.activity .when { white-space: nowrap; color: var(--muted); }

/* ---------- Settings, projects and admin pages ---------- */
.subnav ul { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; margin: 0 0 1.5rem; padding: 0; }
.subnav a { display: block; padding: 0.35rem 0.85rem; border-radius: var(--r-chip); border: 1px solid var(--line); text-decoration: none; font-weight: 650; color: var(--muted); background: var(--surface); }
.subnav a[aria-current="page"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.secret-box { padding: 0.75rem 1rem; border-left: 4px solid var(--signal); border-radius: 0 var(--r-control) var(--r-control) 0; background: var(--signal-soft); }
code.secret { display: inline-block; padding: 0.3rem 0.6rem; border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--line); user-select: all; overflow-wrap: anywhere; }
.admin-rows { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr; gap: 0.875rem; }
.admin-rows > li { padding: 0.9rem 1rem 1rem; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.admin-rows > li.failed { border-color: var(--danger); }
.admin-rows .row-title { margin: 0; font-weight: 700; font-size: var(--t-h3); }
.admin-rows .row-title a { color: var(--fg); text-decoration: none; }
.admin-rows .row-title a:hover { text-decoration: underline; }
.admin-rows .row-title .id { color: var(--muted); font-weight: 650; font-size: var(--t-small); margin-left: 0.25rem; }
.admin-rows form { margin-top: 0.25rem; }
.admin-rows form + form { margin-top: 0.5rem; }
.admin-rows button { margin-top: 0.75rem; }
.badge, .admin-rows .badge { vertical-align: 0.1em; }
.stack fieldset { margin: 0.875rem 0 0; padding: 0.4rem 0.9rem 0.7rem; }
table.tokens { display: block; overflow-x: auto; }
@media (min-width: 720px) {
  .admin-rows { grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr)); }
  table.tokens { display: table; }
}

/* Project page: the create form sits beside the list on wide screens. */
.projects-page { display: grid; gap: 1.5rem; }
@media (min-width: 1100px) {
  .projects-page { grid-template-columns: 22rem minmax(0, 1fr); align-items: start; }
  .projects-page > .new-project { position: sticky; top: 1.5rem; }
}
.new-project { padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.new-project h2 { margin-top: 0; }
.projects-page h2 { margin-top: 0; }
.project-stats { display: flex; flex-wrap: wrap; gap: 0.3rem; list-style: none; padding: 0; margin: 0.5rem 0 0.25rem; font-size: 0.8rem; }
.project-stats li { padding: 0.05rem 0.55rem; border-radius: var(--r-chip); background: var(--bg); color: var(--muted); }
.project-stats strong { color: var(--fg); }
.project-edit { border-top: 1px solid var(--line); margin-top: 0.75rem; padding-top: 0.5rem; }
.project-edit > summary { font-weight: 650; color: var(--accent); }

/* ---------- Login ---------- */
body:not(.signed-in) main { display: grid; place-items: start center; padding-top: 12vh; }
body:not(.signed-in) header.site { background: transparent; color: var(--fg); justify-content: center; padding-top: 2rem; }
body:not(.signed-in) header.site a { color: var(--fg); }
body:not(.signed-in) header.site .brand { margin: 0 auto; }
.login-card { width: 100%; max-width: 24rem; padding: 1.5rem 1.5rem 1.75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.login-card h1 { margin-bottom: 0.25rem; }
.login-card .stack { max-width: none; }
.login-card .stack > button { width: 100%; }

@media (prefers-reduced-motion: no-preference) {
  .card, button, a.button, .new-ticket, header.site a { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease; }
}

/* Admin > Sprints: the lists beside the new-sprint form, like Projects. */
.sprint-lists { display: grid; gap: 1.5rem; min-width: 0; }
.sprint-lists h2 { margin-top: 0; }
.sprints.admin-rows > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.sprints .row-title { overflow-wrap: anywhere; min-width: 0; }
.sprints .count { color: var(--muted); font-weight: 400; font-size: var(--t-small); margin-left: 0.25rem; }
.sprints .row-actions { display: flex; gap: 0.5rem; }
.sprints .row-actions form, .sprints .row-actions form + form { margin: 0; }
.sprints .row-actions button { margin-top: 0; }
