/* Engram Reader — design tokens & base styles
   Adapted from Horus Reader (packages/horus-ui-client/styles.css).
   IBM Plex stack, warm-cool neutrals, single amber accent.
*/

:root {
  /* Dark theme (default) */
  --bg: #15171a;
  --bg-1: #1b1e22;
  --bg-2: #22262b;
  --bg-3: #2b3036;
  --bg-hover: #2a2f35;

  --fg: #e8e6e1;
  --fg-1: #cfcdc7;
  --fg-2: #a09e98;
  --fg-3: #6f6d68;
  --fg-4: #4a4944;

  --line: #2c3036;
  --line-2: #383d44;
  --line-strong: #4a4f57;

  --accent: oklch(0.74 0.13 60);   /* amber-orange */
  --accent-soft: oklch(0.74 0.13 60 / 0.18);
  --accent-fg: oklch(0.96 0.04 80);

  --link: oklch(0.74 0.13 60);
  --link-hover: oklch(0.82 0.13 60);

  --highlight: oklch(0.74 0.13 60 / 0.22);

  /* Engram backbone type colors — distinct but quiet */
  --type-note:      oklch(0.72 0.06 220);   /* slate-blue */
  --type-task:      oklch(0.74 0.10 140);   /* sage */
  --type-project:   oklch(0.72 0.10 300);   /* dusk purple */
  --type-person:    oklch(0.72 0.10 330);   /* rose */
  --type-document:  oklch(0.74 0.08 40);    /* warm ochre */
  --type-bookmark:  oklch(0.72 0.10 250);   /* indigo */
  --type-journal:   oklch(0.74 0.10 80);    /* warm sand */
  --type-event:     oklch(0.72 0.12 170);   /* teal */
  --type-type:      oklch(0.72 0.06 260);   /* steel */
  --type-template:  oklch(0.72 0.06 195);   /* slate-teal */
  /* Legacy carry-overs used in ContextualBlock */
  --type-story:     oklch(0.72 0.13 30);    /* terracotta */
  --type-area:      oklch(0.74 0.06 180);   /* teal-grey */

  /* NLP Agent Search colors */
  --nlp: #2a6e4c;
  --nlp-soft: oklch(0.22 0.04 145);
  --nlp-mid: oklch(0.35 0.08 145);
  --red: oklch(0.65 0.18 15);
  --amber: oklch(0.74 0.13 60);

  /* Aliases used by NLP components */
  --ink: var(--fg);
  --ink-2: var(--fg-2);
  --ink-3: var(--fg-3);
  --paper-2: var(--bg-2);
  --paper-3: var(--bg-3);
  --line-soft: var(--line);
  --hl: oklch(0.74 0.13 60 / 0.22);

  --radius-1: 3px;
  --radius-2: 6px;
  --radius-3: 10px;

  --shadow-pop: 0 2px 0 rgba(0,0,0,0.25), 0 12px 40px -8px rgba(0,0,0,0.55);

  --font-ui: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-body: "IBM Plex Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;

  --content-w: 720px;
  --side-w: 240px;

  --density: 1; /* multiplier */
}

[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-1: #ede9df;
  --bg-2: #e3ddcd;
  --bg-3: #d8d1bd;
  --bg-hover: #e8e2d2;

  --fg: #1a1a18;
  --fg-1: #34332f;
  --fg-2: #5d5b54;
  --fg-3: #84817a;
  --fg-4: #aaa69b;

  --line: #d4cebd;
  --line-2: #c4bda9;
  --line-strong: #a8a191;

  --accent: oklch(0.55 0.16 50);
  --accent-soft: oklch(0.55 0.16 50 / 0.14);

  --link: oklch(0.50 0.16 50);
  --link-hover: oklch(0.42 0.18 50);

  --highlight: oklch(0.85 0.13 80 / 0.5);

  /* Engram backbone type colors — light mode */
  --type-note:      oklch(0.45 0.08 230);
  --type-task:      oklch(0.45 0.12 145);
  --type-project:   oklch(0.45 0.12 300);
  --type-person:    oklch(0.45 0.10 330);
  --type-document:  oklch(0.50 0.10 40);
  --type-bookmark:  oklch(0.45 0.10 250);
  --type-journal:   oklch(0.50 0.10 70);
  --type-event:     oklch(0.45 0.12 170);
  --type-type:      oklch(0.45 0.06 260);
  --type-template:  oklch(0.45 0.06 195);
  /* Legacy carry-overs */
  --type-story:     oklch(0.50 0.14 30);
  --type-area:      oklch(0.48 0.06 180);

  --nlp: #1e5236;
  --nlp-soft: oklch(0.90 0.04 145);
  --nlp-mid: oklch(0.70 0.08 145);
  --red: oklch(0.50 0.20 15);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* ── App shell ──────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "head head"
    "side main";
  height: 100vh;
  transition: grid-template-columns .18s ease;
}
.app.side-collapsed {
  grid-template-columns: 44px 1fr;
}

/* Back/forward arrows */
.nav-arrows { display: flex; gap: 2px; }
.nav-arrows .icon-btn { color: var(--fg-2); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; color: var(--fg-2); }

/* Inline SVG icons in header buttons */
.icon-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.head {
  grid-area: head;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 14px;
  background: color-mix(in oklab, var(--bg) 80%, var(--bg-1) 20%);
  position: relative; z-index: 5;
}
.brand {
  display: flex; align-items: baseline; gap: 10px;
  cursor: pointer;
  user-select: none;
}
.brand .logo {
  width: 18px; height: 18px;
  display: inline-block;
  background:
    radial-gradient(circle at 50% 50%, var(--accent) 0 4px, transparent 5px),
    conic-gradient(from 0deg, var(--accent) 0 25%, transparent 25% 50%, var(--accent) 50% 75%, transparent 75%);
  border-radius: 50%;
  border: 1.5px solid var(--accent);
}
.brand h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.2px;
}
.brand .crumb { font-size: 13px; color: var(--fg-3); font-family: var(--font-mono); }

.head-search { flex: 1; max-width: 540px; margin: 0 auto; }
.head-search-btn {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  color: var(--fg-3);
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease;
}
.head-search-btn:hover { border-color: var(--line-strong); background: var(--bg-2); }
.head-search-btn .ico { color: var(--fg-3); }
.head-search-btn .grow { flex: 1; text-align: left; }
.kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1.5px 5px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--fg-2);
}

.head-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-2);
  color: var(--fg-2);
  transition: background .12s ease, color .12s ease;
  font-size: 17px;
}
.icon-btn:hover { background: var(--bg-2); color: var(--fg); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }

/* ── Sidebar ─────────────────────────────────────── */
.side {
  grid-area: side;
  border-right: 1px solid var(--line);
  background: var(--bg-1);
  overflow-y: auto;
  padding: 14px 8px 24px 8px;
  font-size: 13px;
}
.side-section { margin-bottom: 14px; }
.side-section-title {
  width: 100%;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-3);
  padding: 5px 10px;
  margin-bottom: 2px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  border-radius: var(--radius-2);
  text-align: left;
  transition: background .1s ease, color .1s ease;
}
.side-section-title:hover { background: var(--bg-2); color: var(--fg-2); }
.side-section-title .t { flex: 1; }
.side-section-title .c {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--fg-4);
  letter-spacing: 0;
}
.chev {
  display: inline-flex;
  width: 14px; height: 14px;
  align-items: center; justify-content: center;
  color: var(--fg-2);
  transition: transform .18s ease, color .12s ease;
  transform: rotate(0deg);
  flex: 0 0 auto;
}
.chev svg {
  width: 12px; height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chev.open { transform: rotate(90deg); }
.side-section-title:hover .chev,
.home-section-head:hover .chev,
.day-head:hover .chev { color: var(--fg); }

.side-section-body { display: flex; flex-direction: column; gap: 1px; }

/* Collapsed sidebar rail */
.side.collapsed { padding: 10px 4px; overflow: hidden; }
.side-rail { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.side-rail-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-2);
  color: var(--fg-2);
  font-size: 13px;
}
.side-rail-btn:hover { background: var(--bg-2); color: var(--fg); }
.side-rail-btn .type-dot { width: 8px; height: 8px; border-radius: 50%; }
.side-link {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-2);
  color: var(--fg-1);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .1s ease, color .1s ease;
  width: 100%;
  text-align: left;
}
.side-link:hover { background: var(--bg-2); color: var(--fg); }
.side-link.active { background: var(--accent-soft); color: var(--fg); }
.side-link .type-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex: 0 0 auto;
}
.side-link .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.side-link .meta { color: var(--fg-3); font-size: 11px; font-family: var(--font-mono); }
.side-empty {
  padding: 4px 10px;
  color: var(--fg-3);
  font-style: italic;
  font-size: 12px;
}

/* ── Main ─────────────────────────────────────────── */
.main {
  grid-area: main;
  overflow-y: auto;
  scroll-behavior: smooth;
}
.main-inner {
  max-width: var(--content-w);
  margin: 0 auto;
  padding: 36px 32px 80px 32px;
}
.main-inner.wide { max-width: 1080px; }

/* ── Type badges & dots ──────────────────────────── */
.type-dot { background: var(--fg-3); } /* fallback for unknown types */
.type-dot.task { background: var(--type-task); }
.type-dot.note { background: var(--type-note); }
.type-dot.journal { background: var(--type-journal); }
.type-dot.story { background: var(--type-story); }
.type-dot.project { background: var(--type-project); }
.type-dot.area { background: var(--type-area); }
.type-dot.bookmark   { background: var(--type-bookmark); }
/* Engram backbone type dots */
.type-dot.person     { background: var(--type-person); }
.type-dot.document   { background: var(--type-document); }
.type-dot.event      { background: var(--type-event); }
.type-dot.type       { background: var(--type-type); }
.type-dot.template   { background: var(--type-template); }

.type-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--fg-1);
  background: var(--bg-1);
}
.type-pill .dot { width: 6px; height: 6px; border-radius: 50%; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg-1);
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.chip:hover { background: var(--bg-3); border-color: var(--line-strong); }
.chip.tag::before { content: "#"; color: var(--fg-3); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--fg); }
.chip.status-open { color: var(--type-task); border-color: color-mix(in oklab, var(--type-task) 60%, var(--line)); }
.chip.status-in-progress { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 60%, var(--line)); }
.chip.status-in-review { color: var(--type-bookmark); border-color: color-mix(in oklab, var(--type-bookmark) 60%, var(--line)); }
.chip.status-done { color: var(--fg-3); border-color: var(--line); text-decoration: line-through; text-decoration-color: var(--fg-4); }
.chip.priority { font-family: var(--font-mono); }

/* ── Home ─────────────────────────────────────────── */
.greeting { margin-bottom: 28px; }
.greeting h2 {
  margin: 0 0 4px 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
}
.greeting .sub { color: var(--fg-2); font-size: 14px; }

.type-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 36px;
}
@media (max-width: 900px) { .type-strip { grid-template-columns: repeat(4, 1fr); } }
.type-tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--bg-1);
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.type-tile:hover { border-color: var(--line-strong); background: var(--bg-2); }
.type-tile .row { display: flex; align-items: center; gap: 6px; }
.type-tile .label {
  font-size: 11px; font-family: var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-2);
}
.type-tile .count {
  font-size: 22px; font-weight: 500;
  font-family: var(--font-body);
  letter-spacing: -0.01em;
  color: var(--fg);
}

.activity { display: flex; flex-direction: column; gap: 18px; }
.day-group .day-head {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.act-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 50%, transparent);
  cursor: pointer;
}
.act-item:hover .title { color: var(--accent); }
.act-item:last-child { border-bottom: 0; }
.act-item .title { color: var(--fg); font-size: 14px; transition: color .12s ease; }
.act-item .meta { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); white-space: nowrap; }

/* ── Note view ───────────────────────────────────── */
.note-header {
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.note-header.type-task    { border-left: 3px solid var(--type-task); padding-left: 14px; }
.note-header.type-journal { border-left: 3px solid var(--type-journal); padding-left: 14px; }
.note-header.type-story   { border-left: 3px solid var(--type-story); padding-left: 14px; }
.note-header.type-project { border-left: 3px solid var(--type-project); padding-left: 14px; }
.note-header.type-bookmark{ border-left: 3px solid var(--type-bookmark); padding-left: 14px; }
.note-header.type-area    { border-left: 3px solid var(--type-area); padding-left: 14px; }

.note-meta-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 8px;
}
.note-title {
  margin: 4px 0 8px 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--fg);
}
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.note-frontmatter {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin: 14px 0 4px 0;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.note-frontmatter .k { color: var(--fg-3); }
.note-frontmatter .v { color: var(--fg-1); }
.note-frontmatter .v.wiki { color: var(--link); cursor: pointer; }
.note-frontmatter .v.wiki:hover { color: var(--link-hover); }

/* Type-specific blocks */
.task-status-block {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  margin: 14px 0;
  background: color-mix(in oklab, var(--type-task) 8%, var(--bg-1));
  border: 1px solid color-mix(in oklab, var(--type-task) 30%, var(--line));
  border-radius: var(--radius-2);
}
.checkbox {
  width: 18px; height: 18px;
  border: 2px solid var(--type-task);
  border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.checkbox.checked { background: var(--type-task); }
.checkbox.checked::after { content: ""; width: 8px; height: 4px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg) translate(1px, -1px); }
.task-status-block .label { font-size: 13px; color: var(--fg-1); }
.task-status-block .due { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--fg-2); }

.journal-date-block {
  display: flex; align-items: baseline; gap: 14px;
  margin: 14px 0;
}
.journal-date-block .big {
  font-family: var(--font-body);
  font-size: 44px; line-height: 0.95;
  font-weight: 400;
  color: var(--type-journal);
}
.journal-date-block .word { font-family: var(--font-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.1em; text-transform: uppercase; }

.bookmark-link-block {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  margin: 14px 0;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  font-family: var(--font-mono);
  font-size: 12px;
}
.bookmark-link-block .url { color: var(--type-bookmark); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-link-block .open-ext { color: var(--fg-3); font-size: 11px; }

/* ── Markdown body ───────────────────────────────── */
.md {
  font-family: var(--font-ui);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--fg-1);
}
.md h1 { font-size: 26px; font-weight: 500; letter-spacing: -0.01em; margin: 28px 0 12px 0; color: var(--fg); }
.md h2 { font-size: 21px; font-weight: 500; margin: 24px 0 10px 0; color: var(--fg); }
.md h3 { font-size: 17px; font-weight: 600; margin: 20px 0 6px 0; color: var(--fg); font-family: var(--font-ui); }
.md p { margin: 8px 0 14px 0; }
.md ul, .md ol { margin: 8px 0 14px 0; padding-left: 24px; }
.md li { margin: 3px 0; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.md code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--accent-fg);
}
.md pre {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.5;
  margin: 14px 0;
}
.md pre code { background: transparent; border: 0; padding: 0; color: var(--fg-1); }
.md table {
  border-collapse: collapse;
  margin: 14px 0;
  font-family: var(--font-ui);
  font-size: 14px;
  width: 100%;
}
.md th, .md td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}
.md th { font-weight: 600; color: var(--fg); background: var(--bg-1); }
.md blockquote {
  margin: 14px 0;
  padding: 4px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--fg-1);
  border-radius: 0 var(--radius-2) var(--radius-2) 0;
}
.wiki-link {
  color: var(--link);
  border-bottom: 1px dashed color-mix(in oklab, var(--link) 60%, transparent);
  cursor: pointer;
  font-style: italic;
  transition: color .12s ease, border-color .12s ease;
}
.wiki-link:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }
.wiki-link.broken {
  color: var(--fg-3);
  border-bottom: 1px dashed var(--fg-4);
  cursor: not-allowed;
  font-style: italic;
}

/* ── Linked references ───────────────────────────── */
.linked-refs {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.linked-refs-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.linked-refs-head .title {
  font-size: 13px;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--fg);
}
.linked-refs-head .count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
}
.edge-group {
  margin-bottom: 14px;
}
.edge-group-title {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 4px;
}
.edge-group-title .arrow { color: var(--accent); margin-right: 4px; }
.edge-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 50%, transparent);
  cursor: pointer;
}
.edge-row:hover .title { color: var(--accent); }
.edge-row .title { color: var(--fg-1); font-size: 13.5px; transition: color .12s ease; }
.edge-row .meta { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }

/* ── Listing pages (tag, type, search) ───────────── */
.list-head { margin-bottom: 22px; }
.list-head h2 {
  margin: 0 0 4px 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.01em;
}
.list-head .sub { color: var(--fg-3); font-size: 13px; font-family: var(--font-mono); }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 22px 0; }

.list-section { margin-bottom: 28px; }
.list-section-title {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.list-section-title .count { color: var(--fg-2); }

/* Cards (active work) */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.work-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  background: var(--bg-1);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s ease, background .15s ease;
}
.work-card:hover { border-color: var(--line-strong); background: var(--bg-2); }
.work-card.story { border-left: 3px solid var(--type-story); }
.work-card.task { border-left: 3px solid var(--type-task); }
.work-card .row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.work-card .row.between { justify-content: space-between; }
.work-card .title { font-size: 14px; font-weight: 500; color: var(--fg); }
.work-card .body { font-size: 12.5px; color: var(--fg-2); line-height: 1.4; }

/* Reference list (notes/journals/bookmarks) */
.ref-list { display: flex; flex-direction: column; }
.ref-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in oklab, var(--line) 50%, transparent);
  cursor: pointer;
}
.ref-row:hover .title { color: var(--accent); }
.ref-row .title { color: var(--fg); font-size: 14px; transition: color .12s ease; }
.ref-row .snippet { color: var(--fg-3); font-size: 12px; margin-top: 2px; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-row .meta { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); white-space: nowrap; }

/* ── Search palette ──────────────────────────────── */
.palette-overlay {
  position: fixed; inset: 0;
  background: color-mix(in oklab, #000 40%, transparent);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
  animation: fadeIn .12s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.palette {
  width: min(640px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: 70vh;
}
.palette-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.palette-input-row .ico { color: var(--fg-3); }
.palette-input {
  flex: 1;
  border: 0; outline: none;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 16px;
}
.palette-input::placeholder { color: var(--fg-3); }
.palette-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.palette-results { overflow-y: auto; flex: 1; padding: 4px 0; }
.palette-result {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 8px 14px;
  align-items: baseline;
  cursor: pointer;
}
.palette-result.active { background: var(--accent-soft); }
.palette-result .title { color: var(--fg); font-size: 14px; font-weight: 500; }
.palette-result .snippet { color: var(--fg-3); font-size: 12px; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 400px; }
.palette-result .meta { font-size: 11px; color: var(--fg-3); font-family: var(--font-mono); }
.palette-result mark { background: var(--highlight); color: var(--fg); padding: 0 2px; border-radius: 2px; }
.palette-foot {
  display: flex; gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  background: var(--bg);
}
.palette-foot .grow { flex: 1; }
.palette-foot kbd {
  font-family: var(--font-mono);
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  padding: 0 4px;
  border-radius: 3px;
  margin-right: 3px;
}

.palette-empty { padding: 30px 16px; text-align: center; color: var(--fg-3); font-size: 13px; }

/* ── Tweaks panel overrides (matches our look) ───── */
.tweaks-panel {
  background: var(--bg-1) !important;
  border: 1px solid var(--line-strong) !important;
  color: var(--fg) !important;
  font-family: var(--font-ui) !important;
}
.tweaks-panel input, .tweaks-panel select { font-family: var(--font-ui) !important; }

/* ── Misc ───────────────────────────────────────── */
.empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
  font-family: var(--font-mono);
}
.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* ── Home — sections ─────────────────────────────── */
.home-section { margin-bottom: 32px; }
.home-section-head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 0;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  text-align: left;
}
.home-section-head.static { cursor: default; }
.home-section-head .t {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.home-section-head .c {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.05em;
}
.home-section-head .grow { flex: 1; }
.link-btn {
  font-size: 12px;
  color: var(--accent);
  font-family: var(--font-ui);
  padding: 2px 6px;
  border-radius: 3px;
}
.link-btn:hover { background: var(--accent-soft); }

.jump-row {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.date-input {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  padding: 4px 8px;
  outline: none;
}
.date-input:focus { border-color: var(--accent); }

/* Day group — bigger headers, collapsible */
.day-group .day-head {
  display: flex; align-items: baseline; gap: 10px;
  width: 100%;
  cursor: pointer;
  border-bottom: none;
  margin-bottom: 6px;
  padding: 6px 0;
  border-radius: 3px;
}
.day-group .day-head:hover { background: color-mix(in oklab, var(--bg-2) 50%, transparent); }
.day-group .day-head .day-label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  color: var(--fg);
  letter-spacing: -0.005em;
  text-transform: none;
}
.day-group .day-head .day-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.day-group .day-head .day-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-4);
}

/* ── Note — 2-col layout with collapsible rail ───── */
.note-layout {
  display: grid;
  grid-template-columns: 1fr var(--rail-w, 300px);
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 32px 80px 32px;
  align-items: start;
}
.note-layout.rail-collapsed {
  grid-template-columns: 1fr 36px;
}
.note-main { padding: 0; max-width: var(--content-w); margin: 0; }

.note-rail {
  position: sticky;
  top: 16px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
  min-height: 100px;
  font-size: 12.5px;
}
.note-rail.collapsed { padding-left: 0; border-left: 0; }
.rail-toggle {
  position: absolute;
  top: 0; right: -8px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--fg-2);
  font-size: 10px;
  z-index: 2;
}
.rail-toggle:hover { background: var(--bg-2); color: var(--fg); }
.note-rail.collapsed .rail-toggle { right: 6px; top: 8px; position: relative; }
.rail-inner { display: flex; flex-direction: column; gap: 18px; }
.rail-block {
  display: flex; flex-direction: column; gap: 4px;
}
.rail-block-title {
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.rail-block-title .rail-count {
  margin-left: auto;
  color: var(--fg-4);
}
.rail-block .kv {
  display: grid;
  grid-template-columns: minmax(56px, auto) 1fr;
  gap: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 1px 0;
  align-items: baseline;
}
.rail-block .kv .k { color: var(--fg-3); white-space: nowrap; }
.rail-block .kv .v { color: var(--fg-1); overflow-wrap: anywhere; }
.rail-sub {
  margin-top: 10px; margin-bottom: 4px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.rail-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12.5px;
}
.rail-row:hover { background: var(--bg-2); }
.rail-row .title { flex: 1; color: var(--fg-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-row:hover .title { color: var(--accent); }
.rail-row .type-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }
.rail-edges { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.edge-dir {
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--fg-2);
  margin-top: 4px;
}
.edge-intent {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  margin: 4px 0 2px;
  font-style: italic;
}
.rail-extlink {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--type-bookmark);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 4px 0;
  word-break: break-all;
}
.rail-extlink .url { overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 920px) {
  .note-layout { grid-template-columns: 1fr; }
  .note-rail { position: static; border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; }
}

/* ── Note meta-row chips wrap to next row ────────── */
.note-meta-row {
  display: flex; flex-wrap: wrap; gap: 6px 8px;
  align-items: center;
  margin-bottom: 8px;
  max-width: 100%;
}

/* ── Type page sort bar ──────────────────────────── */
.sort-bar {
  display: flex; gap: 6px; flex-wrap: wrap;
  align-items: center;
  margin: 10px 0 22px 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.sort-bar .chip.dir {
  font-family: var(--font-mono);
  margin-left: auto;
}
.filter-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-right: 4px;
}

/* Type-row chips wrap */
.ref-row.type-row { grid-template-columns: minmax(120px, auto) 1fr auto; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }

/* Cards: chip groups wrap */
.work-card .row.chips { gap: 4px; }
.work-card .row.between { align-items: flex-start; }
[data-density="compact"] .act-item { padding: 5px 0; }
[data-density="compact"] .ref-row { padding: 6px 0; }
[data-density="compact"] .main-inner { padding: 24px 28px 60px 28px; }
[data-density="compact"] .md { font-size: 15px; line-height: 1.55; }

/* Note title pin action */
/* PageActions icon row */
.page-actions {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  margin-bottom: 10px;
}
.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--fg-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.action-icon svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.action-icon:hover { background: var(--bg-2); color: var(--fg-1); }
.action-icon.active { color: var(--accent); }
.action-icon.active svg { fill: currentColor; }
.action-icon.danger { color: var(--red); }
.action-icon.danger:hover { background: oklch(0.65 0.18 15 / 0.12); color: var(--red); }
.action-icon.disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.action-icon.danger.disabled { color: var(--fg-3); }

/* Sidebar inline unpin button on pinned rows */
.side-row { position: relative; }
.side-unpin {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  display: none;
  align-items: center; justify-content: center;
  background: transparent;
  border: 0;
  border-radius: 4px;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
}
.side-row:hover .side-unpin { display: inline-flex; }
.side-unpin:hover { background: var(--bg-2); }
.side-unpin svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 1.75; fill: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.side-empty { padding: 4px 8px; color: var(--fg-3); font-size: 11.5px; font-family: var(--font-mono); font-style: italic; }

/* Header pin/panel-right active state */
.icon-btn.active {
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
}

/* Scrollbar */
.main::-webkit-scrollbar, .side::-webkit-scrollbar, .palette-results::-webkit-scrollbar { width: 8px; }
.main::-webkit-scrollbar-thumb, .side::-webkit-scrollbar-thumb, .palette-results::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.main::-webkit-scrollbar-track, .side::-webkit-scrollbar-track, .palette-results::-webkit-scrollbar-track { background: transparent; }

/* Mermaid diagram blocks */
.mermaid-block { margin: 1.25rem 0; overflow-x: auto; }
.mermaid-block svg { max-width: 100%; height: auto; }
.mermaid-error { position: relative; }
.mermaid-error-label { display: block; font-size: 11px; font-family: var(--font-mono); color: var(--fg-3); margin-bottom: 4px; }

/* ── NLP Agent Search Layout ──────────────────────────────────── */

/* In ask mode, main spans both grid columns (no sidebar) */
.app.ask-mode {
  grid-template-columns: 1fr;
  grid-template-areas:
    "head"
    "main";
}
.app.ask-mode .main {
  overflow: hidden;
}

/* /ask route — 3-pane grid */
.ask-layout {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  height: 100%;
  overflow: hidden;
}
.ask-layout.preview-open {
  grid-template-columns: var(--side-w) 1fr 4px 230px;
}

/* Drag handle between chat and preview panes */
.resize-handle {
  width: 4px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  border-left: 1.5px solid var(--line-soft);
  transition: border-color 0.12s, background 0.12s;
  flex-shrink: 0;
}
.resize-handle:hover,
.resize-handle:active {
  background: var(--line-soft);
  border-left-color: var(--ink-3);
}

/* Mode toggle */
.mode-toggle {
  display: flex;
  border: 1.5px solid var(--line-soft);
  border-radius: 4px;
  overflow: hidden;
}
.mode-toggle-seg {
  padding: 3px 10px;
  font: 400 9px/1 var(--font-mono);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-3);
  transition: all 0.12s;
}
.mode-toggle-seg.active-editor {
  background: var(--bg-2);
  color: var(--ink);
  border-right: 1px solid var(--line-soft);
}
.mode-toggle-seg.active-agent {
  background: var(--nlp);
  color: #fff;
}

/* Sidebar tabs */
.side-tabs {
  display: flex;
  border-bottom: 1.5px solid var(--line);
  flex-shrink: 0;
}
.side-tab {
  flex: 1;
  padding: 6px 8px;
  font: 500 11px/1 var(--font-mono);
  text-align: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
}
.side-tab.active-notes {
  background: var(--bg-2);
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.side-tab.active-chats {
  background: var(--nlp-soft);
  color: var(--nlp);
  border-bottom-color: var(--nlp);
}

/* Chat session list */
.chat-session-list {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.chat-search-bar {
  padding: 6px 8px;
  flex-shrink: 0;
}
.chat-search-input {
  width: 100%;
  padding: 4px 8px;
  font: 400 12px/1.4 var(--font-mono);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  outline: none;
}
.chat-search-input:focus { border-color: var(--nlp); }
.chat-new-btn {
  width: calc(100% - 16px);
  margin: 4px 8px;
  padding: 5px 8px;
  font: 400 12px/1 var(--font-mono);
  background: transparent;
  border: 1.5px dashed var(--line-soft);
  border-radius: 3px;
  color: var(--ink-3);
  cursor: pointer;
  text-align: left;
}
.chat-new-btn:hover { border-color: var(--nlp); color: var(--nlp); }
.chat-session-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: 3px;
  margin: 1px 4px;
  font: 400 13px/1.3 var(--font-mono);
  color: var(--ink-2);
  position: relative;
}
.chat-session-row:hover { background: var(--bg-hover); }
.chat-session-row.active { background: var(--nlp-soft); color: var(--nlp); }
.chat-session-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-date-group { padding: 4px 12px 2px; font: 500 10px/1 var(--font-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.05em; }

/* Ask bar on home page */
.ask-bar-wrap {
  margin: 16px 0;
}
.ask-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 2px solid var(--nlp);
  border-radius: 5px;
  padding: 8px 12px;
  background: var(--bg-1);
}
.ask-bar-icon { color: var(--nlp); font-size: 14px; flex-shrink: 0; }
.ask-bar-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font: 400 12px/1.4 var(--font-ui);
  color: var(--ink);
}
.ask-bar-input::placeholder { color: var(--ink-3); }
.ask-bar-btn {
  padding: 3px 8px;
  font: 500 8.5px/1 var(--font-mono);
  background: var(--nlp);
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.ask-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.ask-chip {
  padding: 2px 8px;
  font: 400 8px/1 var(--font-mono);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.ask-chip:hover { border-color: var(--nlp); color: var(--nlp); background: var(--nlp-soft); }

/* Chat pane */
.chat-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--ink-3);
  text-align: center;
}
.chat-empty-icon { font-size: 32px; color: var(--nlp); }
.chat-empty-title { font: 600 16px/1.3 var(--font-ui); color: var(--ink); }
.chat-empty-sub { font: 400 12px/1.5 var(--font-ui); max-width: 280px; }
.chat-empty-cards { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 320px; margin-top: 8px; }
.chat-empty-card {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg-2);
  cursor: pointer;
  font: 400 11px/1.4 var(--font-ui);
  color: var(--ink-2);
  text-align: left;
}
.chat-empty-card:hover { border-color: var(--nlp); color: var(--nlp); }

/* Message bubbles */
.msg-user {
  display: flex;
  justify-content: flex-end;
}
.msg-user-bubble {
  background: var(--bg-3);
  border: 1.5px solid var(--line-soft);
  border-radius: 10px 10px 2px 10px;
  padding: 8px 12px;
  font: 400 14px/1.5 var(--font-ui);
  max-width: 80%;
  color: var(--ink);
}
.msg-assistant { display: flex; flex-direction: column; gap: 6px; }
.msg-thinking { display: flex; flex-direction: column; gap: 6px; }
.msg-assistant-label {
  font: 500 8px/1 var(--font-mono);
  color: var(--nlp);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.msg-assistant-body {
  font: 400 14px/1.6 var(--font-ui);
  color: var(--ink);
}
.msg-assistant-body strong { font-weight: 600; }

/* Status / searching */
.msg-searching { display: flex; align-items: center; gap: 6px; }
.pulse-dots { display: flex; gap: 3px; }
.pulse-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--nlp);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.pulse-dot:nth-child(2) { animation-delay: 0.2s; }
.pulse-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes pulse-dot { 0%,80%,100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }
.msg-status-text { font: 400 10px/1 var(--font-mono); color: var(--ink-3); }

/* Streaming cursor */
.stream-cursor {
  display: inline-block;
  width: 2px; height: 10px;
  background: var(--nlp);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Response skeleton — shown during searching state before tokens arrive */
.msg-skeleton { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; max-width: 340px; }
.skeleton-line {
  height: 9px; border-radius: 4px; width: 100%;
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Live indicator dot in session list */
.session-live-dot {
  display: inline-block;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--nlp);
  animation: pulse-dot 1.2s ease-in-out infinite;
  margin-right: 3px; vertical-align: middle; flex-shrink: 0;
}

/* Inline citation superscripts */
.cite-ref {
  font: 500 7.5px/1 var(--font-mono);
  color: var(--nlp);
  vertical-align: super;
  cursor: pointer;
  border-bottom: 1px dashed var(--nlp-mid);
}

/* Reference list */
.ref-list { margin-top: 8px; }
.ref-list-header {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: 500 8px/1 var(--font-mono);
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 0;
}
.ref-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border: 1px solid var(--bg-3);
  background: var(--bg-2);
  border-radius: 3px;
  cursor: pointer;
  font: 400 9px/1.3 var(--font-mono);
  margin-top: 3px;
}
.ref-item:hover { border-color: var(--nlp); color: var(--nlp); background: var(--nlp-soft); }
.ref-item.active { border-color: var(--nlp); }
.ref-n { color: var(--nlp); font-weight: 600; }
.ref-type-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ref-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref-age { color: var(--ink-3); font-size: 8px; }

/* Follow-up chips */
.followup-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.followup-chip {
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  font: 400 9px/1 var(--font-mono);
  cursor: pointer;
  color: var(--ink-3);
  background: transparent;
}
.followup-chip:hover { border-color: var(--nlp); color: var(--nlp); background: var(--nlp-soft); }

/* Chat input bar */
.chat-input-bar {
  border-top: 1.5px solid var(--line-soft);
  background: var(--bg-2);
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font: 400 14px/1.4 'Kalam', var(--font-body);
  color: var(--ink);
  resize: none;
}
.chat-input::placeholder { color: var(--ink-3); }
.chat-send-btn {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--nlp);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  flex-shrink: 0;
}
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Note preview pane */
.note-preview-pane {
  border-left: 1.5px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.preview-header { padding: 8px 10px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.preview-body { flex: 1; overflow-y: auto; padding: 8px 10px; font: 400 10.5px/1.55 var(--font-ui); color: var(--ink-2); }
.preview-ctas { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.preview-cta-primary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1.5px solid var(--line-soft);
  border-radius: 4px;
  background: var(--bg-2);
  font: 400 8.5px/1 var(--font-mono);
  color: var(--ink-2);
  cursor: pointer;
}
.preview-cta-primary:hover { border-color: var(--ink); color: var(--ink); }
.preview-cta-close {
  font: 400 8px/1 var(--font-mono);
  color: var(--ink-3);
  opacity: 0.55;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
}

/* "← from chat" badge */
.from-chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  font: 400 8px/1 var(--font-mono);
  background: var(--nlp-soft);
  border: 1px solid var(--nlp-mid);
  border-radius: 99px;
  color: var(--nlp);
  cursor: pointer;
  margin-left: 6px;
}
.from-chat-badge:hover { background: var(--nlp); color: #fff; }

/* ── Overflow / Context menus ────────────────────────── */
.overflow-menu-wrap { position: relative; display: inline-flex; }
.overflow-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-2);
  color: var(--fg-3);
  font-size: 16px;
  letter-spacing: 1px;
  transition: background .1s ease, color .1s ease;
}
.overflow-btn:hover { background: var(--bg-2); color: var(--fg); }
.overflow-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-pop);
  min-width: 140px;
  z-index: 100;
  overflow: hidden;
  padding: 4px 0;
}
.overflow-menu-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--fg-1);
  transition: background .1s ease, color .1s ease;
}
.overflow-menu-item:hover { background: var(--bg-3); color: var(--fg); }
.overflow-menu-item.danger { color: var(--red); }
.overflow-menu-item.danger:hover { background: oklch(0.65 0.18 15 / 0.12); color: var(--red); }
.overflow-menu-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

/* ── Inline editor (EDIT-2/3) ───────────────────────────────────── */
/* Obsidian-style: editable body signals click-to-edit */
article.md.editable { cursor: text; }

/* Pencil edit button in note title actions */
.edit-pencil-btn svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.editing-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-1);
  background: oklch(0.55 0.18 150 / 0.15);
  color: oklch(0.72 0.14 150);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.inline-editor {
  display: flex; flex-direction: column; gap: 10px;
  margin: 0 0 24px;
}
.inline-editor-hint {
  padding: 8px 12px;
  border-radius: var(--radius-2);
  background: oklch(0.65 0.14 80 / 0.10);
  border: 1px solid oklch(0.65 0.14 80 / 0.25);
  color: var(--fg-2);
  font-size: 13px;
}
.inline-editor-hint code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-1);
}
.inline-editor-textarea {
  width: 100%;
  min-height: 300px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s ease;
}
.inline-editor-textarea:focus { border-color: var(--accent); }
.append-editor .inline-editor-textarea { min-height: 150px; font-family: var(--font-ui); }
.inline-editor-error {
  padding: 8px 12px;
  border-radius: var(--radius-2);
  background: oklch(0.65 0.18 15 / 0.10);
  border: 1px solid oklch(0.65 0.18 15 / 0.25);
  color: var(--red);
  font-size: 13px;
}
.inline-editor-actions {
  display: flex; gap: 8px; justify-content: flex-end; align-items: center;
}

/* Auto-save status indicator */
.save-status {
  flex: 1;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--fg-3);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}
.save-status.saving { color: var(--fg-3); }
.save-status.saved { color: oklch(0.65 0.16 150); animation: editorSavedFade 1s ease-in-out 2s forwards; }
.save-status.error { color: var(--red); }
.retry-btn {
  background: none; border: none; padding: 0;
  color: inherit; text-decoration: underline; cursor: pointer; font-size: inherit;
}
@keyframes editorSavedFade { from { opacity: 1; } to { opacity: 0; } }

.chip.save-btn {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.chip.save-btn:hover:not(:disabled) { opacity: 0.88; }
.chip:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Journal append button (EDIT-3) ─────────────────────────────── */
.journal-append-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  margin: 16px 0;
  padding: 10px;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-2);
  color: var(--fg-3);
  font-size: 13px;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.journal-append-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: oklch(from var(--accent) l c h / 0.06);
}

/* ── Sidebar context menu ────────────────────────────── */
.side-link-wrap { position: relative; }
.side-link-wrap .side-ctx-btn {
  position: absolute;
  right: 4px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px;
  display: none;
  align-items: center; justify-content: center;
  border-radius: var(--radius-1);
  color: var(--fg-3);
  font-size: 14px;
  letter-spacing: 0.5px;
  transition: background .1s ease, color .1s ease;
}
.side-link-wrap:hover .side-ctx-btn { display: inline-flex; }
.side-ctx-btn:hover { background: var(--bg-3); color: var(--fg); }
.side-ctx-menu {
  position: fixed;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-pop);
  min-width: 150px;
  z-index: 200;
  overflow: hidden;
  padding: 4px 0;
}
.side-ctx-menu-item {
  display: block;
  width: 100%;
  padding: 7px 14px;
  text-align: left;
  font-size: 13px;
  color: var(--fg-1);
  transition: background .1s ease, color .1s ease;
}
.side-ctx-menu-item:hover { background: var(--bg-3); color: var(--fg); }
.side-ctx-menu-item.danger { color: var(--red); }
.side-ctx-menu-item.danger:hover { background: oklch(0.65 0.18 15 / 0.12); color: var(--red); }
.side-ctx-menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ── Confirm delete modal ────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.modal-box {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-pop);
  padding: 24px 28px;
  width: 400px;
  max-width: calc(100vw - 32px);
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 16px;
  font-family: var(--font-ui);
}
.modal-note-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
}
.modal-note-row .type-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.modal-note-type { font-size: 12px; color: var(--fg-3); font-family: var(--font-mono); }
.modal-note-title {
  font-size: 13px;
  color: var(--fg-1);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-warning {
  font-size: 13px;
  color: var(--fg-2);
  font-family: var(--font-body);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.5;
}
.modal-irreversible {
  font-size: 12px;
  color: var(--fg-3);
  margin-bottom: 20px;
  font-family: var(--font-mono);
}
.modal-error {
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
  line-height: 1.5;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px;
}
.modal-cancel-btn {
  padding: 7px 16px;
  border-radius: var(--radius-2);
  border: 1px solid var(--line-2);
  font-size: 13px;
  color: var(--fg-2);
  transition: background .1s ease, color .1s ease, border-color .1s ease;
}
.modal-cancel-btn:hover:not(:disabled) { background: var(--bg-2); color: var(--fg); border-color: var(--line-strong); }
.modal-cancel-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.modal-delete-btn {
  padding: 7px 16px;
  border-radius: var(--radius-2);
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: opacity .1s ease, background .1s ease;
}
.modal-delete-btn:hover:not(:disabled) { opacity: 0.88; }
.modal-delete-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.modal-delete-btn.loading { opacity: 0.7; cursor: not-allowed; }

/* ── System status (sidebar) ─────────────────────────────────────── */
.side-status {
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.side-status-head {
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10.5px;
}
.side-status-head .ss-mode { color: var(--fg-3); font-weight: 500; text-transform: none; }
.side-status-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  color: var(--fg-2);
}
.side-status-row.muted { color: var(--fg-3); }
.side-status-row .ss-note { color: var(--fg-3); font-size: 11px; }
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--fg-3);
}
.status-dot.ok    { background: oklch(0.72 0.16 150); }
.status-dot.warn  { background: oklch(0.78 0.15 75); }
.status-dot.err   { background: var(--red); }
.status-dot.muted { background: var(--fg-3); opacity: 0.5; }

/* ── Login gate ──────────────────────────────────────── */
.login-gate-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.login-gate-card {
  width: 360px;
  padding: 32px;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-3);
  box-shadow: var(--shadow-pop);
}
.login-gate-card .logo-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.login-gate-card .brand-name {
  font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
}
.login-gate-card p {
  font-size: 13px; color: var(--fg-2);
  margin: 0 0 18px 0; line-height: 1.55;
}
.login-gate-card textarea {
  width: 100%;
  height: 80px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  color: var(--fg);
  font: var(--font-mono);
  font-size: 12px;
  padding: 10px 12px;
  resize: none;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.login-gate-card textarea:focus { border-color: var(--accent); }
.login-gate-card .login-btn {
  width: 100%;
  margin-top: 12px;
  padding: 9px 0;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-2);
  font-size: 14px;
  font-weight: 600;
  transition: opacity .15s;
}
.login-gate-card .login-btn:hover { opacity: 0.88; }
.login-gate-card .login-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.login-gate-card .login-error {
  margin-top: 10px;
  font-size: 12px;
  color: var(--red);
}

/* ── Facet bar (type page) ───────────────────────────── */
.facet-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.facet-bar .facet-group {
  display: flex; align-items: center; gap: 6px;
}
.facet-bar .facet-label {
  font-size: 10.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-right: 4px;
}
.facet-bar .sep {
  width: 1px; height: 16px;
  background: var(--line-strong);
  margin: 0 4px;
}

/* ── Review queue ──────────────────────────────────── */
.review-page { max-width: 860px; margin: 0 auto; padding: 32px 24px 80px 24px; }
.review-page h2 {
  margin: 0 0 4px 0;
  font-size: 22px; font-weight: 600;
}
.review-page .sub { color: var(--fg-2); font-size: 13px; margin-bottom: 24px; }

/* Autonomy stats strip */
.autonomy-strip {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
}
.autonomy-strip-head {
  width: 100%;
  font-size: 10.5px; font-family: var(--font-mono);
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 4px;
}
.autonomy-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  min-width: 120px;
}
.autonomy-card .ac-class {
  font-size: 11px; font-family: var(--font-mono);
  color: var(--fg-2); letter-spacing: 0.06em;
}
.autonomy-card .ac-mode {
  font-size: 12px; font-weight: 600; color: var(--fg);
}
.autonomy-card .ac-mode.auto { color: var(--accent); }
.autonomy-card .ac-misfile {
  font-size: 11px; color: var(--fg-3); font-family: var(--font-mono);
}
.autonomy-card .ac-misfile.high { color: var(--red); }

/* Batch bar */
.review-batch-bar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
  padding: 8px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  font-size: 13px;
}
.review-batch-bar .bc { color: var(--fg-2); flex: 1; }
.review-batch-bar button { font-size: 12px; padding: 4px 12px; }

/* Proposal card */
.proposal-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-2);
  margin-bottom: 14px;
  background: var(--bg-1);
  overflow: hidden;
  transition: border-color .15s;
}
.proposal-card.decided {
  opacity: 0.35;
  pointer-events: none;
  transform: scale(0.98);
  transition: opacity .3s, transform .3s;
}
.proposal-card:hover { border-color: var(--line-strong); }
.proposal-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.proposal-card-head .select-box { cursor: pointer; flex: 0 0 auto; }
.proposal-card-head .action-class-chip {
  font-size: 10px; font-family: var(--font-mono);
  padding: 2px 7px; border-radius: 999px;
  background: var(--accent-soft); border: 1px solid color-mix(in oklab, var(--accent) 50%, var(--line));
  color: var(--accent); letter-spacing: 0.06em; text-transform: uppercase;
}
.proposal-card-head .summary {
  flex: 1; font-size: 13px; color: var(--fg);
  font-weight: 500;
}
.proposal-card-head .age {
  font-size: 11px; color: var(--fg-3);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.proposal-card-body {
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.proposal-confidence {
  display: flex; align-items: center; gap: 10px; font-size: 12px;
}
.proposal-confidence .conf-label { color: var(--fg-3); font-family: var(--font-mono); }
.conf-bar {
  flex: 1; max-width: 140px; height: 5px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.conf-bar-fill {
  height: 100%; border-radius: 999px;
  background: var(--accent);
  transition: width .3s;
}
.conf-bar-fill.high   { background: oklch(0.72 0.16 150); }
.conf-bar-fill.medium { background: var(--amber); }
.conf-bar-fill.low    { background: var(--red); }
.conf-text { font-weight: 600; }
.conf-text.high   { color: oklch(0.72 0.16 150); }
.conf-text.medium { color: var(--amber); }
.conf-text.low    { color: var(--red); }

.proposal-rationale {
  font-size: 13px; color: var(--fg-2); line-height: 1.5;
  font-style: italic;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: var(--radius-2);
  border-left: 2px solid var(--line-strong);
}

.proposal-entities {
  display: flex; flex-direction: column; gap: 6px;
}
.proposal-entities-title {
  font-size: 11px; font-family: var(--font-mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin-bottom: 2px;
}
.proposal-entity-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px;
  background: var(--bg-2); border-radius: var(--radius-2);
  font-size: 12px;
}
.proposal-entity-row .et { font-weight: 600; color: var(--fg); }
.proposal-entity-row .eb { color: var(--fg-2); margin-top: 3px; line-height: 1.45; }

.proposal-actions {
  display: flex; align-items: center; gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.proposal-actions button { font-size: 12px; padding: 5px 14px; border-radius: var(--radius-2); }
.proposal-actions .accept-btn {
  background: oklch(0.30 0.08 150); border: 1px solid oklch(0.55 0.14 150);
  color: oklch(0.88 0.10 150); font-weight: 600;
}
.proposal-actions .accept-btn:hover { background: oklch(0.36 0.10 150); }
.proposal-actions .reject-btn {
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--fg-1);
}
.proposal-actions .reject-btn:hover { background: var(--bg-3); border-color: var(--line-strong); }
.proposal-actions .modify-btn {
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--accent);
}
.proposal-actions .modify-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.proposal-actions .doing-msg {
  font-size: 11px; color: var(--fg-3); font-family: var(--font-mono);
}
.proposal-actions .grow { flex: 1; }

/* Modify ops editor */
.ops-editor {
  margin-top: 8px;
  background: var(--bg-2);
  border-radius: var(--radius-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.ops-editor-head {
  padding: 6px 12px;
  font-size: 11px; font-family: var(--font-mono);
  color: var(--fg-3); letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
}
.ops-editor textarea {
  width: 100%; min-height: 120px;
  background: transparent;
  border: 0;
  color: var(--fg);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.ops-editor-actions {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}
.ops-editor-actions button { font-size: 12px; padding: 4px 12px; }
.ops-editor-actions .ops-err { font-size: 11px; color: var(--red); }

.review-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-3);
  font-size: 15px;
}
.review-empty .icon { font-size: 36px; margin-bottom: 12px; }
.review-empty .msg { font-weight: 500; margin-bottom: 6px; color: var(--fg-2); }

/* Sidebar logout footer */
.side-logout-footer {
  margin-top: 12px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}
.side-logout-footer button {
  font-size: 11px; color: var(--fg-3);
  padding: 4px 8px;
  border-radius: var(--radius-2);
  width: 100%;
  text-align: left;
  transition: background .1s, color .1s;
}
.side-logout-footer button:hover { background: var(--bg-2); color: var(--red); }

/* Sidebar pending-proposals badge */
.side-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 16px; height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 9.5px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-left: 4px;
}

/* Sidebar review link */
.side-review-link {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-2);
  color: var(--fg-1);
  cursor: pointer;
  transition: background .1s, color .1s;
  width: 100%;
  text-align: left;
  font-size: 13px;
}
.side-review-link:hover { background: var(--bg-2); color: var(--fg); }
.side-review-link.active { background: var(--accent-soft); color: var(--fg); }
