/* Hírmondó — the reader. Tokens first, three theme states (auto / light / dark). */
:root {
  --ground: #f4f6f8; --surface: #ffffff; --sunken: #eaedf1; --ink: #191d25; --muted: #5b6472;
  --faint: #8791a0; --rule: #dbe0e7; --hover: #eef1f5; --accent: #7048e8; --accent-ink: #fff;
  --unread: #191d25; --read: #6e7889; --star: #e8a317; --error: #a33b3b;
  --sidebar-w: 280px; --toolbar-h: 48px; --measure: 72ch;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --ground: #111419; --surface: #181c23; --sunken: #1f242c; --ink: #e1e5ec; --muted: #939cab;
  --faint: #6e7889; --rule: #2a303a; --hover: #1f242c; --unread: #e1e5ec; --read: #7c8696; } }
:root[data-theme="dark"] {
  --ground: #111419; --surface: #181c23; --sunken: #1f242c; --ink: #e1e5ec; --muted: #939cab;
  --faint: #6e7889; --rule: #2a303a; --hover: #1f242c; --unread: #e1e5ec; --read: #7c8696; }
:root[data-color="blue"]   { --accent: #2e5c8a; }
:root[data-color="green"]  { --accent: #2c6e4c; }
:root[data-color="red"]    { --accent: #c0392b; }
:root[data-color="orange"] { --accent: #d35400; }
:root[data-color="teal"]   { --accent: #0e8a7c; }
:root[data-color="pink"]   { --accent: #c2185b; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.55 var(--sans); background: var(--ground); color: var(--ink); }
a { color: inherit; }
button { font: inherit; }
img { max-width: 100%; }
kbd { font-family: ui-monospace, monospace; font-size: .85em; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
.btn { border: 1px solid var(--rule); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 4px 10px; text-decoration: none; cursor: pointer; white-space: nowrap; font-size: 13px; }
.btn:hover { background: var(--hover); }
.btn.active { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.icon { border: 0; background: none; color: var(--ink); cursor: pointer; font-size: 18px; padding: 4px 8px; }
/* Lucide icons from the inline sprite (web/icons.py): stroke follows the text colour */
svg.sprite { display: none; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; flex: none; pointer-events: none; }
.ic.filled { fill: currentColor; stroke: none; }
.btn.ib { display: inline-flex; align-items: center; padding: 4px 7px; line-height: 1; }
.icon { display: inline-flex; align-items: center; }
.icon .ic { width: 20px; height: 20px; }
.sidebar-user .ic { width: 16px; height: 16px; }
#mobile-footer .ic { width: 22px; height: 22px; }
button.link { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- login ---------- */
body.login { display: grid; place-items: center; }
.login-box { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 32px 36px; width: min(92vw, 360px); }
.login-box h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 26px; }
.login-box .tagline { margin: 4px 0 20px; color: var(--muted); }
.login-box label { display: block; margin: 12px 0; color: var(--muted); font-size: 13px; }
.login-box input { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); }
.login-box button { width: 100%; margin-top: 16px; padding: 9px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.login-box .error { color: var(--error); }

/* ---------- app shell ---------- */
/* The app is exactly one viewport tall: only #sidebar and #entries scroll, the toolbar and the
   tree stay put. Grid/flex items default to min-height:auto (= their content), which would let a
   long list stretch the page instead — hence the min-height: 0 and the overflow clip. */
#app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; height: 100dvh; overflow: hidden; }
body.sidebar-hidden #app { grid-template-columns: 1fr; }  /* #sidebar is display:none, so #main is the only grid item */
body.sidebar-hidden #sidebar { display: none; }
#sidebar { background: var(--surface); border-right: 1px solid var(--rule); overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 600; border-bottom: 1px solid var(--rule); }
.tree { flex: 1; padding: 6px 0; }
.tree .node { display: flex; align-items: center; gap: 8px; padding: 5px 14px; text-decoration: none; color: var(--muted); font-size: 14px; }
.tree .node .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .node.has-unread, .tree .category.has-unread > summary .node { color: var(--ink); font-weight: 600; }
.tree .node.current { background: var(--sunken); color: var(--accent); }
.tree .node:hover { background: var(--hover); }
.tree .node.error .name { color: var(--error); }
.tree .badge { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 500; }
.tree .badge:empty { display: none; }
.tree .badge.muted { color: var(--faint); }
.tree details.category > summary { list-style: none; cursor: pointer; display: flex; align-items: stretch; }
.tree details.category > summary::-webkit-details-marker { display: none; }
.tree details.category > summary > .node { flex: 1; min-width: 0; padding-left: 4px; }
/* the arrow is the whole left edge of the row, not just the glyph — a stray click must never navigate */
.tree .twisty { flex: none; border: 0; background: none; color: var(--faint); font-size: 11px; width: 28px; padding: 0 0 0 8px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tree .twisty::before { content: "▸"; display: inline-block; width: 16px; line-height: 18px; text-align: center; border-radius: 4px; }
.tree details.category[open] > summary > .twisty::before { content: "▾"; }
.tree .twisty:hover::before { background: var(--rule); color: var(--ink); }
@media (pointer: coarse) { .tree .twisty { width: 40px; padding-left: 10px; } .tree .twisty::before { width: 24px; line-height: 24px; font-size: 13px; } }
.tree .node.dragging { opacity: .4; }
.tree .node.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.tree .node.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.tree .node.drop-into { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tree .children { padding-left: 14px; }
.tree .all .name::before { content: "≡ "; color: var(--faint); }
.favicon { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.favicon.placeholder { display: inline-block; background: var(--rule); }
.sidebar-user { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--rule); color: var(--muted); font-size: 13px; }
.sidebar-user .user { flex: 1; }
.sidebar-user a, .sidebar-user button { text-decoration: none; font-size: 15px; }

#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
#toolbar { display: flex; align-items: center; gap: 10px; height: var(--toolbar-h); padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--rule); }
#toolbar h1 { font-size: 16px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toolbar h1 .count { color: var(--faint); font-weight: 400; font-size: 13px; }
#search { flex: 1; max-width: 360px; }
#search input { width: 100%; padding: 5px 10px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); font: inherit; font-size: 13px; }
#toolbar .actions { display: flex; gap: 6px; margin-left: auto; }
/* the player icon next to the stats icon (sidebar) and, on phones, in the toolbar: grey while a
   track is loaded but paused, accent + pulse while it plays (kanyi, 2026-09-28) */
.btn-player { color: var(--faint); }
.btn-player.loaded { color: var(--muted); }
.btn-player.live { color: var(--accent); }
.btn-player.live .ic { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .btn-player.live .ic { animation: none; } }
#btn-player { display: none; }
#view-count { margin-left: 2px; font-variant-numeric: tabular-nums; }  /* plain "(13)" in the h1's faint .count style */
#view-count[hidden] { display: none; }
#toolbar .btn.font { font-weight: 600; font-size: 13px; padding: 4px 7px; letter-spacing: -.02em; }

#entries { position: relative; flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; padding-bottom: 40vh; overscroll-behavior-y: contain; }  /* positioned so .entry offsetTop is measured in the list's own scroll space */
html, body { overscroll-behavior-y: contain; }  /* our own pull-to-refresh, not the browser's reload */
#pull { display: flex; justify-content: center; align-items: center; height: 40px; margin-bottom: -40px; position: relative; z-index: 1; color: var(--faint); background: var(--surface); transition: opacity .15s; }
#pull[hidden] { display: none; }
#pull.ready { color: var(--accent); }
#pull .ic { width: 22px; height: 22px; }
#pull.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.entry-header { touch-action: pan-y; }
.entry.swipe-ready .entry-header { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
@media (prefers-reduced-motion: reduce) { #entries { scroll-behavior: auto; } }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; }
.more { color: var(--faint); text-align: center; padding: 20px; font-size: 13px; }

/* ---------- entries ---------- */
.entry { border-bottom: 1px solid var(--rule); background: var(--surface); }
.entry.current { box-shadow: inset 3px 0 0 var(--accent); }
.entry-header { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 8px 10px; align-items: center; padding: 10px 16px; cursor: pointer; }
.entry-header .feed-title { color: var(--muted); font-size: 12px; white-space: nowrap; }
.entry-header .title { grid-column: 1 / -1; grid-row: 2; margin: 0; font-size: calc(17px * var(--entry-scale, 1)); line-height: 1.3; font-family: var(--entry-font, inherit); }
.entry-header .title a { text-decoration: none; color: var(--unread); }
.entry.read .entry-header .title a { color: var(--read); font-weight: 400; }
.entry.read .entry-body { color: var(--read); }  /* read = the whole entry greyish, current or not (kanyi, 2026-10-21) */
.entry.read .entry-body img, .entry.read .entry-body video { opacity: .7; }
.entry.unread .entry-header .title a { font-weight: 600; }
.entry-header .meta { color: var(--faint); font-size: 12px; white-space: nowrap; }
.entry-header .star { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 18px; padding: 0 4px; }
.entry-header .controls { display: inline-flex; align-items: center; gap: 2px; }
.entry-header .star, .entry-header .play { display: inline-flex; align-items: center; border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 4px; }
.entry-header .play:hover { color: var(--accent); }
.entry.played .entry-header .play { color: var(--rule); }
.entry.starred .star, #mf-star.starred { color: var(--star); }
.entry.starred .star .ic, #mf-star.starred .ic { fill: var(--star); }
/* the star button lives in the two action rows (kanyi, 2026-09-28); the header only marks a starred entry */
.entry-header .lead { display: inline-flex; align-items: center; gap: 5px; }
.entry-header .starmark { display: none; color: var(--star); font-size: 13px; line-height: 1; }
.entry.starred .entry-header .starmark { display: inline; }
.entry-body { padding: 0 16px 16px; }
.entry-body .content { max-width: var(--measure); line-height: 1.6; overflow-wrap: anywhere; font-size: calc(1em * var(--entry-scale, 1)); font-family: var(--entry-font, inherit); }
.entry-body .content img, .entry-body .content video, .entry-body .content iframe { max-width: 100%; height: auto; }
.entry-body .content pre { overflow-x: auto; background: var(--sunken); padding: 10px; border-radius: 6px; }
.entry-body .content audio { width: 100%; max-width: var(--measure); }
.entry-footer { display: flex; gap: 8px; margin-top: 12px; }
.entry-footer.top { margin: 0 0 12px; }

/* title and compact layouts: one line per entry, body only when opened */
body.layout-compact .entry-header { grid-template-columns: auto minmax(90px, 160px) 1fr auto auto; grid-template-rows: auto; padding: 8px 16px; }
body.layout-compact .entry-header .title { grid-column: 3; grid-row: 1; font-size: calc(15px * var(--entry-scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.layout-title .entry-header .feed-title, body.layout-compact .entry-header .feed-title { overflow: hidden; text-overflow: ellipsis; }
/* title layout (kanyi, 2026-09-28): first row = feed, author · time and the action buttons; the full
   title wraps below on as many lines as it needs. Compact stays the one-line, cut-off dense mode. */
body.layout-title .entry-header { grid-template-columns: auto auto 1fr auto auto; grid-template-rows: auto auto; gap: 4px 10px; padding: 8px 16px; }
body.layout-title .entry-header .title { grid-column: 1 / -1; grid-row: 2; font-size: calc(15px * var(--entry-scale, 1)); white-space: normal; }
body.layout-title .entry-header .feed-title { max-width: 220px; }
body.layout-title .entry-header .meta { grid-column: 3; grid-row: 1; }
body.layout-title .entry-header .entry-footer { grid-column: 4; grid-row: 1; margin: 0; gap: 4px; }
body.layout-title .entry-header .entry-footer .btn.ib { padding: 2px 6px; }
body.layout-title .entry-header .toggle-fulltext, body.layout-title .entry.open .entry-body .entry-footer.top { display: none; }
body.layout-title .entry-header .controls { grid-column: 5; grid-row: 1; }
/* compact: visibly denser than title — tighter rows, smaller type, no author, narrower feed column */
body.layout-compact .entry-header { padding: 2px 16px; font-size: 12px; gap: 4px 8px; grid-template-columns: auto minmax(60px, 110px) 1fr auto auto; }
body.layout-compact .entry-header .title { font-size: calc(13px * var(--entry-scale, 1)); }
body.layout-compact .entry-header .author { display: none; }
body.layout-compact .entry-header .favicon { width: 14px; height: 14px; }
body.layout-compact .entry-header .controls .ic { width: 15px; height: 15px; }
body.layout-compact .entry-header .meta { font-size: 11px; }
body.layout-title .entry.open .entry-header .title, body.layout-compact .entry.open .entry-header .title { white-space: normal; }

/* ---------- podcast player (outside #app, so it survives in-page navigation) ---------- */
:root { --player-h: 64px; }
#player { position: fixed; left: 0; right: 0; bottom: 0; height: var(--player-h); display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--surface); border-top: 1px solid var(--rule); box-shadow: 0 -4px 16px rgba(0,0,0,.12); z-index: 12; }
#player[hidden] { display: none; }
body.playing #app { height: calc(100vh - var(--player-h)); height: calc(100dvh - var(--player-h)); }
#player .cover { width: 40px; height: 40px; border-radius: 6px; flex: none; }
#player .pmeta { min-width: 0; width: 220px; flex: none; }
#player .ptitle { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); text-decoration: none; }
#player .pfeed { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#player .pcontrols { display: flex; align-items: center; gap: 2px; flex: none; }
#player button { border: 0; background: none; color: var(--ink); cursor: pointer; padding: 6px; border-radius: 6px; display: inline-flex; align-items: center; }
#player button:hover { background: var(--hover); }
#player button.big { background: var(--accent); color: var(--accent-ink); padding: 8px; border-radius: 50%; }
#player button.big .ic { width: 20px; height: 20px; }
#player .seek { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 0; }
#player .seek input { flex: 1; min-width: 60px; accent-color: var(--accent); }
#pl-speed { font-size: 12px; font-variant-numeric: tabular-nums; min-width: 40px; justify-content: center; }
.episode { margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.episode .hint { color: var(--muted); font-size: 13px; }
.play-body .ic { margin-right: 4px; }
.continue { padding: 10px 16px 6px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.continue h3 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); }
.continue .chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.continue .chip { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-width: 220px; max-width: 280px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--ground); }
.continue .chip .play { grid-row: 1 / 3; border: 0; background: var(--accent); color: var(--accent-ink); border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.continue .ctitle { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue .cfeed { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree .node.podcasts .ic { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.entry-footer .toggle-played[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ---------- mobile ---------- */
#mobile-footer { display: none; }
#backdrop { display: none; }
#btn-options { display: none; }
#options { width: min(92vw, 380px); }
#jump { width: min(92vw, 440px); padding: 12px; }
#jump input { width: 100%; box-sizing: border-box; padding: 8px 12px; font: inherit; font-size: 15px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); }
#jump ul { list-style: none; margin: 8px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
#jump li { display: flex; align-items: baseline; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
#jump li[aria-selected="true"], #jump li:hover { background: var(--hover); }
#jump .jname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#jump .jkind { color: var(--faint); font-size: 12px; }
#jump .jbadge { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 2ch; text-align: right; }
#jump .empty { color: var(--faint); padding: 7px 10px; }
#options .opt-search input { width: 100%; padding: 8px 10px; font: inherit; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); }
#options .opt-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
#options .opt-rows .btn { text-align: center; padding: 9px 10px; font-size: 14px; }
#options .opt-font { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
#options .opt-font .btn { min-width: 44px; }
.font-sample { margin: 6px 0 0; padding: 8px 12px; border: 1px dashed var(--rule); border-radius: 6px; font-family: var(--entry-font, inherit); font-size: calc(1em * var(--entry-scale, 1)); }
@media (max-width: 800px) {
  #backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 15; }
  #backdrop[hidden] { display: none; }
  #btn-options { display: inline-block; }
  #toolbar { padding: 0 6px; gap: 4px; }
  #toolbar h1 { flex: 1; font-size: 15px; }
  .entry-header { padding: 10px 12px; }
  .entry-header .title { font-size: calc(16px * var(--entry-scale, 1)); }
  .entry-body { padding: 0 12px 14px; }
  .entry-body .content { font-size: calc(16px * var(--entry-scale, 1)); }
  .login-box { padding: 26px 22px; }
  .page-box { margin: 16px auto; padding: 0 12px; }
  .settings .section { padding: 14px; }
  dialog { max-width: 92vw; }
  #app { grid-template-columns: 1fr; }
  #sidebar { position: fixed; inset: 0 auto 0 0; width: min(85vw, var(--sidebar-w)); z-index: 20; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.25); }
  body.sidebar-open #sidebar { transform: none; }
  body.sidebar-hidden #sidebar { display: flex; }
  #btn-sidebar { display: inline-block; }
  #search { display: none; }
  #toolbar .actions .btn:not(.primary):not(#btn-player) { display: none; }
  #btn-player:not([hidden]) { display: inline-flex; }
  #entries { padding-bottom: 120px; }
  #player { bottom: calc(52px + env(safe-area-inset-bottom)); height: auto; flex-wrap: wrap; padding: 6px 10px; gap: 6px 10px; }
  #player .pmeta { width: auto; flex: 1; }
  #player .seek { flex-basis: 100%; order: 3; }
  body.playing #app { height: 100vh; height: 100dvh; }
  body.playing #entries { padding-bottom: 240px; }
  #mobile-footer { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 52px; padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--rule); z-index: 10; }
  #mobile-footer button { flex: 1; border: 0; background: none; color: var(--ink); font-size: 20px; }
  .entry-header { grid-template-columns: auto 1fr auto; }
  .entry-header .meta { grid-column: 2 / -1; grid-row: 3; }
  /* title / compact on a phone: feed name + time on the first row, the title with the star on the
     second — the desktop one-row grid squeezed the title into a sliver under the star (2026-09-24) */
  body.layout-title .entry-header, body.layout-compact .entry-header { grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 2px 8px; padding: 8px 12px; }
  body.layout-compact .entry-header { padding: 4px 12px; }
  body.layout-title .entry-header .feed-title, body.layout-compact .entry-header .feed-title { grid-column: 2; grid-row: 1; }
  body.layout-title .entry-header .meta, body.layout-compact .entry-header .meta { grid-column: 3; grid-row: 1; }
  body.layout-title .entry-header .title, body.layout-compact .entry-header .title { grid-column: 1 / 3; grid-row: 2; }
  body.layout-title .entry-header .controls, body.layout-compact .entry-header .controls { grid-column: 3; grid-row: 2; }
  body.layout-title .entry-header { grid-template-columns: auto 1fr auto; grid-template-rows: auto auto auto; }
  body.layout-title .entry-header .title { grid-column: 1 / -1; grid-row: 2; }
  body.layout-title .entry-header .entry-footer { grid-column: 1 / 3; grid-row: 3; }
  body.layout-title .entry-header .controls { grid-column: 3; grid-row: 3; justify-self: end; }
  .entry-header .controls { grid-column: 3; grid-row: 1; }
}
/* #btn-sidebar shows on desktop too since 2026-09-28 (kanyi: the feed list must be collapsible) */

/* ---------- manage dialogs ---------- */
#manage { width: min(94vw, 520px); position: relative; }
#manage > .close { position: absolute; top: 8px; right: 10px; font-size: 22px; line-height: 1; color: var(--muted); }
#manage > .close:hover { color: var(--ink); }
#manage h2 { padding-right: 32px; }
#manage h2 { display: flex; align-items: center; gap: 8px; }
#manage h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 18px 0 6px; }
.manage-form label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; }
.manage-form input:not([type=checkbox]), .manage-form select { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font: inherit; font-size: 14px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); }
.manage-form .row { display: flex; gap: 8px; align-items: end; margin-top: 4px; }
.manage-form .row input, .manage-form .row select { margin-top: 0; }
.manage-form .row label { flex: 1; margin: 0; }
.manage-form label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.manage-form textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font: inherit; font-family: ui-monospace, monospace; font-size: 13px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); resize: vertical; }
.manage-form details.filter { margin: 10px 0; border: 1px solid var(--rule); border-radius: 8px; padding: 6px 10px; }
.manage-form details.filter > summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.manage-form .hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0; }
.manage-form .hint code { font-size: 12px; }
.manage-form .filter-result { margin: 8px 0 0; padding-left: 0; list-style: none; max-height: 220px; overflow: auto; font-size: 13px; }
.manage-form .filter-result li { padding: 2px 0; }
.manage-form .filter-result li.summary { color: var(--muted); }
.manage-form .filter-result li.read { color: var(--faint); text-decoration: line-through; }
.manage-form .actions, #manage > .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.manage-form .error { color: var(--error); font-size: 13px; }
.btn.danger { color: var(--error); border-color: var(--error); margin-left: auto; }
.candidates { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.candidates label { display: flex; gap: 8px; align-items: center; margin: 0; padding: 6px 8px; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; }
.candidates label:has(input:checked) { border-color: var(--accent); }
.candidates input { width: auto; margin: 0; }
.candidates .url { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
dl.info { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; margin: 14px 0 0; }
dl.info dt { color: var(--faint); }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
dl.info .err { color: var(--error); }
#btn-view-settings { font-size: 15px; padding: 2px 6px; }

/* ---------- help dialog ---------- */
dialog { border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); color: var(--ink); padding: 20px 24px; max-width: 420px; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
dialog table { border-collapse: collapse; font-size: 14px; }
dialog td { padding: 3px 12px 3px 0; }
dialog tr.group th { text-align: left; padding: 12px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
#help { max-width: 520px; }
#help table { width: 100%; }
#help form, #options form[method=dialog] { margin-top: 14px; text-align: right; }

.page-box { max-width: 720px; margin: 40px auto; padding: 0 20px; }

/* ---------- tags ---------- */
.tree .tags-head { padding: 10px 14px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.tree .node.tag { color: var(--muted); }
.entry-footer { flex-wrap: wrap; align-items: center; }
.entry-footer .tags { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { font-size: 12px; color: var(--accent); background: var(--sunken); border-radius: 10px; padding: 1px 8px; text-decoration: none; }
.tag-input { font: inherit; font-size: 13px; padding: 3px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--ground); color: var(--ink); min-width: 220px; }

/* ---------- sharing menu ---------- */
details.share { position: relative; }
details.share > summary { list-style: none; display: inline-block; }
details.share > summary::-webkit-details-marker { display: none; }
details.share .menu { position: absolute; z-index: 5; top: 100%; left: 0; margin-top: 4px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); display: flex; gap: 2px; padding: 4px; }
details.share .menu a { display: inline-flex; padding: 6px; border-radius: 6px; color: inherit; line-height: 0; }
details.share .menu a:hover { background: var(--hover); }
details.share .menu a .ic { width: 20px; height: 20px; }
details.share .menu a img { width: 20px; height: 20px; max-width: none; object-fit: contain; display: block; }  /* max-width: 100% of a shrink-to-fit link = 0 */
.login-box .alt { margin: 14px 0 0; text-align: center; font-size: 13px; }
.login-box .alt a { color: var(--accent); }

/* ---------- admin ---------- */
.page-box.wide { max-width: 1100px; }
.settings .scroll { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.list th { color: var(--faint); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
table.list .muted { color: var(--faint); }
table.list .mono { font-family: ui-monospace, monospace; font-size: 11px; }
table.list tr.has-error td { background: color-mix(in srgb, var(--error) 8%, transparent); }
table.list tr.inactive td { opacity: .6; }
table.list .err { color: var(--error); }
table.list select, table.list input[type=password] { width: auto; display: inline-block; margin: 0; padding: 4px 8px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .danger { margin-left: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--faint); font-size: 12px; }
.stats .err { color: var(--error); }
.range { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.range .btn.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chart { position: relative; }
.chart h3 { margin: 0 0 6px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart text { fill: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--accent); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .bar.err { fill: var(--error); opacity: 1; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: .15; }
.chart .dot { fill: var(--accent); }
.chart .empty { color: var(--faint); font-size: 13px; margin: 6px 0 0; }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.list tr.inactive td { color: var(--faint); }
.settings .checks label { margin: 2px 0; }
.settings .share-rows .row, .settings .custom-rows .row { display: flex; gap: 8px; margin: 6px 0; align-items: center; }
.settings .share-rows .check { flex: 0 0 160px; margin: 0; }
.settings label.ico { flex: 0 0 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; color: var(--muted); }
.settings label.ico:hover { background: var(--hover); }
.settings label.ico img, .settings label.ico .ic { width: 18px; height: 18px; object-fit: contain; }
.settings label.ico .ic.filled { fill: currentColor; }
.settings input.icon-url { flex: 1 1 200px; }
@media (max-width: 800px) { .settings .share-rows .row, .settings .custom-rows .row { flex-wrap: wrap; } }
.settings .custom-rows .row input:first-child { flex: 0 0 160px; }
.settings .custom-rows .row input { margin: 0; }

/* ---------- settings page ---------- */
body.page { overflow-y: auto; }
.settings .page-head { margin-bottom: 20px; }
.settings .page-head h1 { margin-top: 6px; }
.settings .back { color: var(--muted); text-decoration: none; font-size: 13px; }
.settings .subnav .back { color: var(--muted); font-size: 14px; margin-right: 6px; }  /* one row: back link first, then the pages (kanyi, 2026-09-28) */
.settings h1 { margin: 6px 0 8px; font-size: 26px; }
.settings .subnav { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; align-items: center; }
.settings .subnav a { color: var(--accent); text-decoration: none; }
.settings .section { background: var(--surface); border: 1px solid var(--rule); border-radius: 10px; padding: 18px 22px; margin-bottom: 18px; }
.settings h2 { margin: 0 0 12px; font-size: 18px; }
.settings h3 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.settings .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; }
.settings label { display: block; font-size: 13px; color: var(--muted); margin: 6px 0; }
.settings label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.settings input:not([type=checkbox]), .settings select, .settings textarea { display: block; width: 100%; margin-top: 4px; padding: 7px 10px; font: inherit; font-size: 14px; border: 1px solid var(--rule); border-radius: 6px; background: var(--ground); color: var(--ink); }
.settings input[readonly] { color: var(--muted); }
.settings .mono { font-family: ui-monospace, monospace; font-size: 13px; }
.settings textarea { font-family: ui-monospace, monospace; font-size: 13px; }
.settings .actions { margin-top: 14px; display: flex; gap: 10px; }
.settings form.inline { display: flex; gap: 10px; align-items: end; margin-top: 12px; }
.settings form.inline label { flex: 1; }
.settings .hint { color: var(--muted); font-size: 13px; }
.settings .notice { background: var(--sunken); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; }
.settings .error { background: var(--sunken); border-left: 3px solid var(--error); padding: 8px 12px; border-radius: 6px; color: var(--error); }
