/* ─────────────────────────────────────────────────────────
   FRIED YAMS STUDIOS — Internal CRM
   Design tokens (dark + light), CRM components.
   ───────────────────────────────────────────────────────── */

:root {
  /* accent set via JS — default amber */
  --accent: #e8a23a;
  --accent-fg: #1a140a;
  --accent-soft: rgba(232, 162, 58, 0.14);
  --accent-line: rgba(232, 162, 58, 0.32);

  /* sizing scale */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --pad-y: 14px;
  --pad-x: 14px;
  --row-h: 38px;

  /* status colors — stay constant across themes */
  --st-art:        #c98aff;
  --st-code:       #6aa6ff;
  --st-design:     #ffb16a;
  --st-audio:      #4fd1c5;
  --st-narrative:  #ff6a85;

  --prio-high:   #ef5567;
  --prio-med:    #e8a23a;
  --prio-low:    #6aa6ff;

  --done:   #51c97a;
  --review: #6aa6ff;
  --wip:    #e8a23a;
  --todo:   #8b8a85;
  --backlog:#5a5a5a;

  --grain-opacity: 0;
  --vignette-opacity: 0;
}

/* ───── DARK ───── */
[data-theme="dark"] {
  --bg:        #0c0d10;
  --bg-2:      #101216;
  --surface:   #14171c;
  --surface-2: #181b22;
  --surface-3: #1d2129;
  --line:      #232730;
  --line-2:    #2c313c;
  --text:      #e8e3d8;
  --text-mid:  #b6b2a8;
  --text-mute: #6f6d66;
  --text-faint:#4a4944;
  --inset:     rgba(0,0,0,0.4);
  --shadow:    0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.35);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
  color-scheme: dark;
}

/* ───── LIGHT ───── */
[data-theme="light"] {
  --bg:        #f6f4ef;
  --bg-2:      #ecebe5;
  --surface:   #fdfcf8;
  --surface-2: #f3f1ea;
  --surface-3: #e9e6dd;
  --line:      #dcd9cf;
  --line-2:    #c7c3b6;
  --text:      #1c1b18;
  --text-mid:  #51504a;
  --text-mute: #7d7b73;
  --text-faint:#a8a59b;
  --inset:     rgba(0,0,0,0.06);
  --shadow:    0 1px 0 rgba(255,255,255,0.6) inset, 0 8px 24px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --accent-fg: #1a140a;
  color-scheme: light;
}

/* ───── DENSITY ───── */
[data-density="comfortable"] {
  --pad-y: 14px;
  --pad-x: 16px;
  --row-h: 40px;
  --fs-body: 13.5px;
}
[data-density="compact"] {
  --pad-y: 8px;
  --pad-x: 10px;
  --row-h: 30px;
  --fs-body: 12.5px;
}

/* ───── RADIUS ───── */
[data-radius="sharp"] {
  --r-xs: 2px;
  --r-sm: 2px;
  --r-md: 3px;
  --r-lg: 4px;
  --r-xl: 6px;
}
[data-radius="soft"] {
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
}

/* ───── ATMOSPHERIC MODE (overlays) ───── */
[data-mood="atmospheric"] {
  --grain-opacity: 0.06;
  --vignette-opacity: 0.55;
}
[data-mood="atmospheric"][data-theme="dark"] {
  --bg:        #08080a;
  --bg-2:      #0c0c0f;
  --surface:   #111114;
  --surface-2: #16161b;
  --surface-3: #1c1c22;
  --line:      #1f1f26;
}
[data-mood="atmospheric"] .display {
  font-family: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────────────────────
   RESET + BASE
   ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: "Geist", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-body, 13.5px);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
.mono { font-family: "Geist Mono", "JetBrains Mono", ui-monospace, "Menlo", monospace; }
.display {
  font-family: "Geist", "Söhne", -apple-system, sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }

/* ─────────────────────────────────────────────────────────
   ATMOSPHERIC OVERLAYS
   ───────────────────────────────────────────────────────── */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 9990;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.7 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 9989;
  opacity: var(--vignette-opacity);
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%);
}

/* ─────────────────────────────────────────────────────────
   APP SHELL
   ───────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 100vh;
  height: 100vh;
  background: var(--bg);
}
[data-sidebar="right"] .app { grid-template-columns: 1fr 240px; }
[data-sidebar="right"] .sidebar { order: 2; border-left: 1px solid var(--line); border-right: 0; }
[data-density="compact"] .app { grid-template-columns: 220px 1fr; }

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.brand > div:not(.brand-mark) { min-width: 0; overflow: hidden; }
.brand-name, .brand-sub { overflow: hidden; text-overflow: ellipsis; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: -0.02em;
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  background: var(--accent);
  mix-blend-mode: multiply;
  opacity: 0;
}
.brand-name { font-weight: 600; font-size: 13.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-mute); margin-top: 1px; }

.nav-section {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
.nav-section + .nav-section { border-top: 0; }
.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding: 6px 10px 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  font-size: 13px;
  transition: background 80ms, color 80ms;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  text-align: left;
}
.nav-item > span:not(.nav-icon):not(.nav-count):not(.avatar) {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--surface-2); color: var(--text); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px;
  width: 2px; background: var(--accent); border-radius: 2px;
}
.nav-icon {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  color: var(--text-mute);
  flex-shrink: 0;
}
.nav-item.is-active .nav-icon { color: var(--accent); }
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--bg);
  flex-shrink: 0;
}
.avatar.a-1 { background: #ff8a65; }
.avatar.a-2 { background: #7bbf9e; }
.avatar.a-3 { background: #b39ddb; }

/* ── Main area ── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.topbar {
  height: 48px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 18px;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg);
  position: relative;
  z-index: 5;
  white-space: nowrap;
}
.crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-mute);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.crumbs .sep { opacity: 0.4; }
.crumbs .now { color: var(--text); }

.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-shrink: 0; white-space: nowrap; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-mid);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--text-mute);
  min-width: 280px;
  white-space: nowrap;
}
.search > span { overflow: hidden; text-overflow: ellipsis; }
.search:hover { border-color: var(--line-2); }
.kbd {
  font-family: "Geist Mono", monospace;
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-mute);
}

/* ── Content area ── */
.content {
  flex: 1;
  overflow: auto;
  min-height: 0;
  background: var(--bg);
}
.content-pad { padding: 22px 26px 60px; }

/* ─────────────────────────────────────────────────────────
   COMMON COMPONENTS
   ───────────────────────────────────────────────────────── */
.page-head {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-head > div:first-child { min-width: 0; flex: 1 1 auto; }
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 4px;
}
.page-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text);
  transition: background 80ms, border-color 80ms;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  font-weight: 500;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-mid); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { padding: 3px 8px; font-size: 11.5px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.card-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.card-sub { font-size: 11.5px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-body { padding: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-mid);
  white-space: nowrap;
  line-height: 1.4;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.chip.tag-art       { color: var(--st-art);       background: color-mix(in oklab, var(--st-art) 14%, transparent); border-color: color-mix(in oklab, var(--st-art) 30%, transparent); }
.chip.tag-code      { color: var(--st-code);      background: color-mix(in oklab, var(--st-code) 14%, transparent); border-color: color-mix(in oklab, var(--st-code) 30%, transparent); }
.chip.tag-design    { color: var(--st-design);    background: color-mix(in oklab, var(--st-design) 14%, transparent); border-color: color-mix(in oklab, var(--st-design) 30%, transparent); }
.chip.tag-audio     { color: var(--st-audio);     background: color-mix(in oklab, var(--st-audio) 14%, transparent); border-color: color-mix(in oklab, var(--st-audio) 30%, transparent); }
.chip.tag-narrative { color: var(--st-narrative); background: color-mix(in oklab, var(--st-narrative) 14%, transparent); border-color: color-mix(in oklab, var(--st-narrative) 30%, transparent); }

.prio-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.prio-dot.high { background: var(--prio-high); }
.prio-dot.med  { background: var(--prio-med); }
.prio-dot.low  { background: var(--prio-low); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.done    { background: var(--done); }
.status-dot.review  { background: var(--review); }
.status-dot.wip     { background: var(--wip); }
.status-dot.todo    { background: var(--todo); border: 1px solid var(--line-2); }
.status-dot.backlog { background: transparent; border: 1px dashed var(--text-mute); }

/* divider line */
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }

/* ─────────────────────────────────────────────────────────
   DASHBOARD
   ───────────────────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.dash-grid > .card { min-width: 0; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.kpi { padding: 14px; }
.kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; margin-top: 6px; }
.kpi-trend { font-size: 11.5px; margin-top: 4px; color: var(--text-mute); display: flex; align-items: center; gap: 4px; }
.kpi-trend.up    { color: var(--done); }
.kpi-trend.down  { color: var(--prio-high); }
.kpi-spark {
  margin-top: 6px;
  height: 28px;
  display: block;
  color: var(--accent);
  width: 100%;
}

.bar-track {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar-fill { height: 100%; background: var(--accent); border-radius: inherit; }

.activity-item {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  align-items: center;
}
.activity-item:last-child { border-bottom: 0; }
.activity-item .a-icon {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-mid);
}
.activity-item .who { color: var(--text); font-weight: 500; }
.activity-item .when { color: var(--text-mute); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* milestone row */
.ms-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 10px 0;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.ms-row:last-child { border-bottom: 0; }
.ms-name { font-size: 13px; }
.ms-date { font-size: 11.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.ms-prog { width: 90px; }

/* ─────────────────────────────────────────────────────────
   WIKI (lore-codex)
   ───────────────────────────────────────────────────────── */
.wiki-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: start;
}
.wiki-side {
  position: sticky;
  top: 0;
  padding-top: 4px;
}
.wiki-cat {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  color: var(--text-mid);
  white-space: nowrap;
  text-align: left;
}
.wiki-cat > span:not(.count) { overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.wiki-cat:hover { background: var(--surface-2); color: var(--text); }
.wiki-cat.is-active { background: var(--surface-2); color: var(--text); }
.wiki-cat .count { margin-left: auto; font-size: 11px; color: var(--text-mute); }

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.codex-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform 120ms, border-color 120ms;
  cursor: pointer;
  position: relative;
}
.codex-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.codex-thumb {
  height: 110px;
  background: var(--surface-2);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.codex-thumb::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, var(--surface) 100%);
}
.codex-thumb .codex-id {
  position: absolute; top: 8px; left: 10px;
  font-size: 10px;
  font-family: "Geist Mono", monospace;
  color: var(--text-mute);
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--line);
  z-index: 2;
  white-space: nowrap;
}
.codex-thumb .codex-cat {
  position: absolute; top: 8px; right: 10px;
  z-index: 2;
}
.codex-body { padding: 12px 14px 14px; }
.codex-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.codex-desc { font-size: 12px; color: var(--text-mute); margin-top: 4px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.codex-meta { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

/* Wiki detail view */
.wiki-detail {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
}
.wiki-doc { max-width: 760px; }
.wiki-doc h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.wiki-doc .doc-sub { color: var(--text-mute); font-size: 13px; margin-bottom: 18px; }
.wiki-doc h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.wiki-doc h3 { font-size: 13.5px; font-weight: 600; margin: 16px 0 6px; }
.wiki-doc p  { font-size: 13.5px; color: var(--text-mid); line-height: 1.65; margin: 0 0 12px; }
.wiki-doc ul { padding-left: 18px; margin: 0 0 12px; color: var(--text-mid); font-size: 13.5px; line-height: 1.7; }
.wiki-doc code {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text);
}
.wiki-doc .callout {
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  padding: 10px 14px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin: 14px 0;
  font-size: 13px;
  color: var(--text);
}
.wiki-doc .wlink {
  color: var(--accent);
  border-bottom: 1px dashed var(--accent-line);
  cursor: pointer;
}
.wiki-doc .wlink:hover { background: var(--accent-soft); }

.wiki-meta-panel {
  position: sticky;
  top: 0;
  font-size: 12.5px;
}
.meta-row {
  display: grid; grid-template-columns: 90px 1fr; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.meta-row:last-child { border-bottom: 0; }
.meta-row .k { color: var(--text-mute); font-size: 11.5px; }
.meta-row .v { color: var(--text); font-size: 12.5px; }

/* Backlinks (kept even though no sync UI — useful for cross-refs) */
.backlinks-list { display: flex; flex-direction: column; gap: 4px; }
.backlinks-list a {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  color: var(--text-mid);
  cursor: pointer;
}
.backlinks-list a:hover { background: var(--surface-2); color: var(--text); }

/* ─────────────────────────────────────────────────────────
   KANBAN
   ───────────────────────────────────────────────────────── */
.kanban-wrap {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kb-col {
  flex: 0 0 280px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
}
.kb-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.kb-col-title { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text); }
.kb-col-count { font-size: 11px; color: var(--text-mute); margin-left: 2px; font-variant-numeric: tabular-nums; }
.kb-col-actions { margin-left: auto; display: flex; gap: 2px; }
.kb-col-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 100px;
}
.kb-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  cursor: grab;
  transition: border-color 80ms, box-shadow 80ms, transform 80ms;
  box-shadow: var(--shadow-sm);
}
.kb-card:hover { border-color: var(--line-2); }
.kb-card.dragging { opacity: 0.5; }
.kb-card-head { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.kb-card-id { font-family: "Geist Mono", monospace; font-size: 10.5px; white-space: nowrap; }
.kb-card-title { font-size: 13px; line-height: 1.4; margin: 4px 0 6px; color: var(--text); font-weight: 500; }
.kb-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kb-card-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--text-mute); }
.kb-card-foot .due { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.kb-card-foot .due.overdue { color: var(--prio-high); }
.kb-avatars { display: flex; margin-left: auto; }
.kb-avatars .avatar { width: 20px; height: 20px; font-size: 9.5px; border: 2px solid var(--surface); margin-left: -6px; }
.kb-avatars .avatar:first-child { margin-left: 0; }

.kb-add {
  font-size: 12px;
  color: var(--text-mute);
  padding: 6px 8px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 6px;
  justify-content: center;
}
.kb-add:hover { color: var(--text); border-color: var(--text-mute); }

/* ─────────────────────────────────────────────────────────
   TASKS TABLE
   ───────────────────────────────────────────────────────── */
.task-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  font-size: 12.5px;
}
.task-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  font-weight: 500;
  padding: 10px 12px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.task-table td {
  padding: 0 12px;
  height: var(--row-h);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-table tr:last-child td { border-bottom: 0; }
.task-table tbody tr { transition: background 60ms; }
.task-table tbody tr:hover { background: var(--surface-2); }
.task-table .t-title { color: var(--text); font-weight: 500; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.task-table .t-id { font-family: "Geist Mono", monospace; font-size: 11px; color: var(--text-mute); }
.task-table .t-row.subtask td:first-child { padding-left: 32px; }
.task-table .t-row.subtask .t-title { color: var(--text-mid); }
.task-table .group-head td {
  background: var(--bg-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  font-weight: 600;
  padding: 8px 12px;
  height: auto;
}

.tasks-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  color: var(--text-mid);
}
.filter-btn.is-on { color: var(--text); border-color: var(--line-2); background: var(--surface-2); }
.filter-btn:hover { color: var(--text); }

/* ─────────────────────────────────────────────────────────
   IDEAS — sticky-note infinite canvas
   ───────────────────────────────────────────────────────── */
.ideas-canvas-frame {
  position: relative;
  height: calc(100vh - 48px - 60px);
  margin: -22px -26px -60px;
  overflow: hidden;
  background: var(--bg-2);
  background-image:
    radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
}
[data-theme="light"] .ideas-canvas-frame {
  background-image: radial-gradient(circle at 1px 1px, var(--line-2) 1px, transparent 1px);
}
.ideas-canvas {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.ideas-toolbar {
  position: absolute;
  top: 14px; left: 14px;
  display: flex; gap: 6px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px;
  z-index: 4;
  box-shadow: var(--shadow);
}
.ideas-minimap {
  position: absolute;
  bottom: 14px; right: 14px;
  width: 180px;
  height: 110px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  z-index: 4;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ideas-zoom {
  position: absolute;
  bottom: 14px; left: 14px;
  display: flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 2px;
  z-index: 4;
  box-shadow: var(--shadow);
  font-size: 11.5px;
  color: var(--text-mute);
}
.ideas-zoom button { padding: 4px 8px; border-radius: var(--r-xs); }
.ideas-zoom button:hover { background: var(--surface-2); color: var(--text); }
.ideas-zoom .pct { padding: 0 8px; font-variant-numeric: tabular-nums; }

.sticky {
  position: absolute;
  width: 200px;
  min-height: 140px;
  padding: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #2a230f;
  box-shadow: 0 8px 22px rgba(0,0,0,0.25), 0 2px 4px rgba(0,0,0,0.15);
  font-family: "Caveat", "Patrick Hand", "Geist", sans-serif;
  transition: transform 120ms, box-shadow 120ms, z-index 0s;
  cursor: grab;
  border-radius: 1px;
  z-index: 1;
}
.sticky:hover { transform: scale(1.04); z-index: 10; box-shadow: 0 14px 28px rgba(0,0,0,0.32), 0 4px 8px rgba(0,0,0,0.2); }
.sticky.dragging { cursor: grabbing; z-index: 100; }
.sticky.c-yellow { background: #fde68a; }
.sticky.c-orange { background: #fdba74; }
.sticky.c-pink   { background: #f9a8d4; color: #2a0f1a; }
.sticky.c-green  { background: #bef264; color: #1a2a0f; }
.sticky.c-blue   { background: #93c5fd; color: #0f1a2a; }
.sticky.c-mint   { background: #a7f3d0; color: #0f2a1a; }
.sticky.c-red    { background: #fca5a5; color: #2a0f0f; }
.sticky .sticky-meta { font-size: 10px; opacity: 0.55; margin-top: 8px; display: flex; gap: 6px; align-items: center; font-family: "Geist", sans-serif; text-transform: uppercase; letter-spacing: 0.06em; }
.sticky .sticky-pin {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8585, #b30000);
  box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.cluster-label {
  position: absolute;
  font-family: "Caveat", "Patrick Hand", sans-serif;
  font-size: 28px;
  color: var(--text-mute);
  pointer-events: none;
  opacity: 0.7;
}
.cluster-frame {
  position: absolute;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  pointer-events: none;
}
.lucid-pill {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.lucid-pill:hover { border-color: var(--accent); }
.lucid-pill .lucid-dot { width: 8px; height: 8px; border-radius: 50%; background: #ff8a3d; }

/* ─────────────────────────────────────────────────────────
   SETTINGS
   ───────────────────────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 26px;
  max-width: 1000px;
}
.settings-nav { display: flex; flex-direction: column; gap: 1px; }
.settings-nav .nav-item.is-active { background: var(--surface-2); }
.settings-section + .settings-section { margin-top: 28px; }
.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: 0; }
.settings-row .label { font-size: 13px; font-weight: 500; }
.settings-row .help { font-size: 12px; color: var(--text-mute); margin-top: 2px; max-width: 480px; }

.swatch-row { display: flex; gap: 8px; }
.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform 80ms;
}
.swatch:hover { transform: scale(1.08); }
.swatch.is-active {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--text);
}

.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 2px;
}
.seg button {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: calc(var(--r-sm) - 2px);
  color: var(--text-mid);
}
.seg button.is-on {
  background: var(--surface-3);
  color: var(--text);
}

.toggle {
  width: 34px; height: 20px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 120ms;
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 120ms;
}
.toggle.is-on { background: var(--accent); border-color: var(--accent); }
.toggle.is-on::after { transform: translateX(14px); background: var(--accent-fg); }

/* ─────────────────────────────────────────────────────────
   MISC
   ───────────────────────────────────────────────────────── */
.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
.kbd-row { display: flex; gap: 4px; }

/* small utilities */
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--text-mute); }
.faint { color: var(--text-faint); }
.f-mono { font-family: "Geist Mono", monospace; }
.tnum { font-variant-numeric: tabular-nums; }
.small { font-size: 11.5px; }
.tag-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.spacer { flex: 1; }
