:root {
  --bg: #fbfaf8; --surface: #ffffff; --fg: #1c1b1a; --muted: #6b6862; --line: #e6e2dc;
  --accent: #0d5fb3; --accent-soft: #e8f0fa; --good: #1d7a46; --warn: #9a5b00; --bad: #b3261e;
  --radius: 10px; --gap: 1rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413; --surface: #1d1c1b; --fg: #ecebe8; --muted: #a29e97; --line: #34322f;
    --accent: #7db7ff; --accent-soft: #1d2a3a; --good: #6fcf97; --warn: #f2b84b; --bad: #ff8a80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
main { max-width: 46rem; margin: 0 auto; padding: 0 1rem 4rem; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 1.25rem 0 .75rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .5rem; }
.sub { color: var(--muted); font-size: .9rem; font-weight: normal; }

/* Header */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  max-width: 46rem; margin: 0 auto; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); letter-spacing: -.01em; }
.main-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .9rem; font-size: .95rem; }
.main-nav a { text-decoration: none; color: var(--muted); }
.main-nav a.active, .main-nav a:hover { color: var(--fg); }
form.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: pointer; }
button.link:hover { color: var(--fg); }

.banner { max-width: 44rem; margin: .75rem auto 0; padding: .6rem .9rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
main .banner { margin: .75rem 0; }
.error { color: var(--bad); }
.ok { color: var(--good); }
.hint, .empty { color: var(--muted); }

/* Digest */
.digest-head { margin-bottom: .5rem; }
.day-nav { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .25rem 1rem; }
.day-nav h1 { flex: 1 1 100%; order: -1; margin-bottom: .25rem; }
.day-nav a { text-decoration: none; font-size: .9rem; }
.jump { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted); margin: .5rem 0 0; }
.items { display: grid; gap: var(--gap); margin-top: 1rem; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.item h2 { font-size: 1.08rem; margin: 0; }
.item h2 a { color: var(--fg); text-decoration: none; }
.item h2 a:hover { color: var(--accent); text-decoration: underline; }
.meta { color: var(--muted); font-size: .85rem; margin: .2rem 0 .6rem; }
.brief { margin: .4rem 0 .3rem; }
.people, .subjects { margin: .15rem 0; font-size: .88rem; color: var(--muted); }
.people .label, .subjects .label { font-weight: 600; }
.more { margin-top: .4rem; }
.more > summary { cursor: pointer; font-size: .85rem; color: var(--accent); width: fit-content; }
.more[open] > summary { margin-bottom: .3rem; }
.summary { margin: .4rem 0; }
.participants, .highlights { margin: .5rem 0; padding-left: 1.2rem; font-size: .95rem; }
.participants { list-style: none; padding-left: 0; color: var(--muted); }
.participants strong { color: var(--fg); font-weight: 600; }
.why { margin: .6rem 0 .2rem; font-size: .85rem; color: var(--muted); }
.why summary { cursor: pointer; }
.why ul { margin: .3rem 0; padding-left: 1.2rem; }
.notice { font-size: .85rem; color: var(--warn); margin: .3rem 0; }
.item.consumed { opacity: .55; }
.item.hidden { opacity: .6; padding-block: .7rem; }
.item.hidden .meta { margin-bottom: .2rem; }
.hidden-note { color: var(--muted); font-size: .9rem; margin: .2rem 0; }
.meta a.source { color: inherit; text-decoration: none; }
.meta a.source:hover { color: var(--accent); text-decoration: underline; }

/* Sources */
.crumb { margin: 1rem 0 -.5rem; font-size: .9rem; }
.crumb a { text-decoration: none; }
.source-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.source-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem; }
.source-list li.disabled { opacity: .6; }
.source-list a { font-weight: 600; text-decoration: none; }
.source-list .meta { display: block; margin: .1rem 0 0; }
.meta .warn { color: var(--warn); }
.ingested { list-style: none; padding: 0; display: grid; gap: .5rem; margin-top: .5rem; }
.ingested > li { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); padding: .55rem .8rem; }
.ingested .title { color: var(--fg); text-decoration: none; font-weight: 600; }
.ingested .title:hover { color: var(--accent); text-decoration: underline; }
.ingested .meta { margin: .15rem 0 0; }
.ingested .status { font-weight: 600; }
.ingested .triage { margin: .2rem 0 0; font-size: .85rem; color: var(--muted); }
.ingested .summarise { margin: .35rem 0 0; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.ingested .summarise button { font-size: .8rem; padding: .15rem .6rem; }
.ingested .summarise .requested { font-size: .85rem; color: var(--accent); }
.ingested .on-demand { margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed var(--line); }
.ingested .on-demand .brief { margin: 0 0 .2rem; }
.rationale { font-style: italic; color: var(--muted); }
.ingested .st-published { border-left-color: var(--good); }
.ingested .st-published .status { color: var(--good); }
.ingested .st-picked { border-left-color: var(--accent); }
.ingested .st-picked .status { color: var(--accent); }
.ingested .st-rejected .title { color: var(--muted); }
.ingested .st-pending { border-left-color: var(--warn); }
.ingested .st-pending .status { color: var(--warn); }
.ingested .st-failed { border-left-color: var(--bad); }
.ingested .st-failed .status { color: var(--bad); }
.ingested .st-archived { border-left-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.sort { font-size: .85rem; color: var(--muted); margin: -.5rem 0 .5rem; }
.sort a { text-decoration: none; }
.sort strong { color: var(--fg); font-weight: 600; }

.feedback { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .75rem; }
.feedback button, .feedback summary { font: inherit; font-size: .8rem; padding: .3rem .6rem; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.feedback button:hover, .feedback summary:hover { border-color: var(--accent); color: var(--fg); }
.feedback button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.feedback .note { flex-basis: 100%; }
.feedback .note[open] summary { margin-bottom: .4rem; }
.feedback .note summary { display: inline-block; list-style: none; }
.feedback .note summary::-webkit-details-marker { display: none; }
.feedback textarea { width: 100%; font: inherit; font-size: .9rem; padding: .5rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg); margin-bottom: .4rem; }
.feedback.busy { opacity: .6; pointer-events: none; }

/* Forms */
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]), select { padding: .4rem .55rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--fg); min-width: 0; }
button { padding: .4rem .8rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--surface); }
button.danger:hover { border-color: var(--bad); color: var(--bad); }
button:disabled, button:disabled:hover { opacity: .45; cursor: default; border-color: var(--line); }
button.primary:disabled { border-color: var(--accent); }
.changed { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent) !important; }
.savebar { position: sticky; bottom: 0; z-index: 1; display: flex; justify-content: flex-end; padding: .75rem 0 1rem;
  background: linear-gradient(to bottom, transparent, var(--bg) 35%); }
.stack { display: grid; gap: .75rem; max-width: 28rem; }
.stack label { display: grid; gap: .25rem; font-size: .9rem; color: var(--muted); }
.narrow { max-width: 28rem; }

/* Manage */
.sub-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.sub-nav a { text-decoration: none; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.sub-nav a.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.rows { display: grid; gap: .5rem; }
.row { display: flex; flex-wrap: wrap; gap: .4rem .5rem; align-items: center; padding: .6rem .7rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.row.disabled { opacity: .6; }
.row input[name=name] { flex: 1 1 12rem; }
.row .wide { flex: 1 1 100%; }
.row .kind { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); min-width: 4.5rem; }
.row .detail { flex-basis: 100%; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.row .warn { color: var(--warn); }
.check { display: inline-flex; gap: .3rem; align-items: center; font-size: .85rem; color: var(--muted); padding: .1rem .25rem; border: 1px solid transparent; border-radius: 6px; }
.add { margin-top: .5rem; }
.settings fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1rem; padding: .75rem 1rem 1rem; display: grid; gap: .6rem; }
.settings legend { font-weight: 600; padding: 0 .3rem; }
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: .9rem; }
.settings input { width: 9rem; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.runs .status-failed td:nth-child(2) { color: var(--bad); }
.runs .status-partial td:nth-child(2) { color: var(--warn); }
.runs .status-ok td:nth-child(2) { color: var(--good); }
.runs tr.message td { color: var(--muted); border-bottom-style: dashed; }
.log { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem;
  font-size: .78rem; line-height: 1.45; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 40rem) {
  .runs th:nth-child(3), .runs td:nth-child(3) { display: none; }
  .settings label { flex-direction: column; align-items: stretch; gap: .25rem; }
  .settings input { width: 100%; }
}
