/* algoat — terminal-tinted design system (matches the hermes/JobHound dashboard).
   Inter Tight (UI) + IBM Plex Mono (labels/mono). Flat, thin borders, 4px radius,
   no gradients / no glow. Green primary, amber accent, cyan + red for signal. */

:root {
  --bg: #0e1117; --surface: #12161d; --panel: #12161d; --code-bg: #0a0c11;
  --ink: #dbe1e8; --ink-2: #9aa4b2; --ink-3: #6b7480;
  --line: #242b35; --line-2: #313a46;
  --primary: #3dd68a; --accent: #f5a623; --cyan: #4ecde4; --red: #e85d75;
  --on-primary: #07130d;
  --fill: rgba(255, 255, 255, .02); --fill-2: rgba(255, 255, 255, .05);
  --radius: 4px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html[data-theme="light"] {
  --bg: #fafafa; --surface: #ffffff; --panel: #ffffff; --code-bg: #f0f1f3;
  --ink: #171717; --ink-2: #4b5563; --ink-3: #6b7280;
  --line: #e4e6ea; --line-2: #d2d5db;
  --primary: #236b4d; --accent: #a85f2a; --cyan: #1a7f96; --red: #c0304a;
  --on-primary: #ffffff;
  --fill: rgba(20, 25, 35, .02); --fill-2: rgba(20, 25, 35, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--bg); color: var(--ink); min-height: 100vh;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; transition: grid-template-columns .15s ease; }
.app.sidebar-collapsed { grid-template-columns: 60px 1fr; }

/* ---- login screen ---- */
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 1000; }
.login-card {
  width: 320px; display: flex; flex-direction: column; gap: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px;
}
.login-brand { font-family: var(--mono); font-weight: 600; font-size: 20px; display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.login-error { color: var(--red); font-family: var(--mono); font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

/* ---- sidebar ---- */
.sidebar {
  border-right: 1px solid var(--line); padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 20px;
  background: var(--surface); overflow: hidden;
}
.brand { font-family: var(--mono); font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 9px; color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 27px; height: 27px; flex: 0 0 auto; font-size: 15px; border-radius: var(--radius); background: var(--fill-2); border: 1px solid var(--line); }
.brand-algo { color: var(--ink); }
.brand-at { color: var(--primary); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative; text-align: left; background: transparent; border: 0;
  color: var(--ink-2); font-size: 13px; font-weight: 500; padding: 9px 12px;
  border-radius: var(--radius); cursor: pointer; display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
.nav-item:hover { background: var(--fill-2); color: var(--ink); }
.nav-item .bar {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 0; background: var(--primary); transition: height .12s;
}
.nav-item.active { color: var(--ink); background: var(--fill-2); }
.nav-item.active .bar { height: 62%; }
.sidebar-toggle {
  margin-top: auto; background: var(--fill); border: 1px solid var(--line); color: var(--ink-2);
  width: 100%; padding: 8px; border-radius: var(--radius); cursor: pointer; font-size: 13px;
}
.sidebar-toggle:hover { color: var(--ink); border-color: var(--line-2); }
.nav-icon { display: none; font-size: 16px; line-height: 1; }
.app.sidebar-collapsed .brand-text, .app.sidebar-collapsed .nav-label { display: none; }
.app.sidebar-collapsed .nav-icon { display: inline; }
.app.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.app.sidebar-collapsed .sidebar-toggle { transform: scaleX(-1); }

/* ---- main ---- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center;
  justify-content: space-between; padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.page-title { font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.top-right { display: flex; align-items: center; gap: 10px; }
.theme-toggle {
  background: var(--fill); border: 1px solid var(--line); color: var(--ink);
  width: 30px; height: 30px; border-radius: var(--radius); cursor: pointer; font-size: 14px;
}
.theme-toggle:hover { border-color: var(--line-2); }
.clock { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; }
.content { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.view.hidden { display: none; }
.hidden { display: none !important; }

/* ---- panel card ---- */
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.glass:hover { border-color: var(--line-2); }

.eyebrow {
  font-family: var(--mono); display: flex; align-items: center; gap: 8px; text-transform: lowercase;
  letter-spacing: .02em; font-size: 11px; color: var(--primary); font-weight: 500;
}
.eyebrow .tick { width: 10px; height: 2px; background: var(--primary); }
.section-head {
  font-family: var(--mono); display: flex; align-items: center; gap: 8px; text-transform: lowercase;
  letter-spacing: .02em; font-size: 11px; color: var(--ink-3); font-weight: 500; margin-bottom: 14px;
}
.section-head .stick { width: 6px; height: 6px; background: var(--primary); }
.subtle { color: var(--ink-3); }
.empty { color: var(--ink-3); font-size: 13px; padding: 18px; text-align: center; }

/* ---- buttons ---- */
.btn { font-family: var(--sans); font-weight: 600; font-size: 13px; border-radius: var(--radius); padding: 8px 13px; cursor: pointer; border: 1px solid transparent; }
.btn.primary { color: var(--on-primary); background: var(--primary); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { color: var(--ink); background: var(--fill); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-2); }
.btn.ghost.danger { color: var(--red); }
.btn.ghost.danger:hover { border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---- filters ---- */
.jobs-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.jobs-actions { display: flex; gap: 8px; }
.solved-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.solved-total { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); margin-right: 2px; }
.jobs-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.jobs-search { font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; font-size: 13px; flex: 1 1 220px; min-width: 160px; }
.jobs-search:focus { outline: none; border-color: var(--primary); }
.filter-select { font-family: var(--sans); background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; font-size: 12px; cursor: pointer; }
.filter-select:focus { outline: none; border-color: var(--primary); color: var(--ink); }

/* ---- table ---- */
.table-wrap { overflow-x: auto; }
.jobs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.jobs-table th { font-family: var(--mono); text-align: left; text-transform: lowercase; letter-spacing: .02em; font-size: 10px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 500; }
.jobs-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.col-filters th { padding: 4px 10px 8px; border-bottom: 1px solid var(--line); }
.col-filters .filter-select { width: 100%; font-size: 11px; padding: 5px 6px; }
.tcell-strong { font-weight: 600; cursor: pointer; }
.tcell-strong:hover { color: var(--primary); }
.badge { font-family: var(--mono); display: inline-block; padding: 2px 8px; border-radius: var(--radius); font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.oat-badge { font-family: var(--mono); display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--radius); font-size: 11px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }
.oat-stars { color: var(--accent); letter-spacing: 1px; }
.oat-stars-empty { color: var(--ink-3); opacity: .5; }
.topic-tag { font-family: var(--mono); display: inline-block; padding: 2px 7px; border-radius: var(--radius); background: var(--fill-2); color: var(--ink-2); font-size: 10px; margin: 2px 3px 2px 0; }
.row-actions { display: flex; gap: 5px; align-items: center; }
.iact { background: var(--fill); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--radius); width: 26px; height: 26px; display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; font-size: 13px; }
.iact.sm { width: 20px; height: 20px; font-size: 11px; }
.iact:hover { color: var(--ink); border-color: var(--line-2); }
.iact.danger:hover { color: var(--red); border-color: var(--red); }

/* ---- detail / editor ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.detail-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); font-weight: 500; margin-bottom: 14px; }
.fld > input, .fld > select, .fld > textarea { font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; font-size: 14px; }
.fld > input:focus, .fld > select:focus, .fld > textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }
.oat-select-row { display: flex; gap: 8px; align-items: center; }
.oat-select-row select { flex: 1; font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; font-size: 14px; }
.oat-select-row select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); }

.chips-input { display: flex; flex-wrap: wrap; gap: 6px; padding: 7px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.chip-item { font-family: var(--mono); display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 9px; border-radius: var(--radius); background: color-mix(in srgb, var(--primary) 12%, transparent); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); font-size: 12px; font-weight: 500; }
.chip-x { background: none; border: 0; color: var(--ink-2); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.chip-x:hover { color: var(--red); }
.chip-add { font-family: var(--sans); flex: 1; min-width: 120px; background: transparent; border: 0; color: var(--ink); font-size: 13px; padding: 4px; }
.chip-add:focus { outline: none; }

.tabs { display: inline-flex; gap: 4px; background: var(--fill); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px; }
.tab-btn { font-family: var(--mono); background: transparent; border: 0; color: var(--ink-2); font-size: 11px; padding: 5px 10px; border-radius: 3px; cursor: pointer; }
.tab-btn.active { background: var(--panel); color: var(--ink); }
.md-toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.md-media-actions { display: flex; gap: 6px; }
.media-btn { padding: 5px 10px; font-size: 12px; }

/* ---- live markdown editor: rendered by default, click a paragraph to edit its raw markdown ---- */
.md-live {
  margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); line-height: 1.6; cursor: text; min-height: 90px;
}
.md-live:focus-within { border-color: var(--line-2); }
.md-live h1, .md-live h2, .md-live h3 { margin: .5em 0 .3em; }
.md-live p { margin: .5em 0; }
.md-live pre { position: relative; background: var(--code-bg); padding: 10px; border-radius: var(--radius); overflow-x: auto; }
.code-lang-badge {
  position: absolute; top: 6px; right: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: .03em;
  color: var(--ink-3); background: var(--fill-2); border: 1px solid var(--line); padding: 1px 7px; border-radius: 3px;
  text-transform: uppercase; cursor: pointer;
}
.code-lang-badge:hover { color: var(--ink); border-color: var(--line-2); }
.md-live code { font-family: var(--mono); font-size: 12.5px; }
.md-live a { color: var(--primary); }
.md-live img, .md-live video { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--line); vertical-align: top; display: block; }
.md-block { border-radius: 3px; outline: none; }
.md-block[data-placeholder]::before { content: attr(data-placeholder); color: var(--ink-3); }
.md-block-empty { color: var(--ink-3); }
.md-block.md-block-active {
  font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word;
  background: color-mix(in srgb, var(--primary) 8%, transparent); border-radius: 3px; padding: 2px 5px; margin: -2px -5px;
}
.md-resizable { position: relative; display: inline-block; max-width: 100%; }
.md-resize-handle {
  position: absolute; right: 3px; bottom: 3px; width: 13px; height: 13px; border-radius: 3px;
  background: var(--primary); border: 2px solid var(--surface); cursor: nwse-resize; opacity: 0; transition: opacity .12s;
}
.md-resizable:hover .md-resize-handle { opacity: 1; }

.code-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.code-head-actions { display: flex; gap: 8px; align-items: center; }

/* live syntax-highlighted code editor: transparent textarea over a highlighted <pre>, kept in sync */
.code-editor-wrap { position: relative; margin-top: 8px; height: 340px; resize: vertical; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--code-bg); }
.tldraw-wrap { position: relative; margin-top: 8px; height: 520px; resize: vertical; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); }
.tldraw-canvas-inner { position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; }
.tldraw-wrap .tl-container { border-radius: var(--radius); }
.tldraw-fullscreen-btn {
  position: absolute; top: 8px; right: 8px; z-index: 500; width: 28px; height: 28px;
  display: grid; place-items: center; background: var(--fill); border: 1px solid var(--line); color: var(--ink-2);
  border-radius: var(--radius); cursor: pointer; font-size: 13px;
}
.tldraw-fullscreen-btn:hover { color: var(--ink); border-color: var(--line-2); }
.tldraw-wrap.fullscreen { position: fixed; inset: 0; margin: 0; z-index: 2000; width: auto; height: auto; resize: none; border-radius: 0; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.tldraw-wrap.fullscreen .tl-container { border-radius: 0; }
.code-editor-wrap:focus-within { border-color: var(--primary); }
.code-highlight, .code-editor-wrap .code-input {
  position: absolute; inset: 0; margin: 0; padding: 12px 14px; box-sizing: border-box;
  font-family: var(--mono); font-size: 13px; line-height: 1.55; white-space: pre; overflow: auto;
}
.code-highlight { pointer-events: none; color: var(--ink); background: transparent; }
.code-highlight code.hljs { background: transparent; padding: 0; font-family: inherit; font-size: inherit; }
.code-editor-wrap .code-input { background: transparent; color: transparent; caret-color: var(--ink); -webkit-text-fill-color: transparent; border: 0; resize: none; outline: none; }

.save-bar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.save-bar > .btn.ghost:first-child { margin-right: auto; }
.save-hint { font-family: var(--mono); font-size: 11px; color: var(--primary); font-weight: 500; }

/* ---- manage lists (topics / oat difficulty) ---- */
.inline-add { display: flex; gap: 8px; }
.inline-add input { flex: 1; font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; font-size: 14px; }
.inline-add input:focus { outline: none; border-color: var(--primary); }

/* ---- oat difficulty add/edit: fields + live preview ---- */
.oat-form { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.oat-form-fields input[type=color] { padding: 2px; height: 38px; width: 52px; flex: 0 0 auto; }
.emoji-input-row { display: flex; gap: 6px; }
.emoji-input-row input { flex: 1; min-width: 0; }
.emoji-picker {
  position: relative; margin-top: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  max-height: 132px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.emoji-picker.hidden { display: none; }
.emoji-picker-btn { background: none; border: 0; font-size: 17px; line-height: 1.4; padding: 4px; border-radius: var(--radius); cursor: pointer; }
.emoji-picker-btn:hover { background: var(--fill-2); }
.color-picker-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.color-preset { width: 22px; height: 22px; border-radius: 50%; background: var(--c); border: 2px solid transparent; cursor: pointer; padding: 0; }
.color-preset:hover { border-color: var(--line-2); }
.color-preset.active { border-color: var(--ink); }
.star-picker { display: inline-flex; flex-direction: row-reverse; gap: 3px; }
.star-btn { background: none; border: 0; padding: 2px; font-size: 22px; line-height: 1; cursor: pointer; color: var(--line-2); }
.star-btn.filled { color: var(--accent); }
.star-btn.hover-fill { color: var(--accent); }
.oat-preview-wrap {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 20px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--fill); height: 100%;
}
.oat-preview-label { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--ink-3); text-transform: uppercase; }
.oat-preview-wrap .oat-badge { font-size: 13px; padding: 6px 12px; }
.manage-list { display: flex; flex-direction: column; gap: 6px; }
.manage-item { display: flex; flex-direction: column; }
.manage-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); background: var(--fill); }
.manage-row.clickable { cursor: pointer; }
.manage-row .m-name { flex: 1; font-weight: 500; }
.manage-row input.m-edit { font-family: var(--sans); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 8px; font-size: 13px; flex: 1; }
.manage-row .m-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.manage-row .m-caret { color: var(--ink-3); font-size: 11px; transition: transform .12s; }
.manage-item.expanded .m-caret { transform: rotate(90deg); }
.topic-expand { padding: 10px 10px 2px 24px; display: flex; flex-direction: column; gap: 6px; }
.topic-expand.hidden { display: none; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-2); display: inline-block; }

/* ---- concept graph (full-screen canvas, click a node for the full concept modal) ---- */
.graph-canvas-wrap { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 480px; }
.graph-legend { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--ink-2); flex: 0 0 auto; }
.lg-item { display: inline-flex; align-items: center; gap: 6px; }
.lg-line { width: 18px; height: 0; border-top: 2px solid var(--ink-3); display: inline-block; }
.lg-line.dashed { border-top-style: dashed; }
.graph-canvas-inner { position: relative; flex: 1 1 auto; min-height: 0; }
svg[data-graph-svg] { width: 100%; height: 100%; display: block; cursor: grab; }
svg[data-graph-svg]:active { cursor: grabbing; }
.graph-node circle { fill: var(--primary); stroke: var(--bg); stroke-width: 2px; cursor: pointer; }
.graph-node.selected circle { fill: var(--accent); }
.graph-node text { fill: var(--ink); font-family: var(--sans); font-size: 11px; pointer-events: none; }
.graph-link { stroke: var(--line-2); stroke-width: 1.5px; }
.graph-link.reference { stroke: var(--cyan); stroke-dasharray: 4 3; }

/* concept side panel: small, floating on the right, non-blocking so nodes stay clickable */
.graph-side-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 320px; min-width: 260px; max-width: calc(100% - 24px);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,.4); z-index: 4; display: flex;
}
.graph-side-panel.hidden { display: none; }
.graph-panel-resize { flex: 0 0 auto; width: 8px; margin-left: -4px; cursor: ew-resize; border-radius: var(--radius) 0 0 var(--radius); }
.graph-panel-resize:hover, .graph-panel-resize.dragging { background: color-mix(in srgb, var(--primary) 30%, transparent); }
.graph-panel-body { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 16px; }
.graph-panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.graph-panel-close { background: var(--fill); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--radius); width: 24px; height: 24px; flex: 0 0 auto; cursor: pointer; font-size: 13px; }
.graph-panel-close:hover { color: var(--ink); border-color: var(--line-2); }
.graph-detail-crumb { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin: 0 0 12px; }
.graph-detail-section { margin-top: 14px; }
.graph-detail-section-head { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; color: var(--ink-3); margin-bottom: 8px; text-transform: uppercase; }
.graph-chip-btn { font-family: var(--mono); background: var(--fill); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--radius); padding: 4px 9px; font-size: 11px; cursor: pointer; margin: 0 6px 6px 0; display: inline-block; }
.graph-chip-btn:hover { border-color: var(--primary); color: var(--ink); }
.graph-problem-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius); background: var(--fill); margin-bottom: 6px; cursor: pointer; }
.graph-problem-row:hover { background: var(--fill-2); }
.graph-problem-row .title { flex: 1; font-size: 13px; font-weight: 500; }
.review-badge { font-family: var(--mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* ---- review scheduling (problem editor field) ---- */
.review-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.review-status { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.review-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.review-actions .btn.danger { color: var(--red); }
.review-suggest { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-suggest.hidden { display: none; }

/* ---- stats dashboard ---- */
.stats-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat-tile:hover { border-color: var(--line-2); }
.stat-num { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--c, var(--ink)); line-height: 1.15; }
.stat-label { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.heatmap-wrap { display: flex; gap: 10px; }
.heat-day-labels { display: grid; grid-template-rows: repeat(7, 16px); gap: 4px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); flex: 0 0 auto; padding-top: 22px; line-height: 16px; }
.heatmap-scroll { flex: 1 1 auto; min-width: 0; }
.heat-month-labels { display: flex; gap: 4px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-bottom: 6px; height: 16px; position: relative; }
.heat-month-labels span { position: absolute; white-space: nowrap; }
.heatmap-grid { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; width: 100%; }
.heat-cell { width: 100%; height: 16px; border-radius: 3px; background: var(--fill-2); }
.heat-cell.heat-1 { background: color-mix(in srgb, var(--primary) 30%, var(--fill-2)); }
.heat-cell.heat-2 { background: color-mix(in srgb, var(--primary) 55%, var(--fill-2)); }
.heat-cell.heat-3 { background: color-mix(in srgb, var(--primary) 80%, var(--fill-2)); }
.heat-cell.heat-4 { background: var(--primary); }
.heat-legend { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.heat-legend .heat-cell { width: 14px; height: 14px; }
.coverage-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.coverage-label { flex: 0 0 160px; font-size: 12.5px; color: var(--ink-2); }
.coverage-bar { flex: 1; height: 8px; border-radius: 4px; background: var(--fill-2); overflow: hidden; }
.coverage-fill { height: 100%; background: var(--c); border-radius: 4px; }
.coverage-count { flex: 0 0 auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); min-width: 46px; text-align: right; }
.topic-coverage-list .coverage-row { padding: 5px 0; }

/* ---- roadmap ---- */
.roadmap-new-row { display: flex; gap: 8px; flex-wrap: wrap; }
.roadmap-new-row input { flex: 1 1 200px; }
.roadmap-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.roadmap-card { background: var(--fill); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.roadmap-card:hover { border-color: var(--primary); }
.roadmap-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.roadmap-card-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.roadmap-card-desc { font-size: 12px; color: var(--ink-3); }
.roadmap-card-progress { height: 6px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.roadmap-card-progress-fill { height: 100%; background: var(--primary); }
.roadmap-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.roadmap-detail-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex: 0 0 auto; }
.roadmap-detail-title { flex: 1 1 auto; min-width: 160px; }
.roadmap-detail-name { font-size: 15px; font-weight: 700; color: var(--ink); }
.roadmap-detail-desc { font-size: 12px; margin-top: 2px; }
.roadmap-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.rm-node { cursor: pointer; }
.rm-node-hit { fill: transparent; }
.rm-node-bg { fill: color-mix(in srgb, var(--node-c, var(--ink-3)) 16%, var(--panel)); stroke: var(--line-2); stroke-width: 1.5px; }
.rm-node.armed .rm-node-bg { stroke: var(--accent); stroke-width: 3px; }
.rm-node-ring-bg { fill: none; stroke: var(--fill-2); stroke-width: 4px; }
.rm-node-ring { fill: none; stroke: var(--node-c, var(--primary)); stroke-width: 4px; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; }
.rm-node-pct { fill: var(--node-c, var(--ink)); font-family: var(--mono); font-size: 11px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.rm-node-label { fill: var(--ink-2); font-family: var(--sans); font-size: 11px; text-anchor: middle; pointer-events: none; }
.rm-node-icon { font-size: 13px; text-anchor: middle; pointer-events: none; }
.rm-edge-hit { stroke: transparent; stroke-width: 14px; cursor: pointer; }
.rm-edge { stroke: var(--line-2); stroke-width: 2px; pointer-events: none; }
.rm-edge-group:hover .rm-edge { stroke: var(--red); }
.rm-prereq-list { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); }
.rm-prereq-list label { display: flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 12.5px; color: var(--ink-2); font-weight: 400; }
.rm-task-row input[type="checkbox"], .rm-prereq-list input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto;
  width: 16px; height: 16px; border: 1.5px solid var(--line-2); border-radius: 4px;
  background: var(--surface); cursor: pointer; display: inline-grid; place-content: center;
  transition: background .12s, border-color .12s;
}
.rm-task-row input[type="checkbox"]:hover, .rm-prereq-list input[type="checkbox"]:hover { border-color: var(--primary); }
.rm-task-row input[type="checkbox"]:checked, .rm-prereq-list input[type="checkbox"]:checked { background: var(--primary); border-color: var(--primary); }
.rm-task-row input[type="checkbox"]:checked::after, .rm-prereq-list input[type="checkbox"]:checked::after {
  content: ''; width: 4px; height: 8px; border: solid var(--on-primary); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.rm-progress-readout { font-family: var(--mono); color: var(--primary); font-weight: 600; }
.rm-task-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); margin-bottom: 8px; }
.rm-task-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-family: var(--sans); font-size: 12.5px; color: var(--ink-2); font-weight: 400; padding: 3px 4px; border-radius: var(--radius); }
.rm-task-row.editing { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rm-task-text { flex: 1 1 auto; }
.rm-task-text.done { color: var(--ink-3); text-decoration: line-through; }
.rm-task-desc-dot { font-size: 10px; opacity: .7; }
.rm-task-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.rm-task-link-chip { flex: 0 0 auto; font-family: var(--mono); font-size: 10.5px; background: var(--fill-2); border: 1px solid var(--line); color: var(--ink-2); border-radius: var(--radius); padding: 2px 7px; cursor: pointer; }
.rm-task-link-chip:hover { border-color: var(--primary); color: var(--ink); }
.rm-task-link-chip.removable { cursor: default; display: inline-flex; align-items: center; gap: 4px; }
.rm-task-link-chip.removable button { background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 12px; padding: 0; line-height: 1; }
.rm-task-link-chip.removable button:hover { color: var(--red); }
.rm-task-add-row { display: flex; gap: 6px; flex-wrap: wrap; }
.rm-task-add-row input[type="text"] { flex: 1 1 140px; }
.rm-task-link-picker { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.rm-task-link-picker select { flex: 0 0 auto; }
.rm-task-link-picker input[type="text"] { flex: 1 1 140px; }
.rm-task-pending-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; min-height: 20px; }
.rm-task-add-actions { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }
.rm-links-rollup { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; background: var(--surface); }
.rm-rollup-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.roadmap-node-page .roadmap-detail-head { padding: 0 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }

/* ---- modal ---- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(5, 7, 11, .66); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-backdrop.hidden { display: none; }
.modal { width: min(460px, 100%); max-height: 90vh; overflow: auto; }
.modal.wide { width: min(640px, 95%); }
.modal-head { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---- random practice modal ---- */
.practice-title { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.practice-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.practice-reveal { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.practice-reveal.hidden { display: none; }
.practice-reveal-section { margin-bottom: 14px; }
.practice-reveal-section pre { background: var(--code-bg); padding: 10px; border-radius: var(--radius); overflow-x: auto; }
.practice-reveal-section code { font-family: var(--mono); font-size: 12.5px; }
