/* ============================================================
   WOLF — Design system shared across all services
   Based on Claude Design handoff bundle (2026-04-18)
   Accent: or doux #E7B24A · Typo: Inter / Fraunces / JetBrains Mono
   Modes: dark (default) / light / auto · Radius & density tunable
   ============================================================ */

/* ==================== TOKENS ==================== */
:root {
  --accent: #E7B24A;
  --accent-soft: color-mix(in oklab, var(--accent) 18%, transparent);
  --radius: 10px;
  --radius-sm: calc(var(--radius) * 0.5);
  --radius-lg: calc(var(--radius) * 1.4);

  /* Densité */
  --gap: 20px;
  --pad: 22px;
  --row: 44px;

  /* Font stacks */
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-serif: 'Fraunces', 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --font-body: var(--font-sans);
  --font-display: var(--font-sans);

  --tap: 180ms cubic-bezier(.4,0,.2,1);
}

[data-density="compact"] { --gap: 12px; --pad: 14px; --row: 36px; }
[data-density="comfy"]   { --gap: 20px; --pad: 22px; --row: 44px; }
[data-density="roomy"]   { --gap: 28px; --pad: 30px; --row: 52px; }

[data-font="sans"]  { --font-body: var(--font-sans);  --font-display: var(--font-sans); }
[data-font="serif"] { --font-body: var(--font-sans);  --font-display: var(--font-serif); }
[data-font="mono"]  { --font-body: var(--font-mono);  --font-display: var(--font-mono); }

/* Dark (default) */
[data-theme="dark"] {
  --bg: #0C0D10;
  --bg-elev: #131518;
  --bg-elev-2: #1A1D22;
  --surface: #16191D;
  --surface-hov: #1E2127;
  --border: #23272D;
  --border-strong: #2E333B;
  --text: #ECECEC;
  --text-muted: #9AA0A8;
  --text-dim: #6B717A;
  --nav-bg: #0A0B0E;
  --nav-border: #1B1E22;
  --shadow-panel: 0 40px 80px -20px rgba(0,0,0,.6), 0 8px 24px -6px rgba(0,0,0,.4);
  --glow: 0 0 0 1px rgba(231,178,74,.2), 0 0 24px -6px rgba(231,178,74,.3);
  /* Sémantique */
  --ok:  #6EE882;
  --err: #E86B6B;
  color-scheme: dark;
}

/* Light */
[data-theme="light"] {
  --bg: #F7F5F0;
  --bg-elev: #FFFFFF;
  --bg-elev-2: #FBFAF6;
  --surface: #FFFFFF;
  --surface-hov: #F4F1EA;
  --border: #E8E3D7;
  --border-strong: #D9D3C2;
  --text: #141414;
  --text-muted: #5E6068;
  --text-dim: #8A8D95;
  --nav-bg: #141414;
  --nav-border: #2A2A2A;
  --shadow-panel: 0 40px 80px -20px rgba(20,20,20,.12), 0 8px 24px -6px rgba(20,20,20,.08);
  --glow: 0 0 0 1px rgba(231,178,74,.3), 0 0 24px -6px rgba(231,178,74,.25);
  --ok:  #20884B;
  --err: #C44545;
  color-scheme: light;
}

/* ==================== BASE ==================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .35s ease, color .35s ease;
  min-height: 100vh;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); color: var(--text); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ==================== TOP NAV ==================== */
.topnav {
  position: sticky; top: 0; z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: var(--nav-bg);
  color: #ECECEC;
  border-bottom: 1px solid var(--nav-border);
  backdrop-filter: saturate(140%) blur(10px);
}

.topnav__left { display: flex; align-items: center; gap: 12px; }
.topnav__center {
  display: flex; align-items: center; justify-content: center; gap: 2px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 999px; padding: 3px;
}
.topnav__right { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 600; letter-spacing: -.01em; font-size: 14px;
  color: #ECECEC;
}
.brand svg { color: var(--accent); }
.brand__sep { opacity: .3; margin: 0 2px; }
.brand__page {
  font-family: var(--font-mono); font-weight: 500; font-size: 12px;
  color: var(--accent); text-transform: lowercase;
}

/* Tabs */
.tab {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: #B4B6BA;
  transition: color var(--tap), background var(--tap);
  white-space: nowrap;
  text-decoration: none;
}
.tab:hover { color: #ECECEC; }
.tab[aria-selected="true"] {
  color: #0A0B0E;
  background: var(--accent);
}
.tab[aria-selected="true"] .tab__dot { background: #0A0B0E; }
.tab__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #606268;
  transition: background var(--tap), box-shadow var(--tap);
}
.tab:not([aria-selected="true"]):hover .tab__dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(231,178,74,.15);
}

/* Theme switch (top-nav) */
.theme-switch {
  position: relative;
  display: inline-flex;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
}
.theme-switch__opt {
  position: relative; z-index: 2;
  width: 30px; height: 26px;
  display: inline-grid; place-items: center;
  color: #8A8D95;
  border-radius: 999px;
  transition: color var(--tap);
}
.theme-switch__opt:hover { color: #ECECEC; }
.theme-switch__opt.is-active { color: #ECECEC; }
.theme-switch__indicator {
  position: absolute; z-index: 1;
  top: 3px; height: 26px; width: 30px;
  background: rgba(255,255,255,.1);
  border-radius: 999px;
  transition: transform var(--tap);
  pointer-events: none;
}

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: #B4B6BA;
  border-radius: 999px;
  transition: background var(--tap), color var(--tap);
  text-decoration: none;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #ECECEC; }

.avatar {
  width: 30px; height: 30px; border-radius: 999px;
  background: var(--accent); color: #0A0B0E;
  display: grid; place-items: center;
  font-weight: 700; font-size: 12px;
  font-family: var(--font-display);
  cursor: pointer;
}

/* ==================== MAIN ==================== */
main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 40px 32px 120px;
}
[data-density="compact"] main { padding: 24px 24px 80px; }
[data-density="roomy"]   main { padding: 56px 40px 140px; }

.page { animation: pageIn .4s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==================== SHARED PAGE HEAD ==================== */
.page-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 24px; margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.page-head__title {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 4px;
  line-height: 1.1;
}
[data-font="serif"] .page-head__title { font-size: 44px; letter-spacing: -.025em; font-weight: 400; }
.page-head__sub {
  font-size: 14px; color: var(--text-muted);
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  flex-wrap: wrap;
}
.page-head__sub .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.page-head__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px; font-weight: 500;
  transition: background var(--tap), border-color var(--tap), transform var(--tap);
  text-decoration: none;
}
.btn:hover { background: var(--surface-hov); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn--accent {
  background: var(--accent); color: #0A0B0E;
  border-color: var(--accent); font-weight: 600;
}
.btn--accent:hover {
  background: color-mix(in oklab, var(--accent) 85%, black);
  border-color: color-mix(in oklab, var(--accent) 85%, black);
}
.btn--danger {
  background: color-mix(in oklab, var(--err) 12%, transparent);
  border-color: color-mix(in oklab, var(--err) 40%, transparent);
  color: var(--err);
}
.btn-ghost {
  font-size: 12px; color: var(--text-muted);
  padding: 6px 10px; border-radius: var(--radius-sm);
  transition: color var(--tap), background var(--tap);
  background: transparent; border: none;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-hov); }

/* ==================== CARD (generic) ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
}
.card__label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

/* ==================== FORM INPUTS ==================== */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text);
  transition: border-color var(--tap), background var(--tap);
  font-size: 13px;
  outline: none;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  background: var(--surface);
}
.textarea { min-height: 80px; resize: vertical; font-family: inherit; }

.label {
  display: block;
  font-size: 12px; color: var(--text-muted); font-weight: 500;
  margin-bottom: 6px;
}

/* ==================== DRAWER ==================== */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed; top: 0; right: 0;
  width: 380px; height: 100vh; height: 100dvh;
  background: var(--bg-elev);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-panel);
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  z-index: 60;
  display: flex; flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }

.drawer__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer__eyebrow {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-muted); font-family: var(--font-mono);
  margin-bottom: 4px;
}
.drawer__title {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  margin: 0; letter-spacing: -.01em;
}
[data-font="serif"] .drawer__title { font-size: 26px; font-weight: 400; }

.drawer__body {
  flex: 1; overflow-y: auto;
  padding: 22px;
  display: flex; flex-direction: column; gap: 28px;
}

.panel-section {
  display: flex; flex-direction: column; gap: 14px;
}
.panel-section__label {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-muted); font-family: var(--font-mono);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field__label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text);
  font-weight: 500;
}
.field__value {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
}

/* Segmented */
.seg {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg__opt {
  height: 30px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 12px; font-weight: 500;
  color: var(--text-muted);
  transition: background var(--tap), color var(--tap);
  background: none; border: none; cursor: pointer;
}
.seg__opt:hover { color: var(--text); }
.seg__opt.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.1), 0 0 0 1px var(--border);
}

/* Slider */
.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--bg-elev-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-elev);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
  transition: transform var(--tap);
}
.slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.slider::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-elev);
  cursor: pointer;
}

.radius-preview {
  height: 34px;
  background: var(--bg-elev-2);
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 6px;
  display: flex; align-items: center;
}
.radius-preview span {
  display: block; height: 100%; width: 60px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
}

/* Toggle row */
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  padding: 10px 0;
  gap: 16px;
}
.toggle__label { color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.toggle__desc { font-size: 11px; color: var(--text-dim); }
.switch {
  width: 34px; height: 20px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  transition: background var(--tap);
  cursor: pointer;
  flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute;
  top: 1px; left: 1px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--tap), background var(--tap);
}
.switch.is-on { background: var(--accent-soft); border-color: var(--accent); }
.switch.is-on::after { transform: translateX(14px); background: var(--accent); }

/* Swatches */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: transform var(--tap), border-color var(--tap);
  position: relative;
}
.swatch:hover { transform: scale(1.1); }
.swatch.is-active { border-color: var(--text); }
.swatch.is-active::after {
  content: ''; position: absolute; inset: -4px;
  border: 1px solid var(--text);
  border-radius: 50%;
  opacity: .3;
}

/* Select list */
.select-list { display: flex; flex-direction: column; gap: 2px; }
.select-list__opt {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  transition: background var(--tap), border-color var(--tap);
}
.select-list__opt:hover { background: var(--surface-hov); }
.select-list__opt.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.select-list__opt .name { font-weight: 500; }
.select-list__opt .meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); }

.drawer__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
}
.drawer__meta { display: inline-flex; align-items: center; gap: 6px; }
.kbd {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-elev-2);
}

/* ==================== LINKS PAGE ==================== */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.links-grid[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.links-grid[data-cols="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.link-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  transition: border-color var(--tap);
  display: flex; flex-direction: column; gap: 4px;
}
.link-group:hover { border-color: var(--border-strong); }
.link-group__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.link-group__title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
}
.link-group__title .dot {
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--group-color, var(--accent));
}
.link-group__count {
  font-size: 10px; color: var(--text-dim); font-family: var(--font-mono);
}
.link-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin: 0 -10px;
  border-radius: var(--radius-sm);
  transition: background var(--tap);
  position: relative;
  cursor: pointer;
}
.link-row:hover { background: var(--surface-hov); }
.link-row__icon {
  width: 22px; height: 22px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  flex-shrink: 0;
  overflow: hidden;
}
.link-row__icon img { width: 100%; height: 100%; object-fit: cover; }
.link-row__name {
  flex: 1; font-size: 13px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.link-row__url {
  font-size: 11px; color: var(--text-dim); font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 120px;
}
.link-row__arrow {
  opacity: 0; transform: translateX(-4px);
  transition: opacity var(--tap), transform var(--tap);
  color: var(--accent);
}
.link-row:hover .link-row__arrow { opacity: 1; transform: translateX(0); }

/* ==================== NOTES PAGE ==================== */
.notes-layout {
  display: grid;
  grid-template-columns: var(--notes-list-w, 260px) 6px 1fr;
  gap: 0;
  min-height: 540px;
  position: relative;
}
[data-density="compact"] .notes-layout { grid-template-columns: var(--notes-list-w, 220px) 6px 1fr; }
[data-density="roomy"]   .notes-layout { grid-template-columns: var(--notes-list-w, 300px) 6px 1fr; }

.notes-resizer {
  cursor: col-resize;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s ease;
  z-index: 2;
}
.notes-resizer::before {
  content: '';
  width: 1px; height: 32px;
  background: var(--border);
  transition: background .15s ease, width .15s ease;
}
.notes-resizer:hover::before, .notes-resizer:active::before {
  background: var(--accent);
  width: 2px;
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent) 20%, transparent);
}

.notes-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex; flex-direction: column; gap: 2px;
  max-height: 78vh; overflow: auto;
  transition: opacity .25s ease, transform .32s cubic-bezier(.4,0,.2,1), visibility .32s;
}

.notes-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 49;
  backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease;
}
.notes-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* Sidebar toggle button */
.notes-toggle {
  display: none; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px; font-weight: 500;
  font-family: var(--font-mono);
  transition: color var(--tap), background var(--tap), border-color var(--tap);
  margin-right: auto;
  cursor: pointer;
}
.notes-toggle:hover { color: var(--text); border-color: var(--border-strong); }

.notes-list__search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  color: var(--text-muted); font-size: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}
.notes-list__search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: 12px; font-family: var(--font-mono);
}

/* Tree */
.tree { display: flex; flex-direction: column; padding: 2px; }
.tree-row {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px calc(8px + var(--depth, 0) * 14px);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--tap);
  font-size: 13px;
  user-select: none;
  position: relative;
}
.tree-row:hover { background: var(--surface-hov); }
.tree-row__name {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--text);
}
.tree-row__count,
.tree-row__date {
  font-size: 10px; font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
}
.tree-chev {
  color: var(--text-dim);
  transition: transform .2s ease;
  flex-shrink: 0;
}
.tree-folder.is-open > .tree-row--folder .tree-chev { transform: rotate(90deg); }
.tree-folder-ic { color: var(--text-muted); flex-shrink: 0; }
.tree-folder.is-open > .tree-row--folder .tree-folder-ic { color: var(--accent); }
.tree-row--folder .tree-row__name {
  font-weight: 500; font-size: 12px;
}
.tree-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height .25s ease;
}
.tree-folder.is-open > .tree-children { max-height: 4000px; }
.tree-children .tree-row { position: relative; }
.tree-children .tree-row::before {
  content: '';
  position: absolute;
  left: calc(var(--depth, 0) * 14px + 12px);
  top: 0; bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: .6;
}
.tree-row--note { padding-left: calc(8px + var(--depth, 0) * 14px); }
.tree-row__bullet {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  margin-left: 4px; margin-right: 2px;
  transition: background var(--tap);
}
.tree-row--note:hover .tree-row__bullet { background: var(--text-muted); }
.tree-row--note.is-active { background: var(--accent-soft); }
.tree-row--note.is-active .tree-row__bullet {
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}
.tree-row--note.is-active .tree-row__name { font-weight: 500; }
.tree-row--note .lock { color: var(--accent); opacity: .85; flex-shrink: 0; }

.note-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 40px;
  display: flex; flex-direction: column;
  min-height: 540px;
}
[data-density="compact"] .note-editor { padding: 20px 24px; }
[data-density="roomy"]   .note-editor { padding: 44px 56px; }

.note-editor__meta {
  display: flex; align-items: center; gap: 12px;
  font-size: 11px; color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
  flex-wrap: wrap;
}
.note-editor__meta .chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
}
.note-editor__meta .chip .lock { color: var(--accent); }

.note-editor__title {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0 0 16px;
  border: none; background: transparent; outline: none;
  color: var(--text);
  width: 100%;
}
[data-font="serif"] .note-editor__title { font-size: 40px; font-weight: 400; }

.note-editor__body {
  flex: 1;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  border: none; background: transparent; outline: none;
  resize: none;
  font-family: inherit;
}
.note-editor__body p { margin: 0 0 14px; }
.note-editor__body h3 {
  font-family: var(--font-display);
  font-size: 18px; margin: 24px 0 10px;
  font-weight: 600;
}
.note-editor__body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elev-2);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

/* ==================== DATA GRID (crypto/market style) ==================== */
.stat-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.bot-status {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px;
}
.bot-status__main { display: flex; align-items: center; gap: 16px; }
.status-orb {
  width: 54px; height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6EE882, #2B8B41 70%);
  position: relative;
  box-shadow: 0 0 0 6px color-mix(in oklab, #2B8B41 20%, transparent), 0 0 20px -4px #6EE882;
  flex-shrink: 0;
}
.status-orb.is-idle {
  background: radial-gradient(circle at 35% 35%, #B4B6BA, #4a4d53 70%);
  box-shadow: 0 0 0 6px color-mix(in oklab, #4a4d53 20%, transparent);
}
.status-orb.is-err {
  background: radial-gradient(circle at 35% 35%, #E86B6B, #8B2B2B 70%);
  box-shadow: 0 0 0 6px color-mix(in oklab, #8B2B2B 20%, transparent), 0 0 20px -4px #E86B6B;
}
.status-orb::after {
  content: ''; position: absolute; inset: -14px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: .4;
  color: #6EE882;
  animation: pulse 2.4s ease-in-out infinite;
}
.status-orb.is-idle::after { display: none; }
.status-orb.is-err::after { color: #E86B6B; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .4; }
  50% { transform: scale(1.15); opacity: 0; }
}
.bot-status__h {
  font-family: var(--font-display); font-size: 24px; font-weight: 600;
  margin: 0 0 2px; letter-spacing: -.01em;
}
.bot-status__sub {
  font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);
}
.bot-status__toggle {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  background: rgba(110,232,130,.1);
  border: 1px solid rgba(110,232,130,.3);
  color: #6EE882;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  font-family: var(--font-mono);
}
.bot-status__toggle.is-off {
  background: rgba(232,107,107,.1);
  border-color: rgba(232,107,107,.3);
  color: var(--err);
}

.stat {
  display: flex; flex-direction: column; gap: 4px;
}
.stat__value {
  font-family: var(--font-mono);
  font-size: 28px; font-weight: 600;
  letter-spacing: -.02em;
  color: var(--text);
  display: flex; align-items: baseline; gap: 6px;
}
.stat__value .unit {
  font-size: 14px; color: var(--text-muted); font-weight: 500;
}
.stat__delta { font-size: 11px; font-family: var(--font-mono); font-weight: 600; }
.stat__delta.pos { color: #6EE882; }
.stat__delta.neg { color: var(--err); }
.stat__foot { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }

.chart-card {
  grid-column: span 3;
  min-height: 240px;
  padding: var(--pad) var(--pad) 8px;
}
.chart-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.chart-tabs {
  display: flex; gap: 2px;
  background: var(--bg-elev-2);
  border-radius: 999px; padding: 3px;
  border: 1px solid var(--border);
}
.chart-tab {
  font-size: 11px; font-family: var(--font-mono);
  padding: 4px 10px; border-radius: 999px;
  color: var(--text-muted);
  transition: background var(--tap), color var(--tap);
  background: none; border: none; cursor: pointer;
}
.chart-tab.is-active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* Data table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
}
.data-table td {
  padding: 12px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 12px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table td.strong { font-weight: 600; color: var(--text); font-family: var(--font-body); }
.data-table .side {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 4px; font-size: 10px;
  font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
}
.side.buy, .side.pos { background: rgba(110,232,130,.12); color: #6EE882; }
.side.sell, .side.neg { background: rgba(232,107,107,.12); color: var(--err); }

/* ==================== UTILITIES ==================== */
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row   { display: flex; align-items: center; gap: var(--gap); flex-wrap: wrap; }
.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.mono  { font-family: var(--font-mono); }

/* ==================== ADAPTER — dusk-v2 compatibility ====================
   Legacy dusk-v2 tokens (--bg-0, --amber, --t1, etc.) re-mapped to wolf
   tokens so existing service pages inherit the new look without markup
   changes. Applies when body has [data-theme] (set by wolf-shell init).
============================================================================ */
[data-theme] {
  /* Backgrounds */
  --bg-0:      var(--bg);
  --bg-1:      var(--bg-elev);
  --bg-2:      var(--bg-elev-2);
  --bg-3:      var(--surface-hov);
  --bg-4:      var(--surface-hov);
  --bg-hover:  var(--surface-hov);

  /* Borders */
  --b0: var(--border);
  --b1: var(--border);
  --b2: var(--border-strong);
  --b3: var(--border-strong);

  /* Accent (old "amber" — now gold) */
  --amber:     var(--accent);
  --amber-dim: color-mix(in oklab, var(--accent) 8%, transparent);
  --amber-mid: color-mix(in oklab, var(--accent) 16%, transparent);
  --amber-glow: 0 0 12px color-mix(in oklab, var(--accent) 40%, transparent);

  /* Semantic */
  --ok:       #6EE882;
  --ok-dim:   rgba(110,232,130,0.10);
  --warn:     #FBBF24;
  --warn-dim: rgba(251,191,36,0.10);
  --err:      #E86B6B;
  --err-dim:  rgba(232,107,107,0.10);
  --info:     #8EB8FF;
  --info-dim: rgba(142,184,255,0.10);
  --muted:    var(--text-muted);

  /* Text */
  --t1: var(--text);
  --t2: var(--text-muted);
  --t3: var(--text-dim);
  --t-amber: var(--accent);

  /* Fonts (dusk used Geist — now follow user's font preference via data-font) */
  --ui:   var(--font-body);
  --mono: var(--font-mono);
  --cond: var(--font-body);

  /* Sizes — keep dusk's scale */
  --f10: 10px; --f11: 11px; --f12: 12px; --f13: 13px; --f14: 14px;
  --f15: 15px; --f16: 16px; --f18: 18px;
  --f22: clamp(18px, 2.5vw, 22px);
  --f28: clamp(22px, 3.5vw, 30px);
  --f36: clamp(26px, 4.5vw, 38px);

  /* Spacing */
  --g1: 2px;  --g2: 4px;  --g3: 8px;   --g4: 10px;  --g5: 14px;
  --g6: 16px; --g8: 20px; --g10: 24px; --g12: 32px;
  --g16: 40px; --g20: 48px;

  /* Radii (map to wolf --radius scale) */
  --r0: 0;
  --r1: var(--radius-sm);
  --r2: var(--radius);
  --r3: var(--radius-lg);

  /* Layout */
  --nav-h: 56px;  /* wolf topnav is slightly taller than old 48px */

  /* Transitions */
  --tf: var(--tap);
}

/* Dark mode: dusk legacy pieces that hardcoded colors now follow theme */
[data-theme="light"] .amber-text,
[data-theme="light"] .t-amber { color: var(--accent) !important; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .topnav { grid-template-columns: auto 1fr auto; padding: 10px 14px; }
  .topnav__center { order: 3; grid-column: 1/-1; justify-content: start; overflow-x: auto; }
  .topnav__right .brand__sep, .topnav__right .brand__page { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .chart-card { grid-column: 1; }
  .drawer { width: 100vw; }
  main { padding: 24px 16px 80px; }

  /* Notes — list becomes slide-over */
  .notes-layout,
  [data-density="compact"] .notes-layout,
  [data-density="roomy"]   .notes-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .notes-resizer { display: none; }
  .notes-toggle { display: inline-flex; }
  .notes-backdrop { display: block; }
  .notes-list {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(320px, 85vw);
    max-height: none;
    height: 100dvh;
    z-index: 50;
    border-radius: 0;
    border: none;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-panel);
    transform: translateX(-100%);
    padding: 14px 10px;
  }
  .notes-layout.is-open .notes-list { transform: translateX(0); }
  .note-editor { padding: 20px 18px; min-height: calc(100vh - 220px); }
}
