/* M27: the theme registry — every color is a token; each theme is one
 * :root[data-theme="<name>"] block (accent + background swaps only).
 * Adding a theme = one block + one THEME_REGISTRY entry in app.js. */

:root, :root[data-theme="dark"] {
  --bg: #10141a;
  --panel: #171d26;
  --line: #2a3342;
  --text: #d7dee8;
  --muted: #8b97a8;
  --accent: #4da3ff;
  --accent-contrast: #0b1420;   /* text on accent surfaces */
  --ok: #3fb96f;
  --bad: #e05656;
  --badge-ok-bg: #1d3b2a;
  --badge-bad-bg: #3f1d1d;
  --badge-run-bg: #1d2b3f;
  --overlay: rgba(5, 8, 12, 0.92);
  --hover-wash: rgba(255, 255, 255, 0.04);
  --chip-bg: #223047;
  --on-accent-hover: #ffffff;
}

:root[data-theme="dark-comfort"] {
  --bg: #1a1611;
  --panel: #241f18;
  --line: #3a3226;
  --text: #e2d9c8;
  --muted: #a89a83;
  --accent: #d9a45b;
  --accent-contrast: #241a0d;
  --ok: #8fb573;
  --bad: #d97b6c;
  --badge-ok-bg: #2c331f;
  --badge-bad-bg: #3a2420;
  --badge-run-bg: #383022;
  --overlay: rgba(16, 12, 8, 0.92);
  --hover-wash: rgba(255, 240, 210, 0.05);
  --chip-bg: #383022;
  --on-accent-hover: #ffffff;
}

:root[data-theme="midnight"] {
  --bg: #060a14;
  --panel: #0b1220;
  --line: #16233b;
  --text: #c9d6ee;
  --muted: #6f81a3;
  --accent: #6d9eff;
  --accent-contrast: #04070f;
  --ok: #4cc98a;
  --bad: #ef6b7d;
  --badge-ok-bg: #0d2318;
  --badge-bad-bg: #2a1017;
  --badge-run-bg: #0e1c33;
  --overlay: rgba(2, 4, 9, 0.94);
  --hover-wash: rgba(120, 160, 255, 0.06);
  --chip-bg: #12203a;
  --on-accent-hover: #ffffff;
}

:root[data-theme="fallout"] {
  --bg: #0a0f08;
  --panel: #121a0e;
  --line: #24401c;
  --text: #a8d08d;
  --muted: #6b8a58;
  --accent: #6ee86e;
  --accent-contrast: #061005;
  --ok: #b6e05a;
  --bad: #e0b13f;
  --badge-ok-bg: #1c3312;
  --badge-bad-bg: #3a3012;
  --badge-run-bg: #1d3315;
  --overlay: rgba(4, 8, 3, 0.94);
  --hover-wash: rgba(110, 232, 110, 0.07);
  --chip-bg: #1d3315;
  --on-accent-hover: #04140a;
}

:root[data-theme="cyberpunk"] {
  --bg: #0d0716;
  --panel: #150b24;
  --line: #2e1850;
  --text: #e6d9ff;
  --muted: #9a7fc9;
  --accent: #ff3ec8;
  --accent-contrast: #1a0512;
  --ok: #33ffcc;
  --bad: #ff2e88;
  --badge-ok-bg: #123a30;
  --badge-bad-bg: #3d0f26;
  --badge-run-bg: #2b1445;
  --overlay: rgba(6, 2, 12, 0.94);
  --hover-wash: rgba(255, 62, 200, 0.08);
  --chip-bg: #2b1445;
  --on-accent-hover: #ffffff;
}

:root[data-theme="nord"] {
  --bg: #2e3440;
  --panel: #3b4252;
  --line: #4c566a;
  --text: #eceff4;
  --muted: #9aa5b6;
  --accent: #88c0d0;
  --accent-contrast: #1b2028;
  --ok: #a3be8c;
  --bad: #bf616a;
  --badge-ok-bg: #3b4a3a;
  --badge-bad-bg: #4a3038;
  --badge-run-bg: #39475c;
  --overlay: rgba(20, 24, 31, 0.92);
  --hover-wash: rgba(236, 239, 244, 0.05);
  --chip-bg: #434c5e;
  --on-accent-hover: #1b2028;
}

:root[data-theme="synthwave"] {
  --bg: #1a1033;
  --panel: #251748;
  --line: #3d2a6e;
  --text: #f2e9ff;
  --muted: #b39ddb;
  --accent: #ff7edb;
  --accent-contrast: #2b0a22;
  --ok: #36f1cd;
  --bad: #ff5c8a;
  --badge-ok-bg: #12433a;
  --badge-bad-bg: #471530;
  --badge-run-bg: #33205e;
  --overlay: rgba(12, 6, 26, 0.93);
  --hover-wash: rgba(255, 126, 219, 0.07);
  --chip-bg: #33205e;
  --on-accent-hover: #ffffff;
}

:root[data-theme="matrix"] {
  --bg: #000000;
  --panel: #041204;
  --line: #0f3f12;
  --text: #46d246;
  --muted: #2c8b2c;
  --accent: #46d246;
  --accent-contrast: #000f00;
  --ok: #8dff70;
  --bad: #d2c046;
  --badge-ok-bg: #0c280c;
  --badge-bad-bg: #2b280c;
  --badge-run-bg: #0c280c;
  --overlay: rgba(0, 0, 0, 0.94);
  --hover-wash: rgba(70, 210, 70, 0.08);
  --chip-bg: #0c280c;
  --on-accent-hover: #000f00;
}

:root[data-theme="dracula"] {
  --bg: #282a36;
  --panel: #343746;
  --line: #44475a;
  --text: #f8f8f2;
  --muted: #9ea3c0;
  --accent: #bd93f9;
  --accent-contrast: #1e2029;
  --ok: #50fa7b;
  --bad: #ff5555;
  --badge-ok-bg: #1d3a2c;
  --badge-bad-bg: #46232f;
  --badge-run-bg: #3b3454;
  --overlay: rgba(18, 18, 26, 0.92);
  --hover-wash: rgba(189, 147, 249, 0.08);
  --chip-bg: #44475a;
  --on-accent-hover: #1e2029;
}

:root[data-theme="light"] {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d8dee7;
  --text: #1d2633;
  --muted: #67707e;
  --accent: #1f6fd6;
  --accent-contrast: #ffffff;
  --ok: #1d7a43;
  --bad: #c43d3d;
  --badge-ok-bg: #ddf1e3;
  --badge-bad-bg: #f8dddd;
  --badge-run-bg: #dfe9f8;
  --overlay: rgba(40, 50, 65, 0.55);
  --hover-wash: rgba(29, 38, 51, 0.05);
  --chip-bg: #e3eaf3;
  --on-accent-hover: #ffffff;
}

:root[data-theme="paper"] {
  --bg: #f7f2e8;
  --panel: #fffdf7;
  --line: #ded4bd;
  --text: #3d3628;
  --muted: #8a7f68;
  --accent: #a2680f;
  --accent-contrast: #fffdf7;
  --ok: #6b7f3a;
  --bad: #b3543c;
  --badge-ok-bg: #e7ecd6;
  --badge-bad-bg: #f2ded4;
  --badge-run-bg: #efe6d0;
  --overlay: rgba(61, 54, 40, 0.5);
  --hover-wash: rgba(61, 54, 40, 0.05);
  --chip-bg: #efe6d0;
  --on-accent-hover: #fffdf7;
}

:root[data-theme="sepia"] {
  --bg: #efe4cf;
  --panel: #f8efdd;
  --line: #d3c3a3;
  --text: #4a3b26;
  --muted: #94836a;
  --accent: #8a5a2b;
  --accent-contrast: #f8efdd;
  --ok: #5f7031;
  --bad: #a85038;
  --badge-ok-bg: #e2e7cd;
  --badge-bad-bg: #f0d9cd;
  --badge-run-bg: #e7dcc2;
  --overlay: rgba(74, 59, 38, 0.5);
  --hover-wash: rgba(74, 59, 38, 0.06);
  --chip-bg: #e7dcc2;
  --on-accent-hover: #f8efdd;
}

:root[data-theme="solarized-light"] {
  --bg: #fdf6e3;
  --panel: #fffbf0;
  --line: #ddd6c1;
  --text: #073642;
  --muted: #839496;
  --accent: #268bd2;
  --accent-contrast: #fdf6e3;
  --ok: #859900;
  --bad: #dc322f;
  --badge-ok-bg: #e8edc8;
  --badge-bad-bg: #f4d9d4;
  --badge-run-bg: #ddeaf2;
  --overlay: rgba(7, 54, 66, 0.5);
  --hover-wash: rgba(7, 54, 66, 0.05);
  --chip-bg: #eee8d5;
  --on-accent-hover: #fdf6e3;
}

:root[data-theme="nord-light"] {
  --bg: #eceff4;
  --panel: #ffffff;
  --line: #d5dbe5;
  --text: #2e3440;
  --muted: #7b88a1;
  --accent: #5e81ac;
  --accent-contrast: #ffffff;
  --ok: #6f9c58;
  --bad: #bf616a;
  --badge-ok-bg: #e0e9dc;
  --badge-bad-bg: #f2dee1;
  --badge-run-bg: #dfe6f0;
  --overlay: rgba(46, 52, 64, 0.5);
  --hover-wash: rgba(46, 52, 64, 0.05);
  --chip-bg: #dfe6f0;
  --on-accent-hover: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", system-ui, sans-serif;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
header h1 { font-size: 18px; margin: 0; }
header h1 a { color: var(--text); text-decoration: none; }
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
}
nav a:hover { color: var(--text); background: var(--line); }
nav.hidden { display: none; }

#theme-select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
  cursor: pointer;
}

main { max-width: 900px; margin: 0 auto; padding: 20px; }
.view.hidden, .hidden { display: none; }

h2 { font-size: 16px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
h3 { font-size: 14px; color: var(--accent); margin: 18px 0 6px; }

table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 10px; max-width: 560px; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.form label:has(input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 8px; }
.form input, .form select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}
.form fieldset { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 10px; }

button {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.1); }
button.danger { background: var(--bad); color: var(--on-accent-hover); }

/* M30: the hashtag→Tags picker card (the confirm-card shell) */
.hashtag-header { margin: 0 0 8px; }
.hashtag-rows { max-height: 240px; overflow: auto; margin-bottom: 10px; }
.hashtag-row { display: block; padding: 2px 0; cursor: pointer; }
.hashtag-row input { margin-right: 6px; }
.hashtag-error { margin: 0 0 8px; }

.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-all;
  font: 12px/1.5 Consolas, monospace;
  min-height: 20px;
}
.result.ok { border-color: var(--ok); }
.result.error { border-color: var(--bad); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
}
.badge.succeeded { background: var(--badge-ok-bg); color: var(--ok); }
.badge.failed, .badge.error { background: var(--badge-bad-bg); color: var(--bad); }
.badge.running { background: var(--badge-run-bg); color: var(--accent); }
.badge.synced { background: var(--badge-ok-bg); color: var(--ok); } /* M22: the workspace row's synced pill */
.tag-row { cursor: pointer; } /* M23: the Tags grid rows drill into the tag's entries */
.tag-row:hover { background: var(--hover-wash); }
.search-sub { font-size: 0.85em; margin-top: 2px; } /* M24: the creator/playlist info lines under a result's title */
.search-sub button { margin-left: 6px; padding: 1px 8px; font-size: 0.9em; }
.suggest-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 8px; } /* M26: the tag-suggestion candidate chips */
.suggest-accept { background: var(--chip-bg); color: var(--text); border: 1px solid var(--accent); border-radius: 10px; padding: 1px 8px; cursor: pointer; font-size: 0.85em; }
.suggest-accept.suggest-new { border-style: dashed; opacity: 0.85; } /* M26: isNew proposals */
.suggest-accept:hover { background: var(--accent); color: var(--on-accent-hover); }
.search-link { color: inherit; } /* M24: the clickable refs open YouTube in a new tab */
.shared-badge { background: var(--badge-ok-bg); color: var(--ok); border: none; padding: 2px 10px; cursor: default; opacity: 0.85; } /* M24: already tracked */
.search-pager { margin-top: 6px; }
.search-pager button { margin-left: 8px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 18px;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

.confirm-card {
  max-width: 560px;
  margin-top: 12px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
}
.confirm-card table { margin: 0 0 10px; }
.confirm-card td code { font: 12px Consolas, monospace; }
.confirm-actions { display: flex; gap: 10px; }
button.primary { min-width: 120px; }

/* M18: status 3-layer accordion */
h3.owner-heading, h4.channel-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 18px 0 6px;
}
h4.channel-heading {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 4px;
}
.acc-toggle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  font: inherit;
  cursor: pointer;
}
.acc-toggle:hover { color: var(--text); border-color: var(--accent); }
.owner-name { color: var(--accent); }
.channel-heading .muted { font-size: 11px; }

/* M19: rename + check-new */
.rename-btn, .check-all {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 12px;
  cursor: pointer;
}
.rename-btn:hover, .check-all:hover { color: var(--text); border-color: var(--accent); }
.check-one {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 0 6px 0 0;
  font-size: 12px;
  cursor: pointer;
}
.check-one:hover { color: var(--accent); }
.new-cell { white-space: nowrap; }
.new-count { color: var(--accent); font: 12px Consolas, monospace; }
/* M23 live-pass fix: the nowrap cell gave the chip row its full single-line width
 * and crushed title/key to a letter per line once an entry carried many tags —
 * chips now wrap BETWEEN chips (each chip itself stays whole). */
.tags-cell { white-space: normal; }
.tags-cell .tag-chip { white-space: nowrap; }
.tag-chip {
  display: inline-block;
  background: var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  margin: 1px 2px 1px 0;
}
.tag-chip .tag-remove {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0 0 4px;
  font-size: 10px;
}
.tag-chip .tag-remove:hover { color: var(--bad); }
.tag-add {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
}
.tag-add:focus { color: var(--text); border-color: var(--accent); }
.channel-delete, .entry-delete-cell .entry-delete {
  background: transparent;
  color: var(--muted);
  border: 0;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
}
.channel-delete:hover, .entry-delete:hover { color: var(--bad); }
.entry-delete-cell { width: 1.6em; }
.entry-delete-cell .entry-delete { visibility: hidden; }
tr:hover .entry-delete-cell .entry-delete { visibility: visible; }
.channel-delete-cell { margin-left: 2px; }
.inline-rename { display: inline-flex; gap: 6px; align-items: center; }
.rename-input {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 4px 8px;
  font: inherit;
  min-width: 180px;
}

/* M18: reader toolbar */
button.pressed {
  background: var(--badge-ok-bg);
  color: var(--ok);
  border: 1px solid var(--ok);
}

/* M18 + M27: the video dialog — maximized by default, a window when restored */
.video-dialog {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-dialog.hidden { display: none; }
.video-dialog-inner {
  width: min(96vw, 170vh);   /* 16:9 fill with a small margin */
  height: min(92vh, 170vw);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.video-dialog.restored {
  align-items: flex-start;
  justify-content: flex-start;
  background: transparent;
  pointer-events: none;
}
.video-dialog-inner.restored {
  position: fixed;
  width: 640px;
  height: 400px;
  left: 10vw;
  top: 10vh;
  min-width: 320px;
  min-height: 180px;
  pointer-events: auto; /* the window itself is interactive (the wrapper passes clicks through) */
  z-index: 101;         /* above the page content AND its own iframe stacking context */
}
/* M27 follow-up: the edges sit OUTSIDE the inner's box (negative offsets) — they
 * must not be clipped, and they must beat the iframe's hit area (z-index + the
 * inner must not clip overflow). */
.video-dialog-inner.restored { overflow: visible; }
.video-dialog-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  cursor: move;
  user-select: none;
}
.video-dialog-bar > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-dialog-bar button { cursor: pointer; }
.video-dialog-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.video-dialog-controls button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 9px;
  font-size: 12px;
  flex-shrink: 0;
}
.video-dialog-controls button:hover { color: var(--text); border-color: var(--accent); }
.video-dialog-controls button.danger:hover { color: var(--bad); border-color: var(--bad); }
.video-dialog-grip {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  border-right: 3px solid var(--muted);
  border-bottom: 3px solid var(--muted);
  border-radius: 0 0 8px 0;
}
/* M27 follow-up: the eight border/edge resize handles (windows-style) */
.video-dialog-edge {
  position: absolute;
  z-index: 5;
  touch-action: none;
}
.video-dialog-edge.n { top: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.video-dialog-edge.s { bottom: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.video-dialog-edge.e { right: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.video-dialog-edge.w { left: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.video-dialog-edge.ne { top: -4px; right: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.video-dialog-edge.nw { top: -4px; left: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.video-dialog-edge.se { bottom: -4px; right: -4px; width: 14px; height: 14px; cursor: nwse-resize; }
.video-dialog-edge.sw { bottom: -4px; left: -4px; width: 14px; height: 14px; cursor: nesw-resize; }
.video-dialog-grip.hidden, .video-dialog-edge.hidden { display: none; }
.video-pill {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 101;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 6px 18px var(--overlay);
}
.video-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.video-pill.hidden { display: none; }
/* M29: the pill stack (bottom-left, vertical offset per index) and the narrow tray */
#video-pills { position: fixed; left: 0; bottom: 0; z-index: 102; pointer-events: none; }
#video-pills .video-pill { position: fixed; pointer-events: auto; max-width: 320px; text-align: left; cursor: pointer; font-weight: 400; }
#video-pills .video-pill .video-pill-close { margin-left: 8px; cursor: pointer; color: var(--bad); }
.video-tray { position: fixed; left: 18px; bottom: 18px; z-index: 102; background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 12px; max-width: 320px; }
.video-tray.hidden { display: none; }
.video-tray-toggle { background: transparent; border: 0; color: var(--text); cursor: pointer; font: inherit; font-weight: 600; padding: 2px 0; width: 100%; text-align: left; }
.video-tray-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.video-tray-row .video-tray-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 0.9em; }
.video-tray-row button { cursor: pointer; padding: 1px 7px; font-size: 11px; }
/* M29: the Local storage management panel (Account view) */
.storage-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.storage-key { font: 12px Consolas, monospace; color: var(--accent); min-width: 180px; }
.storage-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px Consolas, monospace; }
.storage-clear { padding: 1px 10px; font-size: 11px; }
.video-dialog-frame {
  flex: 1;
  min-height: 0;
}
.video-dialog-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 6px;
}

.muted { color: var(--muted); }
.error { color: var(--bad); }
.job-row { cursor: pointer; }
.job-row:hover { background: var(--hover-wash); }
.progress-cell { color: var(--accent); font: 12px Consolas, monospace; }
.queue-controls { display: inline-flex; gap: 4px; }
.queue-controls button {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  cursor: pointer;
}
.queue-controls button:hover { color: var(--text); border-color: var(--accent); }
.job-cancel:hover { color: var(--bad); border-color: var(--bad); }
.doc-row { cursor: pointer; }
.doc-row:hover { background: var(--hover-wash); }
.doc-link { cursor: pointer; }
.doc-link:hover { text-decoration: underline; }

#status-filter {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  min-width: 280px;
  margin: 10px 0;
}

.docs-controls { display: flex; gap: 10px; align-items: end; margin: 10px 0; }
.docs-controls select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  min-width: 280px;
}
.docs-controls input[type="search"] {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  min-width: 200px;
}

.sort-header { cursor: pointer; user-select: none; }
.sort-header:hover { text-decoration: underline; }
.status-sort-header { cursor: pointer; user-select: none; }
.status-sort-header:hover { text-decoration: underline; color: var(--text); }
.ep-cb { width: 2em; }
.ep-cb input { cursor: pointer; accent-color: var(--accent); }
.ep-num { color: var(--muted); width: 2.5em; text-align: right; font: 12px Consolas, monospace; }
.docs-toolbar { display: flex; gap: 10px; align-items: center; margin: 12px 0 8px; }

.accordion-header {
  width: 100%;
  text-align: left;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
}
.accordion-header:hover { border-color: var(--accent); }

article.markdown {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 22px;
  max-height: 70vh;
  overflow: auto;
}
article.markdown h1, article.markdown h2, article.markdown h3, article.markdown h4 {
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  margin: 18px 0 8px;
  color: var(--accent);
}
article.markdown h1 { font-size: 20px; }
article.markdown h2 { font-size: 17px; }
article.markdown p { margin: 8px 0; }
article.markdown ul, article.markdown ol { margin: 8px 0 8px 22px; }
article.markdown li { margin: 3px 0; }
article.markdown code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font: 12px Consolas, monospace;
}
article.markdown pre {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  overflow: auto;
}
article.markdown pre code { border: 0; padding: 0; background: none; }
article.markdown blockquote {
  border-left: 3px solid var(--accent);
  margin: 8px 0;
  padding: 2px 12px;
  color: var(--muted);
}
article.markdown a { color: var(--accent); }
article.markdown img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
details.md-fold {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 10px 0;
  background: var(--bg);
}
details.md-fold summary {
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 600;
  color: var(--accent);
}
details.md-fold > div { padding: 4px 14px 10px; }
