/* ───────────────────────────────────────────────
   THE CACHE — widget board + sidebar. Plain CSS.
   Widgets scale their contents with container queries.
   ─────────────────────────────────────────────── */

:root {
  --ink-rgb: 28, 26, 18;
  --paper: #ece6d6;
  --panel: #e4ddca;
  --ink: rgb(var(--ink-rgb));
  --accent: #c9542e;
  --edge: rgba(var(--ink-rgb), 0.30);
  --edge-soft: rgba(var(--ink-rgb), 0.14);
}
:root[data-theme="dark"] {        /* BEAST MODE — fully red, feral */
  --ink-rgb: 255, 211, 206;              /* light warm-red text */
  --paper: #1c0307;                      /* deep blood red */
  --panel: #320810;                      /* lifted red panel */
  --accent: #ff3a46;                     /* hot red */
  --edge: rgba(255, 80, 88, 0.45);       /* red-glowing borders */
  --edge-soft: rgba(255, 80, 88, 0.20);
  --widget-bg: rgba(255, 70, 80, 0.08);  /* widgets glow red, not white-washed */
}
:root[data-theme="dark"] body {          /* red room + red dot-grid */
  background-color: #160206;
  background-image: radial-gradient(rgba(255, 70, 80, 0.13) 1px, transparent 1px);
}
/* BEAST: a single red color-blend overlay → recolors EVERYTHING to a shade of red
   (hue/saturation from the red, brightness kept from each element, so contrast holds).
   Catches every stray green/amber/icon/chart with no per-color work. */
:root[data-theme="dark"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  z-index: 2147483000; background: #d11626; mix-blend-mode: color;
}
:root[data-theme="terminal"] {
  --ink-rgb: 143, 227, 136;
  --paper: #0c0f0a;
  --panel: #141a12;
  --accent: #e6b450;
}
:root[data-theme="blueprint"] {
  --ink-rgb: 195, 214, 245;
  --paper: #0e1830;
  --panel: #16223f;
  --accent: #6aa6ff;
}
:root[data-theme="mist"] {
  --ink-rgb: 42, 47, 56;
  --paper: #e8ecf0;
  --panel: #dde3ea;
  --accent: #4a6da7;
}
:root[data-theme="vapor"] {
  --ink-rgb: 244, 198, 255;
  --paper: #1a0e2e;
  --panel: #271544;
  --accent: #ff4fd8;
}
:root[data-theme="acid"] {
  --ink-rgb: 198, 255, 80;
  --paper: #0a0a06;
  --panel: #13160b;
  --accent: #aaff2b;
}
:root[data-theme="ember"] {
  --ink-rgb: 255, 206, 176;
  --paper: #1a0c08;
  --panel: #271310;
  --accent: #ff5a36;
}
:root[data-theme="cache"] {        /* the brand theme — warm dark with #FFD409 gold */
  --ink-rgb: 240, 233, 214;
  --paper: #16140c;
  --panel: #211e12;
  --accent: #FFD409;
}
:root[data-theme="mono"] {         /* DEFAULT — minimal greyscale; accent collapses to ink so the UI reads black-and-white. Light base = clean pure white. */
  --ink-rgb: 26, 26, 24;
  --paper: #ffffff;
  --panel: #fafafa;
  --accent: rgb(var(--ink-rgb));
  --edge: rgba(var(--ink-rgb), 0.22);
  --edge-soft: rgba(var(--ink-rgb), 0.10);
}
@media (prefers-color-scheme: dark) {   /* AUTO mode: invert to white-on-black with the system setting (forced light/dark opt out) */
  :root[data-theme="mono"]:not([data-monomode="light"]):not([data-monomode="dark"]) {
    --ink-rgb: 235, 235, 232;
    --paper: #0d0d0c;
    --panel: #121210;
    --widget-bg: var(--paper);   /* widgets sit flush with the canvas (like light mono), defined only by the border */
  }
}
:root[data-theme="mono"][data-monomode="dark"] {   /* DARK forced — ignore the system setting */
  --ink-rgb: 235, 235, 232;
  --paper: #0d0d0c;
  --panel: #121210;
  --widget-bg: var(--paper);   /* widgets sit flush with the canvas (like light mono), defined only by the border */
}
:root[data-theme="mono"] body { background-image: none; }   /* drop the dotted paper texture — calmer, less early-internet */
html { background: var(--paper); }

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background-color: var(--paper);
  background-image: radial-gradient(rgba(var(--ink-rgb), 0.06) 1px, transparent 1px);
  background-size: 14px 14px;
  color: var(--ink);
  font-family: var(--font-ui, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  overflow: hidden;
}

/* hide the native cursor everywhere — our JS cursor is the only cursor */
*, *::before, *::after { cursor: none !important; }
/* hold space to pan: native hand cursor (open → grabs closed), jelly cursor hidden */
body.panning, body.panning * { cursor: grab !important; }
body.panning.grabbing, body.panning.grabbing * { cursor: grabbing !important; }
body.panning .cursor-ball { display: none !important; }

/* ── board ──────────────────────────────────────── */
.board { position: fixed; inset: 0; overflow: auto; overscroll-behavior: contain; }
.board-canvas { position: relative; width: 3200px; height: 2200px; transform-origin: 0 0; }

/* zoom control (bottom-left) */
.zoom-control {
  position: fixed; left: 14px; bottom: 14px; z-index: 60;
  display: flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--panel); border: 1px solid var(--edge);
  border-radius: 999px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.zoom-control button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  color: rgba(var(--ink-rgb), 0.7); border-radius: 999px;
  padding: 4px 8px; font-size: 13px; line-height: 1; min-width: 28px;
}
.zoom-control button:hover { background: rgba(var(--ink-rgb), 0.06); color: var(--accent); }
#zoomReset { font-size: 11px; font-variant-numeric: tabular-nums; min-width: 44px; }

/* ── widget ─────────────────────────────────────── */
.widget {
  position: absolute;
  display: flex;
  flex-direction: column;
  background: var(--widget-bg, rgba(255, 255, 255, 0.18));
  border: 1px solid var(--edge);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.18s ease;
  container-type: size;
  perspective: 1500px;
}
/* card flip: ? on the bar shows how the widget is calculated on the back */
.widget-flip { flex: 1; min-height: 0; position: relative;
  transform-style: preserve-3d; transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1); }
.widget.flipped .widget-flip { transform: rotateY(180deg); }
.widget-face { position: absolute; inset: 0; display: flex; flex-direction: column;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.face-back { transform: rotateY(180deg); background: var(--paper); pointer-events: none; }
/* only the face you can see is interactive — so the hidden back never steals clicks */
.widget.flipped .face-front { pointer-events: none; }
.widget.flipped .face-back { pointer-events: auto; }
.back-bar { cursor: default; }
.widget-back-body { flex: 1; min-height: 0; overflow-y: auto; padding: 11px 14px 14px;
  font-size: 11.5px; line-height: 1.5; color: rgba(var(--ink-rgb), 0.78); text-align: left; }
.widget-back-body p { margin: 0 0 8px; }
.widget-back-body p:last-child { margin-bottom: 0; }
.widget-back-body b { color: var(--ink); font-weight: 600; }
.widget-back-body code { font-size: 10.5px; background: rgba(var(--ink-rgb), 0.09);
  padding: 0 4px; border-radius: 4px; }
.widget-help { border: none; background: none; cursor: pointer; padding: 2px 6px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center; font-family: inherit;
  font-weight: 700; font-size: 12px; line-height: 1; color: rgba(var(--ink-rgb), 0.38); }
.widget-help:hover { color: var(--accent); background: rgba(var(--ink-rgb), 0.06); }
.flip-back { border: none; background: none; cursor: pointer; padding: 2px 7px; border-radius: 5px;
  font-size: 14px; line-height: 1; color: rgba(var(--ink-rgb), 0.5); }
.flip-back:hover { color: var(--accent); background: rgba(var(--ink-rgb), 0.06); }
.widget.dragging { box-shadow: 0 14px 40px -12px rgba(var(--ink-rgb), 0.35); }
.widget.tidying, .sticker.tidying { transition: left 0.45s cubic-bezier(0.16, 1, 0.3, 1), top 0.45s cubic-bezier(0.16, 1, 0.3, 1), width 0.45s cubic-bezier(0.16, 1, 0.3, 1), height 0.45s cubic-bezier(0.16, 1, 0.3, 1); }

/* bare mode — strip border, background, shadow down to just content */
.widget.bare { background: transparent; border-color: transparent; }
.widget.bare.dragging { box-shadow: none; }
.widget.bare .widget-bar { border-bottom-color: transparent; }

.widget-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--edge-soft);
  cursor: grab;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}
.widget-bar:active { cursor: grabbing; }
.bar-left { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bar-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.widget-color {
  border: none; background: none; cursor: pointer;
  padding: 2px 4px; border-radius: 5px; display: inline-flex; align-items: center;
}
.widget-color:hover { background: rgba(var(--ink-rgb), 0.06); }
.color-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);   /* reflects this widget's color (its own --accent override) */
  border: 1px solid rgba(var(--ink-rgb), 0.25);
}
.widget-color:hover .color-dot { transform: scale(1.15); }
/* per-widget color popover */
.wcolor-back { position: fixed; inset: 0; z-index: 330; }
.wcolor-pop {
  position: fixed; z-index: 331; display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px;
  padding: 9px; background: var(--paper); border: 1px solid var(--edge); border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4);
}
.wc-sw {
  width: 24px; height: 24px; border-radius: 7px; cursor: pointer; padding: 0;
  border: 1px solid var(--edge-soft); background: var(--panel);
  display: grid; place-items: center; font-size: 12px; color: rgba(var(--ink-rgb), 0.55);
}
.wc-sw.on { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px rgba(var(--ink-rgb), 0.55); }
.bar-ico { display: inline-flex; }
.bar-ico:empty { display: none; }
.bar-ico svg { width: 14px; height: 14px; stroke-width: 2; color: var(--accent); }
.widget-title {
  text-transform: uppercase; letter-spacing: 0.16em; font-size: 10px;
  color: rgba(var(--ink-rgb), 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.widget-close {
  border: none; background: none; cursor: pointer;
  color: rgba(var(--ink-rgb), 0.35); font-size: 12px; line-height: 1;
  padding: 2px 4px; border-radius: 5px; flex-shrink: 0;
}
.widget-close:hover { color: var(--accent); background: rgba(var(--ink-rgb), 0.06); }
.widget-magnet {
  border: none; background: none; cursor: pointer;
  padding: 2px 4px; border-radius: 5px; display: inline-flex; align-items: center;
  color: rgba(var(--ink-rgb), 0.22); opacity: 0.5;  /* snap OFF → clearly greyed out */
  transition: color 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}
.widget-magnet svg { width: 13px; height: 13px; stroke-width: 2; }
.widget-magnet:hover { color: var(--accent); opacity: 1; }
.widget-magnet.on { color: var(--accent); opacity: 1; }  /* snap ON → just the accent color, no background */

.widget-body {
  flex: 1; min-height: 0;
  display: grid; place-items: center; text-align: center;
  padding: clamp(8px, 6cqmin, 22px); overflow: hidden;
}
.big { font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-size: clamp(20px, 26cqmin, 80px); }
.sub {
  text-transform: uppercase; letter-spacing: 0.16em; margin-top: 8px;
  color: rgba(var(--ink-rgb), 0.45); font-size: clamp(8px, 4.5cqmin, 13px);
}

/* Statistics widget — grid of data-fact tiles */
.widget-body.is-stats { display: block; place-items: stretch; text-align: left; overflow-y: auto; padding: clamp(8px, 5cqmin, 14px); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 8px; }
.stat-tile { background: rgba(var(--ink-rgb), 0.04); border: 1px solid var(--edge-soft); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.stat-tile-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-tile-val.t-ok { color: #3f8f4e; }
.stat-tile-val.t-bad { color: #c9542e; }
.stat-tile-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(var(--ink-rgb), 0.5); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-empty { color: rgba(var(--ink-rgb), 0.45); font-size: 12px; text-align: center; padding: 20px 10px; }

/* Dev Tree widget — collapsible code/build-status tree */
.widget-body.is-tree { display: block; place-items: stretch; text-align: left; overflow-y: auto; padding: clamp(8px, 4cqmin, 14px); }
.tree-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.tree-sum { font-size: 11px; color: rgba(var(--ink-rgb), 0.55); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tree-cnt-bad { color: #c9542e; font-weight: 700; }
.tree-cnt-todo { color: #b9842c; font-weight: 700; }
.tree-grp { margin-bottom: 4px; }
.tree-grp > summary, .tree-file > summary { cursor: pointer; list-style: none; padding: 5px 7px; border-radius: 7px; font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-grp > summary { font-weight: 700; }
.tree-grp > summary::-webkit-details-marker, .tree-file > summary::-webkit-details-marker { display: none; }
.tree-grp > summary:hover, .tree-file > summary:hover { background: rgba(var(--ink-rgb), 0.05); }
.tree-subhead { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(var(--ink-rgb), 0.4); padding: 6px 6px 2px 16px; }
.tree-leaf { padding: 3px 6px 3px 20px; font-size: 11.5px; color: rgba(var(--ink-rgb), 0.72); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-leaf.warn { color: #b9842c; }
.tree-leaf.dim { color: rgba(var(--ink-rgb), 0.42); }
.tree-file { margin-left: 12px; }
.tree-file > summary { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; font-weight: 500; }
.tree-mk { padding: 2px 6px 2px 28px; font-family: ui-monospace, Menlo, monospace; font-size: 10.5px; color: rgba(var(--ink-rgb), 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-mk .mk-line { color: rgba(var(--ink-rgb), 0.38); }
.tree-mk .mk-kind { font-weight: 700; }
.tree-mk.sev-bad .mk-kind { color: #c9542e; }
.tree-mk.sev-todo .mk-kind { color: #b9842c; }
.tree-empty { color: rgba(var(--ink-rgb), 0.45); font-size: 12px; text-align: center; padding: 16px 10px; }
.widget-body.is-note { place-items: stretch; padding: 12px; }
.note-edit {
  width: 100%; height: 100%; outline: none;
  text-align: left; font-size: 13px; line-height: 1.5;
  color: rgba(var(--ink-rgb), 0.8); overflow: auto;
}
.note-edit:empty::before { content: "write a note…"; color: rgba(var(--ink-rgb), 0.3); }

/* balance widget — total with a slide-down per-account breakdown */
.widget-body.is-balance {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch;
  justify-content: center; text-align: center; gap: 4px; overflow-y: auto;
}
.widget-body.is-balance.expanded { justify-content: flex-start; }
.bal-head { flex-shrink: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.bal-total-label {
  text-transform: uppercase; letter-spacing: 0.16em; margin-bottom: 2px;
  font-size: clamp(8px, 4cqmin, 11px); color: rgba(var(--ink-rgb), 0.4);
}
.bal-skull {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  padding: 4px; border: none; background: none;
  display: inline-flex; align-items: center; justify-content: center;
  color: rgba(var(--ink-rgb), 0.5); cursor: pointer;
  transition: color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bal-skull svg { width: 20px; height: 20px; stroke-width: 1.5; }
.bal-skull:hover { color: var(--accent); }
.is-balance.expanded .bal-skull { color: var(--accent); transform: scale(1.12); }
/* checking / savings split — quick read of where the cash sits */
.bal-split {
  flex-shrink: 0; align-self: center; min-width: min(74%, 230px);
  display: flex; flex-direction: column; gap: 3px; margin-top: 12px;
}
.bal-line { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; }
.bal-line-label {
  text-transform: uppercase; letter-spacing: 0.12em;
  font-size: clamp(9px, 4cqmin, 11px); color: rgba(var(--ink-rgb), 0.5);
}
.bal-line-amt {
  font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink);
  font-size: clamp(13px, 6cqmin, 18px);
}
.bal-cards-line { display: none; }
.is-balance.show-net .bal-cards-line { display: flex; }
.bal-cards-line .bal-line-amt { color: #c9542e; }  /* debt reads red */
.bal-net-toggle {
  align-self: center; margin-top: 9px; padding: 3px 11px;
  border: 1px solid var(--edge); border-radius: 999px; background: none; cursor: pointer;
  font-family: inherit; font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em;
  color: rgba(var(--ink-rgb), 0.5); transition: all 0.15s ease;
}
.bal-net-toggle:hover { color: var(--ink); border-color: rgba(var(--ink-rgb), 0.4); }
.bal-net-toggle.on { color: var(--accent); border-color: var(--accent); }
.bal-accounts {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
.is-balance.expanded .bal-accounts { grid-template-rows: 1fr; opacity: 1; }
.bal-accounts-inner {
  overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; gap: 1px; padding-top: 10px;
}
.acct {
  display: flex; align-items: center; gap: 8px; padding: 4px 6px; font-size: 12px;
  opacity: 0; transform: translateX(-18px);
  transition: opacity 0.3s ease, transform 0.5s cubic-bezier(0.34, 1.4, 0.5, 1);
}
/* cascade out, one after another */
.is-balance.expanded .acct {
  opacity: 1; transform: translateX(0);
  transition-delay: calc(var(--i) * 0.06s);
}
.acct-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.acct-name {
  flex: 1; text-align: left; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: rgba(var(--ink-rgb), 0.7);
}
.acct-bal { font-variant-numeric: tabular-nums; color: var(--ink); }

/* safe-to-spend — clean forecast */
.widget-body.is-forecast {
  display: flex; flex-direction: column;
  padding: clamp(8px, 5cqmin, 18px); gap: 6px; overflow: hidden; text-align: center;
}
.fc-head { flex-shrink: 0; }
.fc-label { text-transform: uppercase; letter-spacing: 0.16em; font-size: 10px; color: rgba(var(--ink-rgb), 0.45); }
.is-forecast .big { font-size: clamp(26px, 20cqmin, 56px); line-height: 1; margin-top: 2px; transition: color 0.3s ease; }
.fc-sub { font-size: 10px; letter-spacing: 0.04em; color: rgba(var(--ink-rgb), 0.5); margin-top: 5px; }
.fc-chart { flex: 1; min-height: 38px; }
.fc-chart svg { width: 100%; height: 100%; display: block; }
.fc-meta { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fc-runway { font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.work-detail {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 12px; line-height: 1.7; color: rgba(var(--ink-rgb), 0.6);
}
.work-when { flex-shrink: 0; text-align: center; font-size: 11px; margin: 4px 0 6px; color: rgba(var(--ink-rgb), 0.6); }
.work-when-label { display: block; text-transform: uppercase; letter-spacing: 0.12em; font-size: 9px; color: rgba(var(--ink-rgb), 0.4); margin-bottom: 2px; }
.work-when b { color: var(--accent); }
.toggl-link { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: rgba(var(--ink-rgb), 0.55); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.toggl-link:hover { color: var(--ink); }
.toggl-mark { width: 14px; height: 14px; display: inline-flex; }
.toggl-mark svg { width: 14px; height: 14px; }
.fc-line { stroke: var(--ink); }
.fc-dot { fill: var(--accent); }
.fc-floor { stroke: rgba(var(--ink-rgb), 0.22); }

/* spending breakdown */
.widget-body.is-breakdown {
  display: flex; flex-direction: column; padding: clamp(8px, 5cqmin, 18px); gap: 6px; overflow: hidden;
}
/* months: full-width flex column (no inherited centering) + generous side padding */
.widget-body.is-months {
  display: flex; flex-direction: column; align-items: stretch; text-align: left;
  padding: clamp(10px, 4cqmin, 16px) clamp(14px, 5cqmin, 20px);
}
.is-months .bd-head { padding: 0 2px; }
.is-months .mo-list,
.is-months .mo-row,
.is-months .mo-top,
.is-months .mo-bar-row { width: 100%; }
.bd-head { flex-shrink: 0; }
.bd-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.bd-trend { font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.is-breakdown .bd-avg { font-size: clamp(22px, 16cqmin, 40px); line-height: 1; margin-top: 2px; }
.bd-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.bd-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bd-cat {
  width: 88px; flex-shrink: 0; text-align: left; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: rgba(var(--ink-rgb), 0.7);
}
.bd-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.08); overflow: hidden; }
.bd-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.bd-amt { width: 54px; flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink); }

/* ── Income bubbles — shared identity for income sources across widgets ── */
.inc-bubbles {
  display: flex; flex-wrap: wrap; gap: 8px 10px;
  align-items: flex-start; justify-content: center; padding: 6px 4px;
}
.inc-bubbles.compact { gap: 6px; padding: 2px; }
.inc-strip { flex-shrink: 0; }
.inc-b { display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 120px; }
.inc-bubbles.compact .inc-b { gap: 2px; max-width: 92px; }
/* black knockout badge: ink fill, paper-colored icon + number (reads as cutout) */
.inc-badge {
  position: relative;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px 4px 7px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  transform: scale(0.6); opacity: 0;
  animation: incPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.inc-badge svg { width: 14px; height: 14px; stroke-width: 2; }
/* status pip: ✓ = you confirmed it, faint dot = auto-detected (click to confirm) */
.inc-status {
  position: absolute; top: -5px; right: -5px;
  width: 14px; height: 14px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid var(--paper);
  cursor: pointer; transition: transform 0.12s ease;
}
.inc-status:hover { transform: scale(1.25); }
.inc-bubbles.compact .inc-status { cursor: default; }
.inc-status.is-confirmed { background: #3f8f4e; color: #fff; }
.inc-status.is-confirmed svg { width: 9px; height: 9px; stroke-width: 3.2; }
.inc-status.is-auto {
  width: 9px; height: 9px; top: -3px; right: -3px;
  background: rgba(var(--ink-rgb), 0.32);
}
.inc-bubbles.compact .inc-status { display: none; }
.inc-b { cursor: default; }
.inc-val { font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.inc-bubbles.compact .inc-badge { padding: 3px 8px 3px 6px; gap: 4px; }
.inc-bubbles.compact .inc-badge svg { width: 12px; height: 12px; }
.inc-bubbles.compact .inc-val { font-size: 11px; }
.inc-lab {
  font-size: 9px; font-weight: 500; text-align: center; line-height: 1.05; max-width: 100%;
  color: rgba(var(--ink-rgb), 0.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inc-bubbles.compact .inc-lab { display: none; }
@keyframes incPop { to { transform: scale(1); opacity: 1; } }
.bd-fix {
  flex-shrink: 0; margin-top: 8px; align-self: flex-start;
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), 0.45);
  transition: color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.bd-fix:hover { color: var(--accent); }

/* core vs flex toggles */
.cf-list { gap: 6px; }
.cf-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.cf-cat { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: rgba(var(--ink-rgb), 0.7); }
.cf-amt { width: 52px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--ink); }
.cf-toggle {
  flex-shrink: 0; width: 70px; text-align: center; padding: 3px 0; border: 1px solid var(--edge-soft); border-radius: 999px;
  background: none; cursor: pointer; font-family: inherit; font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.07em; transition: background 0.15s ease, color 0.15s ease;
}
.cf-toggle.is-core, .cf-toggle.is-income { background: #3f8f4e; color: #fff; border-color: #3f8f4e; }
.cf-toggle.is-flex, .cf-toggle.is-ignore { color: rgba(var(--ink-rgb), 0.5); }
/* cadence picker — quiet by default, a custom caret so it isn't a boxy native select */
.cf-cad-wrap { position: relative; flex-shrink: 0; width: 44px; }
.cf-cad-wrap::after { content: "▾"; position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  font-size: 7px; color: rgba(var(--ink-rgb), 0.4); pointer-events: none; }
.cf-cad { -webkit-appearance: none; appearance: none; width: 100%; padding: 2px 14px 2px 6px;
  border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer;
  font-family: inherit; font-size: 9.5px; color: rgba(var(--ink-rgb), 0.55); }
.cf-cad:hover { border-color: var(--edge-soft); color: var(--ink); }
/* new / changed / dropped flags from recurrence detection */
.mm-flag { flex-shrink: 0; font-size: 8px; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 1px 5px; border-radius: 999px; line-height: 1.5; }
.mm-flag-new { color: #3f8f4e; border: 1px solid rgba(63, 143, 78, 0.45); }
.mm-flag-changed { color: #b9842c; border: 1px solid rgba(185, 132, 44, 0.5); }
.mm-flag-dropped { color: #c9542e; border: 1px solid rgba(201, 84, 46, 0.5); }
.inc-toggle {
  flex-shrink: 0; width: 58px; padding: 4px 0; border: 1px solid var(--edge-soft); border-radius: 999px;
  background: none; cursor: pointer; font-family: inherit; font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.08em; transition: background 0.15s ease, color 0.15s ease;
}
.inc-toggle.is-income { background: #3f8f4e; color: #fff; border-color: #3f8f4e; }
.inc-toggle.is-skip { color: rgba(var(--ink-rgb), 0.45); }

/* category editor modal */
.cat-backdrop { position: fixed; inset: 0; z-index: 330; background: rgba(0, 0, 0, 0.3); }
.cat-modal {
  /* centered via inset+auto margins (NOT transform) so hit-testing stays correct under
     the Accessibility text-size zoom — a transform here makes clicks land off-target */
  position: fixed; z-index: 340; inset: 0; margin: auto;
  width: min(420px, 92vw); height: fit-content; max-height: 80vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--edge); border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.5);
}
.cat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--edge-soft);
  font-size: 13px; letter-spacing: 0.04em;
}
.cat-close { border: none; background: none; cursor: pointer; color: rgba(var(--ink-rgb), 0.5); font-size: 14px; }
.cat-close:hover { color: var(--accent); }
.cat-hint { padding: 10px 16px 4px; font-size: 11px; font-style: italic; color: rgba(var(--ink-rgb), 0.5); }
.cat-list { overflow-y: auto; padding: 8px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.cat-empty { padding: 20px 4px; text-align: center; font-size: 12px; color: rgba(var(--ink-rgb), 0.5); }
/* user-resizable modal: top-left anchored (set by JS), drag the corner */
.cat-modal.resizable {
  transform: none; inset: auto; height: auto; resize: both; overflow: hidden;
  min-width: 320px; min-height: 260px; max-width: 94vw; max-height: 92vh;
}
.cat-modal.resizable .cat-list, .cat-modal.resizable .bug-list { flex: 1; }
/* auto-save feedback on a row */
.cat-row.saving { opacity: 0.55; }
.cat-row.saved { box-shadow: inset 3px 0 0 #3f8f4e; }
.cat-row.saving, .cat-row.saved { transition: opacity 0.2s ease, box-shadow 0.2s ease; }
/* roadmap (backlog) list */
.rm-tabs { display: flex; gap: 6px; padding: 10px 16px 2px; }
.rm-tab {
  border: 1px solid var(--edge-soft); background: none; cursor: pointer; font-family: inherit;
  font-size: 11px; padding: 4px 12px; border-radius: 999px; color: rgba(var(--ink-rgb), 0.6);
}
.rm-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.rm-text strong { font-weight: 600; color: var(--ink); }
.rm-list { gap: 1px; min-height: 220px; }
.rm-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: rgba(var(--ink-rgb), 0.45); margin: 14px 0 4px;
}
.rm-section:first-child { margin-top: 0; }
.rm-item { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; line-height: 1.4; padding: 2px 0; }
.rm-box { flex-shrink: 0; width: 12px; text-align: center; color: var(--accent); }
.rm-text { flex: 1; }
.rm-item.done { color: rgba(var(--ink-rgb), 0.4); }
.rm-item.done .rm-box { color: #3f8f4e; }
.rm-item.done .rm-text { text-decoration: line-through; }

/* import: toast + drag-drop overlay */
.toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%) translateY(8px);
  z-index: 400; background: var(--ink); color: var(--paper);
  padding: 9px 16px; border-radius: 999px; font-size: 12px; max-width: 80vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.csv-drop {
  position: fixed; inset: 0; z-index: 380; display: none; pointer-events: none;
  align-items: center; justify-content: center; background: rgba(var(--ink-rgb), 0.16);
}
.csv-drop.show { display: flex; }
.csv-drop-inner {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 34px 54px; border-radius: 18px; border: 2px dashed var(--accent);
  background: var(--panel); color: var(--ink); font-size: 14px; letter-spacing: 0.04em;
}
.csv-drop-inner svg { width: 30px; height: 30px; color: var(--accent); }
.cat-row {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 6px 0; border-bottom: 1px solid var(--edge-soft);
  transition: opacity 0.25s ease;
}
.cat-row.done { opacity: 0.4; }
.cat-merch-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cat-merch { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-dates { font-size: 10px; color: rgba(var(--ink-rgb), 0.42); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cat-amt { flex-shrink: 0; font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.6); }
.cat-select {
  flex-shrink: 0; font-family: inherit; font-size: 11px; padding: 4px 6px;
  border: 1px solid var(--edge); border-radius: 7px;
  background: var(--panel); color: var(--ink); cursor: pointer;
}

/* ── Category Manager ── */
.cm-list { display: flex; flex-direction: column; gap: 2px; }
.cm-cat { border-bottom: 1px solid var(--edge-soft); }
.cm-row { display: flex; align-items: center; gap: 8px; padding: 7px 2px; }
.cm-name { flex: 1; min-width: 0; text-align: left; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-name:hover { color: var(--accent); }
.cm-count { flex-shrink: 0; font-size: 11px; font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.5);
  min-width: 30px; text-align: right; }
.cm-act { flex-shrink: 0; border: none; background: none; cursor: pointer; font-size: 13px;
  padding: 2px 5px; border-radius: 6px; color: rgba(var(--ink-rgb), 0.55); }
.cm-act:hover { background: rgba(var(--ink-rgb), 0.08); color: var(--ink); }
.cm-merch { display: none; padding: 0 2px; }
.cm-merch.open { display: block; padding: 2px 2px 10px; }
.cm-m { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.cm-mname { flex: 1; min-width: 0; font-size: 11px; color: rgba(var(--ink-rgb), 0.7);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-mto, .cm-delto { font-family: inherit; font-size: 11px; padding: 3px 6px; border: 1px solid var(--edge);
  border-radius: 7px; background: var(--panel); color: var(--ink); cursor: pointer; }
.cm-delbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 11px;
  padding: 4px 0; color: rgba(var(--ink-rgb), 0.7); }
.cm-delgo, .cm-x { border: 1px solid var(--edge); background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 11px; padding: 3px 9px; border-radius: 7px; color: var(--ink); }
.cm-delgo { border-color: #c9542e; color: #c9542e; }
.cm-empty2 { font-size: 11px; color: rgba(var(--ink-rgb), 0.45); padding: 4px 0; }
.cm-new { margin: 10px 16px 14px; align-self: flex-start; border: 1px dashed var(--edge); background: none;
  cursor: pointer; font-family: inherit; font-size: 12px; padding: 6px 12px; border-radius: 9px; color: var(--ink); }
.cm-new:hover { border-color: var(--accent); color: var(--accent); }

/* pin-to-top button (Time worked projects + Subscriptions) */
.pin-btn { flex-shrink: 0; border: none; background: none; cursor: pointer; padding: 0 2px; line-height: 1;
  font-size: 11px; color: rgba(var(--ink-rgb), 0.22); transition: color 0.15s ease, transform 0.15s ease; }
.pin-btn:hover { color: rgba(var(--ink-rgb), 0.55); }
.pin-btn.on { color: var(--accent); transform: scale(1.08); }
.avg-row.pinned, .sub-row.pinned { background: rgba(var(--ink-rgb), 0.03); border-radius: 7px; }
.wk-proj { gap: 6px; }

/* Time worked widget */
/* saved views */
.view-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.view-del { flex-shrink: 0; color: rgba(var(--ink-rgb), 0.35); font-size: 11px; padding: 0 2px; border-radius: 4px; }
.view-del:hover { color: #c9542e; background: rgba(var(--ink-rgb), 0.08); }

.wk-spots { display: flex; gap: 8px; margin-top: 6px; width: 100%; }
.wk-spot { flex: 1 1 0; min-width: 0; text-align: center; padding: 11px 6px 9px;
  border: 1px solid var(--edge-soft); border-radius: 13px; background: rgba(var(--ink-rgb), 0.035); }
.wk-spot-num { font-weight: 600; letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums; font-size: clamp(17px, 11cqmin, 32px);
  white-space: nowrap; }
.wk-hours { color: var(--ink); }
.wk-earned { color: #3f8f4e; }
.wk-spot-lbl { font-size: 9px; text-transform: uppercase; letter-spacing: 0.16em;
  color: rgba(var(--ink-rgb), 0.5); margin-top: 7px; }
.wk-running { margin: 2px 0; }
.wk-run { font-size: 11px; color: #e9408f; background: rgba(233, 64, 143, 0.1);
  border-radius: 8px; padding: 5px 9px; display: inline-block; }
.wk-projh { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(var(--ink-rgb), 0.42); padding: 9px 0 2px; border-top: 1px dashed var(--edge-soft); margin-top: 6px; }
.wk-list .avg-val { font-size: 12px; }

/* Budget waterfall — this month is the hero, next month a peek below */
.pl-hero-head { display: flex; align-items: baseline; gap: 7px; margin-bottom: 4px; }
.pl-pane-tag { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.4); }
.pl-pane-mo { font-size: 12px; font-weight: 600; color: var(--ink); }
.pl-hero .pl-big { font-size: clamp(22px, 9cqmin, 34px); }
.pl-note { font-size: 9.5px; color: rgba(var(--ink-rgb), 0.5); margin-top: 4px; }
.pl-tier.paid .pl-note { color: #3f8f4e; }
.pl-pool { font-size: 10.5px; color: rgba(var(--ink-rgb), 0.6); margin: 2px 0 10px; }
.pl-pool b { color: var(--ink); font-variant-numeric: tabular-nums; }
/* next-month peek bar */
.pl-next { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 12px; padding: 9px 11px;
  border: 1px solid var(--edge-soft); border-radius: 11px; background: rgba(var(--ink-rgb), 0.03);
  cursor: pointer; font-family: inherit; text-align: left; }
.pl-next:hover { border-color: var(--edge); }
.pl-next-dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: rgba(var(--ink-rgb), 0.3); }
.pl-next-mo { font-size: 11px; font-weight: 600; color: var(--ink); }
.pl-next-sum { flex: 1; font-size: 11px; color: rgba(var(--ink-rgb), 0.62); font-variant-numeric: tabular-nums; }
.pl-next-sum b { color: var(--ink); }
.pl-next-caret { flex-shrink: 0; font-size: 10px; color: rgba(var(--ink-rgb), 0.4); transition: transform 0.2s ease; }
.pl-next.open .pl-next-caret { transform: rotate(180deg); }
.pl-next-body { margin-top: 10px; gap: 11px; opacity: 0.85; }
.pl-next-body[hidden] { display: none; }
.pl-list { gap: 11px; }
.pl-tier { cursor: grab; }
.pl-tier.pl-dragging { opacity: 0.4; }
.pl-grip { flex-shrink: 0; color: rgba(var(--ink-rgb), 0.28); font-size: 12px; letter-spacing: -2px; cursor: grab; }
.pl-tier:hover .pl-grip { color: rgba(var(--ink-rgb), 0.5); }
.pl-row { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; margin-bottom: 4px; }
.pl-ic { flex-shrink: 0; width: 13px; font-size: 11px; }
.pl-name { flex: 1; min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-amt { flex-shrink: 0; font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.6); }
.pl-track { height: 10px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.08); overflow: hidden; }
.pl-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.pl-tier.met .pl-fill { background: #3f8f4e; }
.pl-tier.met .pl-ic { color: #3f8f4e; }
.pl-tier.part .pl-fill { background: #d6920f; }
.pl-tier.part .pl-ic { color: #d6920f; }
.pl-tier.unmet .pl-fill { background: #c9542e; opacity: 0.5; }
.pl-tier.unmet .pl-ic { color: #c9542e; }
.pl-tier.unmet .pl-name, .pl-tier.unmet .pl-amt { opacity: 0.5; }
.pl-cut { font-size: 9.5px; color: #d6920f; text-align: center; margin-top: 6px; letter-spacing: 0.05em; }
/* choose-bills button + empty state */
.pl-pick { margin-left: auto; border: 1px solid var(--edge); background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 10px; color: rgba(var(--ink-rgb), 0.7); padding: 4px 9px; border-radius: 999px; }
.pl-pick:hover { border-color: var(--accent); color: var(--accent); }
.pl-empty { font-size: 11px; color: rgba(var(--ink-rgb), 0.5); text-align: center; padding: 6px 0 10px; line-height: 1.7; }
.pl-pick-inline { border: 1px solid var(--accent); background: none; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 11px; padding: 4px 10px; border-radius: 999px; }
.pl-subhead { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.38);
  margin: 4px 0 1px; padding-top: 8px; border-top: 1px dashed var(--edge-soft); }
/* estimated rows read softer than the exact bank-confirmed bills */
.pl-tier.est { cursor: default; opacity: 0.82; }
.pl-tier.est .pl-name { font-style: italic; }
.pl-tier.est .pl-note { font-style: italic; }
.pl-grip.ghost { cursor: default; opacity: 0.4; }

/* bills picker modal */
.bills-modal { width: min(440px, 92vw); }
.bills-intro { font-size: 11.5px; line-height: 1.6; color: rgba(var(--ink-rgb), 0.62); padding: 2px 2px 12px; }
.bills-list { display: flex; flex-direction: column; gap: 6px; max-height: 56vh; overflow-y: auto; }
.bills-empty { font-size: 12px; color: rgba(var(--ink-rgb), 0.5); text-align: center; padding: 24px 8px; line-height: 1.6; }
.bill-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 11px; background: var(--panel); padding: 9px 12px; font-family: inherit; }
.bill-row:hover { border-color: rgba(var(--ink-rgb), 0.3); }
.bill-row.on { border-color: var(--accent); background: rgba(var(--ink-rgb), 0.04); }
.bill-star { flex-shrink: 0; font-size: 16px; color: rgba(var(--ink-rgb), 0.3); width: 18px; }
.bill-row.on .bill-star { color: var(--accent); }
.bill-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bill-name { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bill-meta { font-size: 10px; color: rgba(var(--ink-rgb), 0.5); text-transform: capitalize; }
.bill-amt { flex-shrink: 0; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }

/* Budget widget: plan / build mode */
.bg-modes { margin-left: auto; display: inline-flex; border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; }
.bg-mode { border: none; background: none; cursor: pointer; font-family: inherit; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.1em; padding: 3px 11px; color: rgba(var(--ink-rgb), 0.5); }
.bg-mode.on { background: var(--accent); color: var(--paper); }
.bg-view[hidden] { display: none; }
/* build mode fills the remaining widget height and scrolls (was clipped before) */
.bg-build { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; }
.bg-build-scroll { display: flex; flex-direction: column; gap: 7px; }
.bg-sec { font-size: 9px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.42);
  margin-top: 8px; padding-bottom: 2px; border-bottom: 1px solid var(--edge-soft); }
.bg-sec:first-child { margin-top: 0; }
.bg-sec-note { text-transform: none; letter-spacing: 0; font-size: 9.5px; color: rgba(var(--ink-rgb), 0.4); margin-left: 6px; }
.bg-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink); }
.bg-field span { color: rgba(var(--ink-rgb), 0.7); }
.bg-field input, .bg-field select { width: 130px; flex-shrink: 0; padding: 6px 9px; font-family: inherit; font-size: 12px;
  border: 1px solid var(--edge); border-radius: 8px; background: var(--paper); color: var(--ink);
  font-variant-numeric: tabular-nums; }
.bg-field input:focus, .bg-field select:focus { outline: none; border-color: var(--accent); }
.bg-hint { font-size: 9.5px; line-height: 1.5; color: rgba(var(--ink-rgb), 0.45); }
.bg-bills { max-height: none; margin-top: 2px; }
/* build mode: must-pays are read-only here (defined in the Money Map) */
.bg-mustpays { display: flex; flex-direction: column; gap: 4px; }
.bg-mp { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; }
.bg-mp-name { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-mp-amt { flex-shrink: 0; font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.62); }
.bg-open-map { margin-top: 6px; width: 100%; border: 1px solid var(--accent); background: none; color: var(--accent);
  cursor: pointer; font-family: inherit; font-size: 11px; padding: 7px 10px; border-radius: 9px; }
.bg-open-map:hover { background: rgba(var(--ink-rgb), 0.04); }

/* Money Map widget — money in / money out in one scroll */
.mm-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.mm-sec { font-size: 9px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.42);
  margin-top: 6px; padding-bottom: 3px; border-bottom: 1px solid var(--edge-soft); }
.mm-sec:first-child { margin-top: 0; }
.mm-sec-note { text-transform: none; letter-spacing: 0; font-size: 9.5px; color: rgba(var(--ink-rgb), 0.4); margin-left: 6px; }
.mm-in { display: flex; flex-direction: column; gap: 6px; }
.mm-row { gap: 8px; }
.mm-dir { flex-shrink: 0; width: 14px; text-align: center; font-weight: 700; }
.mm-dir.in { color: #3f8f4e; }
.mm-dir.off { color: rgba(var(--ink-rgb), 0.3); }
.mm-empty { font-size: 11px; color: rgba(var(--ink-rgb), 0.45); padding: 4px 0; }
/* income → Toggl project link */
.mm-link-wrap { flex-shrink: 0; position: relative; }
.mm-link { -webkit-appearance: none; appearance: none; max-width: 96px; padding: 2px 16px 2px 7px;
  border: 1px solid var(--edge-soft); border-radius: 7px; background: none; cursor: pointer;
  font-family: inherit; font-size: 9.5px; color: rgba(var(--ink-rgb), 0.6);
  text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.mm-link:hover { color: var(--ink); border-color: var(--edge); }
.mm-link-wrap::after { content: "▾"; position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  font-size: 7px; color: rgba(var(--ink-rgb), 0.4); pointer-events: none; }
.mm-hrs { flex-shrink: 0; font-size: 9.5px; font-variant-numeric: tabular-nums; color: var(--accent); }

/* Money flow widget — cascade of accounts with connector lines + transfer bubbles */
.af-cards-toggle { margin-left: auto; border: 1px solid var(--edge); background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 10px; color: rgba(var(--ink-rgb), 0.7); padding: 4px 9px; border-radius: 999px; }
.af-cards-toggle:hover { border-color: var(--accent); color: var(--accent); }
.af-cards-toggle.on { border-color: var(--accent); color: var(--accent); }
.af-wrap { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 8px 6px 10px; }
.af-links { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.af-link { fill: none; stroke: rgba(var(--ink-rgb), 0.22); stroke-width: 1.5; }
.af-flow { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 26px; min-width: min-content; }
.af-tier { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.af-node { min-width: 92px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 13px; border-radius: 11px; border: 1px solid var(--edge); background: var(--panel); }
.af-node-type { font-size: 7.5px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.4); }
.af-node-name { font-size: 11px; color: var(--ink); white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.af-node-bal { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.af-node.af-checking { border-color: var(--accent); }
.af-node.af-savings { border-color: #3f8f4e; }
.af-node.af-credit { border-style: dashed; }
.af-node.af-credit .af-node-bal { color: #c9542e; }
.af-port { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.18em; padding: 4px 14px;
  border-radius: 999px; border: 1px dashed var(--edge-soft); color: rgba(var(--ink-rgb), 0.5); }
.af-port.af-in { color: #3f8f4e; border-color: rgba(63, 143, 78, 0.5); }
.af-port.af-out { color: #c9542e; border-color: rgba(201, 84, 46, 0.45); }
.af-bubble { position: absolute; transform: translate(-50%, -50%); z-index: 2; font-size: 9.5px; padding: 2px 7px;
  border-radius: 999px; background: var(--paper); border: 1px solid var(--edge); white-space: nowrap;
  font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.75); pointer-events: none; }

/* Income forecast — slider tilts a 6-month cushion projection */
.if-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* fixed-height chart (never resizes as you slide) that lets the line bleed up over the head */
.if-chart { flex: 1 1 auto; min-height: 96px; margin: 6px 0 2px; overflow: visible; }
.if-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.if-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; stroke-linecap: round; transition: d 0.12s ease; }
.if-base { stroke: rgba(var(--ink-rgb), 0.28); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.if-zero { stroke: rgba(var(--ink-rgb), 0.2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.if-mlabel { fill: rgba(var(--ink-rgb), 0.45); font-size: 9px; font-family: inherit; }
.if-grid { stroke: rgba(var(--ink-rgb), 0.09); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* goal chip + "+ source" button + the scrolling list of per-source sliders */
.if-goal { margin-left: auto; border: 1px solid var(--edge); background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 10px; color: rgba(var(--ink-rgb), 0.78); padding: 4px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.if-goal:hover { border-color: var(--accent); color: var(--accent); }
.if-add { margin-left: 6px; border: 1px solid var(--edge); background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 10px; color: rgba(var(--ink-rgb), 0.7); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.if-add:hover { border-color: var(--accent); color: var(--accent); }
/* the goal target line + label + crossing marker */
.if-goal-line { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; opacity: 0.65; }
.if-goal-label { fill: var(--accent); font-size: 8.5px; font-family: inherit; opacity: 0.9; }
.if-goal-hit { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
/* streams view: mode toggle, legend, stacked-area strokes + labels */
.if-modeseg { margin-left: auto; display: inline-flex; border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; }
.if-modeopt { border: none; background: var(--panel); cursor: pointer; font-family: inherit; font-size: 10px;
  color: rgba(var(--ink-rgb), 0.6); padding: 4px 11px; white-space: nowrap; }
.if-modeopt:hover { color: var(--accent); }
.if-modeopt.on { background: var(--accent); color: var(--paper); font-weight: 600; }
.if-modeopt.on:hover { color: var(--paper); }
.if-goal { margin-left: 6px; }                /* mode button now holds margin-left:auto */
.if-mode-streams .if-goal { display: none; }  /* goal target is cushion-only */
.if-legend { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 12px 0; }
.if-legend:empty { display: none; }
.if-leg { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--edge-soft); background: var(--panel);
  cursor: pointer; font-family: inherit; font-size: 10px; color: rgba(var(--ink-rgb), 0.8); padding: 3px 8px; border-radius: 999px; }
.if-leg[data-off] { opacity: 0.4; }
.if-leg-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex-shrink: 0; }
.if-ylabel { fill: rgba(var(--ink-rgb), 0.4); font-size: 8px; font-family: inherit; }
.if-need { stroke: rgb(var(--ink-rgb)); stroke-width: 1.4; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; opacity: 0.7; }
.if-need-lbl { fill: rgb(var(--ink-rgb)); font-size: 8.5px; font-family: inherit; opacity: 0.85; }
.if-now { stroke: rgba(var(--ink-rgb), 0.55); stroke-width: 1.4; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.if-now-lbl { fill: rgba(var(--ink-rgb), 0.6); font-size: 8.5px; font-family: inherit; }
.if-hatch { stroke: rgba(var(--ink-rgb), 0.35); }
.if-effort { fill: none; stroke: #0ea5e9; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.if-effort-proj { stroke-dasharray: 3 3; opacity: 0.8; }
.if-effort-dot { fill: #0ea5e9; stroke: var(--paper); stroke-width: 1; }
.if-src-link { border: none; background: none; cursor: pointer; font-family: inherit; font-size: inherit; padding: 0;
  color: rgba(var(--ink-rgb), 0.5); text-decoration: underline; text-decoration-color: var(--edge); }
.if-src-link:hover { color: var(--accent); }
.if-sources { flex: 0 0 auto; overflow: visible; margin-top: 4px; display: flex; flex-direction: column; gap: 14px; }
.if-src-top { display: flex; align-items: baseline; gap: 8px; }
.if-src-name { flex: 1; min-width: 0; font-size: 12px; color: var(--ink); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.if-src-name:hover { color: var(--accent); }
.if-src-val { flex-shrink: 0; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.if-src-x { flex-shrink: 0; width: 16px; border: none; background: none; cursor: pointer;
  font-size: 14px; line-height: 1; color: rgba(var(--ink-rgb), 0.3); padding: 0; }
.if-src-x:hover { color: #c9542e; }
.if-src-hint { font-size: 9.5px; color: rgba(var(--ink-rgb), 0.45); margin-top: 1px; font-variant-numeric: tabular-nums; }
.if-src-hint .if-src-hours { color: var(--accent); font-weight: 600; }
.if-src-rate { border: none; background: none; cursor: pointer; font-family: inherit; font-size: inherit; padding: 0;
  color: rgba(var(--ink-rgb), 0.55); text-decoration: underline dotted; text-underline-offset: 2px; }
.if-src-rate:hover { color: var(--accent); }
/* this widget runs its content a bit wider than the default body padding */
.widget-body.is-forecast { padding-left: clamp(7px, 3cqmin, 13px); padding-right: clamp(7px, 3cqmin, 13px); }
.if-sources, .if-src { min-width: 0; }
/* per-source sliders: full width, but pad by the thumb radius so the chunky thumb
   never pokes past the row edge (it stays inside the widget when resized small) */
.if-src-slider { height: 38px; width: 100%; padding: 0 17px; }
.if-src-slider::-webkit-slider-thumb { width: 34px; height: 34px; margin-top: -9px; border-width: 4px; }
.if-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 46px; background: transparent;
  outline: none; cursor: pointer; }
/* WebKit: fat rounded track that fills with accent as you drag */
.if-slider::-webkit-slider-runnable-track { height: 20px; border-radius: 999px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), rgba(var(--ink-rgb), 0.1) var(--fill, 0%));
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.15); }
.if-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 42px; height: 42px;
  margin-top: -11px; border-radius: 50%; background: var(--accent); border: 5px solid var(--paper);
  box-shadow: 0 6px 16px -3px rgba(0, 0, 0, 0.5), inset 0 -3px 4px rgba(0, 0, 0, 0.18), inset 0 2px 3px rgba(255, 255, 255, 0.35);
  cursor: grab; transition: transform 0.16s cubic-bezier(0.34, 1.75, 0.5, 1); }
.if-slider:hover::-webkit-slider-thumb { transform: scale(1.09); }
.if-slider:active::-webkit-slider-thumb { transform: scale(0.86); cursor: grabbing; }
/* Firefox */
.if-slider::-moz-range-track { height: 20px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.1);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.15); }
.if-slider::-moz-range-progress { height: 20px; border-radius: 999px; background: var(--accent); }
.if-slider::-moz-range-thumb { width: 42px; height: 42px; border-radius: 50%; background: var(--accent);
  border: 5px solid var(--paper); box-shadow: 0 6px 16px -3px rgba(0, 0, 0, 0.5); cursor: grab;
  transition: transform 0.16s cubic-bezier(0.34, 1.75, 0.5, 1); }
.if-slider:hover::-moz-range-thumb { transform: scale(1.09); }
.if-slider:active::-moz-range-thumb { transform: scale(0.86); cursor: grabbing; }
/* the wording changes as you slide → make it the flexible, scrolling part so it
   absorbs length changes WITHOUT nudging the slider above it */

/* What's next widget */
.wn-deadline { font-size: 12px; color: var(--ink); padding: 7px 10px; margin: 4px 0 4px;
  background: rgba(var(--ink-rgb), 0.045); border-radius: 9px; text-align: center; }
.wn-deadline b { color: var(--accent); }
.wn-say { font-size: 11px; line-height: 1.5; color: rgba(var(--ink-rgb), 0.62);
  margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--edge-soft); }

/* Averages widget */
.avg-list { gap: 2px; }
.avg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 6px 2px; border-bottom: 1px solid var(--edge-soft); font-size: 13px; }
.avg-row:last-child { border-bottom: none; }
.avg-label { color: rgba(var(--ink-rgb), 0.65); }
.avg-val { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }

/* Subscriptions: detected-but-not-tracked section */
.sub-detected { margin-top: 4px; }
.sub-det-h { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(var(--ink-rgb), 0.42); padding: 8px 0 3px; border-top: 1px dashed var(--edge-soft); margin-top: 6px; }
.sub-det-row { opacity: 0.92; }
.sub-track { flex-shrink: 0; border: 1px solid var(--accent); background: none; color: var(--accent);
  cursor: pointer; font-family: inherit; font-size: 10px; padding: 3px 8px; border-radius: 999px; }
.sub-track:hover { background: var(--accent); color: var(--paper); }
/* active / lapsed / paused status pip + manage controls */
.sub-row { gap: 7px; }
.sub-pip { flex-shrink: 0; width: 9px; height: 9px; padding: 0; border-radius: 50%; border: none; cursor: pointer; }
.sub-pip.active { background: #3f8f4e; }
.sub-pip.lapsed { background: #d6920f; }
.sub-pip.paused { background: rgba(var(--ink-rgb), 0.25); }
.sub-row.paused .sub-name, .sub-row.paused .cf-amt { opacity: 0.45; text-decoration: line-through; }
.sub-x { flex-shrink: 0; width: 16px; text-align: center; border: none; background: none; cursor: pointer;
  font-size: 15px; line-height: 1; color: rgba(var(--ink-rgb), 0.35); padding: 0; }
.sub-x:hover { color: #c9542e; }
.sub-x-empty { display: inline-block; width: 16px; flex-shrink: 0; }  /* keep the column aligned when there's no × */
.sub-add { border: 1px solid var(--edge); background: none; cursor: pointer; font-family: inherit; font-size: 10px;
  padding: 2px 8px; border-radius: 999px; color: rgba(var(--ink-rgb), 0.6); margin-left: auto; }
.sub-add:hover { border-color: var(--accent); color: var(--accent); }

/* ── Review inbox (status panel) ── */
.rv-group { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(var(--ink-rgb), 0.45); padding: 11px 0 4px; margin-top: 2px; }
.rv-item { padding: 7px 8px; margin: 3px 0; border: 1px solid var(--edge-soft); border-radius: 9px;
  background: rgba(var(--ink-rgb), 0.025); display: flex; flex-direction: column; gap: 5px; }
.rv-top { display: flex; align-items: baseline; gap: 6px; }
.rv-label { font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-detail { font-size: 10px; color: rgba(var(--ink-rgb), 0.5); }
.rv-act { align-self: flex-start; border: 1px solid var(--accent); background: none; color: var(--accent);
  cursor: pointer; font-family: inherit; font-size: 11px; padding: 4px 10px; border-radius: 999px; }
.rv-act:hover { background: var(--accent); color: var(--paper); }
.rv-cat { font-family: inherit; font-size: 11px; padding: 4px 6px; border: 1px solid var(--edge);
  border-radius: 7px; background: var(--panel); color: var(--ink); cursor: pointer; align-self: flex-start; }
.rv-more { font-size: 10px; color: rgba(var(--ink-rgb), 0.45); padding: 4px 2px; }
.rv-sync { width: 100%; text-align: left; border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--ink); padding: 6px 2px; display: flex; align-items: center; gap: 8px; }

/* ── Settings panel ── */
.set-body { padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }

/* Connect-a-bank coaching modal */
.connect-body { padding: 12px 16px 18px; display: flex; flex-direction: column; gap: 11px; overflow-y: auto; }
.cn-status { font-size: 12px; padding: 8px 10px; border-radius: 9px; background: rgba(var(--ink-rgb), 0.05); }
.cn-ok { color: #3f8f4e; font-weight: 600; }
.cn-no, .cn-err { color: #c9542e; font-weight: 600; }
.cn-working { color: var(--accent); }
.cn-intro { font-size: 12.5px; line-height: 1.6; color: rgba(var(--ink-rgb), 0.78); }
.cn-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; line-height: 1.55; color: var(--ink); }
.cn-steps a { color: var(--accent); }
.cn-dim { color: rgba(var(--ink-rgb), 0.5); }
.cn-token { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit; font-size: 12px;
  padding: 9px 11px; border: 1px solid var(--edge); border-radius: 10px; background: var(--paper); color: var(--ink); }
.cn-token:focus { outline: none; border-color: var(--accent); }
.cn-connect { border: 1px solid var(--accent); background: var(--accent); color: var(--paper); cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 10px; border-radius: 10px; }
.cn-connect:hover { filter: brightness(1.06); }
.cn-or { text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.4); }
.cn-alts { display: flex; gap: 8px; }
.cn-alts button { flex: 1; border: 1px solid var(--edge); background: var(--panel); color: var(--ink); cursor: pointer;
  font-family: inherit; font-size: 11.5px; padding: 9px; border-radius: 9px; }
.cn-alts button:hover { border-color: var(--accent); color: var(--accent); }
.cn-result { font-size: 12.5px; line-height: 1.5; min-height: 1.2em; }

/* Bank connection inside Settings */
.set-bank-status { font-size: 11.5px; padding: 2px 0; }
.set-token-wrap { position: relative; }
.set-bank-input { width: 100%; box-sizing: border-box; font-family: inherit; font-size: 12px; padding: 8px 38px 8px 10px;
  border: 1px solid var(--edge); border-radius: 9px; background: var(--paper); color: var(--ink); }
.set-bank-input:focus { outline: none; border-color: var(--accent); }
.set-token-eye { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: none; background: none;
  cursor: pointer; color: rgba(var(--ink-rgb), 0.5); padding: 5px; display: grid; place-items: center; }
.set-token-eye:hover { color: var(--ink); }
.set-token-eye i, .set-token-eye svg { width: 16px; height: 16px; }
.set-bank-row { display: flex; gap: 8px; margin-top: 6px; }
.set-bank-btn { flex: 1; border: 1px solid var(--accent); background: var(--accent); color: var(--paper); cursor: pointer;
  font-family: inherit; font-size: 12px; font-weight: 600; padding: 8px; border-radius: 9px; }
.set-bank-btn:hover { filter: brightness(1.06); }
.set-bank-help { flex: 0 0 auto; border: 1px solid var(--edge); background: var(--panel); color: var(--ink); cursor: pointer;
  font-family: inherit; font-size: 11.5px; padding: 8px 12px; border-radius: 9px; }
.set-bank-help:hover { border-color: var(--accent); color: var(--accent); }
.set-sec { font-size: 9px; text-transform: uppercase; letter-spacing: 0.16em; color: rgba(var(--ink-rgb), 0.42);
  padding: 12px 0 2px; border-top: 1px solid var(--edge-soft); margin-top: 4px; }
.set-sec:first-child { border-top: none; margin-top: 0; padding-top: 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.set-row > span { color: rgba(var(--ink-rgb), 0.7); flex-shrink: 0; }
.set-row input { flex: 1; min-width: 0; max-width: 58%; font-family: inherit; font-size: 12px; text-align: right;
  padding: 6px 9px; border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); color: var(--ink); }
.set-row input:focus { outline: none; border-color: var(--accent); }
.set-select { flex: 1; min-width: 0; max-width: 58%; font-family: inherit; font-size: 12px; text-align: right;
  padding: 6px 9px; border: 1px solid var(--edge); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; }
.set-hint { font-size: 10px; font-style: italic; color: rgba(var(--ink-rgb), 0.45); margin: 1px 0 2px; }
.set-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  border: 1px solid var(--edge); border-radius: 9px; background: var(--panel); cursor: pointer;
  font-family: inherit; font-size: 12px; color: var(--ink); padding: 8px 11px; }
.set-toggle .set-state { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(var(--ink-rgb), 0.5); }
.set-toggle.on { border-color: var(--accent); color: var(--accent); }
.set-toggle.on .set-state { color: var(--accent); }
.set-bk-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 2px; }
.set-btn { flex: 1 1 auto; min-width: 0; border: 1px solid var(--edge); border-radius: 9px; background: var(--panel);
  cursor: pointer; font-family: inherit; font-size: 12px; color: var(--ink); padding: 9px 12px; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease; }
.set-btn:hover { border-color: var(--accent); color: var(--accent); }
.set-themes { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 2px; }
.set-stats { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.set-stats .set-toggle { padding: 7px 10px; flex: 1; }
.set-stat-row { display: flex; align-items: center; gap: 6px; }
.cst-ctrls { display: inline-flex; gap: 4px; flex-shrink: 0; }
.cst-act { border: 1px solid var(--edge); background: var(--panel); cursor: pointer; font-family: inherit;
  font-size: 11px; min-width: 30px; padding: 6px 8px; border-radius: 8px; color: rgba(var(--ink-rgb), 0.75); }
.cst-act:hover { border-color: var(--accent); color: var(--accent); }
.cst-act.on { background: #3f8f4e; color: #fff; border-color: #3f8f4e; }
.cst-del { border: none; background: none; cursor: pointer; color: rgba(var(--ink-rgb), 0.35); font-size: 15px; padding: 0 4px; }
.cst-del:hover { color: #c9542e; }
.cst-add { margin-top: 8px; width: 100%; border: 1px dashed var(--edge); background: none; cursor: pointer;
  font-family: inherit; font-size: 12px; color: rgba(var(--ink-rgb), 0.7); padding: 9px; border-radius: 9px; }
.cst-add:hover { border-color: var(--accent); color: var(--accent); }

/* greeting in the sidebar */
.sidebar-greeting { padding: 16px 16px 12px; font-size: 13px; color: var(--accent); letter-spacing: 0.01em; line-height: 1.5; }
.founder-compliment { display: block; font-size: 11px; color: rgba(var(--ink-rgb), 0.55); font-style: italic; margin-top: 8px; letter-spacing: 0; line-height: 1.5; }
.sidebar-xp { padding: 4px 16px 12px; font-size: 11px; color: rgba(var(--ink-rgb), 0.5); letter-spacing: 0.04em; }
.sidebar-xp b { color: var(--accent); font-variant-numeric: tabular-nums; }
/* your cache, as a character — name + level + title + XP toward the next level */
.cache-char { padding: 11px 13px; border: 1px solid var(--edge-soft); border-radius: 12px; background: var(--panel); }
.cc-top { display: flex; align-items: center; gap: 8px; }
.cc-emoji { font-size: 18px; line-height: 1; }
.cc-name { border: none; background: none; cursor: pointer; font-family: inherit; font-size: 14px; font-weight: 700;
  color: var(--ink); padding: 0; text-align: left; letter-spacing: 0.02em; }
.cc-name:hover { color: var(--accent); }
.cc-meta { font-size: 9.5px; color: rgba(var(--ink-rgb), 0.6); margin: 5px 0 6px; text-transform: uppercase; letter-spacing: 0.09em; }
.cc-meta b { color: var(--accent); }
.cc-bar { height: 6px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.12); overflow: hidden; }
.cc-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.cc-xp { font-size: 9.5px; color: rgba(var(--ink-rgb), 0.5); margin-top: 5px; font-variant-numeric: tabular-nums; }
.cc-xp b { color: rgba(var(--ink-rgb), 0.78); }

/* privacy blur — hide amounts until hovered (for screen-sharing) */
.privacy-on .big, .privacy-on .bal-line-amt, .privacy-on .acct-bal, .privacy-on .bd-amt,
.privacy-on .cf-amt, .privacy-on .mo-net, .privacy-on .mo-val, .privacy-on .mo-cat-amt,
.privacy-on .inc-val, .privacy-on .pm-net {
  filter: blur(7px); transition: filter 0.14s ease; cursor: default;
}
.privacy-on .big:hover, .privacy-on .bal-line-amt:hover, .privacy-on .acct-bal:hover,
.privacy-on .bd-amt:hover, .privacy-on .cf-amt:hover, .privacy-on .mo-net:hover,
.privacy-on .mo-val:hover, .privacy-on .mo-cat-amt:hover, .privacy-on .inc-val:hover,
.privacy-on .pm-net:hover { filter: none; }
.safe-reserve {
  border: none; background: none; cursor: pointer; flex-shrink: 0;
  font-family: inherit; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(var(--ink-rgb), 0.45);
  transition: color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.safe-reserve:hover { color: var(--accent); }

/* clock widget + 12/24h toggle */
.widget-body.is-clock {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; text-align: center;
}
.is-clock .big { white-space: nowrap; }
.clock-toggle {
  display: inline-flex; gap: 2px; margin-top: 8px;
  border: 1px solid var(--edge-soft); border-radius: 999px; padding: 2px;
}
.clock-toggle button {
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 9px; letter-spacing: 0.1em; padding: 3px 9px; border-radius: 999px;
  color: rgba(var(--ink-rgb), 0.45);
  transition: background 0.2s ease, color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.clock-toggle button.active { background: var(--ink); color: var(--paper); }

/* resize handle */
/* resize from any corner; handles sit above the bar but below its buttons */
.widget-resize { position: absolute; width: 18px; height: 18px; touch-action: none; z-index: 2; }
.r-nw { top: 0; left: 0; cursor: nwse-resize; }
.r-ne { top: 0; right: 0; cursor: nesw-resize; }
.r-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.r-se { bottom: 0; right: 0; cursor: nwse-resize; }
/* only the bottom-right shows the little corner indicator — rounded to match the widget */
.r-se::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px;
  border-right: 1.5px solid rgba(var(--ink-rgb), 0.4); border-bottom: 1.5px solid rgba(var(--ink-rgb), 0.4);
  border-bottom-right-radius: 7px;
}
.widget-bar { position: relative; z-index: 1; }
.bar-right { position: relative; z-index: 3; }

/* ── sticker (free-floating icon) ───────────────── */
.sticker {
  position: absolute;
  display: grid; place-items: center;
  container-type: size;
  cursor: grab; touch-action: none;
}
.sticker:active { cursor: grabbing; }
.sticker svg {
  width: clamp(20px, 72cqmin, 420px); height: auto;
  color: var(--ink); stroke-width: 1.5;
  filter: drop-shadow(0 2px 4px rgba(var(--ink-rgb), 0.18));
}
.sticker-close {
  position: absolute; top: -8px; right: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--edge); background: var(--paper);
  color: var(--ink); font-size: 10px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity 0.15s ease;
}
.sticker:hover .sticker-close { opacity: 1; }
.sticker-magnet {
  position: absolute; top: -8px; left: -8px;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1px solid var(--edge); background: var(--paper);
  color: rgba(var(--ink-rgb), 0.5); cursor: pointer; padding: 0;
  display: grid; place-items: center; opacity: 0; transition: opacity 0.15s ease;
}
.sticker-magnet i, .sticker-magnet svg { width: 10px; height: 10px; }
.sticker:hover .sticker-magnet { opacity: 1; }
.sticker-magnet.on { color: var(--accent); border-color: var(--accent); opacity: 1; }
.sticker-resize { position: absolute; right: -2px; bottom: -2px; width: 16px; height: 16px; cursor: nwse-resize; opacity: 0; }
.sticker:hover .sticker-resize { opacity: 0.5; }
.sticker-resize::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
}

/* drag ghost (follows the cursor while dragging an icon out) */
.drag-ghost { position: fixed; z-index: 300; pointer-events: none; transform: translate(-50%, -50%); }
.drag-ghost svg { width: 40px; height: 40px; color: var(--ink); filter: drop-shadow(0 3px 6px rgba(var(--ink-rgb), 0.3)); }

/* drop menu */
.drop-backdrop { position: fixed; inset: 0; z-index: 310; }
.drop-menu {
  position: fixed; z-index: 320;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 10px;
  padding: 5px; display: flex; flex-direction: column; gap: 3px;
  box-shadow: 0 16px 40px -12px rgba(var(--ink-rgb), 0.4);
}
.drop-menu button {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: none; border-radius: 7px;
  background: none; color: var(--ink); font-family: inherit; font-size: 12px;
  cursor: pointer; white-space: nowrap; text-align: left;
}
.drop-menu button:hover { background: rgba(var(--ink-rgb), 0.07); }
.drop-menu svg { width: 15px; height: 15px; stroke-width: 1.75; }

/* ── sidebar toggle ─────────────────────────────── */
.sidebar-toggle {
  position: fixed; top: 14px; right: 14px; z-index: 60;
  width: 38px; height: 38px;
  border: 1px solid var(--edge); border-radius: 10px;
  background: var(--paper); color: var(--ink); font-size: 15px; cursor: pointer;
  transition: opacity 0.2s ease, background 0.15s ease;
}
.sidebar-toggle:hover { background: var(--panel); }
body.sidebar-open .sidebar-toggle { opacity: 0; pointer-events: none; }

/* theme toggle — top right */
.theme-toggle {
  position: fixed; top: 14px; right: 60px; z-index: 60;
  width: 38px; height: 38px;
  border: 1px solid var(--edge); border-radius: 10px;
  background: var(--paper); color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-toggle:hover { background: var(--panel); }
.theme-toggle svg { width: 17px; height: 17px; }

.theme-backdrop { position: fixed; inset: 0; z-index: 315; }

/* backgrounds picker (separate from theme) */
.bg-toggle { right: 106px; }
.bg-toggle svg { width: 18px; height: 18px; }
.bg-pop {
  position: fixed; top: 58px; right: 14px; z-index: 320; width: 224px;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 14px; padding: 12px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4);
}
.bg-cat { font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(var(--ink-rgb), 0.45); margin: 11px 2px 5px; }
.bg-cat:first-child { margin-top: 0; }
.bg-row { display: flex; gap: 6px; flex-wrap: wrap; }
.bg-swatch {
  flex: 1; min-width: 62px; height: 36px; border-radius: 8px; cursor: pointer; position: relative; overflow: hidden;
  border: 1px solid var(--edge-soft); font-family: inherit; font-size: 9px; color: var(--ink); background: var(--panel);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px;
}
.bg-swatch span { position: relative; z-index: 1; background: var(--paper); padding: 1px 5px; border-radius: 4px; letter-spacing: 0.04em; }
.bg-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-swatch.motion-drift, .bg-swatch.motion-aurora, .bg-swatch.motion-pulse {
  background: radial-gradient(circle at 38% 40%, color-mix(in srgb, var(--accent) 40%, var(--panel)), var(--panel));
}
.bg-swatch.retro-grid {
  background-color: var(--panel);
  background-image: linear-gradient(rgba(var(--ink-rgb), 0.2) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--ink-rgb), 0.2) 1px, transparent 1px);
  background-size: 9px 9px;
}
.bg-swatch.retro-scan { background-color: var(--panel); background-image: repeating-linear-gradient(rgba(var(--ink-rgb), 0.22) 0 1px, transparent 1px 3px); }
.bg-swatch.retro-sun { background: radial-gradient(circle at 50% 95%, color-mix(in srgb, var(--accent) 55%, var(--panel)), var(--panel) 65%); }
.bg-swatch.sticker-dots {
  background-color: var(--panel);
  background-image: radial-gradient(rgba(var(--ink-rgb), 0.28) 1.5px, transparent 2px); background-size: 9px 9px;
}
.bg-swatch.sticker-confetti {
  background-color: var(--panel);
  background-image: radial-gradient(circle at 30% 30%, var(--accent) 0 2px, transparent 3px), radial-gradient(circle at 70% 65%, rgba(var(--ink-rgb), 0.45) 0 2px, transparent 3px);
  background-size: 17px 17px;
}

/* applied backgrounds (a layer behind the board) */
html[data-bg]::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; }
/* let the bg layer (html::before, behind everything) actually show — the body's opaque
   paper fill was covering it. html keeps the paper base; body goes clear when a bg is on. */
html[data-bg] body { background-color: transparent; background-image: none; }
html[data-bg="retro-grid"]::before {
  background-image: linear-gradient(rgba(var(--ink-rgb), 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--ink-rgb), 0.06) 1px, transparent 1px);
  background-size: 30px 30px;
}
html[data-bg="retro-scan"]::before { background-image: repeating-linear-gradient(rgba(var(--ink-rgb), 0.05) 0 2px, transparent 2px 5px); }
html[data-bg="retro-sun"]::before {
  background: radial-gradient(circle at 50% 82%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 48%),
    repeating-linear-gradient(transparent 0 16px, rgba(var(--ink-rgb), 0.04) 16px 18px);
}
html[data-bg="motion-drift"]::before {
  background: radial-gradient(40% 40% at 30% 30%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(45% 45% at 72% 68%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  animation: bgDrift 20s ease-in-out infinite alternate;
}
@keyframes bgDrift { from { background-position: 0 0, 0 0; } to { background-position: 7% 9%, -9% -7%; } }
html[data-bg="motion-aurora"]::before {
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 38%, color-mix(in srgb, var(--accent) 12%, transparent) 68%, transparent);
  background-size: 220% 220%; animation: bgAurora 24s ease infinite;
}
@keyframes bgAurora { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
html[data-bg="motion-pulse"]::before {
  background: radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 58%);
  animation: bgPulse 7s ease-in-out infinite;
}
@keyframes bgPulse { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
html[data-bg="sticker-dots"]::before { background-image: radial-gradient(rgba(var(--ink-rgb), 0.09) 2.5px, transparent 3px); background-size: 28px 28px; }
html[data-bg="sticker-confetti"]::before {
  background-image:
    radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--accent) 55%, transparent) 0 4px, transparent 5px),
    radial-gradient(circle at 68% 58%, rgba(var(--ink-rgb), 0.4) 0 3px, transparent 4px),
    radial-gradient(circle at 45% 82%, color-mix(in srgb, var(--accent) 38%, transparent) 0 3px, transparent 4px),
    radial-gradient(circle at 86% 26%, rgba(var(--ink-rgb), 0.3) 0 3px, transparent 4px);
  background-size: 130px 130px;
}
@media (prefers-reduced-motion: reduce) {
  html[data-bg="motion-drift"]::before, html[data-bg="motion-aurora"]::before, html[data-bg="motion-pulse"]::before { animation: none; }
}

/* ── Accessibility ─────────────────────────────────────────────────────────
   Driven by attributes on <html> set in applyA11y(). */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
/* Skip link — invisible until a keyboard user tabs to it */
.skip-link { position: fixed; top: -60px; left: 12px; z-index: 100001; background: var(--accent); color: #06040f;
  padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; text-decoration: none; transition: top 0.15s ease; }
.skip-link:focus { top: 12px; outline: 2px solid #06040f; outline-offset: 2px; }
#board:focus { outline: none; }  /* programmatic focus target only */
/* Reduce motion & flashing — neutralise every CSS animation/transition, kill the
   warp flash and any animated backgrounds. JS paths (warp, sparks) gate too. */
html[data-reduce-motion="1"] *, html[data-reduce-motion="1"] *::before, html[data-reduce-motion="1"] *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
  transition-duration: 0.001ms !important; scroll-behavior: auto !important;
}
html[data-reduce-motion="1"] .lg-flash { display: none !important; }
html[data-reduce-motion="1"][data-bg^="motion-"]::before { animation: none !important; }
/* High contrast — stronger borders + full-strength text. */
html[data-contrast="high"] { --edge: rgba(var(--ink-rgb), 0.6); --edge-soft: rgba(var(--ink-rgb), 0.42); }
html[data-contrast="high"] .menu-item, html[data-contrast="high"] .status-pill,
html[data-contrast="high"] .widget, html[data-contrast="high"] .a11y-seg { border-color: var(--edge); }
html[data-contrast="high"] :focus-visible { outline-width: 3px; }
/* Text & UI size — scale the whole interface. */
html[data-text="lg"] { zoom: 1.12; }
html[data-text="xl"] { zoom: 1.26; }
/* The Accessibility panel */
.a11y-modal { max-width: 470px; }
.a11y-body { padding: 4px 16px 14px; display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-bottom: 1px solid var(--edge-soft); }
.a11y-row:last-of-type { border-bottom: none; }
.a11y-lbl { display: flex; flex-direction: column; gap: 3px; }
.a11y-lbl b { font-size: 13px; color: var(--ink); }
.a11y-lbl span { font-size: 11px; line-height: 1.45; color: rgba(var(--ink-rgb), 0.62); max-width: 250px; }
.a11y-lbl em { font-style: normal; color: var(--accent); }
.a11y-seg { display: inline-flex; flex-shrink: 0; background: rgba(var(--ink-rgb), 0.06); border: 1px solid var(--edge-soft); border-radius: 9px; padding: 2px; gap: 2px; }
.a11y-opt { font-family: inherit; font-size: 11px; padding: 6px 11px; border: none; border-radius: 7px; background: none; color: rgba(var(--ink-rgb), 0.7); cursor: pointer; white-space: nowrap; transition: background 0.12s, color 0.12s; }
.a11y-opt:hover { color: var(--ink); }
.a11y-opt.on { background: var(--ink); color: var(--paper); font-weight: 700; }
.a11y-note { font-size: 11px; color: rgba(var(--ink-rgb), 0.5); padding-top: 12px; line-height: 1.5; }
.a11y-intro { font-size: 12.5px; line-height: 1.5; color: rgba(var(--ink-rgb), 0.78); padding: 4px 0 10px; }
.a11y-intro em { font-style: normal; color: var(--accent); font-weight: 700; }
.a11y-sec { font-size: 9px; text-transform: uppercase; letter-spacing: 0.18em; color: rgba(var(--ink-rgb), 0.45); padding: 12px 0 7px; }
.a11y-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.a11y-preset { flex: 1 1 120px; display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: pointer;
  padding: 11px 13px; border-radius: 12px; background: rgba(var(--ink-rgb), 0.05); border: 1px solid var(--edge-soft);
  font-family: inherit; transition: border-color 0.15s, background 0.15s, transform 0.12s; }
.a11y-preset:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.a11y-preset b { font-size: 13px; color: var(--ink); }
.a11y-preset span { font-size: 10px; line-height: 1.35; color: rgba(var(--ink-rgb), 0.6); }
.a11y-preset.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-pop {
  position: fixed; top: 58px; right: 14px; z-index: 320; width: 196px;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 12px;
  padding: 7px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4);
}
/* date/time format popover (from the dock pill) */
.clock-pop { position: fixed; z-index: 320; width: 230px; background: var(--paper); border: 1px solid var(--edge);
  border-radius: 12px; padding: 9px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4); }
.cp-title { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.22em; color: rgba(var(--ink-rgb), 0.4); padding: 0 2px 1px; }
.cp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink); }
.cp-row > span:first-child { color: rgba(var(--ink-rgb), 0.7); }
.cp-row select { flex-shrink: 0; max-width: 124px; padding: 5px 8px; font-family: inherit; font-size: 11px;
  border: 1px solid var(--edge); border-radius: 8px; background: var(--paper); color: var(--ink); }
.cp-seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; }
.cp-h { border: none; background: none; cursor: pointer; font-family: inherit; font-size: 10px; padding: 4px 11px; color: rgba(var(--ink-rgb), 0.5); }
.cp-h.on { background: var(--accent); color: var(--paper); }
.cp-toggle { border: 1px solid var(--edge-soft); background: none; cursor: pointer; font-family: inherit; font-size: 9px;
  text-transform: uppercase; letter-spacing: 0.08em; padding: 4px 12px; border-radius: 999px; color: rgba(var(--ink-rgb), 0.5); }
.cp-toggle.on { background: var(--accent); color: var(--paper); border-color: var(--accent); }

/* Mono tier — Light / Auto / Dark as chunky 3D analog buttons that depress when engaged */
.mono-tier { margin-bottom: 4px; }
.mono-tier-top { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; }
.mono-tier-name { font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: 0.02em; }
.mono-tier-sub { font-size: 9px; color: rgba(var(--ink-rgb), 0.5); text-transform: uppercase; letter-spacing: 0.06em; }
.mono-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mono-btn {
  font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  padding: 9px 0; border-radius: 9px; border: 1px solid var(--edge); cursor: pointer;
  background: var(--panel); color: var(--ink);
  box-shadow: 0 3px 0 rgba(var(--ink-rgb), 0.22), 0 4px 7px rgba(0, 0, 0, 0.2);
  transform: translateY(0);
  transition: transform 0.09s cubic-bezier(0.3, 0.7, 0.4, 1.2), box-shadow 0.09s ease, background 0.12s ease;
}
.mono-btn:hover { background: rgba(var(--ink-rgb), 0.06); }
.mono-btn:active { transform: translateY(3px); box-shadow: 0 0 0 rgba(0, 0, 0, 0), inset 0 2px 5px rgba(0, 0, 0, 0.28); }
.mono-btn.on {
  transform: translateY(3px);
  background: var(--accent); color: var(--paper); border-color: var(--accent);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0), inset 0 2px 6px rgba(0, 0, 0, 0.4);
}
.theme-chips-grid { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }

/* named, starrable theme chips (settings + popover) */
.theme-chip { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--edge-soft); background: var(--panel); cursor: pointer; }
.theme-chip:hover { border-color: var(--edge); }
.theme-chip.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tc-swatch { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; display: grid; place-items: center;
  border: 1px solid var(--edge-soft); }
.tc-dot { width: 8px; height: 8px; border-radius: 50%; }
.tc-name { flex: 1; min-width: 0; font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-star { flex-shrink: 0; border: none; background: none; cursor: pointer; font-size: 14px; line-height: 1;
  color: rgba(var(--ink-rgb), 0.3); padding: 0 2px; }
.tc-star.on { color: var(--accent); }
.theme-swatch {
  width: 34px; height: 34px; border-radius: 8px; cursor: pointer; padding: 0;
  border: 1px solid var(--edge-soft); display: grid; place-items: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.theme-swatch .dot { width: 9px; height: 9px; border-radius: 50%; }
.theme-swatch.active { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── sidebar pane ───────────────────────────────── */
.sidebar-resize {
  position: absolute; top: 0; left: -3px; width: 8px; height: 100%; z-index: 72;
  cursor: ew-resize; touch-action: none;
}
.sidebar-resize:hover { background: linear-gradient(to left, transparent, rgba(var(--ink-rgb), 0.1)); }
body.sidebar-sizing, body.sidebar-sizing * { user-select: none; }
.sidebar {
  position: fixed; top: 0; right: 0; bottom: 0; width: 280px; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--edge);
  transform: translateX(100%);
  transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
body.sidebar-open .sidebar { transform: none; }

.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid var(--edge-soft); flex-shrink: 0;
}
.brand { display: inline-flex; align-items: center; min-width: 0; }
/* the real logo, rendered as a CSS mask so it tints to the theme's ink — adapts
   light/dark automatically and takes any custom scheme color. (Switch the
   background-color to var(--accent) if you want it to pop in the accent hue.) */
.brand-logo {
  display: inline-block; flex-shrink: 0;
  height: 16px; width: 108px;   /* logo is 1500×222 → ~6.76:1 */
  background-color: var(--accent);   /* logo takes each theme's accent → yellow on the brand theme */
  -webkit-mask: url("av%20assets/THECACHE_LOGO_WHITE.png") left center / contain no-repeat;
          mask: url("av%20assets/THECACHE_LOGO_WHITE.png") left center / contain no-repeat;
  transition: background-color 0.2s ease;
}
.brand-name {
  font-family: "Special Gothic Expanded One", system-ui, sans-serif;
  font-size: 15px; letter-spacing: 0.02em; color: var(--ink); line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px;
}
/* status "dot" is the pixel goat, tinted by live/stale/down state */
.brand-dot { display: inline-block; width: 15px; height: 15px; margin-right: 9px; vertical-align: middle; flex-shrink: 0;
  background-color: var(--accent); transition: background-color 0.2s ease;
  -webkit-mask: url("av%20assets/goat-pixel.png") center / contain no-repeat;
  mask: url("av%20assets/goat-pixel.png") center / contain no-repeat; }
.brand-dot[data-state="live"] { background-color: #3f8f4e; }
.brand-dot[data-state="stale"] { background-color: #d6920f; }
.brand-dot[data-state="down"] { background-color: #c9542e; }
.sidebar-version {
  padding: 12px 16px; border-top: 1px solid var(--edge-soft); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px;
}
.ver-url { font-size: 10px; letter-spacing: 0.04em; color: rgba(var(--ink-rgb), 0.4); }
.sidebar-close { border: none; background: none; cursor: pointer; color: rgba(var(--ink-rgb), 0.45); font-size: 13px; padding: 4px 6px; border-radius: 6px; }
.sidebar-close:hover { color: var(--accent); background: rgba(var(--ink-rgb), 0.06); }

.sidebar-scroll { overflow-y: auto; flex: 1; }
.sidebar-section { padding: 16px; border-bottom: 1px solid var(--edge-soft); }
.section-title { text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px; color: rgba(var(--ink-rgb), 0.45); margin-bottom: 10px; }
.section-hint { font-size: 10px; color: rgba(var(--ink-rgb), 0.35); margin-top: 10px; font-style: italic; }

/* collapsible section */
.section-toggle {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 0; margin-bottom: 10px; border: none; background: none; cursor: pointer;
  color: inherit; font-family: inherit;
}
.section-toggle .section-title { margin-bottom: 0; }
.section-caret { font-size: 10px; opacity: 0.5; transition: transform 0.3s ease; }
.sidebar-section.collapsed .section-caret { transform: rotate(-90deg); }
.sidebar-section.collapsed .section-toggle { margin-bottom: 0; }
.section-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.sidebar-section.collapsed .section-body { grid-template-rows: 0fr; }
.section-body-inner { overflow: hidden; min-height: 0; }

.library { display: flex; flex-direction: column; gap: 6px; }
.lib-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; cursor: pointer;
  font-size: 12px; text-align: left; color: var(--ink); transition: background 0.14s ease;
}
.lib-item:hover { background: rgba(var(--ink-rgb), 0.07); }
.lib-item.active { background: rgba(var(--ink-rgb), 0.05); }
.lib-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--edge); flex-shrink: 0; }
.lib-item.active .lib-dot { background: var(--accent); border-color: var(--accent); }
.lib-star { flex-shrink: 0; cursor: pointer; font-size: 12px; line-height: 1; width: 14px; text-align: center;
  color: rgba(var(--ink-rgb), 0.3); transition: color 0.15s, transform 0.1s; }
.lib-star:hover { color: var(--accent); transform: scale(1.2); }
.lib-item.fav .lib-star { color: var(--accent); }
.gutter-ctrl { display: flex; align-items: center; gap: 9px; padding: 10px 2px 2px; }
.gutter-end { font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(var(--ink-rgb), 0.4); flex-shrink: 0; }
.gutter-track-wrap { position: relative; flex: 1; display: flex; align-items: center; height: 16px; }
.gutter-slider { flex: 1; accent-color: var(--accent); cursor: pointer; height: 4px; margin: 0; position: relative; z-index: 1; background: transparent; }
.gt-tick { position: absolute; top: 50%; width: 2px; height: 9px; margin: -4.5px 0 0 -1px; background: rgba(var(--ink-rgb), 0.25); border-radius: 1px; pointer-events: none; }
.gutter-ctrl + .section-hint { margin-bottom: 14px; }   /* breathing room before the widget list */
/* Smooth Brain = luxurious: roomy padding, airy letter-spacing, big calm targets */
:root[data-menutier="1"] .menu-item { font-size: 15px; padding: 14px 16px; border-radius: 13px; letter-spacing: 0.04em; line-height: 1.3; }
:root[data-menutier="1"] .lib-item { font-size: 14.5px; padding: 13px 14px; border-radius: 13px; letter-spacing: 0.02em; }
:root[data-menutier="1"] .section-title { font-size: 12px; letter-spacing: 0.18em; margin-bottom: 4px; }
:root[data-menutier="1"] .sidebar-section { margin-bottom: 12px; }
:root[data-menutier="1"] .cache-char { padding: 15px; }
:root[data-menutier="1"] .menu-item + .menu-item { margin-top: 3px; }
/* Galaxy Brain = packed: tight padding, dense, efficient — more on screen, more buttons */
:root[data-menutier="3"] .menu-item { font-size: 11.5px; padding: 5px 10px; letter-spacing: 0; }
:root[data-menutier="3"] .lib-item { font-size: 11.5px; padding: 5px 9px; }
:root[data-menutier="3"] .section-title { font-size: 9px; margin-bottom: 1px; }
:root[data-menutier="3"] .sidebar-section { margin-bottom: 4px; }
:root[data-menutier="3"] .section-hint { font-size: 8.5px; }
/* click sparks — rapid clicking shoots theme-colored EXP sparks from the cursor */
.exp-spark { position: fixed; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: var(--accent); pointer-events: none; z-index: 99999; will-change: transform, opacity;
  animation: exp-spark-fly 0.68s cubic-bezier(0.2, 0.7, 0.3, 1) forwards; }
@keyframes exp-spark-fly {
  0% { transform: translate(0, 0) scale(var(--s, 1)); opacity: 1; }
  100% { transform: translate(var(--dx, 0), var(--dy, 0)) scale(0); opacity: 0; }
}
/* BLESSED — cache health maxed → the cursor upgrades (Mario-style) + clicks erupt gold */
body.blessed .cursor-ball {
  background: radial-gradient(circle at 35% 30%, #fff7cc, var(--accent) 58%, #b8930a) !important;
  box-shadow: 0 0 8px var(--accent) !important;   /* single, smaller glow — keeps the layer light + snappy */
}
.exp-spark.blessed { width: 9px; height: 9px; background: radial-gradient(circle, #fff7cc, var(--accent) 70%); animation-duration: 0.8s; }
/* trust badge — live ledger-integrity proof in the menu pane */
.sidebar-trust { padding: 8px 16px 0; }
.sidebar-trust:empty { display: none; }
.trust-chip { display: inline-flex; align-items: center; gap: 8px; width: 100%; justify-content: space-between;
  font-family: inherit; font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em; cursor: pointer;
  border: 1px solid var(--edge); background: rgba(63, 143, 78, 0.08); border-radius: 10px; padding: 9px 13px; color: var(--ink); }
.trust-chip.ok { border-color: rgba(63, 143, 78, 0.5); }
.trust-chip.ok .trust-n { color: #3f8f4e; }
.trust-chip.warn { background: rgba(201, 84, 46, 0.08); border-color: rgba(201, 84, 46, 0.55); color: #c9542e; }
.trust-chip:hover { border-color: var(--accent); }
.trust-n { color: rgba(var(--ink-rgb), 0.45); font-variant-numeric: tabular-nums; font-weight: 700; }
.trust-body { padding: 12px 16px 16px; }
.trust-lead { font-size: 12.5px; color: rgba(var(--ink-rgb), 0.7); line-height: 1.55; margin-bottom: 12px; }
.trust-row { display: flex; align-items: baseline; gap: 9px; padding: 6px 0; border-bottom: 1px solid var(--edge-soft); font-size: 12px; }
.trust-row:last-of-type { border-bottom: none; }
.trust-pass { color: #3f8f4e; font-weight: 700; }
.trust-fail { color: #c9542e; font-weight: 700; }
.trust-name { color: var(--ink); flex-shrink: 0; }
.trust-detail { color: rgba(var(--ink-rgb), 0.5); margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.trust-foot { font-size: 11px; color: rgba(var(--ink-rgb), 0.5); margin-top: 12px; font-variant-numeric: tabular-nums; }
/* cache health badge + modal */
.sidebar-health { padding: 6px 16px 0; }
.sidebar-health:empty { display: none; }
.health-chip { display: inline-flex; align-items: center; gap: 8px; width: 100%; cursor: pointer; font-family: inherit; font-size: 11px;
  border: 1px solid var(--edge-soft); background: var(--panel); border-radius: 999px; padding: 6px 12px; color: var(--ink); }
.health-chip:hover { border-color: var(--accent); }
.health-ring { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), rgba(var(--ink-rgb), 0.15) 0); }
.health-lbl { flex: 1; text-align: left; }
.health-pct { font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.6); }
.health-chip.full { border-color: var(--accent); }
.health-chip.full .health-pct { color: var(--accent); font-weight: 600; }
.health-body { padding: 14px 16px 16px; }
.health-big { font-size: 30px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1; }
.health-big span { display: block; font-size: 11px; font-weight: 400; color: rgba(var(--ink-rgb), 0.55); margin-top: 4px; }
.health-bonus { font-size: 12px; margin: 12px 0; color: var(--ink); }
.health-bonus.dim { color: rgba(var(--ink-rgb), 0.6); }
.health-row { display: flex; align-items: baseline; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--edge-soft); font-size: 12.5px; }
.health-row:last-child { border-bottom: none; }
.health-mk { flex-shrink: 0; font-weight: 700; }
.health-row.ok .health-mk { color: #3f8f4e; }
.health-row.todo .health-mk { color: rgba(var(--ink-rgb), 0.4); }
.health-name { color: var(--ink); }
.health-row.ok .health-name { color: rgba(var(--ink-rgb), 0.55); }
.health-act { margin-left: auto; font-size: 10.5px; color: var(--accent); text-align: right; }
/* settings tiers — Smooth Brain / Big Brain / Galaxy Brain */
.set-tier { display: flex; gap: 6px; margin: 2px 0 2px; }
.set-tier-opt { flex: 1; font-family: inherit; font-size: 11px; cursor: pointer; padding: 8px 6px; border-radius: 8px;
  border: 1px solid var(--edge); background: var(--panel); color: rgba(var(--ink-rgb), 0.7); white-space: nowrap; }
.set-tier-opt:hover { border-color: var(--accent); color: var(--accent); }
.set-tier-opt.on { background: var(--accent); color: var(--paper); border-color: var(--accent); font-weight: 600; }
/* character ledger modal */
.char-body { padding: 14px 16px 16px; }
.char-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.char-stat { text-align: center; background: var(--panel); border: 1px solid var(--edge-soft); border-radius: 10px; padding: 8px 4px; }
.char-stat b { display: block; font-size: 15px; color: var(--accent); font-variant-numeric: tabular-nums; }
.char-stat span { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.07em; color: rgba(var(--ink-rgb), 0.5); }
.char-bar { height: 7px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.12); overflow: hidden; }
.char-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.char-since { font-size: 10.5px; color: rgba(var(--ink-rgb), 0.5); margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.char-sec { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(var(--ink-rgb), 0.5); margin: 12px 0 6px; }

/* Merit badges — flat duotone 8-bit pixel tiles (ink + paper). Earned: inked outline.
   One-of-one (mythic): inverted/filled. Locked: faint outline. No gradients, no glow. */
.badge-count { font-variant-numeric: tabular-nums; color: rgba(var(--ink-rgb), 0.4); letter-spacing: 0; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 14px 8px; margin: 2px 0 4px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; cursor: pointer; }
.badge-disc {
  width: 50px; height: 50px; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.12s ease;
}
.badge-disc svg { display: block; width: 30px; height: 30px; image-rendering: pixelated; }
.badge.got .badge-disc { border: 3px solid var(--ink); background: var(--paper); color: var(--ink); }
.badge.got.tier-mythic .badge-disc { background: var(--ink); color: var(--paper); }  /* one-of-one: inverted */
.badge.got:hover .badge-disc { transform: translateY(-2px); }
.badge.lock .badge-disc { border: 3px solid var(--edge-soft); background: transparent; color: var(--edge-soft); }
.badge-name { font-size: 9.5px; line-height: 1.15; letter-spacing: 0.02em; color: rgba(var(--ink-rgb), 0.7); }
.badge.lock .badge-name { color: rgba(var(--ink-rgb), 0.38); }
.badge-caption { font-size: 11px; color: rgba(var(--ink-rgb), 0.55); min-height: 15px; margin: 7px 2px 2px; }
.char-ev { display: flex; align-items: baseline; gap: 9px; padding: 6px 0; border-bottom: 1px solid var(--edge-soft); font-size: 12.5px; }
.char-ev:last-child { border-bottom: none; }
.char-ev-i { flex-shrink: 0; }
.char-ev-d { flex: 1; color: var(--ink); }
.char-ev-t { color: rgba(var(--ink-rgb), 0.45); font-size: 10.5px; white-space: nowrap; }
.char-empty { font-size: 12.5px; color: rgba(var(--ink-rgb), 0.55); line-height: 1.6; padding: 8px 0; }
/* Skills & unlocks — unleashable pills */
.sk-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.sk-pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 12px; font-size: 11.5px;
  font-family: inherit; border: 1px solid var(--edge); background: var(--panel); color: rgba(var(--ink-rgb), 0.45); cursor: default; }
.sk-pill.got { background: var(--accent); color: var(--paper); border-color: var(--accent); cursor: pointer; }
.sk-pill.got:hover { filter: brightness(1.06); }
.sk-i { font-size: 11px; }
.sk-go { font-size: 8px; text-transform: uppercase; letter-spacing: 0.09em; opacity: 0.85; }
.sk-req { font-size: 8px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.6; }
.sk-pill.unleash { animation: sk-unleash 0.55s ease-out; }
@keyframes sk-unleash { 0% { box-shadow: 0 0 0 0 rgba(255, 212, 9, 0.7); } 100% { box-shadow: 0 0 0 14px rgba(255, 212, 9, 0); } }
/* Journey — StarCraft-style tech tree: a spine with node dots + branching feats */
.tt-tree { position: relative; padding-left: 16px; }
.tt-tree::before { content: ""; position: absolute; left: 4px; top: 9px; bottom: 12px; width: 2px; background: var(--edge); }
.tt-tier { position: relative; margin-bottom: 14px; }
.tt-tier::before { content: ""; position: absolute; left: -12px; top: 10px; width: 12px; height: 2px; background: var(--edge); }
.tt-tier::after { content: ""; position: absolute; left: -16px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--panel); border: 2px solid var(--edge); }
.tt-tier.done::after { background: #3f8f4e; border-color: #3f8f4e; }
.tt-tier.now::after { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 9px var(--accent); }
.tt-node { display: inline-flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.tt-tier.lock .tt-node { color: rgba(var(--ink-rgb), 0.4); }
.tt-tier.done .tt-arc::after { content: " ✓"; color: #3f8f4e; font-weight: 700; }
.tt-lvl { font-weight: 400; font-size: 10px; color: rgba(var(--ink-rgb), 0.45); }
.tt-branch { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tt-feat { font-size: 10px; color: rgba(var(--ink-rgb), 0.65); border: 1px solid var(--edge-soft); border-radius: 6px; padding: 3px 8px; }
.tt-tier.now .tt-feat { border-color: rgba(255, 212, 9, 0.4); }
.tt-tier.lock .tt-feat { opacity: 0.5; }
/* King Cozy — founder-only retro-futuristic phosphor console */
.king-modal { background: #0b0e08; border: 1px solid rgba(143, 227, 136, 0.32);
  box-shadow: 0 0 44px rgba(143, 227, 136, 0.16), inset 0 0 70px rgba(0, 0, 0, 0.55); }
.king-head { background: linear-gradient(180deg, rgba(143, 227, 136, 0.12), transparent); border-bottom: 1px solid rgba(143, 227, 136, 0.25); }
.king-head span { color: #8fe388; letter-spacing: 0.16em; font-weight: 700; text-shadow: 0 0 9px rgba(143, 227, 136, 0.55); }
.king-head .cat-close { color: rgba(143, 227, 136, 0.7); }
.king-body { padding: 14px 16px 16px; position: relative; }
.king-body::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(143, 227, 136, 0.045) 0 1px, transparent 1px 3px); }
.king-sub { color: rgba(143, 227, 136, 0.6); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 14px; position: relative; }
.king-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.king-tile { border: 1px solid rgba(143, 227, 136, 0.22); border-radius: 8px; padding: 13px 8px; text-align: center; background: rgba(143, 227, 136, 0.04); }
.king-tile b { display: block; font-size: 23px; color: #8fe388; font-variant-numeric: tabular-nums; text-shadow: 0 0 11px rgba(143, 227, 136, 0.4); line-height: 1.1; }
.king-tile span { font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(143, 227, 136, 0.55); }
.king-foot { margin-top: 14px; font-size: 10px; color: rgba(143, 227, 136, 0.45); position: relative; letter-spacing: 0.03em; }
.king-ph { position: relative; margin-top: 4px; }
.king-dim { font-size: 11px; color: rgba(143, 227, 136, 0.5); }
.king-phtop { font-size: 12px; color: rgba(143, 227, 136, 0.7); margin-bottom: 8px; }
.king-phtop b { color: #8fe388; text-shadow: 0 0 8px rgba(143, 227, 136, 0.4); }
.king-phrow { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; padding: 4px 0; border-bottom: 1px solid rgba(143, 227, 136, 0.12); }
.king-phrow span { color: rgba(143, 227, 136, 0.75); font-variant-numeric: tabular-nums; }
.king-phrow b { color: #8fe388; font-variant-numeric: tabular-nums; }
/* "built on THE CACHE" badge — bottom-right; becomes "Community Cache" later in the hub */
.built-on { display: inline-flex; align-items: center; gap: 7px; font-size: 9.5px; letter-spacing: 0.07em;
  text-transform: uppercase; color: rgba(var(--ink-rgb), 0.5); background: var(--panel);
  border: 1px solid var(--edge-soft); border-radius: 999px; padding: 5px 11px; white-space: nowrap; }
.built-logo { height: 11px; width: 74px; }
/* in-app help wiki */
.wiki-modal { max-width: 580px; }
.wk-body { padding: 10px 18px 18px; overflow-y: auto; }
.wk-h { color: var(--ink); margin: 18px 0 6px; }
.wk-body h2.wk-h { font-size: 16px; font-weight: 700; }
.wk-body h3.wk-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(var(--ink-rgb), 0.55); margin-top: 14px; }
.wk-p { font-size: 13px; line-height: 1.65; color: rgba(var(--ink-rgb), 0.82); margin: 7px 0; }
.wk-ul { margin: 7px 0; padding-left: 18px; }
.wk-ul li { font-size: 13px; line-height: 1.6; color: rgba(var(--ink-rgb), 0.82); margin-bottom: 4px; }
.wk-body code { background: rgba(var(--ink-rgb), 0.09); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.wk-body strong { color: var(--ink); font-weight: 700; }
.wk-body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
/* Enter the Ledger — skull CTA + full-screen hyperspace warp + cosmic ledger space */
.ledger-pill { display: inline-flex; align-items: center; font-size: 14px; line-height: 1; background: rgba(var(--ink-rgb), 0.06);
  border: 1px solid var(--edge-soft); border-radius: 999px; padding: 5px 11px; cursor: pointer; color: var(--ink);
  transition: transform 0.2s, filter 0.2s; animation: lg-bob 3.4s ease-in-out infinite; }
.ledger-pill .lp-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(var(--ink-rgb), 0.62); }
.ledger-pill:hover { transform: scale(1.1); filter: drop-shadow(0 0 9px var(--accent)); }
.ledger-pill:hover .lp-label { color: var(--accent); }
@keyframes lg-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.lg-space { position: fixed; inset: 0; z-index: 100000; background: #06040f; overflow: hidden;
  font-family: ui-monospace, Menlo, monospace; animation: lg-in 0.3s ease; }
.lg-space, .lg-space * { cursor: auto !important; }
.lg-space .lg-back, .lg-space .lg-book, .lg-space .lg-cancel, .lg-space .lg-mute, .lg-space .lg-bubble { cursor: pointer !important; }
.lg-space .lg-ledger { cursor: grab !important; }
.lg-space .lg-ledger.lg-dragging { cursor: grabbing !important; }
@keyframes lg-in { from { opacity: 0; } to { opacity: 1; } }
.lg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lg-scene { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; transition: opacity 0.5s ease, transform 0.5s ease; padding: 24px; }
.lg-hidden { opacity: 0; pointer-events: none; }
.lg-eyebrow { font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--accent); opacity: 0.8; }
.lg-gold { color: var(--accent); opacity: 1; text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent); }
.lg-cta { font-size: 24px; font-weight: 700; letter-spacing: 0.16em; color: #eef0ff; text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 50%, #788cff); }
.lg-title { font-family: "Special Gothic Expanded One", ui-monospace, sans-serif; font-size: 30px; letter-spacing: 0.04em; color: #fff; text-shadow: 0 0 22px color-mix(in srgb, var(--accent) 55%, #b478ff); }
.lg-headline { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 6px 0; }
.lg-headline b { font-size: 34px; color: var(--accent); text-shadow: 0 0 20px color-mix(in srgb, var(--accent) 55%, transparent); font-variant-numeric: tabular-nums; }
.lg-headline span { font-size: 11px; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.5); }
.lg-const { width: 92%; max-width: 1000px; height: auto; margin: 4px 0; }
.lg-back { margin-top: 8px; font-family: inherit; font-size: 13px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent); border-radius: 999px; padding: 9px 18px; }
.lg-back:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.lg-reward { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 1px; margin: 2px 0 4px;
  opacity: 0; transform: translateY(8px) scale(0.9); }
.lg-reward.lg-rw-show { animation: lg-rw-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards; }
@keyframes lg-rw-pop { to { opacity: 1; transform: translateY(0) scale(1); } }
.lg-rw-amt { font-size: 26px; font-weight: 800; color: var(--accent); text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 60%, transparent);
  font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.lg-rw-lbl { font-size: 11px; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.62); }
.lg-rw-lbl b { color: var(--accent); }
.lg-rw-star { position: absolute; top: -2px; font-size: 20px; opacity: 0; animation: lg-rw-star 1.1s ease-out 0.15s forwards; }
@keyframes lg-rw-star { 0% { opacity: 0; transform: translateY(6px) scale(0.6); } 28% { opacity: 1; } 100% { opacity: 0; transform: translateY(-48px) scale(1.15); } }
/* Spaceship-cockpit dashboard bubbles along the bottom of the cache */
.lg-dash { position: absolute; left: 0; right: 0; bottom: 26px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; padding: 0 24px;
  opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; pointer-events: none; }
.lg-dash.lg-dash-show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.lg-bubble { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 96px;
  padding: 14px 18px 9px; border-radius: 18px; font-family: ui-monospace, Menlo, monospace; color: #eef0ff;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--c) 28%, transparent), rgba(10, 12, 26, 0.74));
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--c) 32%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 12%, transparent);
  transition: transform 0.15s ease, box-shadow 0.2s ease; }
.lg-bubble::before { content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 26px; height: 3px;
  border-radius: 3px; background: var(--c); box-shadow: 0 0 10px var(--c); }
.lg-bubble:hover { transform: translateY(-2px); box-shadow: 0 0 32px color-mix(in srgb, var(--c) 55%, transparent), inset 0 0 18px color-mix(in srgb, var(--c) 16%, transparent); }
.lg-bub-ico { font-size: 17px; }
.lg-bub-val { font-size: 21px; font-weight: 800; color: var(--c); text-shadow: 0 0 12px color-mix(in srgb, var(--c) 60%, transparent); font-variant-numeric: tabular-nums; line-height: 1.1; }
.lg-bub-lbl { font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }
.lg-board-sub { font-size: 13px; color: rgba(255, 255, 255, 0.55); max-width: 340px; line-height: 1.5; }
.lg-book { margin-top: 14px; font-family: inherit; font-size: 16px; font-weight: 700; letter-spacing: 0.06em; color: #06040f;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 78%, #fff), var(--accent)); border: none; border-radius: 999px; padding: 13px 30px;
  box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 50%, transparent); transition: transform 0.15s ease, box-shadow 0.2s ease; }
.lg-book:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 0 40px color-mix(in srgb, var(--accent) 75%, transparent); }
.lg-cancel { font-family: inherit; font-size: 12px; color: rgba(255, 255, 255, 0.45); background: none; border: none; padding: 6px; }
.lg-cancel:hover { color: rgba(255, 255, 255, 0.8); }
.lg-mute { position: absolute; top: 18px; right: 18px; z-index: 5; width: 40px; height: 40px; font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center; color: #fff;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 50%;
  transition: background 0.18s ease, opacity 0.4s ease; }
.lg-mute:hover { background: rgba(255, 255, 255, 0.16); }
.lg-mute.lg-muted { opacity: 0.55; }
.lg-flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, #fff, rgba(255, 255, 255, 0) 60%); opacity: 0; pointer-events: none; transition: opacity 0.18s ease; }
.lg-flash.on { opacity: 1; }
/* font packs — each chip previews in its own typeface */
.set-fonts { display: flex; flex-wrap: wrap; gap: 6px; }
.font-chip { font-size: 13px; cursor: pointer; padding: 7px 12px; border-radius: 8px;
  border: 1px solid var(--edge); background: var(--panel); color: var(--ink); }
.font-chip:hover { border-color: var(--accent); }
.font-chip.active { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.lib-label { flex: 1; }
.lib-state { text-transform: uppercase; letter-spacing: 0.12em; font-size: 9px; color: rgba(var(--ink-rgb), 0.4); }

.icon-search {
  width: 100%; padding: 8px 10px; margin-bottom: 10px;
  border: 1px solid var(--edge-soft); border-radius: 8px;
  background: rgba(255, 255, 255, 0.25); color: var(--ink);
  font-family: inherit; font-size: 12px; outline: none;
}
.icon-search:focus { border-color: var(--edge); }
.icon-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.icon-cell {
  display: grid; place-items: center; aspect-ratio: 1;
  border: 1px solid var(--edge-soft); border-radius: 8px;
  background: rgba(255, 255, 255, 0.16); cursor: grab; color: var(--ink);
  touch-action: none; transition: background 0.12s ease, transform 0.08s ease;
}
.icon-cell:hover { background: rgba(255, 255, 255, 0.5); }
.icon-cell:active { cursor: grabbing; }
.icon-cell svg { width: 18px; height: 18px; stroke-width: 1.5; pointer-events: none; }
.icon-cell.hidden { display: none; }

.menu-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 11px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink);
  font-family: inherit; font-size: 12px; cursor: pointer; transition: background 0.14s ease;
}
.menu-item:hover { background: rgba(var(--ink-rgb), 0.07); }

/* ── bottom-right status: sources + sync ─────────── */
.status-bar { position: fixed; bottom: 24px; right: 24px; z-index: 55; display: flex; gap: 11px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--edge); border-radius: 999px;
  background: var(--paper); cursor: pointer;
  font-family: inherit; font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(var(--ink-rgb), 0.6);
  transition: background 0.15s ease;
}
/* every icon inside a dock pill renders at one size so heights match */
.status-pill svg, .status-pill i { width: 15px; height: 15px; flex-shrink: 0; }
.status-pill:hover { background: var(--panel); }
.src-count { font-weight: 600; color: var(--ink); }
.snd-note { font-size: 12px; line-height: 1; display: inline-block; }
.status-pill.playing { color: var(--accent); border-color: var(--accent); }
.status-pill.playing .snd-note { animation: snd-pulse 0.9s ease-in-out infinite; }
@keyframes snd-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: 0.7; } }
.yt-hidden { position: fixed; width: 0; height: 0; overflow: hidden; opacity: 0; pointer-events: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #3f8f4e; flex-shrink: 0; }
.status-pill.syncing .sync-dot { animation: syncblink 1s steps(1) infinite; }
@keyframes syncblink { 50% { opacity: 0.2; } }

/* ── The Dock (one cohesive bottom bar) ───────────────── */
.dock-bar {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 55;
  display: flex; justify-content: center; align-items: center; gap: 9px;
  padding: 0 8px; pointer-events: none;  /* full-width so nothing gets squeezed; clicks pass through the gaps */
}
.dock-bar > * { pointer-events: auto; }
/* sync sits in the bottom-right corner but stays vertically centered against the
   dock (same height/alignment as before) — absolute + margin:auto, no transform
   so the arcade press still works. The dock keeps centering on its own. */
.dock-bar > #syncHealth { position: absolute; right: 16px; top: 0; bottom: 0; margin: auto 0; z-index: 56; }
.dock-label {
  position: absolute; top: -15px; left: 4px;
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.26em; color: rgba(var(--ink-rgb), 0.32);
}
.dock {
  position: relative;
  display: flex; align-items: center; gap: 9px; padding: 9px 12px 11px;
  background: rgba(var(--ink-rgb), 0.05); border: 1px solid var(--edge-soft);
  border-radius: 18px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  flex: 0 0 auto; overflow: visible; flex-wrap: nowrap;
}
.dock-item { flex-shrink: 0; }
.dock-item.dock-dragging { opacity: 0.4; }
.dock .zoom-control { position: static; left: auto; bottom: auto; box-shadow: none; height: 32px; box-sizing: border-box; padding: 0 4px; }
#datetimeBtn { gap: 6px; }
#datetimeBtn .dt-time { font-weight: 600; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--ink); }
#datetimeBtn .dt-date { font-size: 10px; color: rgba(var(--ink-rgb), 0.55); text-transform: none; letter-spacing: 0; }
#periodBtn { gap: 6px; }
#periodBtn .period-text { font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 11px; color: var(--ink); }
#periodBtn[aria-busy] { color: var(--accent); }

/* top stats bar — a HUD of live numbers, mirrors the dock's glass pill */
.stats-bar {
  position: fixed; left: 0; right: 0; top: 14px; z-index: 55;
  display: flex; justify-content: center; align-items: center;
  padding: 0 64px; pointer-events: none;  /* clear the corner toggles; clicks pass through gaps */
}
.stats-bar > * { pointer-events: auto; }
.stats {
  display: flex; align-items: stretch; gap: 2px; padding: 6px 8px;
  background: rgba(var(--ink-rgb), 0.05); border: 1px solid var(--edge-soft);
  border-radius: 16px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.stats::-webkit-scrollbar { display: none; }
.stat-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; padding: 3px 13px; border-radius: 11px; cursor: grab; flex: 0 0 auto;
  min-width: 58px;
}
.stat-chip + .stat-chip { border-left: 1px solid var(--edge-soft); border-radius: 0; }
.stat-chip:hover { background: rgba(var(--ink-rgb), 0.05); }
.stat-chip.stat-dragging { opacity: 0.4; }
.stat-val {
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
  color: var(--ink); white-space: nowrap; line-height: 1.1;
}
.stat-val.t-exp { color: var(--accent); }
.stat-val.t-ok { color: #3f8f4e; }
.stat-val.t-warn { color: #b9842c; }
.stat-val.t-bad { color: #c9542e; }
.stat-label {
  font-size: 8px; text-transform: uppercase; letter-spacing: 0.14em;
  color: rgba(var(--ink-rgb), 0.45); white-space: nowrap;
}

/* King Cozy bar — founder-only second stats layer: a minimalist gold-tinted pill,
   stacked just below the personal pill. (No cartridge/slot/plug — kept simple.) */
.king-bar { top: 60px; z-index: 56; }
.king-stats {
  cursor: pointer; align-items: center;
  border-color: rgba(201, 162, 39, 0.6);
  background: rgba(201, 162, 39, 0.16);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.15), 0 3px 16px rgba(201, 162, 39, 0.16);  /* soft gold halo */
}
.king-stats:hover { border-color: rgba(201, 162, 39, 0.9); box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25), 0 4px 20px rgba(201, 162, 39, 0.22); }
.king-crown { font-size: 13px; padding: 0 6px 0 4px; line-height: 1; align-self: center; }
.king-stats .stat-chip { cursor: pointer; }
.king-stats .stat-val { color: #c9a227; }
.king-stats .stat-chip + .stat-chip { border-left-color: rgba(201, 162, 39, 0.28); }
.king-stats .stat-chip:hover { background: rgba(201, 162, 39, 0.13); }

/* period chip on each span widget's title bar */
.w-period {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(var(--ink-rgb), 0.07); color: rgba(var(--ink-rgb), 0.5);
  white-space: nowrap; flex-shrink: 0;
}

/* period selector popover (opens above the dock) */
.period-menu {
  position: fixed; z-index: 80; width: 232px; max-height: 60vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 14px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22); padding: 8px;
}
.pm-group { display: flex; flex-direction: column; gap: 3px; }
.pm-label {
  font-size: 8.5px; text-transform: uppercase; letter-spacing: 0.22em;
  color: rgba(var(--ink-rgb), 0.34); padding: 9px 6px 4px;
}
.pm-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 7px 10px; border: 1px solid transparent;
  border-radius: 9px; background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--ink);
}
.pm-item:hover { background: rgba(var(--ink-rgb), 0.06); }
.pm-item.active { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pm-net { font-size: 10px; font-variant-numeric: tabular-nums; }
.pm-net.pos { color: #3f8f4e; }
.pm-net.neg { color: #c9542e; }
.pm-empty { font-size: 11px; color: rgba(var(--ink-rgb), 0.45); padding: 6px 8px; }
.pm-custom { display: flex; align-items: center; gap: 5px; padding: 2px 4px 6px; }
.pm-custom input[type="date"] { flex: 1; min-width: 0; font-family: inherit; font-size: 10.5px; padding: 4px 5px;
  border: 1px solid var(--edge); border-radius: 7px; background: var(--paper); color: var(--ink); }
.pm-custom input[type="date"]:focus { outline: none; border-color: var(--accent); }
.pm-dash { color: rgba(var(--ink-rgb), 0.4); flex-shrink: 0; }
.pm-apply { flex-shrink: 0; border: 1px solid var(--accent); background: none; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: 10px; padding: 4px 9px; border-radius: 999px; }
.pm-apply:hover { background: var(--accent); color: var(--paper); }

.sources-panel {
  position: fixed; bottom: 80px; left: 50%; right: auto; margin-left: -130px; z-index: 56; width: 260px;
  max-height: 70vh; overflow-y: auto;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 14px; padding: 14px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.4);
  transform: translateY(10px); opacity: 0; pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.sources-panel.open { transform: none; opacity: 1; pointer-events: auto; }
a.src-link { text-decoration: none; color: inherit; }
a.src-link:hover .src-bankname { color: var(--accent); }
.src-subtitle {
  margin: 12px 0 6px; padding-top: 10px; border-top: 1px solid var(--edge-soft);
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: rgba(var(--ink-rgb), 0.4);
}
.src-log { font-size: 10px; color: rgba(var(--ink-rgb), 0.55); padding: 2px 0; font-variant-numeric: tabular-nums; }

/* ── jogger: goofy jointed cowboy hovering above the pills ── */
.jogger {
  position: fixed; bottom: 60px; right: 62px; z-index: 54;
  width: 70px; height: 76px; pointer-events: none; opacity: 0.96;
  animation: jog-hover 3.6s ease-in-out infinite;
}
/* pixel-art goat sprite (frames extracted from the reference video, white knocked out) */
.sprite-goat {
  width: 70px; height: 76px;
  background: url("goat-sprite.png") 0 0 / 560px 76px no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.22));
  animation: trot 0.8s steps(8) infinite;
}
@keyframes trot { to { background-position-x: -560px; } }
.jog-body { transform-box: view-box; transform-origin: 28px 20px; animation: goat-bob 0.7s ease-in-out infinite; }
.goat-solid { fill: currentColor; }
.goat-neck { fill: none; stroke: currentColor; stroke-width: 5.5; stroke-linecap: round; }
.goat-horn { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.goat-eye { fill: none; stroke: var(--paper); stroke-width: 1; stroke-linecap: round; }
.goat-cut { fill: var(--paper); }
.goat-sweat { fill: #7fb0e8; }
.gFront, .gBack { transform-box: fill-box; transform-origin: 50% 0%; }
.gFront { animation: goat-front 0.7s ease-in-out infinite; }
.gBack { animation: goat-back 0.7s ease-in-out infinite; }
.goatfar { animation-delay: -0.13s; opacity: 0.7; }
@keyframes jog-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes goat-bob { 0%, 100% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-2.5px) rotate(1.5deg); } }
@keyframes goat-front { 0%, 100% { transform: rotate(24deg); } 50% { transform: rotate(-28deg); } }
@keyframes goat-back { 0%, 100% { transform: rotate(-28deg); } 50% { transform: rotate(24deg); } }
.src-title { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(var(--ink-rgb), 0.45); margin-bottom: 10px; }
.src-bank { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; }
.src-bankdot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 4px; flex-shrink: 0; }
.src-bankname { font-size: 12px; color: var(--ink); }
.src-accts { font-size: 10px; color: rgba(var(--ink-rgb), 0.5); margin-top: 2px; line-height: 1.4; }
.src-foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--edge-soft); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(var(--ink-rgb), 0.45); }
.src-auto { display: inline-block; margin-top: 4px; text-transform: none; letter-spacing: 0; color: #3f8f4e; }

/* status pill + next-actions panel */
.status-main { max-width: 240px; }
.status-main .status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3f8f4e; flex-shrink: 0; }
.status-main[data-sev="1"] .status-dot { background: #d6920f; }
.status-main[data-sev="2"] .status-dot { background: #c9542e; }
.status-main .status-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-panel { z-index: 57; }
.status-action {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; font-family: inherit;
  font-size: 12px; color: var(--ink); padding: 7px 4px; border-radius: 8px;
  border-bottom: 1px solid var(--edge-soft);
}
.status-action:last-child { border-bottom: none; }
.status-action:hover { background: rgba(var(--ink-rgb), 0.05); }
.sa-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: #8a8f73; }
.sa-dot.sev1 { background: #d6920f; }
.sa-dot.sev2 { background: #c9542e; }
.status-clear { font-size: 12px; color: rgba(var(--ink-rgb), 0.55); padding: 6px 2px; }

/* sync = chunky green arcade button: cutout text, 3D side, depresses on press */
#syncHealth {
  background: #34b85a; border: none; color: var(--paper); font-weight: 800; letter-spacing: 0.03em;
  box-shadow: 0 3px 0 #1d7d39, 0 4px 7px rgba(0, 0, 0, 0.2);
  transition: transform 0.07s ease, box-shadow 0.07s ease, background 0.15s ease;
}
#syncHealth:hover { background: #3ac463; }
#syncHealth:active { transform: translateY(3px); box-shadow: 0 0 0 #1d7d39, 0 1px 3px rgba(0, 0, 0, 0.2); }
#syncHealth .sync-text { color: var(--paper); }

/* backend heartbeat = 8-bit goat head: spins when live, eyes X-out when not */
/* pixel goat head — the PNG is a cutout used as a mask, so it takes the theme color */
.server-pill .goat-head {
  width: 17px; height: 17px; margin-right: 5px; flex-shrink: 0; display: inline-block;
  background-color: var(--ink);
  -webkit-mask: url("av%20assets/goat-pixel.png") center / contain no-repeat;
  mask: url("av%20assets/goat-pixel.png") center / contain no-repeat;
  transform-origin: center;
}
/* live → the goat spins flat + very slowly, like a record on a turntable */
.server-pill[data-state="live"] .goat-head { animation: goatSpin 11s linear infinite; }
@keyframes goatSpin { to { transform: rotate(360deg); } }
.server-pill[data-state="down"], .server-pill[data-state="stale"] { color: var(--accent); }
.server-pill[data-state="down"] .goat-head, .server-pill[data-state="stale"] .goat-head {
  background-color: var(--accent); opacity: 0.6;
}

/* subscription detail / rename */
.subd-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.subd-field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; color: rgba(var(--ink-rgb), 0.55); text-transform: uppercase; letter-spacing: 0.08em; }
.subd-input {
  font-family: inherit; font-size: 15px; color: var(--ink); padding: 8px 10px;
  border: 1px solid var(--edge); border-radius: 8px; background: var(--paper);
  text-transform: none; letter-spacing: normal;
}
.subd-input:focus { outline: none; border-color: var(--accent); }
.subd-note { font-size: 11px; font-style: italic; color: rgba(var(--ink-rgb), 0.5); }
.subd-meta { font-size: 12px; color: var(--ink); display: flex; gap: 8px; align-items: baseline; }
.subd-k { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(var(--ink-rgb), 0.4); min-width: 72px; flex-shrink: 0; }
.subd-meta code { font-size: 11px; background: rgba(var(--ink-rgb), 0.06); padding: 1px 6px; border-radius: 5px; }
.subd-descs { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.subd-descs li { font-size: 11px; color: rgba(var(--ink-rgb), 0.6); }
.subd-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.subd-save, .subd-reset { font-family: inherit; font-size: 12px; padding: 7px 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--edge); background: none; color: var(--ink); }
.subd-save { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.subd-reset { color: rgba(var(--ink-rgb), 0.5); }

/* bug reports */
.bug-new { padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--edge-soft); }
.bug-input {
  font-family: inherit; font-size: 13px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--edge); border-radius: 8px; padding: 8px 10px; resize: vertical; min-height: 56px; line-height: 1.4;
}
.bug-input:focus { outline: none; border-color: var(--accent); }
.bug-types { display: flex; gap: 6px; }
.bug-type {
  font-family: inherit; font-size: 12px; padding: 6px 12px; cursor: pointer;
  border: 1px solid var(--edge); border-radius: 999px; background: var(--paper);
  color: rgba(var(--ink-rgb), 0.7);
}
.bug-type.on { background: var(--accent); color: var(--paper); border-color: var(--accent); font-weight: 600; }
.bug-email {
  font-family: inherit; font-size: 13px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--edge); border-radius: 8px; padding: 8px 10px;
}
.bug-email:focus { outline: none; border-color: var(--accent); }
.bug-msg { font-size: 12px; min-height: 16px; color: rgba(var(--ink-rgb), 0.55); }
.bug-msg.ok { color: #3f8f4e; }
.bug-msg.err { color: #c9542e; }
/* transparent "update available" preview modal */
.upd-body { padding: 12px 16px 16px; }
.upd-lead { font-size: 13px; color: var(--ink); margin-bottom: 10px; line-height: 1.5; }
.upd-sec { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(var(--ink-rgb), 0.5); margin: 8px 0 4px; }
.upd-changes { margin: 0 0 12px; padding-left: 18px; }
.upd-changes li { font-size: 12.5px; color: rgba(var(--ink-rgb), 0.85); line-height: 1.5; margin-bottom: 3px; }
.upd-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11.5px; color: rgba(var(--ink-rgb), 0.6); margin-bottom: 6px; }
.upd-meta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.upd-stat { font-size: 11px; color: rgba(var(--ink-rgb), 0.5); font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.upd-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.upd-actions button { font-family: inherit; font-size: 12px; padding: 8px 14px; border-radius: 8px; cursor: pointer; border: 1px solid var(--edge); background: var(--panel); color: var(--ink); }
.upd-go { background: var(--accent); color: var(--paper); border-color: var(--accent); font-weight: 600; }
.upd-skip { color: rgba(var(--ink-rgb), 0.6); }
.upd-skip:hover { border-color: #c9542e; color: #c9542e; }
.upd-note { font-size: 10.5px; color: rgba(var(--ink-rgb), 0.45); margin-top: 10px; line-height: 1.5; }
.bug-submit {
  align-self: flex-end; font-family: inherit; font-size: 12px; padding: 7px 16px;
  border-radius: 8px; cursor: pointer; background: var(--ink); color: var(--paper); border: none;
}
.bug-list { gap: 2px; }
.bug-row { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; padding: 7px 0; border-bottom: 1px solid var(--edge-soft); }
.bug-row:last-child { border-bottom: none; }
.bug-check { border: none; background: none; cursor: pointer; color: var(--accent); font-size: 14px; line-height: 1.3; flex-shrink: 0; padding: 0; }
.bug-text { flex: 1; color: var(--ink); line-height: 1.45; word-break: break-word; }
.bug-del { border: none; background: none; cursor: pointer; color: rgba(var(--ink-rgb), 0.3); font-size: 11px; flex-shrink: 0; padding: 0 2px; }
.bug-del:hover { color: #c9542e; }
.bug-row.solved .bug-text { text-decoration: line-through; color: rgba(var(--ink-rgb), 0.4); }
.bug-row.solved .bug-check { color: #3f8f4e; }

/* subscription name as a clickable button */
button.cf-cat { font-family: inherit; border: none; background: none; cursor: pointer; padding: 0; text-align: left; }
button.cf-cat:hover { color: var(--accent); text-decoration: underline; }

/* months history */
.mo-list { gap: 20px; scrollbar-gutter: stable; padding-right: 4px; }
/* thin, subtle scrollbar so it never crowds the numbers */
.bd-list::-webkit-scrollbar { width: 7px; }
.bd-list::-webkit-scrollbar-track { background: transparent; }
.bd-list::-webkit-scrollbar-thumb { background: rgba(var(--ink-rgb), 0.2); border-radius: 999px; }
.bd-list { scrollbar-width: thin; scrollbar-color: rgba(var(--ink-rgb), 0.2) transparent; }
.mo-row { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--edge-soft); }
.mo-row:last-child { border-bottom: none; padding-bottom: 0; }
.mo-top { display: flex; justify-content: space-between; align-items: baseline; cursor: pointer; }
.mo-top:hover .mo-label { color: var(--accent); }
.mo-label { font-size: 19px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; }
.mo-net { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mo-bar-row { display: flex; align-items: center; gap: 9px; }
.mo-tag { font-size: 9px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 600; width: 24px; flex-shrink: 0; }
.mo-in-tag { color: #3f8f4e; }
.mo-out-tag { color: #c9542e; }
.mo-track { flex: 1; height: 18px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.07); overflow: hidden; min-width: 0; }
.mo-fill { display: block; height: 100%; border-radius: 999px; transition: width 0.7s cubic-bezier(0.16, 1, 0.3, 1); }
.mo-fill.mo-in { background: #3f8f4e; }
.mo-fill.mo-out { background: #c9542e; }
.mo-val { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink); width: 66px; text-align: right; flex-shrink: 0; }
.mo-detail { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.mo-detail:empty { display: none; }
.mo-cat { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.mo-cat-name { width: 72px; flex-shrink: 0; color: rgba(var(--ink-rgb), 0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-cat-track { flex: 1; height: 6px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.08); overflow: hidden; }
.mo-cat-fill { display: block; height: 100%; border-radius: 999px; }
.mo-cat-amt { width: 52px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--ink); }
.mo-empty { font-size: 11px; color: rgba(var(--ink-rgb), 0.5); }
.mo-src { font-size: 9.5px; color: rgba(var(--ink-rgb), 0.4); letter-spacing: 0.04em; }

/* data coverage (in the sources panel) */
.cov-live { font-size: 11px; color: var(--ink); margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.cov-note { font-size: 10px; line-height: 1.45; color: rgba(var(--ink-rgb), 0.5); margin: 0 0 10px; }
.cov-note b { color: rgba(var(--ink-rgb), 0.8); font-weight: 600; }
.cov-row { display: flex; gap: 9px; align-items: flex-start; padding: 4px 0; }
.cov-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; background: #3f8f4e; }
.cov-dot.cov-imported { background: #d6920f; }
.cov-dot.cov-mixed { background: #6a4bc4; }
.cov-name { font-size: 12px; color: var(--ink); }
.cov-meta { font-size: 10px; color: rgba(var(--ink-rgb), 0.5); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* ── footer ─────────────────────────────────────── */
.foot {
  position: fixed; bottom: 16px; left: 0; right: 0; text-align: center;
  text-transform: uppercase; letter-spacing: 0.18em; font-size: 10px;
  color: rgba(var(--ink-rgb), 0.3); pointer-events: none;
}

/* ── designed cursor: 3D jelly ball ─────────────── */
.cursor-ball {
  position: fixed; left: 0; top: 0; z-index: 401; pointer-events: none;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  transform-origin: center;
  /* mostly the ink color (flips with theme), a whisper of shading */
  background: radial-gradient(circle at 40% 36%, color-mix(in srgb, var(--ink) 68%, #fff 32%), var(--ink) 60%);
  /* imperfect, gestural blob — never a perfect circle */
  border-radius: 47% 53% 51% 49% / 52% 48% 51% 49%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  transition: border-radius 0.3s ease, box-shadow 0.2s ease;
  will-change: transform;
}
/* pressed: morphs into a slightly different blob */
.cursor-ball.press {
  border-radius: 42% 58% 54% 46% / 56% 44% 53% 47%;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.16);
}

/* jelly: buttons squish under the ball, then spring back */
.lib-item, .menu-item, .icon-cell, .widget-close, .widget-color,
.sticker-close, .sidebar-toggle, .sidebar-close {
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.14s ease, color 0.14s ease;
}
.jelly-hover { transform: scale(0.97); }
.jelly-down { transform: scale(0.9); }

/* ════════════ Mobile: the freeform board becomes one scroll of full-width widgets ════════════ */
@media (max-width: 640px) {
  .board { overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .board-canvas {
    position: static !important; transform: none !important;
    width: 100% !important; height: auto !important; min-height: 100%;
    display: flex; flex-direction: column; gap: 14px; box-sizing: border-box;
    padding: calc(58px + env(safe-area-inset-top)) 10px calc(94px + env(safe-area-inset-bottom));
  }
  /* every widget: full width, natural height, no absolute positioning or transforms */
  .widget {
    position: static !important; left: auto !important; top: auto !important;
    width: 100% !important; height: auto !important; min-height: 88px;
    transform: none !important; flex: 0 0 auto;
    container-type: inline-size !important;   /* width-based container queries keep working with auto height */
  }
  .widget-resize { display: none !important; }   /* no resizing on touch */
  .sticker { display: none !important; }          /* hide free-floating decor in a stack */
  .zoom-control { display: none !important; }     /* no zoom in stack mode */
  /* SVG-chart widgets need an explicit height (height:100% collapses inside an auto-height stack) */
  .if-chart { height: 150px !important; flex: none !important; }
  .af-wrap  { height: 300px !important; flex: none !important; }

  /* floating chrome: keep it, fit the narrow screen, scroll if crowded */
  .stats-bar { top: 0; padding: calc(6px + env(safe-area-inset-top)) 8px 0; }
  .king-bar { top: calc(34px + env(safe-area-inset-top)); padding-top: 0; }   /* cartridge tucks into the slot on phones too */
  .stats { max-width: 100%; }
  .dock-bar { padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .dock { max-width: calc(100vw - 16px); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .dock-bar > #syncHealth { position: static; }   /* fold sync into the dock row instead of pinning it */
  .sidebar { width: min(92vw, 360px); }
}

/* touch devices of any size: reveal controls desktop only shows on hover */
@media (hover: none) {
  .sticker-close, .sticker-magnet, .widget-resize { opacity: 1; }
}
