/* ── Knowledge Hub Dashboard ─────────────────────────────────────────── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../vendor/inter-var-latin.woff2') format('woff2');
}
:root {
  --bg: #0e1116;
  --bg-raised: #151a22;
  --bg-hover: #1c2330;
  --border: #232b3a;
  --border-light: #2e3850;
  --text: #dde3ee;
  --text-dim: #8b95ab;
  --text-faint: #5d678a;
  --accent: #7c8cf8;
  --accent-soft: rgba(124, 140, 248, 0.14);
  --green: #4ade80;
  --amber: #fbbf24;
  --glass: rgba(21, 26, 34, 0.92);
  --grad: linear-gradient(120deg, #8b9bff 0%, #67e8f9 60%, #4ade80 120%);
  --accent-text: #0e1116;
  --shadow: rgba(0, 0, 0, 0.5);
  --radius: 10px;
  --topbar-h: 56px;
  --sidebar-w: 290px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

html[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-raised: #ffffff;
  --bg-hover: #e9edf4;
  --border: #dfe4ee;
  --border-light: #c8d1e2;
  --text: #1d2433;
  --text-dim: #5a6478;
  --text-faint: #8d97ad;
  --accent: #4f5ed6;
  --accent-soft: rgba(79, 94, 214, 0.1);
  --glass: rgba(255, 255, 255, 0.92);
  --grad: linear-gradient(120deg, #4f5ed6 0%, #0891b2 60%, #15803d 120%);
  --accent-text: #ffffff;
  --shadow: rgba(25, 35, 65, 0.18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overflow: hidden;
}
.hidden { display: none !important; }
.loading { color: var(--text-dim); padding: 16px; font-size: 13px; }
button { font-family: inherit; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.brand-mark {
  font-size: 20px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-name { font-weight: 650; font-size: 15.5px; letter-spacing: 0.2px; }
.brand-badge {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg-hover);
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--border);
}

.search-wrap { flex: 1; max-width: 520px; position: relative; }
#search-input {
  width: 100%; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font-size: 13.5px; outline: none;
  transition: border-color 0.15s;
}
#search-input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 420px; overflow-y: auto;
  background: var(--bg-raised); border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: 0 12px 40px var(--shadow);
}
.search-result { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--bg-hover); }
.search-result .sr-name { font-size: 13.5px; font-weight: 550; }
.search-result .sr-folder { font-size: 11px; color: var(--accent); margin-left: 8px; }
.search-result .sr-snippet { font-size: 12px; color: var(--text-dim); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-tabs { display: flex; gap: 6px; margin-left: auto; }
.nav-tab {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  padding: 7px 16px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 550;
  transition: all 0.15s;
}
.nav-tab:hover { color: var(--text); background: var(--bg-hover); }
.nav-tab.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(124,140,248,0.3); }

/* ── Layout ──────────────────────────────────────────────────────────── */
.layout { display: flex; height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-raised); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px 8px; font-size: 11.5px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim);
}
.sidebar-header button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 14px; padding: 2px 6px; border-radius: 6px;
}
.sidebar-header button:hover { background: var(--bg-hover); color: var(--text); }
.file-tree { flex: 1; overflow-y: auto; padding: 4px 8px 24px; font-size: 13.5px; }

.tree-dir > .tree-row .tree-chevron { transition: transform 0.15s; display: inline-block; width: 14px; color: var(--text-dim); font-size: 10px; }
.tree-dir.open > .tree-row .tree-chevron { transform: rotate(90deg); }
.tree-row {
  display: flex; align-items: center; gap: 5px; padding: 3.5px 8px;
  border-radius: 7px; cursor: pointer; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text-dim);
}
.tree-row:hover { background: var(--bg-hover); color: var(--text); }
.tree-row.active { background: var(--accent-soft); color: var(--accent); }
.tree-dir > .tree-row { color: var(--text); font-weight: 530; }
.tree-children { display: none; padding-left: 16px; border-left: 1px solid var(--border); margin-left: 14px; }
.tree-dir.open > .tree-children { display: block; }
.tree-label { overflow: hidden; text-overflow: ellipsis; }
.tree-icon { font-size: 12px; flex-shrink: 0; }

/* ── Main / views ────────────────────────────────────────────────────── */
.main { flex: 1; overflow: hidden; position: relative; }
.view { height: 100%; overflow-y: auto; animation: view-in 0.3s ease; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
body, .topbar, .sidebar, .panel, .topic-card, .modal, .btn {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.15s ease;
}

/* Dashboard */
.dash-hero { padding: 38px 44px 10px; }
.dash-hero h1 {
  margin: 0 0 6px; font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; width: fit-content;
}
.dash-stats { color: var(--text-dim); font-size: 14px; margin: 0; }
.dash-stats b { color: var(--accent); font-weight: 650; }

.topic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px; padding: 24px 44px 60px;
}
.topic-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px;
  transition: border-color 0.15s, transform 0.15s;
}
.topic-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: 0 10px 30px var(--shadow); }
.topic-card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.topic-card-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.topic-count { font-size: 12px; color: var(--text-dim); background: var(--bg-hover);
  padding: 2px 9px; border-radius: 99px; }
.topic-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag-chip {
  font-size: 11px; color: var(--accent); background: var(--accent-soft);
  padding: 2px 9px; border-radius: 99px; font-weight: 550;
}
.topic-section-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-dim); font-weight: 650; margin: 10px 0 5px; }
.topic-note-link {
  display: block; font-size: 13px; color: var(--text); text-decoration: none;
  padding: 4px 8px; margin: 0 -8px; border-radius: 7px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.topic-note-link:hover { background: var(--bg-hover); color: var(--accent); }
.topic-note-link .hub-badge { font-size: 10.5px; color: var(--amber); margin-left: 6px; }

/* Graph */
#view-graph { overflow: hidden; position: relative; }
#graph-container { position: absolute; inset: 0; }
.graph-overlay {
  position: absolute; top: 16px; left: 16px; z-index: 10;
  display: flex; flex-direction: column; gap: 10px; max-width: 290px;
}
.graph-panel {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 8px;
}
#graph-filter {
  padding: 7px 11px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 13px; outline: none;
}
#graph-filter:focus { border-color: var(--accent); }
.graph-check { font-size: 12.5px; color: var(--text-dim); display: flex; align-items: center; gap: 7px; cursor: pointer; }
.graph-legend {
  background: var(--glass); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; backdrop-filter: blur(8px);
  display: flex; flex-direction: column; gap: 4px; max-height: 46vh; overflow-y: auto;
}
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--text-dim); cursor: pointer; padding: 2px 4px; border-radius: 5px; user-select: none; }
.legend-item:hover { background: var(--bg-hover); }
.legend-item.muted { opacity: 0.35; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.graph-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 11.5px; color: var(--text-faint); background: var(--glass);
  padding: 5px 14px; border-radius: 99px; pointer-events: none; white-space: nowrap;
  color: var(--text-dim);
}

/* Note view */
.note-shell { max-width: 860px; margin: 0 auto; padding: 34px 40px 80px; }
.note-header { border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 22px; }
.note-meta-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.note-breadcrumb { color: var(--accent); }
.note-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.note-title-row h1 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -0.3px; line-height: 1.3; }
.note-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }
.btn {
  background: var(--bg-hover); color: var(--text); border: 1px solid var(--border-light);
  padding: 6px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 550;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { opacity: 0.88; color: var(--accent-text); }
.note-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.note-editor {
  width: 100%; min-height: 60vh; resize: vertical;
  background: var(--bg-raised); color: var(--text); border: 1px solid var(--border-light);
  border-radius: var(--radius); padding: 18px; font-family: var(--mono);
  font-size: 13.5px; line-height: 1.7; outline: none;
}
.note-editor:focus { border-color: var(--accent); }

/* Linked notes panel */
.note-links { margin-top: 36px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.links-col { background: var(--bg-raised); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.links-col h4 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.links-col .link-item { display: block; font-size: 13px; padding: 4px 8px; margin: 0 -8px;
  border-radius: 7px; color: var(--text); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.links-col .link-item:hover { background: var(--bg-hover); color: var(--accent); }
.links-col .empty { font-size: 12.5px; color: var(--text-faint); color: var(--text-dim); }

/* ── Markdown rendering ──────────────────────────────────────────────── */
.markdown { font-size: 15px; line-height: 1.75; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 {
  font-weight: 680; letter-spacing: -0.2px; margin: 1.6em 0 0.5em; line-height: 1.3;
}
.markdown h1 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.markdown h2 { font-size: 19px; }
.markdown h3 { font-size: 16.5px; }
.markdown p { margin: 0.7em 0; }
.markdown a { color: var(--accent); text-decoration: none; }
.markdown a:hover { text-decoration: underline; }
.markdown a.wikilink {
  color: var(--accent); background: var(--accent-soft); padding: 1px 6px;
  border-radius: 5px; cursor: pointer; font-weight: 520;
}
.markdown a.wikilink.broken { color: var(--text-dim); background: var(--bg-hover); cursor: default; }
.markdown code {
  font-family: var(--mono); font-size: 0.86em; background: var(--bg-hover);
  padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border);
}
.markdown pre {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; overflow-x: auto;
}
.markdown pre code { background: none; border: none; padding: 0; font-size: 12.8px; line-height: 1.6; }
.markdown blockquote {
  margin: 1em 0; padding: 10px 18px; border-left: 3px solid var(--accent);
  background: var(--bg-raised); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-dim);
}
.markdown blockquote p { margin: 0.3em 0; }
.markdown .callout-label { color: var(--accent); font-weight: 650; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; }
.markdown table { border-collapse: collapse; margin: 1em 0; width: 100%; font-size: 13.5px; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 7px 12px; text-align: left; }
.markdown th { background: var(--bg-raised); font-weight: 620; }
.markdown img { max-width: 100%; border-radius: var(--radius); }
.markdown hr { border: none; border-top: 1px solid var(--border); margin: 2em 0; }
.markdown ul, .markdown ol { padding-left: 1.5em; }
.markdown li { margin: 0.25em 0; }
.markdown input[type="checkbox"] { accent-color: var(--accent); margin-right: 6px; }
.markdown .md-tag { color: var(--accent); font-size: 0.9em; }

/* ── Connect screen ──────────────────────────────────────────────────── */
#view-connect { display: flex; align-items: center; justify-content: center; }
.connect-card {
  max-width: 480px; width: 100%; margin: 0 24px 8vh;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 18px; padding: 38px 40px; text-align: center;
}
.connect-mark { font-size: 38px; color: var(--accent); }
.connect-card h1 { margin: 10px 0 8px; font-size: 23px; font-weight: 700; }
.connect-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 26px; }
.connect-options { display: flex; flex-direction: column; gap: 12px; }
.connect-btn {
  background: var(--bg-hover); border: 1px solid var(--border-light);
  border-radius: 12px; padding: 14px 18px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 3px; transition: all 0.15s;
}
.connect-btn:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.connect-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.connect-btn-title { font-size: 14.5px; font-weight: 620; color: var(--text); }
.connect-btn-sub { font-size: 12.5px; color: var(--text-dim); }
.connect-note { font-size: 12px; color: var(--text-dim); margin: 18px 0 0; }
.connect-progress { margin-top: 18px; font-size: 13px; color: var(--accent); }

/* ── Source pill ─────────────────────────────────────────────────────── */
.source-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 12.5px; color: var(--text-dim);
  white-space: nowrap;
}
.source-pill button {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 13px; padding: 2px 6px; border-radius: 99px;
}
.source-pill button:hover { background: var(--bg); color: var(--accent); }

/* ── Insights ────────────────────────────────────────────────────────── */
.insights-shell { max-width: 1180px; margin: 0 auto; padding-bottom: 60px; }
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; padding: 18px 44px 6px;
}
.stat-card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 18px;
}
.stat-card.stat-warn { border-color: rgba(248, 113, 113, 0.45); }
.stat-card.stat-warn .stat-num { color: #f87171; }
.stat-num { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.stat-label { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 2px; }
.stat-bar { height: 4px; background: var(--bg-hover); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.stat-bar-fill { height: 100%; background: var(--green); border-radius: 99px; }

.insights-grid {
  display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; padding: 18px 44px 0;
  align-items: start;
}
.insights-side { display: flex; flex-direction: column; gap: 18px; }
.panel {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px 20px;
}
.panel:hover { border-color: var(--border-light); }
.panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.panel-head h3 { margin: 0; }
.empty-msg { color: var(--text-dim); font-size: 13px; padding: 8px 0; }

.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
  transition: opacity 0.4s;
}
.task-row:last-child { border-bottom: none; }
.task-row.task-done { opacity: 0.35; }
.task-row.task-done .task-text { text-decoration: line-through; }
.task-check { margin-top: 4px; accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }
.task-body { flex: 1; min-width: 0; }
.task-text { font-size: 13.8px; line-height: 1.5; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.task-note { font-size: 12px; color: var(--accent); cursor: pointer; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.task-note:hover { text-decoration: underline; }
.task-badge { font-size: 10.5px; padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.badge-red { color: #f87171; background: rgba(248, 113, 113, 0.12); }
.badge-amber { color: var(--amber); background: rgba(251, 191, 36, 0.12); }
.badge-purple { color: var(--accent); background: var(--accent-soft); }
.badge-dim { color: var(--text-dim); background: var(--bg-hover); }
.task-score {
  font-size: 11.5px; font-weight: 700; color: var(--text-dim);
  background: var(--bg-hover); border-radius: 99px; padding: 2px 9px; margin-top: 3px; flex-shrink: 0;
}

.folder-bar-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.folder-bar-label { font-size: 12.5px; color: var(--text-dim); width: 110px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-bar { flex: 1; height: 7px; background: var(--bg-hover); border-radius: 99px; overflow: hidden; }
.folder-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.folder-bar-n { font-size: 12px; color: var(--text); width: 28px; text-align: right; }

/* ── Focus view ──────────────────────────────────────────────────────── */
.focus-shell { max-width: 1180px; margin: 0 auto; padding-bottom: 60px; }
.focus-suggestion {
  margin: 14px 0 0; font-size: 14.5px; line-height: 1.65; color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg-raised);
  border: 1px solid var(--border); position: relative;
  border-radius: 0 12px 12px 0; padding: 12px 18px 12px 21px; max-width: 880px;
}
.focus-suggestion::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--grad); border-radius: 3px;
}
.focus-grid {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px;
  padding: 22px 44px 0; align-items: start;
}
.focus-tasks { grid-row: span 2; }
.panel-link { font-size: 12.5px; color: var(--accent); cursor: pointer; font-weight: 550; }
.panel-link:hover { text-decoration: underline; }
.panel-sub { font-size: 12px; color: var(--text-dim); margin: -4px 0 10px; }

.momentum-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.momentum-row:last-child { border-bottom: none; }
.momentum-head { display: flex; justify-content: space-between; align-items: baseline; }
.momentum-folder { font-size: 13.5px; font-weight: 620; }
.momentum-count { font-size: 11.5px; color: var(--text-dim); }
.momentum-notes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.note-pill {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg-hover);
  border: 1px solid var(--border); padding: 2px 9px; border-radius: 99px;
  cursor: pointer; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.note-pill:hover { color: var(--accent); border-color: var(--accent); }

.theme-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--accent); background: var(--accent-soft);
  border: 1px solid transparent; padding: 4px 12px; border-radius: 99px;
  cursor: pointer; font-weight: 560;
}
.theme-chip:hover { border-color: var(--accent); }
.theme-chip .chip-n { font-size: 10.5px; color: var(--text-dim); font-weight: 700; }
.theme-chip .chip-rising { font-size: 10px; color: var(--amber); font-weight: 700; }

.attention-row {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  font-size: 13px; border-bottom: 1px solid var(--border);
}
.attention-row:last-child { border-bottom: none; }
.attention-icon { flex-shrink: 0; }
.attention-link { color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-link:hover { color: var(--accent); }
.attention-meta { font-size: 11.5px; color: var(--text-dim); margin-left: auto; flex-shrink: 0; }

/* ── Icon button / sidebar actions ───────────────────────────────────── */
.icon-btn {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-size: 15px; padding: 5px 10px; border-radius: 8px; cursor: pointer; transition: all 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-light); background: var(--bg-hover); }
.sidebar-actions { display: flex; gap: 2px; }

/* ── Modal ───────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(8, 10, 14, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 300;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--bg-raised); border: 1px solid var(--border-light);
  border-radius: 16px; padding: 24px 28px; width: 420px; max-width: 92vw;
  box-shadow: 0 18px 60px var(--shadow);
}
.modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 680; }
.modal-label { display: block; font-size: 11.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-dim); margin: 12px 0 5px; }
.modal input {
  width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
.modal input:focus { border-color: var(--accent); }
.modal-hint { font-size: 12px; color: var(--text-dim); margin: 10px 0 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@media (max-width: 1000px) {
  .focus-grid { grid-template-columns: 1fr; }
}

/* ── Graph mode buttons ──────────────────────────────────────────────── */
.graph-mode { display: flex; gap: 6px; }
.mode-btn {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  color: var(--text-dim); padding: 5px 10px; border-radius: 7px;
  cursor: pointer; font-size: 12.5px; font-weight: 600; transition: all 0.15s;
}
.mode-btn:hover { color: var(--text); border-color: var(--border-light); }
.mode-btn.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(124,140,248,0.35); }

@media (max-width: 1000px) {
  .insights-grid { grid-template-columns: 1fr; }
  .stat-row, .insights-grid { padding-left: 20px; padding-right: 20px; }
}

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--bg-raised); border: 1px solid var(--border-light);
  color: var(--text); padding: 10px 22px; border-radius: 99px; font-size: 13.5px;
  box-shadow: 0 8px 30px var(--shadow); z-index: 200;
  animation: toast-in 0.2s ease;
}
.toast.ok { border-color: rgba(74, 222, 128, 0.4); }
.toast.err { border-color: rgba(248, 113, 113, 0.5); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #3c4862; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .note-links { grid-template-columns: 1fr; }
  .topic-grid { padding: 20px; }
  .dash-hero { padding: 24px 20px 0; }
}

/* ── Command palette ─────────────────────────────────────────────────── */
.palette-overlay {
  position: fixed; inset: 0; background: rgba(8, 10, 14, 0.55);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 14vh; z-index: 400; backdrop-filter: blur(4px);
  animation: view-in 0.18s ease;
}
.palette {
  width: 580px; max-width: 92vw; max-height: 60vh;
  background: var(--glass); border: 1px solid var(--border-light);
  border-radius: 16px; box-shadow: 0 24px 80px var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; backdrop-filter: blur(16px);
}
.palette-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.palette-icon { font-size: 15px; color: var(--accent); }
#palette-input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 15.5px; font-family: var(--font);
}
.palette-list { overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px;
}
.palette-item.active, .palette-item:hover { background: var(--accent-soft); }
.palette-item .pi-icon { width: 22px; text-align: center; flex-shrink: 0; }
.palette-item .pi-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .pi-hint { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.palette-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-dim); font-weight: 700; padding: 10px 12px 4px;
}
kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-dim);
  background: var(--bg-hover); border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px;
}

/* ── Hero actions / kbd hint ─────────────────────────────────────────── */
.hero-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.kbd-hint { font-size: 12px; color: var(--text-dim); margin-left: 6px; }

/* ── Activity heatmap ────────────────────────────────────────────────── */
#focus-heatmap {
  display: grid; grid-template-rows: repeat(7, 11px); grid-auto-flow: column;
  grid-auto-columns: 11px; gap: 3px; padding: 4px 0 2px; overflow-x: auto;
}
.hm-cell { width: 11px; height: 11px; border-radius: 3px; background: var(--bg-hover); }
.hm-1 { background: color-mix(in srgb, var(--accent) 30%, var(--bg-hover)); }
.hm-2 { background: color-mix(in srgb, var(--accent) 55%, var(--bg-hover)); }
.hm-3 { background: color-mix(in srgb, var(--accent) 80%, var(--bg-hover)); }
.hm-4 { background: var(--accent); }

/* ── Neighborhood mini-graph ─────────────────────────────────────────── */
.local-graph-card {
  margin-top: 36px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px 18px 8px;
}
.local-graph-card h4 {
  margin: 0 0 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim);
}
#local-graph { height: 240px; border-radius: 10px; overflow: hidden; }
.local-graph-card + .note-links { margin-top: 18px; }

/* Similar-notes column shares the links grid */
.note-links.has-similar { grid-template-columns: repeat(3, 1fr); }
.links-col .link-terms { font-size: 10.5px; color: var(--text-dim); margin-left: 6px; }
@media (max-width: 1100px) {
  .note-links.has-similar { grid-template-columns: 1fr; }
}

/* ── Now Mode (one thing only) ───────────────────────────────────────── */
#view-now { display: flex; align-items: center; justify-content: center; }
.now-shell {
  max-width: 720px; width: 100%; padding: 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.now-label {
  font-size: 11px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--accent);
}
.now-task { font-size: 30px; font-weight: 750; line-height: 1.35; letter-spacing: -0.4px; }
.now-note { font-size: 13.5px; color: var(--accent); cursor: pointer; }
.now-note:hover { text-decoration: underline; }
.now-timer { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.timer-ring {
  width: 190px; height: 190px; border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--accent) 0%, var(--bg-hover) 0);
  transition: background 0.3s linear;
}
.timer-ring::before {
  content: ''; position: absolute; width: 168px; height: 168px; border-radius: 50%;
  background: var(--bg);
}
#timer-display {
  position: relative; font-size: 38px; font-weight: 750; font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.timer-presets { display: flex; gap: 8px; }
.timer-presets .preset { flex: none; padding: 5px 14px; }
.now-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-lg { padding: 11px 26px; font-size: 14.5px; border-radius: 12px; }
.now-hint { font-size: 12.5px; color: var(--text-dim); }
.now-break .now-task { color: var(--green); }

/* timer chip in topbar */
.timer-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent-soft); border: 1px solid var(--accent);
  color: var(--accent); font-weight: 700; font-size: 12.5px;
  padding: 5px 13px; border-radius: 99px; cursor: pointer;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  animation: chip-pulse 2.4s ease infinite;
}
@keyframes chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 5px var(--accent-soft); }
}
.wins-chip {
  font-size: 12px; font-weight: 650; color: var(--text-dim);
  background: var(--bg-hover); border: 1px solid var(--border);
  padding: 4px 11px; border-radius: 99px; white-space: nowrap;
}

/* confetti */
.confetti {
  position: fixed; top: -16px; width: 8px; height: 14px; z-index: 900;
  border-radius: 2px; pointer-events: none;
  animation: confetti-fall ease-in forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(108vh) rotate(740deg); opacity: 0.85; }
}

/* quick wins rows */
.qw-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.qw-row:last-child { border-bottom: none; }
.qw-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qw-go {
  background: var(--accent-soft); border: none; color: var(--accent);
  border-radius: 7px; padding: 3px 10px; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.qw-go:hover { background: var(--accent); color: var(--accent-text); }

/* per-task focus button */
.task-focus-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  font-size: 13px; padding: 2px 6px; border-radius: 6px; flex-shrink: 0; margin-top: 2px;
}
.task-focus-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* ── Review view ─────────────────────────────────────────────────────── */
.review-shell { max-width: 1180px; margin: 0 auto; padding-bottom: 60px; }
.review-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
  padding: 22px 44px 0; align-items: start;
}
.review-wide { grid-column: 1 / -1; }
.panel-counter { font-size: 12px; color: var(--text-dim); font-weight: 650; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.redis-card, .triage-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; min-height: 132px;
}
.redis-reason {
  font-size: 11.5px; font-weight: 700; color: var(--amber); margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.redis-title { font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.redis-folder { font-size: 11.5px; color: var(--accent); margin-bottom: 8px; }
.redis-excerpt { font-size: 13px; color: var(--text-dim); line-height: 1.6; }

.triage-text { font-size: 15.5px; font-weight: 600; line-height: 1.5; margin-bottom: 8px; }
.triage-meta { font-size: 12px; color: var(--text-dim); }
.triage-meta .task-note { font-size: 12px; }
.triage-age { color: var(--amber); font-weight: 650; }
.review-done-msg { color: var(--text-dim); font-size: 13.5px; padding: 30px 0; text-align: center; }

.folder-bar-pct { font-size: 10.5px; color: var(--text-dim); width: 64px; text-align: right; flex-shrink: 0; }

@media (max-width: 1000px) {
  .review-grid { grid-template-columns: 1fr; padding: 18px 20px 0; }
}

/* ── Focus nudges + pinned + on this day (round 6) ───────────────────── */
.nudge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.nudge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600;
  padding: 5px 13px; border-radius: 99px; border: 1px solid var(--border); cursor: default;
}
.nudge.good { color: var(--green); background: color-mix(in srgb, var(--green) 12%, transparent); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.nudge.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.nudge.info { color: var(--accent); background: var(--accent-soft); }
.nudge.clickable { cursor: pointer; }
.nudge.clickable:hover { filter: brightness(1.15); }

.pinned-strip {
  display: flex; align-items: center; gap: 12px; margin: 18px 44px 0;
  padding: 10px 16px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 12px;
}
.pinned-label { font-size: 12px; font-weight: 700; color: var(--text-dim); white-space: nowrap; }
.pinned-items { display: flex; flex-wrap: wrap; gap: 8px; }
.pinned-item {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  background: var(--bg-hover); border: 1px solid var(--border); border-radius: 99px;
  padding: 3px 6px 3px 12px; cursor: pointer;
}
.pinned-item:hover { border-color: var(--accent); color: var(--accent); }
.pinned-item .pin-x { font-size: 13px; color: var(--text-faint); padding: 0 4px; border-radius: 99px; }
.pinned-item .pin-x:hover { color: #f87171; }

.onthisday { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.onthisday-label { font-size: 11px; font-weight: 700; color: var(--amber); margin-bottom: 6px; }
.onthisday a { display: block; font-size: 13px; color: var(--text); cursor: pointer; padding: 3px 0; }
.onthisday a:hover { color: var(--accent); }
.onthisday a .years { color: var(--text-dim); font-size: 11.5px; }

/* ── Vault doctor ────────────────────────────────────────────────────── */
.doctor-row { padding: 7px 0; border-bottom: 1px solid var(--border); }
.doctor-row:last-child { border-bottom: none; }
.doctor-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
.doctor-count { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin-left: auto; }
.doctor-count.bad { color: #f87171; background: rgba(248,113,113,0.12); }
.doctor-count.ok { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.doctor-detail { font-size: 12px; color: var(--text-dim); margin-top: 3px; line-height: 1.5; }
.doctor-detail a { color: var(--accent); cursor: pointer; }
.doctor-detail a:hover { text-decoration: underline; }

/* ── Note stats / outline / pin / draft ──────────────────────────────── */
.note-stats { font-size: 12px; color: var(--text-dim); margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.note-outline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.outline-chip {
  font-size: 11.5px; color: var(--text-dim); background: var(--bg-hover);
  border: 1px solid var(--border); border-radius: 7px; padding: 3px 10px; cursor: pointer;
}
.outline-chip:hover { color: var(--accent); border-color: var(--accent); }
.outline-chip.lvl3 { opacity: 0.78; font-size: 11px; }
.tag-chip.clickable { cursor: pointer; }
.tag-chip.clickable:hover { filter: brightness(1.2); }
#btn-pin.pinned { color: var(--amber); border-color: var(--amber); }

.draft-restore {
  margin: 14px 0 0; padding: 10px 16px; border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 12%, var(--bg-raised));
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  font-size: 13px; color: var(--text);
}
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 600; padding: 0 4px; }
.link-btn:hover { text-decoration: underline; }

/* ── Modal select ────────────────────────────────────────────────────── */
.modal-select {
  width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
.modal-select:focus { border-color: var(--accent); }

/* ── Learning queue ──────────────────────────────────────────────────── */
.learn-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.learn-row:last-child { border-bottom: none; }
.learn-body { flex: 1; min-width: 0; }
.learn-name { font-size: 13.5px; font-weight: 600; cursor: pointer; }
.learn-name:hover { color: var(--accent); }
.learn-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.learn-age { color: var(--amber); font-weight: 600; }

/* + Link button on similar notes */
.link-add {
  background: var(--accent-soft); border: none; color: var(--accent);
  border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer;
  padding: 2px 7px; margin-left: 8px; flex-shrink: 0;
}
.link-add:hover { background: var(--accent); color: var(--accent-text); }
.links-col.similar .link-item { display: flex; align-items: center; }
.links-col.similar .link-item .l-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* ── Home view ───────────────────────────────────────────────────────── */
.home-shell { max-width: 1260px; margin: 0 auto; padding-bottom: 60px; }
.resume-card {
  margin: 6px 44px 0; padding: 16px 20px; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg-raised);
  border: 1px solid var(--border); position: relative; overflow: hidden;
}
.resume-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.resume-card:hover { border-color: var(--accent); }
.resume-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); }
.resume-title { font-size: 19px; font-weight: 700; margin-top: 4px; letter-spacing: -0.3px; }
.resume-meta { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }

.home-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 18px; padding: 22px 44px 0; align-items: start;
}
.home-types { grid-column: span 2; }
@media (max-width: 760px) { .home-types { grid-column: span 1; } }

.type-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.type-pill {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  font-size: 13px; font-weight: 600; padding: 6px 13px; border-radius: 10px;
  background: var(--bg-hover); border: 1px solid var(--border); text-transform: capitalize;
}
.type-pill:hover, .type-pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.type-pill .type-n { font-size: 11px; font-weight: 700; color: var(--text-dim); }
.type-pill.active .type-n { color: var(--accent); }
.type-icon { font-size: 14px; }
.type-notes { margin-top: 12px; }
.type-notes:empty { display: none; }

.home-item {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin: 0 -8px;
  border-radius: 7px; cursor: pointer; font-size: 13.5px;
  white-space: nowrap; overflow: hidden;
}
.home-item:hover { background: var(--bg-hover); color: var(--accent); }
.home-item .hi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.home-item .hi-meta { font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.home-item .hi-type {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700;
  color: var(--text-dim); background: var(--bg-hover); padding: 1px 6px; border-radius: 5px; flex-shrink: 0;
}
.signal-line { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.signal-line:last-child { border-bottom: none; }
.signal-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 1px 6px; border-radius: 5px; margin-right: 7px; }
.signal-tag.block { color: #f87171; background: rgba(248,113,113,0.12); }
.signal-tag.follow { color: var(--accent); background: var(--accent-soft); }
.signal-text { color: var(--text); }
.signal-note { display: block; font-size: 11px; color: var(--accent); cursor: pointer; margin-top: 2px; }
.signal-note:hover { text-decoration: underline; }
.week-stat { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.week-stat:last-child { border-bottom: none; }
.week-stat b { color: var(--accent); }
.type-pill.type-more { color: var(--text-dim); font-style: italic; }

/* ── Ask (AI search) ─────────────────────────────────────────────────── */
.ask-shell { max-width: 860px; margin: 0 auto; padding: 34px 40px 80px; }
.ask-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ask-header h1 {
  margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.ask-sub { color: var(--text-dim); font-size: 13.5px; margin: 8px 0 18px; line-height: 1.6; }
.ask-input-row { display: flex; gap: 10px; }
#ask-input {
  flex: 1; padding: 12px 16px; border-radius: 12px; font-size: 15px;
  border: 1px solid var(--border-light); background: var(--bg-raised); color: var(--text); outline: none;
}
#ask-input:focus { border-color: var(--accent); }
.ask-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ask-chip {
  font-size: 12.5px; color: var(--text-dim); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 99px; padding: 5px 13px; cursor: pointer;
}
.ask-chip:hover { border-color: var(--accent); color: var(--accent); }

.ask-thread { margin-top: 28px; display: flex; flex-direction: column; gap: 24px; }
.ask-turn { animation: view-in 0.25s ease; }
.ask-q { font-size: 16px; font-weight: 700; display: flex; gap: 9px; align-items: flex-start; }
.ask-q::before { content: '❓'; font-size: 15px; }
.ask-a { margin-top: 12px; padding: 16px 20px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 14px; }
.ask-a-body { font-size: 14.5px; line-height: 1.7; }
.ask-a-body p { margin: 0.5em 0; }
.ask-a-body strong { font-weight: 680; }
.ask-thinking { color: var(--text-dim); font-size: 13.5px; display: flex; align-items: center; gap: 9px; }
.ask-thinking::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border-light); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cite {
  color: var(--accent); background: var(--accent-soft); cursor: pointer;
  border-radius: 5px; padding: 0 5px; font-weight: 600; font-size: 0.92em; white-space: nowrap;
}
.cite:hover { background: var(--accent); color: var(--accent-text); }
.ask-sources { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.ask-sources-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 700; margin-bottom: 8px; }
.ask-source { padding: 7px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.ask-source:last-child { border-bottom: none; }
.ask-source:hover .ask-source-name { color: var(--accent); }
.ask-source-name { font-size: 13px; font-weight: 600; }
.ask-source-snip { font-size: 12px; color: var(--text-dim); margin-top: 2px; line-height: 1.5; }
.ask-backend-tag { font-size: 11px; color: var(--text-dim); margin-top: 10px; }

/* AI modal */
.modal-wide { width: 520px; }
.modal-input {
  width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 14px; margin-bottom: 2px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none;
}
.modal-input:focus { border-color: var(--accent); }
.key-note { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint); font-size: 10.5px; }
.ai-backends { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.ai-opt { display: flex; gap: 11px; align-items: flex-start; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.ai-opt:hover { border-color: var(--border-light); }
.ai-opt input { margin-top: 3px; accent-color: var(--accent); }
.ai-opt div { display: flex; flex-direction: column; }
.ai-opt b { font-size: 13.5px; }
.ai-opt span { font-size: 12px; color: var(--text-dim); }
.ai-fields { margin-top: 4px; }

/* ── Modes + Share (round 9) ─────────────────────────────────────────── */
.mode-select {
  background: var(--bg-hover); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 12.5px; font-weight: 600; border-radius: 8px;
  padding: 6px 10px; cursor: pointer; outline: none; max-width: 160px;
}
.mode-select:hover { border-color: var(--border-light); }
.mode-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 12px; padding: 9px 15px; border-radius: 10px;
  background: var(--accent-soft); border: 1px solid var(--border); font-size: 13px;
}
.mode-banner b { color: var(--accent); }
.mode-banner .mode-sub { color: var(--text-dim); }
.mode-banner .mode-clear { margin-left: auto; color: var(--accent); cursor: pointer; font-weight: 600; font-size: 12.5px; }
.mode-banner .mode-clear:hover { text-decoration: underline; }

/* ── Board (kanban) ──────────────────────────────────────────────────── */
.board-shell { padding: 28px 32px 20px; height: 100%; display: flex; flex-direction: column; }
.board-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.board-head h1 {
  margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.5px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.board-controls { display: flex; gap: 8px; }
.board-hint { color: var(--text-dim); font-size: 12.5px; margin: 8px 0 16px; }
.board-columns { display: flex; gap: 14px; overflow-x: auto; flex: 1; padding-bottom: 14px; align-items: flex-start; }
.board-col {
  flex: 0 0 270px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 14px; max-height: 100%; display: flex; flex-direction: column;
}
.board-col.drop-target { border-color: var(--accent); background: var(--accent-soft); }
.board-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px 9px; font-size: 13px; font-weight: 700; text-transform: capitalize;
  position: sticky; top: 0;
}
.board-col-head .col-n { font-size: 11px; color: var(--text-dim); background: var(--bg-hover); padding: 1px 8px; border-radius: 99px; }
.board-col-body { overflow-y: auto; padding: 0 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.board-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; cursor: grab; transition: border-color 0.12s, transform 0.12s;
}
.board-card:hover { border-color: var(--border-light); transform: translateY(-1px); }
.board-card.dragging { opacity: 0.45; }
.board-card .bc-name { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.board-card .bc-meta { font-size: 11px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.board-card .bc-type { color: var(--accent); }

/* ── Wikilink autocomplete ───────────────────────────────────────────── */
.note-body { position: relative; }
.wl-autocomplete {
  position: absolute; z-index: 60; min-width: 240px; max-width: 340px; max-height: 240px; overflow-y: auto;
  background: var(--bg-raised); border: 1px solid var(--border-light); border-radius: 10px;
  box-shadow: 0 12px 36px var(--shadow); padding: 4px;
}
.wl-item { padding: 7px 11px; border-radius: 7px; cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-item.active, .wl-item:hover { background: var(--accent-soft); color: var(--accent); }
.wl-item .wl-folder { font-size: 10.5px; color: var(--text-dim); margin-left: 6px; }
#btn-read.reading { color: var(--accent); border-color: var(--accent); }

/* ── Command Center (FineReport-style big screen) ────────────────────── */
#view-command { overflow: hidden; }
.cc {
  --cc-bg0: #04070f; --cc-bg1: #0a1830; --cc-line: rgba(56,189,248,0.22);
  --cc-line2: rgba(56,189,248,0.4); --cc-cyan: #2fe0ff; --cc-text: #cfe6f8;
  --cc-dim: #6f90b6; --cc-glow: rgba(47,224,255,0.35);
  height: 100%; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px;
  color: var(--cc-text); position: relative;
  background:
    radial-gradient(1200px 700px at 50% -10%, #11315c 0%, transparent 60%),
    radial-gradient(900px 600px at 0% 100%, #0b1f3d 0%, transparent 55%),
    linear-gradient(160deg, var(--cc-bg1), var(--cc-bg0));
  font-variant-numeric: tabular-nums;
}
.cc::before { /* faint grid overlay */
  content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(var(--cc-line) 1px, transparent 1px), linear-gradient(90deg, var(--cc-line) 1px, transparent 1px);
  background-size: 46px 46px; mask-image: radial-gradient(circle at 50% 40%, #000 30%, transparent 85%);
}

/* topbar */
.cc-topbar {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 8px 26px 14px; border-bottom: 1px solid var(--cc-line);
}
.cc-topbar::after { content: ''; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cc-cyan), transparent); filter: drop-shadow(0 0 6px var(--cc-cyan)); }
.cc-corner { position: absolute; width: 26px; height: 26px; top: 4px; }
.cc-corner.tl { left: 6px; border-left: 2px solid var(--cc-line2); border-top: 2px solid var(--cc-line2); }
.cc-corner.tr { right: 6px; border-right: 2px solid var(--cc-line2); border-top: 2px solid var(--cc-line2); }
.cc-title { text-align: center; }
.cc-title-main {
  font-size: 27px; font-weight: 800; letter-spacing: 7px;
  background: linear-gradient(180deg, #ffffff, #7fdcff); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; text-shadow: 0 0 22px var(--cc-glow); display: block;
}
.cc-title-sub { display: block; font-size: 11px; letter-spacing: 6px; color: var(--cc-cyan); margin-top: 2px; opacity: 0.85; }
.cc-title-side { font-size: 12px; letter-spacing: 2px; color: var(--cc-dim); align-self: center; }
.cc-title-side.cc-clock { text-align: right; color: var(--cc-cyan); }

/* grid */
.cc-grid { flex: 1; display: grid; grid-template-columns: 1fr 1.55fr 1fr; gap: 12px; min-height: 0; position: relative; z-index: 1; }
.cc-col { display: flex; flex-direction: column; gap: 12px; min-height: 0; min-width: 0; }
.cc-col-center { min-width: 0; }

/* panels */
.cc-panel {
  position: relative; background: linear-gradient(180deg, rgba(17,42,74,0.55), rgba(7,20,40,0.5));
  border: 1px solid var(--cc-line); border-radius: 4px; backdrop-filter: blur(3px);
  display: flex; flex-direction: column; min-height: 0;
  box-shadow: inset 0 0 28px rgba(20,70,130,0.25), 0 6px 22px rgba(0,0,0,0.35);
  animation: cc-fade 0.5s ease both;
}
.cc-panel-grow, .cc-panel-graph { flex: 1; }
.cc-panel-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px; font-size: 12px; font-weight: 700; letter-spacing: 1.5px; color: #bfe6ff;
  border-bottom: 1px solid var(--cc-line);
}
.cc-panel-h::before { content: ''; width: 3px; height: 13px; background: var(--cc-cyan); margin-right: 9px;
  box-shadow: 0 0 8px var(--cc-cyan); border-radius: 2px; }
.cc-panel-h > span:first-child { flex: 1; display: flex; align-items: center; }
.cc-panel-b { flex: 1; padding: 12px 14px; min-height: 0; position: relative; }
.cb { position: absolute; width: 9px; height: 9px; pointer-events: none; }
.cb.tl { top: -1px; left: -1px; border-left: 2px solid var(--cc-cyan); border-top: 2px solid var(--cc-cyan); }
.cb.tr { top: -1px; right: -1px; border-right: 2px solid var(--cc-cyan); border-top: 2px solid var(--cc-cyan); }
.cb.bl { bottom: -1px; left: -1px; border-left: 2px solid var(--cc-cyan); border-bottom: 2px solid var(--cc-cyan); }
.cb.br { bottom: -1px; right: -1px; border-right: 2px solid var(--cc-cyan); border-bottom: 2px solid var(--cc-cyan); }
@keyframes cc-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* KPI cards */
.cc-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-kpi {
  position: relative; background: linear-gradient(180deg, rgba(17,42,74,0.5), rgba(7,20,40,0.45));
  border: 1px solid var(--cc-line); border-radius: 4px; padding: 12px 14px; overflow: hidden;
}
.cc-kpi::after { content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%; background: var(--k, var(--cc-cyan)); box-shadow: 0 0 10px var(--k, var(--cc-cyan)); }
.cc-kpi-val { font-size: 26px; font-weight: 800; color: #eaf6ff; text-shadow: 0 0 16px var(--k, var(--cc-glow)); line-height: 1.1; }
.cc-kpi-label { font-size: 10.5px; letter-spacing: 1.2px; color: var(--cc-dim); text-transform: uppercase; margin-top: 3px; }

/* donut + legend */
.cc-donut-wrap { display: flex; align-items: center; gap: 12px; }
#cc-donut { flex-shrink: 0; }
.cc-legend { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; flex: 1; min-width: 0; }
.cc-legend-row { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.cc-legend-row:hover { color: #fff; }
.cc-legend-dot { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.cc-legend-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--cc-text); }
.cc-legend-n { color: var(--cc-dim); }

/* gauge */
#cc-gauge { display: flex; align-items: center; justify-content: center; }

/* bars */
.cc-bar-row { display: flex; align-items: center; gap: 9px; margin: 9px 0; }
.cc-bar-label { width: 92px; font-size: 11px; color: var(--cc-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.cc-bar-track { flex: 1; height: 9px; background: rgba(56,189,248,0.08); border-radius: 2px; overflow: hidden; }
.cc-bar-fill { height: 100%; border-radius: 2px; width: 0; transition: width 0.9s cubic-bezier(.2,.8,.2,1); box-shadow: 0 0 8px var(--cc-glow); }
.cc-bar-n { width: 30px; text-align: right; font-size: 11.5px; color: var(--cc-text); flex-shrink: 0; }

/* feed list */
.cc-feed { overflow-y: auto; display: flex; flex-direction: column; }
.cc-feed-row { padding: 7px 2px; border-bottom: 1px solid rgba(56,189,248,0.1); cursor: pointer; display: flex; gap: 9px; align-items: flex-start; }
.cc-feed-row:hover { background: rgba(47,224,255,0.06); }
.cc-feed-rank { color: var(--cc-cyan); font-weight: 800; font-size: 12px; min-width: 18px; }
.cc-feed-txt { flex: 1; min-width: 0; overflow: hidden; }
.cc-feed-name { font-size: 12.5px; color: #dbeeff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-feed-meta { font-size: 10.5px; color: var(--cc-dim); margin-top: 1px; }

/* spark */
.cc-panel-spark { height: 150px; flex-shrink: 0; }

/* replay button */
.cc-replay { background: rgba(47,224,255,0.1); border: 1px solid var(--cc-line2); color: var(--cc-cyan);
  font-size: 10.5px; letter-spacing: 1px; font-weight: 700; padding: 3px 10px; border-radius: 3px; cursor: pointer; }
.cc-replay:hover { background: var(--cc-cyan); color: #04111f; }

/* tree svg */
#cc-tree { padding: 4px; }
#cc-tree svg { width: 100%; height: 100%; display: block; }
.cc-tree-link { fill: none; stroke: rgba(90,180,235,0.45); }
.cc-tree-node { cursor: pointer; }
.cc-tree-node:hover circle { stroke: #fff; stroke-width: 1.5; }
.cc-tree-label { fill: #bfe6ff; font-size: 9px; pointer-events: none; }

@media (max-width: 1100px) { .cc-grid { grid-template-columns: 1fr; overflow-y: auto; } .cc-col-center { order: -1; } }

/* ══ COMMAND theme: big-screen look applied app-wide (round 12) ════════ */
html[data-theme="command"] {
  --bg: #050b16; --bg-raised: #0b1d34; --bg-hover: #102a49;
  --border: rgba(56,189,248,0.24); --border-light: rgba(56,189,248,0.5);
  --text: #d6ebff; --text-dim: #83a3c8; --text-faint: #5d7da3;
  --accent: #2fe0ff; --accent-soft: rgba(47,224,255,0.12);
  --green: #34d399; --amber: #fbbf24;
  --glass: rgba(9,22,42,0.9); --accent-text: #04111f; --shadow: rgba(0,0,0,0.6);
  --grad: linear-gradient(120deg, #9befff, #38bdf8 55%, #34d399);
}
html[data-theme="command"] body {
  background:
    radial-gradient(1100px 650px at 50% -8%, rgba(20,60,110,0.45), transparent 60%),
    linear-gradient(160deg, #0a1a34, #04070f 80%);
}
/* faint grid overlay */
html[data-theme="command"] body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.6;
  background-image: linear-gradient(rgba(56,189,248,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(56,189,248,0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(circle at 50% 38%, #000 35%, transparent 92%);
  mask-image: radial-gradient(circle at 50% 38%, #000 35%, transparent 92%);
}
/* lift real content above the backdrop */
html[data-theme="command"] .layout { position: relative; z-index: 1; }
html[data-theme="command"] .main { background: transparent; }
html[data-theme="command"] .sidebar,
html[data-theme="command"] .topbar { background: rgba(8,20,38,0.93); border-color: var(--border); }

/* panels get the glow + corner brackets everywhere */
html[data-theme="command"] .panel,
html[data-theme="command"] .topic-card,
html[data-theme="command"] .stat-card,
html[data-theme="command"] .links-col,
html[data-theme="command"] .local-graph-card,
html[data-theme="command"] .connect-card,
html[data-theme="command"] .modal,
html[data-theme="command"] .redis-card,
html[data-theme="command"] .triage-card {
  position: relative;
  background: linear-gradient(180deg, rgba(13,32,58,0.86), rgba(7,18,36,0.84));
  border: 1px solid var(--border); border-radius: 5px;
  box-shadow: inset 0 0 26px rgba(20,70,130,0.18), 0 8px 26px rgba(0,0,0,0.4);
}
html[data-theme="command"] .panel::after,
html[data-theme="command"] .topic-card::after,
html[data-theme="command"] .stat-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    linear-gradient(var(--accent),var(--accent)) left top, linear-gradient(var(--accent),var(--accent)) left top,
    linear-gradient(var(--accent),var(--accent)) right top, linear-gradient(var(--accent),var(--accent)) right top,
    linear-gradient(var(--accent),var(--accent)) left bottom, linear-gradient(var(--accent),var(--accent)) left bottom,
    linear-gradient(var(--accent),var(--accent)) right bottom, linear-gradient(var(--accent),var(--accent)) right bottom;
  background-repeat: no-repeat;
  background-size: 11px 2px, 2px 11px, 11px 2px, 2px 11px, 11px 2px, 2px 11px, 11px 2px, 2px 11px;
  background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom;
  opacity: 0.7;
}
html[data-theme="command"] .topic-card:hover { box-shadow: inset 0 0 26px rgba(20,70,130,0.25), 0 0 22px rgba(47,224,255,0.18); }

/* glowing headings + nav */
html[data-theme="command"] .dash-hero h1,
html[data-theme="command"] .ask-header h1,
html[data-theme="command"] .board-head h1 { text-shadow: 0 0 20px rgba(47,224,255,0.35); }
html[data-theme="command"] .brand-name { text-shadow: 0 0 14px rgba(47,224,255,0.4); }
html[data-theme="command"] .nav-tab.active { box-shadow: inset 0 0 14px rgba(47,224,255,0.22); border-color: var(--border-light); }
html[data-theme="command"] .btn-primary { box-shadow: 0 0 16px rgba(47,224,255,0.4); }

/* frame text-heavy views as readable panels over the backdrop */
html[data-theme="command"] .note-shell {
  background: rgba(7,18,36,0.78); border: 1px solid var(--border); border-radius: 6px;
  padding-left: 30px; padding-right: 30px; box-shadow: inset 0 0 30px rgba(20,70,130,0.15), 0 8px 30px rgba(0,0,0,0.4);
}
html[data-theme="command"] .markdown pre,
html[data-theme="command"] .markdown code { background: rgba(8,22,42,0.9); }


/* ── No decorative motion except the Graph page (round 12 fix) ───────── */
html[data-theme="command"] .view { animation: none; }
html[data-theme="command"] .cc-panel,
html[data-theme="command"] .ask-turn,
html[data-theme="command"] .topic-card { animation: none; }
/* Command Center renders static (its tree/charts don't animate) */
html[data-theme="command"] #view-command *,
html[data-theme="command"] #view-command *::before,
html[data-theme="command"] #view-command *::after { transition: none !important; animation: none !important; }

/* Tree mode on the Graph page: make the SVG fill the container */
#graph-container > svg { width: 100%; height: 100%; display: block; }

/* ── Spinning-dots backdrop behind the graph (ambient animation) ─────── */
#view-graph { position: relative; }
#graph-bg {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  opacity: 0.55;
}
#graph-container { position: absolute; inset: 0; z-index: 1; }
#graph-bg svg { width: 100%; height: 100%; display: block; }
.gbg-rot { animation: gbg-spin 90s linear infinite; }
@keyframes gbg-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.gbg-rot2 { animation: gbg-spin 140s linear infinite reverse; }

/* Link to the About/explainer page from the connect screen */
.connect-about { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--accent); cursor: pointer; }
.connect-about:hover { text-decoration: underline; }
