:root {
  --bg: #fbfaf7; --panel: #f3f1ec; --ink: #1d1c1a; --muted: #6d6a63; --line: #e3e0d8;
  --accent: #c2410c; --accent-ink: #fff; --warn: #b42318; --ok: #3f6212; --sel: #fff3e8;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161513; --panel: #1f1e1b; --ink: #ecebe7; --muted: #9b978e; --line: #2f2d29;
    --accent: #fb923c; --accent-ink: #1d1c1a; --warn: #f97066; --ok: #a3e635; --sel: #2a2119; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; }
a:hover { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code, kbd { font: .85em ui-monospace, SFMono-Regular, Menlo, monospace; }
kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 .3em; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side summary { list-style: none; cursor: default; display: flex; justify-content: space-between; align-items: center; padding: 0 .5rem .75rem; }
.side summary::-webkit-details-marker { display: none; }
.side summary .count { display: none; }
.brand { font-weight: 700; letter-spacing: -.01em; }
.side nav a, .side .link { display: flex; gap: .5rem; align-items: baseline; padding: .3rem .5rem; border-radius: 6px; text-decoration: none; font-size: .95rem; }
.side nav a .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav a[aria-current] { background: var(--bg); font-weight: 600; }
.side nav h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2rem .5rem .3rem; }
.count { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .85rem; }
.warn { color: var(--warn); font-weight: 700; }
.side form { margin: 0; }
button.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; width: 100%; text-align: left; }

main { padding: 1.5rem 2rem 4rem; max-width: 820px; width: 100%; }
main.bare { margin: 10vh auto; max-width: 360px; }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.head p { margin: .3rem 0 0; }

button, .button { font: inherit; font-size: .9rem; padding: .35rem .8rem; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
input[type=text], input[type=url], input[type=password], input:not([type]) { font: inherit; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); min-width: 0; }
form.inline { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline.wide input { flex: 1; }
form.stack, .stack { display: grid; gap: .75rem; }
.stack label { display: grid; gap: .25rem; }
.stack label.check { display: flex; gap: .5rem; align-items: center; }

.tabs { display: flex; gap: 1rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.tabs a { text-decoration: none; padding: .3rem 0; color: var(--muted); }
.tabs a[aria-current] { color: var(--ink); border-bottom: 2px solid var(--accent); }

.river { list-style: none; padding: 0; margin: 0; }
.post { padding: 1rem .75rem; border-bottom: 1px solid var(--line); border-radius: 8px; scroll-margin: 2rem; }
.post.selected { background: var(--sel); }
.post .meta { margin: 0; font-size: .85rem; color: var(--muted); }
.post .meta a { text-decoration: none; }
.post h2 { font-size: 1.15rem; margin: .2rem 0; line-height: 1.3; }
.post h2 a { text-decoration: none; }
.post .excerpt { margin: .2rem 0 .5rem; color: var(--muted); font-size: .95rem; }
.post.opened h2 a, .post.skipped h2 a { color: var(--muted); }
.post.leaving { opacity: .3; transition: opacity .2s; }
.actions { display: flex; gap: .5rem; }
.actions form { margin: 0; }
.actions button { font-size: .8rem; padding: .15rem .6rem; }
.tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 .35em; }
.empty { color: var(--muted); padding: 2rem 0; list-style: none; }
.more { margin: 1.5rem 0; }
.keys { margin-top: 2rem; font-size: .85rem; }

table.feeds { width: 100%; border-collapse: collapse; font-size: .92rem; }
.feeds th, .feeds td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.feeds th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.feeds .num { text-align: right; font-variant-numeric: tabular-nums; }
.feeds tr.archived { opacity: .55; }
tr.failing .tag, tr.gone .tag, li.failing { color: var(--warn); }

.facts dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1.5rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.settings { display: grid; gap: .75rem; padding: 1rem; background: var(--panel); border-radius: 8px; }
.danger summary { cursor: pointer; color: var(--warn); }
.danger form { margin-top: .5rem; }
h2.section { font-size: 1rem; margin: 2rem 0 .5rem; }
ol.compact, ul.compact { list-style: none; padding: 0; margin: 0; }
.compact li { padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.compact time { color: var(--muted); font-variant-numeric: tabular-nums; display: inline-block; min-width: 7.5em; }
.compact li.opened a, .compact li.skipped a, .compact li.backlog a { color: var(--muted); }
.candidate { margin-top: 1.5rem; padding: 1rem; background: var(--panel); border-radius: 8px; }
.candidate h2 { margin: 0; font-size: 1.2rem; }
.candidate .compact { margin: .75rem 0 1rem; }
.notice { padding: .6rem .8rem; border-radius: 6px; background: var(--panel); }
.notice.error { color: var(--warn); }
.login h1 { font-size: 1.4rem; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; align-content: start; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: .6rem .75rem; }
  .side summary { cursor: pointer; padding: .2rem .5rem; }
  .side summary .count { display: inline; }
  .side:not([open]) nav { display: none; }
  main { padding: 1rem 1rem 3rem; }
  .feeds th:nth-child(2), .feeds td:nth-child(2), .feeds th:nth-child(5), .feeds td:nth-child(5), .feeds th:nth-child(6), .feeds td:nth-child(6) { display: none; }
  .keys { display: none; }
}

.post.pick { background: var(--panel); border: 1px solid var(--line); margin-bottom: .75rem; }
.pick-label { color: var(--accent); font-weight: 600; text-transform: uppercase; font-size: .75rem; letter-spacing: .06em; }
.settings.channel, .settings { margin-bottom: 1rem; }
.settings h2 { font-size: 1.05rem; margin: 0; display: flex; gap: .5rem; align-items: center; }
.settings p { margin: 0; }
.code code { font-size: 1.3rem; padding: .2rem .5rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; user-select: all; }
.inline-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-actions form { margin: 0; }
.warn-text { color: var(--warn); }

.state { font-size: .8rem; padding: .05em .45em; border-radius: 4px; background: var(--panel); white-space: nowrap; }
.state.core, .dot.core circle { --c: #3f6212; }
.state.quiet-favourite, .dot.quiet-favourite circle { --c: #0f766e; }
.state.firehose, .dot.firehose circle { --c: #a16207; }
.state.neglected, .dot.neglected circle, .state.broken, .dot.broken circle { --c: #b42318; }
.state.dormant, .dot.dormant circle, .state.fading, .dot.fading circle { --c: #6d6a63; }
.state.settling, .dot.settling circle { --c: #4f46e5; }
.state { color: var(--c, var(--muted)); }
.healthmap { width: 100%; height: auto; max-width: 640px; display: block; margin: .5rem 0; }
.healthmap .axis { stroke: var(--muted); stroke-width: 1; }
.healthmap .zone { stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 4 4; }
.healthmap .tick, .healthmap .zonelabel { font-size: 11px; fill: var(--muted); }
.healthmap .zonelabel { text-transform: uppercase; letter-spacing: .05em; font-size: 10px; }
.healthmap .dot circle { fill: var(--c, var(--accent)); }
.healthmap .dot text { font-size: 11px; fill: var(--ink); }
.heat { display: flex; gap: 4px; align-items: flex-start; margin: .5rem 0; overflow-x: auto; }
.heat-days, .heat-week { display: grid; grid-template-rows: repeat(7, 14px) 6px; gap: 3px; }
.heat-days span { font-size: 10px; line-height: 14px; color: var(--muted); padding-right: 4px; }
.cell { width: 14px; height: 14px; border-radius: 3px; background: var(--line); }
.cell.l1 { background: #fed7aa; } .cell.l2 { background: #fdba74; } .cell.l3 { background: #f97316; } .cell.l4 { background: #c2410c; }
.cell.l-1 { background: transparent; border: 1px dashed var(--line); }
.bar { height: 4px; border-radius: 2px; background: var(--line); margin-top: 2px; }
.bar.met { background: var(--accent); }
.checkin { max-width: 480px; }
.checkin h1 { font-size: 1.5rem; }
