:root {
  /* Sharpening pass (owner-approved preview 2026-08-12): cleaner canvas, brand-tinted hairlines
     + shadows, tighter headings, crisper buttons/focus. Brand tokens stay LOCKED. */
  --bg: #f1f2f8;
  --card: #ffffff;
  --ink: #1c2033;
  --muted: #6b7189;
  --line: #e2e4f2; /* hairline tinted toward the brand violet (was neutral #e4e7f0) */
  /* Brand palette = the LOGO's colours (icon.svg / brand/stancito-logo-official.svg), used
     universally for the app's accent, gradients, and the "Stancito" wordmark. The brand gradient
     is exactly the logo tile's #5b4fe6 → #8a43dd; --brand-ito is the logo's "ito" violet. */
  --accent: #5b4fe6;      /* logo gradient start — solid accent (links, focus, buttons) */
  --accent-2: #8a43dd;    /* logo gradient end — the companion in every brand gradient */
  --brand-ito: #7c3aed;   /* the logo's "ito" violet — the wordmark suffix on light backgrounds */
  --accent-soft: #eef0ff;
  /* Organisation Circles: a distinct professional accent (deep teal) so work/org spaces
     read differently from the social/brand violet — the "app-switch feel" for org modules. */
  --org-accent: #0e7490;
  --org-accent-soft: #e0f2fe;
  --for: #059669;
  --for-soft: #e7f7f0;
  --against: #e11d48;
  --against-soft: #fdecf0;
  --danger: #dc2626; /* single red for destructive/alert accents (buttons, borders) */
  /* Neutral two-option scheme (blue vs amber) for non-polar match-ups like
     Virat/Dhoni or Passion/Experience, where red/green would mislead. */
  --o1: #2563eb;
  --o1-soft: #e7effd;
  --o2: #d97706;
  --o2-soft: #fbf0dd;
  /* Two more distinct, neutral hues for 4-option (MCQ) match-ups — e.g. four
     names. A/B stay blue/amber; C/D add teal/pink. */
  --o3: #0d9488;
  --o4: #db2777;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(28, 32, 51, 0.05), 0 10px 28px rgba(91, 79, 230, 0.09); /* soft layer carries a faint brand tint */
  /* Semantic neutral surfaces (so DARK MODE can flip them in one place). Brand tokens above stay fixed. */
  --bg2: #fafbfe;      /* secondary surface (sticky headers, subtle panels) */
  --chip: #eef0f4;     /* chip / count-pill grey */
  --amber-soft: #fef3c7; /* warm "closes-soon" chip fill */
  --amber-ink: #b45309;
  --th-bg: #eceeffe6;  /* sticky data-table header */
  --frame: #d8dbe6;    /* the outer frame behind the phone on desktop */
  --ring: rgba(28,32,51,.06);
  /* Top + bottom STRIPS (owner-approved 2026-08-12): a very light, sharp blue. The logo, wordmark
     colours and icons on the strips are UNCHANGED — only the strip surface + its hairline. */
  --strip: #eef4ff;
  --strip-line: #dbe6fb;
  --strip-pill: #dce8fd;     /* the "live" pill on the blue strip */
  --strip-pill-ink: #2b4c86;
  --strip-sel: #ffffff;      /* the selected bottom-tab chip */
  /* Shelfito shelf furniture ONLY (owner-approved shelf look, on the app's BRAND-VIOLET palette —
     owner: no off-pattern brown). Never touches the brand wordmark, its two-tone colours, or the
     top strip. Token names kept --oak-* (internal) to avoid churn; values are brand violet. */
  --oak-1: #a78bfa; --oak-2: #7c3aed; --oak-edge: #5b21b6; --oak-face: #f3efff;
}
/* ── DARK MODE — swaps ONLY the neutral tokens; the brand gradient / --brand-ito violet / teal / for-against
   hues are untouched, so Stancito stays exactly on-brand. Toggled by data-theme on <html> (persisted). ── */
:root[data-theme="dark"] {
  --bg: #14151d;
  --card: #1f2130;
  --ink: #e9eaf3;
  --muted: #9aa0b8;
  --line: #30334a; /* violet-tinted hairline on dark too */
  --accent-soft: #241f38;
  --org-accent-soft: #10243b;
  --bg2: #191b24;
  --chip: #2a2d3e;
  --frame: #0e0f16;
  --ring: rgba(0,0,0,.5);
  --for-soft: #12271e;
  --against-soft: #2b1420;
  --o1-soft: #132339;
  --o2-soft: #2e2410;
  --brand-ito: #7c3aed; /* EXACT finalized-logo violet — same in dark as light (owner rule: never change the name colour). Visibility comes from the darker --strip below, not from altering the violet. */
  --amber-soft: #3a2f12; /* warm "closes-soon" chip — deep amber on dark, still legible */
  --amber-ink: #f2c879;
  --th-bg: #232638;      /* sticky data-table header on dark */
  --strip: #12141d;      /* darkened (owner-approved) so the EXACT logo violet #7c3aed on the wordmark reads clearly (>3:1 for large bold brand text) */
  --strip-line: #232d44;
  --strip-pill: #20304d;
  --strip-pill-ink: #9fc0f0;
  --strip-sel: #232838;  /* selected bottom-tab chip on dark */
  --shadow: 0 1px 2px rgba(0,0,0,.45), 0 12px 30px rgba(124,58,237,.16); /* dark float with a violet hint */
  --oak-1: #8b5cf6; --oak-2: #6d28d9; --oak-edge: #4c1d95; --oak-face: #221a33; /* shelf furniture on dark = deep violet */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body { height: 100dvh; }
/* Global guard: the frame itself must NEVER scroll (any axis). All real scrolling happens
   inside #view. Matching html/body to 100dvh (same unit as #phone) removes the tiny
   viewport-vs-dvh mismatch that let the whole page nudge up/down a couple pixels. */
html, body { overflow: hidden; max-width: 100%; }
/* Guided tour: a dim overlay with a spotlight hole + a tooltip card. */
.tour-overlay { position: fixed; inset: 0; z-index: 6000; }
.tour-dim { position: fixed; inset: 0; background: rgba(0,0,0,.6); }
.tour-hole { position: fixed; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(0,0,0,.6); pointer-events: none; transition: top .2s, left .2s, width .2s, height .2s; }
.tour-tip { position: fixed; width: calc(100% - 32px); max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 14px 44px rgba(0,0,0,.34); }
/* Animated pointer on the tour tip aiming at the highlighted target (a bouncing speech-bubble caret). */
.tour-arrow { position: absolute; left: 50%; width: 0; height: 0; }
.tour-arrow.up { top: -11px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 11px solid var(--card); animation: tourArrowUp 1.1s ease-in-out infinite; }
.tour-arrow.down { bottom: -11px; border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 11px solid var(--card); animation: tourArrowDown 1.1s ease-in-out infinite; }
@keyframes tourArrowUp { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }
@keyframes tourArrowDown { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 4px); } }
@media (prefers-reduced-motion: reduce) { .tour-arrow { animation: none !important; } }
.tour-title { font-weight: 800; font-size: 16px; margin-bottom: 6px; color: var(--ink); }
.tour-body { font-size: 14px; color: var(--muted); line-height: 1.5; }
.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tour-acts { margin-left: auto; display: flex; gap: 8px; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.tour-dot.on { background: var(--brand); }
/* Zoom = PINCH ONLY (owner 2026-08-14). `manipulation` disables double-tap-to-zoom (which was
   accidentally stretching the page and shoving content under the top/bottom strips) while KEEPING
   pinch-zoom + panning. touch-action intersects down the tree, so this covers every descendant;
   the few surfaces that set touch-action:none (drawing canvas) / pan-y still win (intersection). */
html, body { touch-action: manipulation; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--frame);
  color: var(--ink);
  /* Sharpening: crisp text everywhere (owner: text/icons must not look fuzzy/"bits"). */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
/* Global no-select guard: on touch, a long-press ANYWHERE used to begin a text selection — which
   highlighted the whole page and nudged/shifted the viewport. Selection (and the iOS callout) is
   disabled app-wide and re-enabled ONLY on real typing surfaces: inputs, textareas, contenteditable
   (and anything explicitly marked .selectable). Copy buttons copy programmatically, so they still work. */
body { -webkit-user-select: none; -moz-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
input, textarea, [contenteditable="true"], [contenteditable=""], .selectable, .allow-select {
  -webkit-user-select: text; -moz-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* Phone frame: full-bleed on mobile, phone-sized card on desktop */
#phone {
  position: relative;
  width: 100%;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 520px) {
  body {
    background:
      radial-gradient(1200px 600px at 20% -10%, #c7cdf1 0%, transparent 60%),
      radial-gradient(1000px 600px at 110% 110%, #d9c9f2 0%, transparent 55%),
      #d8dbe6;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
  }
  #phone {
    width: 414px;
    height: min(880px, calc(100vh - 48px));
    border-radius: 36px;
    box-shadow: 0 30px 80px rgba(28, 32, 51, 0.35), 0 0 0 10px #111327, 0 0 0 12px #2c2f45;
  }
}

/* ---------- App bar ---------- */

#appbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* On installed iOS PWAs (notch / Dynamic Island) the status bar overlaps the top,
     so pad by the safe-area inset to keep the title/bell/search clear of it. */
  padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 12px;
  /* Owner 2026-08-12: the FINALIZED logo + two-tone wordmark render true (ink "Stanc" + violet
     "ito") on a very light, sharp BLUE strip (owner-approved). Logo/wordmark/icons unchanged —
     only the strip surface + hairline. Dark mode flips via the same --strip tokens. */
  background: var(--strip);
  color: var(--ink);
  border-bottom: 1px solid var(--strip-line);
}

.appbar-title { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: 0.2px; }
/* Wordmark: the name is still "Stancito" (one word); the "-ito" suffix is tinted
   so the eye reads it as Stanc·ito (stance + ito). Text content is unchanged. */
/* "ito" carries the LOGO's violet on light backgrounds (matches the name on the ballot box). */
.wm-b { color: var(--brand-ito); }
/* Suite wordmark wrapper (Opito / Shelfito): one unbreakable inline unit, so the two-tone name
   can never be split across lines or stacked as separate flex items inside a column tab button. */
.wm-x { white-space: nowrap; }
/* The app bar now sits on the card surface, so the wordmark uses the TRUE logo pattern with no
   substitute tint: "Stanc" inherits the bar's ink, "ito" takes .wm-b's --brand-ito directly
   (#7c3aed on light, the legibility-lightened #b9a3ff on dark). */

.logo-dot {
  width: 22px; height: 22px; border-radius: 7px;
  background: #fff;
  position: relative;
  flex: 0 0 auto;
}
.logo-dot::after {
  content: "✓";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 14px; font-weight: 800;
}
/* The app logo (the ballot-box icon.svg) — small in the app bar, larger on the auth
   screen. The icon is pre-rounded with transparent corners, so use drop-shadow (which
   follows the actual shape) rather than box-shadow/background (which would leave a square
   halo or white corners on the app bar's gradient). */
.brand-logo {
  width: 26px; height: 26px; flex: 0 0 auto; display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}
.auth-logo-img {
  width: 74px; height: 74px; display: block; margin: 0 auto 14px;
  filter: drop-shadow(0 10px 22px rgba(79, 70, 229, 0.35));
}

.live-pill {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600;
  background: var(--strip-pill); color: var(--strip-pill-ink);
  padding: 4px 10px; border-radius: 999px;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; }
.live-pill.off .live-dot { background: #fbbf24; }
/* Brief "just updated" pulse when a live refresh lands. */
.live-pill.pulse { animation: livePulse .7s ease; }
.live-pill.pulse .live-dot { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); animation: liveDot .7s ease; }
@keyframes livePulse { 0% { background: rgba(74,222,128,0.55); } 100% { background: var(--strip-pill); } }
@keyframes liveDot { 0% { box-shadow: 0 0 0 0 rgba(74,222,128,0.7); } 100% { box-shadow: 0 0 0 7px rgba(74,222,128,0); } }
@media (prefers-reduced-motion: reduce) { .live-pill.pulse, .live-pill.pulse .live-dot { animation: none; } }

/* ---------- Main scroll area ---------- */

#view {
  flex: 1 1 auto;
  overflow-y: auto;
  /* overflow-x MUST be set explicitly: leaving it `visible` while overflow-y is `auto`
     makes the browser compute overflow-x to `auto`, which lets any too-wide element
     scroll the whole page left/right. Clip it — genuinely wide content (data tables)
     has its own .table-wrap scroll container. */
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 16px 16px 24px;
  scrollbar-width: thin;
}

/* ---------- Bottom tab bar ---------- */

#tabbar {
  flex: 0 0 auto;
  display: flex;
  background: var(--strip); /* matches the top strip — very light, sharp blue (owner-approved) */
  border-top: 1px solid var(--strip-line);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}

.tab-btn {
  flex: 1; min-width: 0;
  position: relative; /* for the selected-tab chip + indicator bar */
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 10.5px; font-weight: 600;
  color: var(--muted);
  padding: 5px 0 4px;
  border-radius: 12px;
  transition: color .18s ease;
  /* Labels NEVER wrap — a two-line label (e.g. the old "My responses") knocked the whole row out
     of alignment. One line always; overflow is clipped rather than allowed to stack. */
  white-space: nowrap; overflow: hidden;
}
/* The icon sits in a pill. Inactive tabs are dimmed so the selected one clearly
   reads as "you are here"; the active tab lifts, sharpens and gets an accent pill. */
.tab-btn .tab-icon {
  font-size: 20px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 14px; border-radius: 11px;
  opacity: .5;
  transition: opacity .18s ease, transform .18s ease, background-color .18s ease;
}
.tab-btn:hover .tab-icon { opacity: .8; }
/* Clear "you are here" focus on the light-blue strip: the selected tab sits on a white chip with a
   soft brand shadow + a small violet indicator bar on top. The chip replaces the icon pill. */
.tab-btn.active { color: var(--accent); font-weight: 700; background: var(--strip-sel); box-shadow: 0 2px 8px rgba(91,79,230,.18); }
.tab-btn.active .tab-icon {
  opacity: 1;
  background: transparent;
  transform: translateY(-1px) scale(1.08);
}
.tab-btn.active::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
@media (prefers-reduced-motion: reduce) {
  .tab-btn, .tab-btn .tab-icon { transition: none; }
  .tab-btn.active .tab-icon { transform: none; }
}

/* ---------- Cards & generic ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

/* ---- Nested topic tree: folder cards + breadcrumb ---- */
.folder-card { cursor: pointer; transition: box-shadow .15s ease, transform .05s ease; border-left: 5px solid var(--accent); }
.folder-card:hover { box-shadow: 0 2px 4px rgba(28,32,51,.08), 0 12px 30px rgba(28,32,51,.10); }
.folder-card:active { transform: scale(.995); }
.folder-row { display: flex; align-items: center; gap: 12px; }
.folder-ico { font-size: 26px; line-height: 1; flex: 0 0 auto; }
.folder-main { flex: 1 1 auto; min-width: 0; }
.folder-chev { flex: 0 0 auto; color: var(--muted); font-size: 26px; font-weight: 700; line-height: 1; }
.folder-crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); margin: 2px 2px 10px;
}
.folder-crumbs a { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; }
.folder-crumbs a:hover { text-decoration: underline; }
.folder-crumbs .crumb-sep { color: var(--line); }
.folder-crumbs .crumb-here { color: var(--ink); font-weight: 700; }

/* Collapsible "major category" section — same look as a card; tap the header to
   expand/collapse so a busy panel shows its categories, not a long wall.
   NOTE: no `overflow: hidden` here — the summary is position:sticky and clipping
   would stop it from pinning to the top while its section is scrolled. */
.acc { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; }
.acc > summary {
  list-style: none; cursor: pointer; padding: 15px 16px; display: flex; align-items: center;
  gap: 10px; font-weight: 700; font-size: 15px; user-select: none;
  /* Sticky header: stays pinned at the top of the scroll area while you read a
     long open section. Its own background covers content scrolling underneath. */
  position: sticky; top: 0; z-index: 3; background: var(--card); border-radius: var(--radius);
}
/* Open section: a small brand accent bar on the left + a hairline under the header, so what's
   expanded reads clearly (owner-approved polish). */
.acc[open] > summary { border-radius: var(--radius) var(--radius) 0 0; box-shadow: inset 0 -1px 0 var(--accent-soft); }
.acc[open] > summary::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: '⌄'; margin-left: auto; color: var(--muted); font-size: 18px; line-height: 1; transition: transform .2s ease; }
.acc[open] > summary::after { transform: rotate(180deg); }
/* Count pill = brand-tinted everywhere it's used (was flat grey). */
.acc-count { font-weight: 700; font-size: 11px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
.acc-body { padding: 2px 16px 16px; }
.acc-body > .card:last-child, .acc-body > .btn-row:last-child { margin-bottom: 0; }
/* A run of accordions that behave as one exclusive group (open one drops to the
   bottom so the other headers stay clustered and visible at the top). */
/* GC18: within an exclusive section group, the OPEN section sinks to the BOTTOM and
   returns to its original slot when it closes or another section opens. Flex `order`
   moves only the VISUAL order — the DOM / keyboard / screen-reader order stays put, so
   state persistence and accessibility are unaffected. Closed sections keep order:0 (their
   natural order); the single open one gets order:1 and drops below them. */
.acc-group { display: flex; flex-direction: column; }
.acc-group > .acc[open] { order: 1; border: 1px solid var(--accent); }

/* My responses: apply the same "open sinks to the bottom, returns to its slot on close"
   rule to the nested umbrellas here (task → 🌐/👥/📅 scope → each group), at EVERY depth.
   Unlike the exclusive .acc-group above this is NOT exclusive — a parent stays open while a
   child opens and sinks within it (so the parent heading naturally sits above its open
   child). Pure flex `order` again: only the container that DIRECTLY holds accordion children
   becomes a column (so card lists are untouched), and any open .tc-group there drops below
   its closed siblings. DOM order is unchanged, so open-state persistence + a11y are safe. */
#resp-scope,
#resp-scope .rh-col,                        /* explicit fallback so the reorder works on browsers WITHOUT :has() (older mobile) */
#resp-scope div:has(> details.tc-group) { display: flex; flex-direction: column; }
#resp-scope details.tc-group[open] { order: 1; }

/* Prominent language picker — shown near the top of the landing + home screens so a
   non-English speaker can switch language at first glance, not hunt for it at the bottom. */
.lang-pick-top {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin: 10px auto 4px; padding: 7px 12px; max-width: max-content;
  background: var(--accent-soft); border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.lang-pick-top .lang-pick-lbl { color: var(--ink); }
.lang-pick-top .hour-select { border: none; background: transparent; color: var(--accent); font-weight: 700; padding: 2px 4px; }
.home-lang { justify-content: flex-start; margin-left: 0; }

/* Shared consistency helpers adopted across panels */
.card-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.r-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.chip.trunc { max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-row.tight { margin-top: 6px; }
.btn-row.flush { margin-top: 0; }

.screen-title { font-size: 20px; font-weight: 800; margin: 4px 2px 14px; }
.screen-sub { color: var(--muted); font-size: 13px; margin: -10px 2px 14px; }

.q-title { font-size: 16px; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.q-desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.suggested-by { font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 8px; }

.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chip.gray { background: var(--chip); color: var(--muted); }
.chip.green { background: var(--for-soft); color: var(--for); }
.chip.red { background: var(--against-soft); color: var(--against); }

.empty {
  text-align: center; color: var(--muted);
  padding: 44px 20px; font-size: 14px; line-height: 1.6;
}
.empty .empty-icon { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- Results bar ---------- */

.results { margin-top: 14px; }
.results-labels {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px;
  font-size: 12.5px; font-weight: 700; margin-bottom: 6px;
}
.results-labels .lab-for { color: var(--for); min-width: 0; overflow-wrap: anywhere; }
.results-labels .lab-against { color: var(--against); min-width: 0; overflow-wrap: anywhere; }

.bar {
  display: flex; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--chip);
}
.bar .seg-for { background: linear-gradient(90deg, #10b981, #059669); transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.bar .seg-against { background: linear-gradient(90deg, #f43f5e, #e11d48); transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }

.results-total { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

/* ---------- Stance controls ---------- */

.stance-row { display: flex; gap: 10px; margin-top: 14px; }

.stance-btn {
  flex: 1; min-width: 0; overflow-wrap: anywhere;
  border: 1.5px solid var(--line); background: var(--card);
  border-radius: 13px; padding: 12px 8px;
  font-family: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer;
  transition: transform 0.06s ease;
}
.stance-btn:active { transform: scale(0.97); }
.stance-btn.for { color: var(--for); }
.stance-btn.against { color: var(--against); }
.stance-btn.for.selected { background: var(--for-soft); border-color: var(--for); }
.stance-btn.against.selected { background: var(--against-soft); border-color: var(--against); }

/* Neutral option scheme: on a non-polar topic (or sub-question), swap the
   green/red value-judgement colours for a neutral blue vs amber contrast. */
.opts-neutral .results-labels .lab-for { color: var(--o1); }
.opts-neutral .results-labels .lab-against { color: var(--o2); }
.opts-neutral .bar .seg-for { background: linear-gradient(90deg, #3b82f6, #2563eb); }
.opts-neutral .bar .seg-against { background: linear-gradient(90deg, #fbbf24, #d97706); }
.opts-neutral .stance-btn.for { color: var(--o1); }
.opts-neutral .stance-btn.against { color: var(--o2); }
.opts-neutral .stance-btn.for.selected { background: var(--o1-soft); border-color: var(--o1); }
.opts-neutral .stance-btn.against.selected { background: var(--o2-soft); border-color: var(--o2); }
/* The "Your choice" chip inside a neutral topic (scoped so the green "Open"
   status chip elsewhere on the card is untouched). */
.opts-neutral .mystance-line .chip.green,
.opts-neutral .h-top .chip.green { background: var(--o1-soft); color: var(--o1); }
.opts-neutral .mystance-line .chip.red,
.opts-neutral .h-top .chip.red { background: var(--o2-soft); color: var(--o2); }

.reason-box { margin-top: 12px; }
.reason-box label { font-size: 12px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 6px; }

textarea, input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input[type="datetime-local"], input[type="time"], input[type="number"], input[type="search"], select, .tab-search {
  width: 100%;
  font-family: inherit; font-size: 16px; /* 16px avoids iOS Safari auto-zoom on focus */
  border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 12px;
  background: var(--bg2);
  color: var(--ink);
  outline: none;
}
textarea:focus, input:focus, select:focus { border-color: var(--accent); background: var(--card); }
/* Auto-zoom guard (owner: "pages auto-zoom in/out in so many places"). Mobile Safari zooms the whole
   viewport into any focused field whose font-size is < 16px. The rule above pins the enumerated input
   types; this LOW-specificity net catches every straggler — typeless <input>, rarer input types, and
   contenteditable editing surfaces — so no focusable text field can trigger the zoom. max(16px, 1em)
   only ever raises to the floor; an intentionally larger field (higher-specificity rule) still wins. */
input, textarea, select, [contenteditable="true"], [contenteditable=""] { font-size: max(16px, 1em); }
/* Search boxes get a soft-blue fill so they read as "search" and match the strips (owner-approved). */
input[type="search"], .tab-search { background: var(--strip); border-color: var(--strip-line); }
input[type="search"]:focus, .tab-search:focus { background: var(--card); border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }
/* P75/#13: mobile-number row — a compact dialing-code <select> inline before the number, so a
   one-time SMS routes to the right country. The select sizes to its content; the number fills the rest. */
.mobile-row { display: flex; gap: 8px; align-items: stretch; }
.mobile-row .dial-cc { width: auto; flex: 0 0 auto; max-width: 46%; font-weight: 600; padding-right: 8px; }
.mobile-row input { flex: 1 1 auto; min-width: 0; }
/* Nicer date/time pickers (where timelines are selected): a tinted, tappable
   calendar/clock button that matches the app accent instead of the plain default. */
input[type="date"], input[type="datetime-local"], input[type="time"] {
  min-height: 46px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(180deg, var(--bg2), var(--bg2));
  font-variant-numeric: tabular-nums;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer; opacity: .75; padding: 4px; border-radius: 8px;
  filter: invert(34%) sepia(72%) saturate(1500%) hue-rotate(215deg);
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; background: color-mix(in srgb, var(--accent) 14%, transparent); }

/* Keyboard focus ring for desktop use. :focus-visible fires for keyboard / assistive
   tech only, never on a mouse click, so the ring stays out of the way of pointer users.
   The outline follows each element's border-radius automatically. */
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }
/* Elements sitting inside overflow:hidden containers (accordion summary, sheet header)
   need an inset ring so it isn't clipped. */
.acc > summary:focus-visible, .sheet-close:focus-visible { outline-offset: -2px; }
textarea:focus-visible, input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }

.cat-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.cat-pick {
  border: 1.5px solid var(--line); background: var(--card);
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 999px; cursor: pointer; color: var(--ink);
}
.cat-pick.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

/* password show/hide + hints */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
/* Hide the browser's OWN password-reveal eye (Edge/IE add one) so only the app's
   custom show/hide toggle is shown — otherwise two eyes appear side by side. */
.pw-wrap input::-ms-reveal,
.pw-wrap input::-ms-clear { display: none; }
.pw-eye {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 17px; cursor: pointer;
  padding: 4px 7px; line-height: 1; border-radius: 8px;
}
.pw-eye:active { background: var(--chip); }
/* GC45: inline clear-field (✕), positioned inside each field's own box (no floating). */
.clr-wrap { position: relative; display: block; }
.clr-wrap > input, .clr-wrap > textarea { padding-right: 34px; }
.clr-btn {
  position: absolute; top: 50%; right: 8px; transform: translateY(-50%);
  display: none; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; margin: 0; border: none; border-radius: 50%;
  background: var(--line); color: var(--muted);
  font-size: 15px; line-height: 1; font-weight: 700; cursor: pointer; z-index: 3;
}
.clr-btn.with-eye { right: 40px; }
.clr-wrap.ta .clr-btn { top: 12px; transform: none; }
.clr-btn:hover { background: var(--against-soft); color: var(--against); }
.clr-btn:active { transform: translateY(-50%) scale(0.9); }
.clr-wrap.ta .clr-btn:active { transform: scale(0.9); }
/* GC46: relative-time labels — tap to reveal the exact date-time. */
.reltime { cursor: pointer; }
.reltime:hover { text-decoration: underline dotted; text-underline-offset: 2px; }
.reltime:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 3px; }
/* GC44: admin external-services registry rows. */
.integ-row { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; margin-bottom: 9px; background: var(--card, #fff); }
.integ-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.integ-name { font-weight: 700; font-size: 14px; }
.integ-purpose { font-size: 12.5px; color: var(--fg, inherit); margin-top: 4px; line-height: 1.45; }
.integ-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.integ-host { font-size: 11.5px; color: var(--muted); }
.integ-data { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
/* Per-question editor blocks inside the admin "Edit topic" sheet (chain/MCQ). */
.sq-edit { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 10px; background: var(--card, #fff); }
.sq-edit-h { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.sq-edit .sqe-text { width: 100%; }
/* M1: live password-rule checklist under a new-password field. */
.pw-req { margin: 6px 2px 0; display: flex; flex-direction: column; gap: 3px; }
.pw-req-row { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.pw-req-row.ok { color: #1a9b52; font-weight: 600; }
/* O28: suppress the entrance fade on same-screen re-renders so live updates don't blink. */
.no-anim .fade-in { animation: none !important; }
.field-hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
.link-sm { color: var(--accent); font-weight: 600; font-size: 12.5px; cursor: pointer; text-decoration: none; }

.btn {
  display: inline-block; width: 100%;
  border: none; border-radius: 13px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; font-family: inherit; font-size: 14.5px; font-weight: 700;
  padding: 13px; cursor: pointer; margin-top: 12px;
  transition: transform 0.06s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.ghost {
  background: none; color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn.danger-ghost { background: none; color: var(--against); border: 1.5px solid var(--against-soft); }
.btn.small { width: auto; padding: 9px 14px; font-size: 13px; margin-top: 0; }

.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.btn-row .btn { margin-top: 0; }
/* small buttons in a wrapping row size to their text and align left */
.btn-row .btn.small { flex: 0 0 auto; white-space: nowrap; }

/* ---------- My stance panel ---------- */

.mystance {
  margin-top: 14px;
  border: 1.5px dashed var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  background: var(--bg2);
}
.mystance-line { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.myreason { margin-top: 8px; font-size: 13px; color: var(--ink); line-height: 1.5; white-space: pre-wrap; }
/* A short muted note (privacy hints, demo disclaimers). Block flow — NOT flex — so an
   inline <b> stays part of the sentence and long text wraps cleanly instead of overflowing
   as separate flex items. The leading emoji sits inline with the first line. */
.private-note { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ---------- Segmented control ---------- */

.seg {
  display: flex; background: var(--chip); border-radius: 12px; padding: 3px; margin-bottom: 14px;
}
.seg button {
  flex: 1; min-width: 0; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700;
  padding: 8px 0; border-radius: 10px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(28,32,51,0.12); }

/* Four-way segment (e.g. the notification buckets: Pending · Done · Missed · Info).
   Tighter type + a small count pill so all four fit on a narrow phone. */
.seg-4 button { font-size: 12px; padding: 8px 2px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
/* inline-flex on the button turns the label into an anonymous flex item, which defeats the base
   text-overflow:ellipsis — so ellipsize an inner span instead (keeps the count pill from being clipped). */
.seg-4 .seg-lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg-count {
  font-size: 10px; font-weight: 800; line-height: 1; padding: 2px 5px; border-radius: 999px;
  background: var(--chip); color: var(--muted);
}
.seg-4 button.active .seg-count { background: var(--accent-soft); color: var(--accent); }
.seg-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }

/* ---------- Transfer progress (uploads & downloads) ---------- */
#xfer-progress {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 4000;
  display: flex; flex-direction: column; gap: 8px;
  width: min(420px, calc(100vw - 24px)); pointer-events: none;
}
.xfer-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px 11px; box-shadow: 0 8px 26px rgba(28, 32, 51, 0.18);
  animation: xferIn .18s ease;
}
@keyframes xferIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.xfer-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 7px; }
.xfer-icon { flex: 0 0 auto; }
.xfer-name { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xfer-pct { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.xfer-bar { height: 6px; border-radius: 999px; background: var(--chip); overflow: hidden; }
.xfer-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s ease; }
.xfer-row.xfer-ok .xfer-fill { background: #16a34a; }
.xfer-row.xfer-ok .xfer-pct { color: #16a34a; }
.xfer-row.xfer-err .xfer-fill { background: var(--danger); }
.xfer-row.xfer-err .xfer-pct { color: var(--danger); }
.xfer-row.xfer-working .xfer-fill { animation: xferPulse 1s ease-in-out infinite; }
@keyframes xferPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .xfer-fill { transition: none; } .xfer-row { animation: none; } .xfer-row.xfer-working .xfer-fill { animation: none; } }

/* ---------- Auth screen ---------- */

.auth-wrap { padding: 30px 6px 10px; }
.auth-logo {
  width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 32px; font-weight: 800;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
}
.auth-title { text-align: center; font-size: 22px; font-weight: 800; }
.or-divider { display: flex; align-items: center; gap: 10px; margin: 16px 4px 12px; color: var(--muted); font-size: 12px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.gbtn-wrap { display: flex; justify-content: center; min-height: 40px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 22px; }

/* Landing-page pitch: a short, attractive vision blurb above the sign-in choices. */
.auth-pitch { text-align: center; margin: 12px auto 4px; max-width: 460px; }
.auth-pitch-tag { font-size: 18px; font-weight: 800; line-height: 1.22; letter-spacing: -.01em; text-wrap: balance; max-width: 20ch; margin: 0 auto; color: var(--accent); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-pitch-tag { background: linear-gradient(100deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
}
.auth-pitch-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 9px auto 0; max-width: 44ch; }
.auth-pitch-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 2px; }
.auth-chip { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 11px; white-space: nowrap; }

/* ---------- Landing hero (first-run sign-in) ---------- */
.auth-landing { padding-top: 16px; }
/* Language: chosen from a popup (default set on first visit); changed later from a subtle globe
   chip at the very bottom of the landing — so it never competes with the hero for attention. */
.auth-langfoot { display: flex; justify-content: center; margin-top: 16px; }
.lang-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
  padding: 6px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.lang-chip span { color: var(--accent); }
.lang-chip:hover { border-color: var(--accent); box-shadow: 0 2px 10px rgba(79, 70, 229, 0.12); }
/* Language popup grid — tap-friendly tiles, current one highlighted. */
.lang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.lang-opt {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-align: left;
  padding: 12px 14px; border-radius: 12px;
  transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.lang-opt:hover { border-color: var(--accent); }
.lang-opt:active { transform: scale(0.98); }
.lang-opt.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (max-width: 340px) { .lang-grid { grid-template-columns: 1fr; } }

/* Branching guided form — the "what are you creating?" kind picker. */
.kind-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 4px 0; }
.kind-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px;
  cursor: pointer; font: inherit; transition: border-color .12s ease, background .12s ease, transform .05s ease;
}
.kind-opt:hover { border-color: var(--accent); }
.kind-opt:active { transform: scale(0.98); }
.kind-opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.kind-opt .kind-ico { font-size: 20px; line-height: 1; }
.kind-opt b { font-size: 13px; color: var(--ink); font-weight: 800; margin-top: 3px; }
.kind-opt span:last-child { font-size: 11px; color: var(--muted); line-height: 1.25; }
.auth-hero { position: relative; text-align: center; padding: 14px 8px 6px; isolation: isolate; }
/* Soft brand glow behind the logo — sets the mood without a heavy image. */
.auth-hero-glow {
  position: absolute; z-index: -1; top: -18px; left: 50%; transform: translateX(-50%);
  width: 280px; height: 240px; pointer-events: none;
  background:
    radial-gradient(58% 46% at 50% 34%, rgba(124, 58, 237, 0.30), transparent 70%),
    radial-gradient(42% 40% at 32% 22%, rgba(79, 70, 229, 0.26), transparent 72%),
    radial-gradient(46% 40% at 72% 26%, rgba(20, 184, 166, 0.16), transparent 72%);
  filter: blur(6px); opacity: 0.9;
}
.auth-hero-logo {
  width: 84px; height: 84px; margin: 4px auto 12px;
  filter: drop-shadow(0 14px 30px rgba(79, 70, 229, 0.40));
  animation: authFloat 5.5s ease-in-out infinite;
}
.auth-hero-title { font-size: 30px; letter-spacing: -0.02em; margin-bottom: 2px; }
.auth-hero-tag {
  font-size: 23px; font-weight: 800; line-height: 1.16; letter-spacing: -0.015em;
  text-wrap: balance; max-width: 15ch; margin: 12px auto 0; color: var(--accent);
}
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .auth-hero-tag { background: linear-gradient(100deg, var(--accent) 15%, var(--accent-2) 55%, #0d9488); -webkit-background-clip: text; background-clip: text; color: transparent; }
}
.auth-hero-desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 11px auto 0; max-width: 40ch; }

/* Feature highlights — small cards, scannable at a glance. */
.auth-feats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 20px 2px 4px; }
.auth-feat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 6px 10px; text-align: center; box-shadow: 0 2px 8px rgba(28, 32, 51, 0.05);
}
.auth-feat .af-ico { font-size: 20px; line-height: 1; }
.auth-feat b { display: block; font-size: 12px; color: var(--ink); margin-top: 5px; font-weight: 800; }
.auth-feat span { display: block; font-size: 10.5px; color: var(--muted); margin-top: 1px; line-height: 1.25; }

/* CTA block — the two clear ways in. */
.auth-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.btn.auth-cta-primary { padding: 15px 16px; font-size: 15px; border-radius: 14px; box-shadow: 0 10px 24px rgba(79, 70, 229, 0.32); }
.btn.auth-cta-primary .cta-sub, .btn.auth-cta-secondary .cta-sub { display: block; font-size: 11px; font-weight: 600; opacity: 0.82; margin-top: 2px; }
.btn.auth-cta-secondary { padding: 13px 16px; font-size: 14.5px; border-radius: 14px; }

@keyframes authFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .auth-hero-logo { animation: none; } }
@media (max-width: 340px) { .auth-feats { grid-template-columns: repeat(2, 1fr); } }

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

.auth-switch { text-align: center; font-size: 14px; color: var(--muted); margin-top: 20px; line-height: 1.7; }
.auth-switch a { color: var(--accent); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- History ---------- */

.h-item .h-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.h-when { font-size: 11px; color: var(--muted); margin-top: 8px; }
/* Pending/chain rows are tappable to resume — show the pointer affordance and a
   gentle lift on hover so it's obvious they open the topic. */
.h-item[role="button"] { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.h-item[role="button"]:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(28, 32, 51, 0.10); }
.h-item[role="button"]:active { transform: translateY(0); }

/* Brief highlight when a topic card is opened from another screen. */
@keyframes cardOpenFlash {
  0% { box-shadow: 0 0 0 0 var(--accent); }
  15% { box-shadow: 0 0 0 3px var(--accent-soft); }
  100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}
.card-open-flash { animation: cardOpenFlash 1.5s ease-out; }
@media (prefers-reduced-motion: reduce) { .card-open-flash { animation: none; } }

/* ---------- Admin ---------- */

.admin-stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat {
  flex: 1; background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  padding: 12px; text-align: center;
}
.stat .stat-num { font-size: 20px; font-weight: 800; }
.stat .stat-lab { font-size: 11px; color: var(--muted); font-weight: 600; margin-top: 2px; }

.cat-editor { display: flex; gap: 8px; }
.cat-editor input { flex: 1; }

/* P41/P7 — personal connect code + QR */
.code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--accent-soft); border-radius: 12px; padding: 12px 14px;
}
.code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--accent);
}
.code-qr { display: flex; justify-content: center; margin-top: 14px; }
.code-qr svg, .code-qr img { border-radius: 10px; padding: 8px; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.12); display: block; }
.qr-scan-wrap {
  position: relative; width: 100%; max-width: 320px; margin: 0 auto;
  aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden; background: #000;
}
.qr-scan-wrap video { width: 100%; height: 100%; object-fit: cover; }
.qr-scan-frame {
  position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.9);
  border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35);
}
.cat-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.cat-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px;
}
.cat-tag button { border: none; background: none; color: var(--accent); font-size: 14px; cursor: pointer; line-height: 1; padding: 0; }

/* Topic emoji picker (create/suggest form) */
.emoji-current { font-size: 22px; line-height: 1; min-width: 28px; text-align: center; }
.emoji-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.emoji-pick {
  font-size: 19px; line-height: 1; width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  cursor: pointer; transition: border-color .12s, background .12s, transform .06s;
}
.emoji-pick:hover { border-color: var(--accent); }
.emoji-pick:active { transform: scale(.94); }
.emoji-pick.sel { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
/* Searchable + categorised emoji picker (replaces the one huge palette). */
.emoji-picker { margin-top: 8px; }
.emoji-search { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; font-size: max(16px, 1em); background: var(--card); color: var(--ink); }
.emoji-search:focus { outline: none; border-color: var(--accent); }
.emoji-cats { display: flex; gap: 6px; overflow-x: auto; padding: 9px 0 7px; scrollbar-width: none; }
.emoji-cats::-webkit-scrollbar { display: none; }
.emoji-cat { flex: 0 0 auto; width: 36px; height: 32px; font-size: 17px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 9px; background: var(--card); cursor: pointer; }
.emoji-cat.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
/* Grid caps its height so it never becomes "one huge list" — it scrolls within itself. */
.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 176px; overflow-y: auto; padding: 2px; }
.emoji-empty { flex: 1 1 100%; font-size: 13px; color: var(--muted); padding: 10px 2px; }

/* Named / open vote — the "who voted what" breakdown */
.voter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; }
.voter-name { font-weight: 600; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voter-qhead { font-weight: 700; margin: 14px 0 4px; }

.q-admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ---------- Bottom sheet ---------- */

#sheet-root .backdrop {
  position: fixed; inset: 0; background: rgba(17, 19, 39, 0.5);
  z-index: 40; animation: fade 0.2s ease;
}
#sheet-root .sheet {
  position: fixed; left: 50%; transform: translateX(-50%);
  /* Sit ABOVE the on-screen keyboard: --kb-inset / --vv-h are set from visualViewport
     (bindViewportKeyboard, PF3). Fallbacks (0px / 100dvh) apply where it's unavailable. */
  bottom: var(--kb-inset, 0px); width: 100%; max-width: 414px;
  max-height: min(78dvh, calc(var(--vv-h, 100dvh) - 24px));
  background: var(--bg); border-radius: 22px 22px 0 0;
  z-index: 41; display: flex; flex-direction: column;
  transition: bottom 0.18s ease;
  animation: slideup 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.sheet-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 10px;
}
.sheet-head h3 { font-size: 16px; font-weight: 800; padding-right: 12px; }
.sheet-close {
  border: none; background: var(--chip); color: var(--muted);
  width: 40px; height: 40px; border-radius: 50%; font-size: 16px; cursor: pointer; flex: 0 0 auto;
}
.sheet-body { flex: 1 1 auto; overflow-y: auto; padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); }

/* Full-screen sheet (handwriting notepad) — fills the viewport on tablets/phones. */
#sheet-root .sheet.sheet-full {
  bottom: 0; top: 0; width: 100%; max-width: 820px;
  max-height: var(--vv-h, 100dvh); height: var(--vv-h, 100dvh);
  border-radius: 0;
}
.sheet-full .sheet-body { display: flex; flex-direction: column; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); }
.notepad { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.notepad-tools { flex: 0 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 2px 10px; }
.notepad-tools-lbl { font-size: 12px; font-weight: 700; color: var(--muted); }
.notepad-tools .btn.small { margin-top: 0; }
.notepad-tools .btn.small.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ink-swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; cursor: pointer; flex: 0 0 auto;
  box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0,0,0,0.2); padding: 0;
}
.ink-swatch.sel { box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0,0,0,0.25); transform: scale(1.06); }
.notepad-canvas {
  flex: 1 1 auto; min-height: 260px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}
.notepad-actions { flex: 0 0 auto; display: flex; gap: 10px; padding: 10px 0 2px; }
.notepad-actions .btn { margin-top: 0; }

.reason-cat-block { margin-bottom: 14px; }
.reason-cat-title {
  font-size: 13px; font-weight: 800; margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.reason-count { font-size: 11px; background: var(--chip); color: var(--muted); border-radius: 999px; padding: 2px 8px; font-weight: 700; }
.reason-item {
  background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
  padding: 11px 13px; margin-bottom: 8px;
}
.reason-item .r-text { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.reason-item .r-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }

/* ---------- Profile ---------- */

.profile-head { text-align: center; padding: 10px 0 18px; }
.avatar {
  --av: 30px;
  width: var(--av); height: var(--av); min-width: var(--av); border-radius: 50%;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  background-size: cover; background-position: center;
  color: #fff; font-weight: 800; overflow: hidden; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
}
.avatar .avatar-ini { font-size: calc(var(--av) * 0.42); line-height: 1; }
.avatar.has-img .avatar-ini { display: none; }
.avatar.avatar-open { cursor: pointer; }
/* Group pictures use a rounded square so a group reads differently from a person. */
.avatar.group-avatar { border-radius: 24%; background: linear-gradient(120deg, var(--accent-2), var(--accent)); }
.group-profile-card { padding: 14px; }
.avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.pres-dot { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--card); box-sizing: border-box; }
.pres-dot.on { background: #16a34a; }
.pres-dot.off { background: var(--muted); opacity: .55; }
.profile-head .avatar { display: flex; margin: 0 auto 10px; }
.opt-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.opt-check input { width: 16px; height: 16px; }
.warn-card { border: 1px solid #dc2626; background: color-mix(in srgb, #dc2626 6%, var(--card)); }
.warn-item { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.warn-item:first-of-type { border-top: none; }
.notif-cat { font-size: 12px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 14px 2px 6px; }
.notif-cat:first-child { margin-top: 2px; }
.profile-name { font-size: 18px; font-weight: 800; }
.profile-contact { color: var(--muted); font-size: 13px; margin-top: 3px; }

.kv { display: flex; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-weight: 600; }
.kv .v { font-weight: 600; }

/* ---------- Toast ---------- */

#toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 92px; z-index: 60;
  background: #1c2033; color: #fff;
  font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 86%; text-align: center;
  animation: toastin 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
#toast.error { background: var(--against); }
#toast.success { background: var(--for); }

@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideup { from { transform: translate(-50%, 40px); opacity: 0.5; } to { transform: translate(-50%, 0); opacity: 1; } }

.fade-in { animation: fade 0.25s ease; }

/* ---------- tab badge ---------- */
.tab-icon { position: relative; display: inline-block; }
.tab-badge {
  position: absolute; top: -3px; right: 2px;
  background: var(--against); color: #fff;
  font-size: 9px; font-weight: 800; line-height: 1;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
}

/* ---------- install / store buttons ---------- */
.install-card { text-align: center; }
.install-head { font-size: 15px; font-weight: 800; }
.install-sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 12px; }
.store-row { display: flex; gap: 10px; }
.store-btn {
  flex: 1; display: flex; align-items: center; gap: 9px; justify-content: center;
  background: #111327; color: #fff; border: none; border-radius: 12px;
  padding: 10px 8px; cursor: pointer; font-family: inherit;
}
.store-btn:active { transform: scale(0.98); }
.store-ic { font-size: 20px; line-height: 1; }
.store-txt { text-align: left; font-size: 14px; font-weight: 700; line-height: 1.1; }
.store-txt small { display: block; font-size: 9px; font-weight: 500; opacity: 0.75; }
.install-note { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.install-steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.9; }

/* ---------- suggestions / requests ---------- */
.mini-req { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mini-req:last-child { border-bottom: none; }
.mini-req-title { font-size: 13px; font-weight: 600; }
.req-card { border: 1.5px solid var(--accent-soft); }
.req-item { border: 1px solid var(--line); border-radius: 13px; padding: 12px; margin-bottom: 10px; }
.req-item:last-child { margin-bottom: 0; }
.req-title { font-size: 14.5px; font-weight: 700; line-height: 1.35; }

/* ---------- geolocation ---------- */
.geo-card { border: 1.5px solid var(--accent-soft); }
.geo-row { margin-bottom: 14px; }
.geo-row:last-child { margin-bottom: 0; }
.geo-row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.geo-label { font-size: 13.5px; font-weight: 700; }
.geo-total { font-size: 11.5px; color: var(--muted); }
.geo-conf { font-size: 13px; line-height: 2; }
.geo-conf b { color: var(--ink); }
.geo-sort-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.geo-sort { margin-bottom: 14px; }
.geo-sort button { font-size: 12px; padding: 7px 0; }

/* expiry chip + events */
.chip.amber { background: var(--amber-soft); color: var(--amber-ink); }
.events-block { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.events-title { font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.event-item { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.event-item:last-child { margin-bottom: 0; }
.event-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.event-name { font-size: 14px; font-weight: 700; }
.event-date { font-size: 12px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.event-mine { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.event-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.event-item .btn.small { margin-top: 8px; }

/* two-option (For/Against or custom) inputs */
.two-opt { display: flex; align-items: center; gap: 8px; }
.two-opt input { flex: 1; min-width: 0; }
.two-opt-vs { font-size: 12px; color: var(--muted); font-weight: 800; flex: 0 0 auto; }

.consent-row { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 6px 0 14px; cursor: pointer; }
.consent-row input { margin-top: 2px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--accent); }

/* groups */
.group-card { cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.group-card:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(28, 32, 51, 0.10); }
.group-card:active { transform: translateY(0); }
.group-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-name { font-size: 15.5px; font-weight: 700; }
.group-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.group-detail-head { margin-bottom: 6px; }
.member-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.member-row:last-of-type { border-bottom: none; }
.member-row > div:first-child { min-width: 0; flex: 1 1 auto; }
.member-name { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; word-break: break-word; }
.member-name.clickable { cursor: pointer; color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }

/* Per-member ⋮ control menu (roster). The row is position:relative so the popover
   anchors to it, but carries NO z-index — that keeps the row out of its own stacking
   context so the popover's z-index can lift above the following rows. */
.member-row.mrow { position: relative; flex-wrap: nowrap; }
.mrow-id { flex: 1 1 auto; min-width: 0; }
.mrow-menu { flex: 0 0 auto; }
.mrow-menu > summary.mrow-kebab {
  list-style: none; cursor: pointer; user-select: none;
  width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 22px; line-height: 1; color: var(--muted);
}
.mrow-menu > summary.mrow-kebab::-webkit-details-marker { display: none; }
.mrow-menu > summary.mrow-kebab::after { content: none; } /* no tc-group chevron */
.mrow-menu > summary.mrow-kebab:hover { background: var(--hover, rgba(127,127,127,.12)); color: var(--ink); }
.mrow-menu[open] > summary.mrow-kebab { background: var(--accent-soft, rgba(99,102,241,.14)); color: var(--accent); }
.mrow-menu-pop {
  /* inset-inline-end (not physical right) so it anchors to the kebab under dir=rtl too.
     z-index 70 keeps it above the fixed voice FAB (z 60) so taps hit the menu, not the FAB. */
  position: absolute; inset-inline-end: 0; top: calc(100% + 4px); z-index: 70;
  min-width: 216px; max-width: min(280px, calc(100vw - 56px));
  max-height: 60vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 34px rgba(15,18,38,.22); padding: 6px;
  display: flex; flex-direction: column; gap: 3px;
}
.mrow-menu-head {
  font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; padding: 4px 8px 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mrow-menu-pop .btn { width: 100%; justify-content: flex-start; text-align: left; margin: 0; }
/* Flip above the ⋮ when there's no room below (last rows in a long roster). */
.mrow-menu.up .mrow-menu-pop { top: auto; bottom: calc(100% + 4px); }

/* Per-topic ⋮ owner menu, anchored top-right of a card (main feed / group / folder).
   The card is position:relative; the .tmenu itself carries NO z-index (so it doesn't create
   a stacking context that would trap its popover under the voice FAB — the popup keeps z 70). */
.tmenu-host { position: relative; }
.tmenu-host > .q-title { padding-inline-end: 42px; }
.tmenu { position: absolute; top: 6px; inset-inline-end: 8px; }
.folder-card.tmenu-host .folder-row { padding-inline-end: 30px; }
.folder-card.tmenu-host .folder-chev { align-self: flex-start; }

/* activity log */
.log-item { border-bottom: 1px solid var(--line); padding: 9px 0; }
.log-item:last-child { border-bottom: none; }
.log-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.log-action { font-size: 13.5px; font-weight: 700; }
.log-when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.log-meta { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-word; }

/* ---------- 2FA ---------- */
.sec-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.qr-wrap { display: flex; justify-content: center; margin: 4px 0 12px; }
.qr-wrap img { border-radius: 12px; border: 1px solid var(--line); background: #fff; padding: 6px; }
.secret-line { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 14px; line-height: 1.7; }
.secret-line code {
  display: inline-block; margin-top: 4px; font-size: 13px; letter-spacing: 1px;
  background: var(--chip); color: var(--ink); padding: 5px 10px; border-radius: 8px; word-break: break-all;
}

/* ---------- voice assistant ---------- */
#voice-fab {
  position: fixed; right: 16px; bottom: 86px; z-index: 60;
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  color: #fff; font-size: 24px; line-height: 1;
  box-shadow: 0 6px 18px rgba(79, 70, 229, .45);
  transition: transform .15s ease;
}
#voice-fab:active { transform: scale(.92); }
/* On desktop #phone is a centered 414px card (half = 207px). Keep the FAB 16px
   inside the phone's right edge, not the old 240px (480px-frame) offset. */
@media (min-width: 520px) { #voice-fab { right: calc(50% - 207px + 16px); } }

#voice-overlay-root .voice-panel {
  position: fixed; left: 12px; right: 12px; bottom: 150px; z-index: 61;
  display: flex; align-items: center; gap: 12px;
  background: rgba(17, 24, 39, .96); color: #fff;
  border-radius: 16px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
@media (min-width: 520px) {
  #voice-overlay-root .voice-panel { left: calc(50% - 207px + 12px); right: calc(50% - 207px + 12px); }
}
.voice-orb {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: rgba(255, 255, 255, .12);
}
.voice-orb.listening { animation: voicepulse 1.1s ease-in-out infinite; background: rgba(220, 38, 38, .85); }
@keyframes voicepulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .45); }
  50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}
.voice-texts { flex: 1 1 auto; min-width: 0; }
.voice-status { font-size: 13px; font-weight: 600; line-height: 1.45; }
.voice-heard { font-size: 12px; color: #a5b4fc; margin-top: 2px; min-height: 15px; }
.voice-close {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 14px;
}

/* tappable admin rows */
.tap-item { cursor: pointer; border-radius: 8px; margin: 0 -6px; padding: 9px 6px; }
.tap-item:active { background: rgba(79, 70, 229, .08); }

/* daily contact-detail reminder */
.nudge-card {
  cursor: pointer;
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, rgba(79, 70, 229, .07), rgba(124, 58, 237, .05));
}
.nudge-card:active { transform: scale(.99); }

/* ---------- notifications ---------- */
.appbar-right { display: flex; align-items: center; gap: 8px; }
#notif-bell, #admin-btn {
  position: relative; border: none; background: transparent; cursor: pointer;
  font-size: 19px; line-height: 1; padding: 4px;
}
/* Live calendar icon (owner 2026-08-14): a real tear-off-calendar badge showing TODAY's
   month · day · year (was the static 📅 emoji). On-palette — brand-accent band, not emoji red. */
#cal-btn { border: none; background: transparent; cursor: pointer; padding: 2px; line-height: 1; }
/* ONE unified calendar icon (owner: same finalised icon everywhere) — top bar, the calendar screen
   header, and the empty state all render this `.cal-glyph` (a live tear-off calendar: accent band =
   month, big day, small year). Day + year share the white area below the band, vertically centred. */
/* Fully em-based so ONE working ratio scales to any size via a single font-size — no per-context width/
   height tweaks that reintroduce clipping. Base font-size 10px → 30x35 (the verified top-bar size). */
.cal-glyph {
  display: inline-flex; flex-direction: column; width: 3em; height: 3.7em; flex: 0 0 auto; font-size: 10px;
  border-radius: 0.6em; overflow: hidden; line-height: 1;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 1px 3px rgba(28, 32, 51, .18);
  font-family: inherit; vertical-align: middle;
}
.cal-glyph-m { flex: 0 0 auto; background: var(--accent); color: #fff; font-size: 0.7em; font-weight: 800; letter-spacing: .3px; padding: 0.1em 0; text-align: center; text-transform: uppercase; line-height: 1.2; }
.cal-glyph-body { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cal-glyph-d { font-size: 1.3em; font-weight: 800; color: var(--ink); line-height: 1; font-variant-numeric: tabular-nums; }
.cal-glyph-y { font-size: 0.7em; font-weight: 700; color: var(--muted); line-height: 1; margin-top: 0.1em; letter-spacing: .2px; font-variant-numeric: tabular-nums; }
#cal-btn.active .cal-glyph { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* Scale for other contexts — change ONLY the font-size; proportions (and no-clip) are preserved. */
.cal-title { display: inline-flex; align-items: center; gap: 8px; }
.cal-title .cal-glyph { font-size: 8px; }
.empty-icon .cal-glyph { font-size: 15px; }
#admin-btn.active { filter: drop-shadow(0 0 0 transparent); transform: scale(1.08); }
#notif-badge, #admin-badge {
  position: absolute; top: -2px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: #dc2626; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-item { border-bottom: 1px solid var(--line); padding: 11px 0; }
.notif-item:last-child { border-bottom: none; }
/* GC10: a notification that deep-links reads as tappable (buttons inside still win the click). */
.notif-item.notif-clickable { cursor: pointer; border-radius: 10px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; transition: background .15s ease; }
.notif-item.notif-clickable.unread { padding-left: 12px; }
.notif-item.notif-clickable:hover { background: var(--accent-soft); }
.notif-item.unread { position: relative; padding-left: 12px; }
.notif-item.unread::before {
  content: ''; position: absolute; left: 0; top: 16px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.pct-bar {
  height: 8px; border-radius: 4px; background: var(--line);
  overflow: hidden; margin-top: 8px;
}
.pct-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  transition: width .4s ease;
}
.pct-label { font-size: 11.5px; color: var(--muted); margin-top: 4px; font-weight: 600; }
.hour-select {
  /* 16px floor: a class selector (0,1,0) beats the `select {font-size:max(16px,1em)}` guard (0,0,1),
     so a sub-16px value here re-triggers iOS focus-zoom. Keep it at the floor. (owner 2026-08-14) */
  font-size: max(16px, 1em); padding: 6px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--card, #fff); color: inherit;
}

/* invite share sheet */
.share-preview {
  font-size: 13px; line-height: 1.55; color: var(--ink);
  background: rgba(79, 70, 229, .06); border: 1px dashed var(--line);
  border-radius: 12px; padding: 12px; word-break: break-word;
}
a.share-btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* topic category filter chips */
.chip-btn {
  border: 1px solid var(--strip-line); background: var(--card); cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--ink);
  padding: 6px 12px; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(28,32,51,.04);
  transition: transform .1s ease;
}
.chip-btn:active { transform: scale(.96); }
/* Selected filter = crisp brand-gradient pill (clear "selected vs not"; owner-approved polish). */
.chip-btn.active { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(91,79,230,.28); }

/* Any non-native clickable element (role=button + data-action) shows the pointer. */
[role="button"][data-action] { cursor: pointer; }

/* compact topics view */
.tc-controls { display: flex; align-items: center; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.tc-toggle { flex: 0 0 auto; white-space: nowrap; }
.tc-group { border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; overflow: hidden; background: var(--card); }
/* Owner-approved polish (2026-08-12): clean white header; the OPEN section shows a small brand
   accent bar on the left + a hairline under the header, so what's expanded reads clearly. */
.tc-group > summary {
  position: relative;
  cursor: pointer; list-style: none; padding: 11px 13px; font-weight: 700; font-size: 13.5px;
  display: flex; align-items: center; gap: 8px; background: var(--card); color: var(--ink);
}
.tc-group[open] > summary { box-shadow: inset 0 -1px 0 var(--accent-soft); }
.tc-group[open] > summary::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(180deg, var(--accent), var(--accent-2)); }
.tc-group > summary > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-group > summary::-webkit-details-marker { display: none; }
/* rotating caret so the collapse/expand affordance is obvious (matches .acc) */
.tc-group > summary::after { content: '⌄'; color: var(--muted); font-weight: 700; transition: transform .2s ease; }
.tc-group[open] > summary::after { transform: rotate(180deg); }
/* Count pill = brand-tinted (was a plain white circle). */
.tc-group .tc-count { font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; }
/* Group profile: a compact card that expands (dropdown) into the full profile / editor.
   Reuses .tc-group only for open-state persistence; the look is a plain white card. */
.group-profile.tc-group { margin: 0; }
.group-profile > summary { background: var(--card); color: var(--ink); font-weight: 400; font-size: 14px; padding: 14px; gap: 12px; align-items: center; }
.group-profile > summary:hover { background: var(--accent-soft); }
.group-profile > summary > .gp-main { flex: 1 1 auto; min-width: 0; overflow: visible; white-space: normal; text-overflow: clip; }
.group-profile > summary::after { font-size: 20px; align-self: center; flex: 0 0 auto; }
.group-profile > .acc-body { padding: 0 14px 14px; }
/* Explicit collapse so the dropdown is deterministic even where the UA's closed-details
   hiding is absent (some embedded/headless renderers) — native hiding still applies too. */
.group-profile:not([open]) > .acc-body { display: none; }
.tc-list { padding: 4px 6px 6px; }
.tc-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.tc-row:last-child { border-bottom: none; }
.tc-row:hover { background: var(--accent-soft); }
.tc-main { min-width: 0; flex: 1; }
.tc-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-meta { font-size: 11px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-side { flex: 0 0 auto; text-align: right; }
.tc-pct { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.tc-pct b { font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; }
.tc-pct span { font-size: 10px; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* topic attachments */
.attach-chip {
  cursor: pointer; border: 1px solid var(--line); background: transparent;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attach-chip:active { background: rgba(79, 70, 229, .08); }
.attach-size { color: var(--muted); font-weight: 400; }

/* "attachments everywhere" slot (reasons / suggestions / objections / ratings) */
.iattach:empty { display: none; }
.iattach-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.iattach-chip { display: inline-flex; align-items: center; max-width: 100%; }
.iattach-dl {
  cursor: pointer; border: 1px solid var(--line); background: transparent; color: inherit;
  border-radius: 999px; padding: 4px 10px; font-size: 12px; line-height: 1.4;
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.iattach-dl:active { background: rgba(79, 70, 229, .08); }
.iattach-sz { color: var(--muted); font-weight: 400; }
.iattach-rm {
  cursor: pointer; border: 1px solid var(--line); border-left: 0; background: transparent; color: var(--muted);
  border-radius: 0 999px 999px 0; margin-left: -1px; padding: 4px 8px; font-size: 12px; line-height: 1.4;
}
.iattach-rm:active { background: rgba(220, 38, 38, .1); color: #dc2626; }
.iattach-add {
  cursor: pointer; border: 1px dashed var(--line); background: transparent; color: var(--accent, #6d28d9);
  border-radius: 999px; padding: 4px 10px; font-size: 12px; line-height: 1.4; font-weight: 600;
}
.iattach-add:active { background: rgba(79, 70, 229, .08); }

/* attachment preview grid (moderation review): image thumbnail or format-icon tile */
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.attach-tile {
  width: 96px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  padding: 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-family: inherit; text-align: center;
}
.attach-tile:active { background: var(--accent-soft); }
.attach-thumb {
  width: 84px; height: 64px; border-radius: 8px; background: var(--bg) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.attach-thumb.attach-file { background: var(--accent-soft); }
.attach-thumb.has-img .attach-ico { display: none; }
.attach-ico { font-size: 26px; line-height: 1; }
.attach-tile-name { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-tile-meta { font-size: 10px; color: var(--muted); }

/* question chains */
.subq { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 10px; }
.subq-text { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.subq.current {
  border: 1px solid var(--accent); border-radius: 12px;
  padding: 12px; margin-top: 12px;
  background: rgba(79, 70, 229, .04);
}
.subq-edit { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 8px; }
.subq-edit .subq-text { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* Editable chain question row: number · text input · remove. */
.subq-textrow { align-items: center; }
.subq-textrow .subq-num { flex: 0 0 auto; color: var(--muted); font-weight: 700; }
.subq-reason-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.subq-reason-row .hour-select { flex: 0 0 auto; }
.subq-textrow input { flex: 1 1 auto; min-width: 0; }
.cat-del {
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px;
}

/* settings weight grid */
.w-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.w-item label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 3px; }
.w-item input { width: 100%; }

/* in-app formatted data tables — .table-wrap is the single scroll container (both
   axes + a max-height) so the sticky header actually pins while you scroll it. */
.table-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 10px; }
.data-table { border-collapse: collapse; width: 100%; font-size: 12px; }
.data-table th {
  text-align: left; font-weight: 700; white-space: nowrap;
  background: var(--th-bg); padding: 7px 9px; z-index: 1;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
}
.data-table td { padding: 6px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td > .cell-clip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.data-table tbody tr:nth-child(even) { background: rgba(79, 70, 229, .03); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* search button in the app bar */
#search-btn { border: none; background: transparent; cursor: pointer; font-size: 17px; padding: 4px; }

/* four-option (MCQ) questions */
.opt4-btns { display: grid; gap: 8px; margin-top: 4px; }
.opt4-btn { text-align: left; justify-content: flex-start; border-left-width: 4px; }
.opt4-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
/* Full option name on its own line above the bar+count, so longer names (e.g.
   four cricketers with initials) stay readable instead of being clipped. */
.opt4-label { flex: 1 1 100%; font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.opt4-row .opt4-bar { flex: 1 1 auto; }
.opt4-row .opt4-count { flex: 0 0 auto; }
.opt4-bar { flex: 1 1 auto; }
.opt4-count { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
/* Each of the four options gets its own neutral colour so the names are easy to
   tell apart — bar fill + label + the button's left edge and letter tag. */
.opt4-fill { height: 100%; border-radius: 999px; transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
.opt4-c0 .opt4-fill { background: var(--o1); } .opt4-c0 .opt4-label { color: var(--o1); }
.opt4-c1 .opt4-fill { background: var(--o2); } .opt4-c1 .opt4-label { color: var(--o2); }
.opt4-c2 .opt4-fill { background: var(--o3); } .opt4-c2 .opt4-label { color: var(--o3); }
.opt4-c3 .opt4-fill { background: var(--o4); } .opt4-c3 .opt4-label { color: var(--o4); }
.opt4-btn.opt4-c0 { border-left-color: var(--o1); } .opt4-btn.opt4-c0 b { color: var(--o1); }
.opt4-btn.opt4-c1 { border-left-color: var(--o2); } .opt4-btn.opt4-c1 b { color: var(--o2); }
.opt4-btn.opt4-c2 { border-left-color: var(--o3); } .opt4-btn.opt4-c2 b { color: var(--o3); }
.opt4-btn.opt4-c3 { border-left-color: var(--o4); } .opt4-btn.opt4-c3 b { color: var(--o4); }

/* labelled sub-sections inside an admin card */
.admin-tools-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 14px; }
.admin-tools-label:first-of-type { margin-top: 4px; }

/* Covert "view as user" bar — fixed at the very top, above everything, so the app
   admin always has a one-tap return while testing as a user. */
#view-as-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 4000;
  display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(90deg, #7c3aed, #4f46e5); color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
#view-as-bar .va-txt { opacity: .96; }
#view-as-bar .va-return {
  border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.14); color: #fff;
  border-radius: 999px; padding: 4px 12px; font-weight: 700; cursor: pointer; font-size: 12.5px;
}
#view-as-bar .va-return:hover { background: rgba(255,255,255,.28); }
/* Nudge the app down so the fixed bar never covers the top bar while impersonating. */
body:has(#view-as-bar) #appbar { top: 34px; }
body:has(#view-as-bar) #view { padding-top: 34px; }

/* ---------- Opito (personal noting panel) ---------- */
.opito-screen { display: flex; flex-direction: column; min-height: 100%; }
.opito-list { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
/* Uniform fixed-size cards — every note is the same height so the panel stays tidy. */
.note-card {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 40px 10px 12px; height: 74px; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px; box-sizing: border-box;
  transition: transform .12s ease, box-shadow .12s ease;
  /* A long-press starts a drag, so the card must NOT select its text or pop the iOS callout menu. */
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.note-card:active { transform: scale(.99); }
.note-card .nc-name { font-weight: 700; font-size: 14px; line-height: 1.25; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.note-card .nc-body {
  font-size: 13px; color: var(--muted); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* When a NAME is shown, the body is a 1-line preview so name + preview + time fit the fixed height
   without clipping (a name already conveys the note; two body lines would overflow). */
.note-card.nc-hasname .nc-body { -webkit-line-clamp: 1; }
.note-card.nc-onlyname .nc-body { display: none; }
/* A note shared TO me: accent stripe + a small "shared by" badge. */
.note-card.nc-shared { border-left: 3px solid var(--accent, #5b4fe6); }
.note-card .nc-shared-badge { font-size: 10.5px; font-weight: 700; color: var(--accent, #5b4fe6); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Note category chip (social / organisation) — a small owner-private classification badge. */
.note-card .nc-cat { align-self: flex-start; margin-top: 3px; font-size: 10.5px; font-weight: 700;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A name-only card would otherwise leave dead space below the title — centre its content so it
   reads as intentional (the matter opens on tap). */
.note-card.nc-onlyname { justify-content: center; }
/* Settings segmented control that may hold 4 options — allow it to wrap on narrow screens. */
.seg.seg-wrap { flex-wrap: wrap; }
.seg.seg-wrap button { flex: 1 1 44%; }
/* Trash cards carry two actions (Restore + Delete forever) — give them room and a bottom action row. */
.note-card.nc-trash { height: auto; min-height: 74px; padding-bottom: 8px; }
.note-card.nc-trash .nc-trash-acts { display: flex; gap: 8px; margin-top: 8px; }
.note-card.nc-trash .nc-trash-acts .btn { flex: 1 1 auto; justify-content: center; }
.note-card.nc-onlyname .nc-meta { margin-top: 4px; }
/* When a thumbnail is present, reserve room on the right so text never runs under it. */
.note-card.nc-hasthumb { padding-right: 94px; }
.note-card .nc-meta { margin-top: auto; font-size: 11px; color: var(--muted); opacity: .8;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Attachment count (📎 docs · 🖼️ images) on a note card — sits in the meta line, slightly stronger than time. */
.note-card .nc-attcount { white-space: nowrap; font-weight: 600; }
.note-card .nc-thumb {
  position: absolute; right: 42px; top: 50%; transform: translateY(-50%); width: 46px; height: 46px;
  object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff;
}
.note-card .nc-menu {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: none; background: none;
  color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.note-card .nc-menu:hover { background: color-mix(in srgb, var(--muted) 14%, transparent); }
/* Delete = gravity absorb (owner-approved motion 2026-08-15): the card is sucked down and shrinks away
   before it's removed. Transform/opacity only (60fps); honours reduce-motion (instant fade). */
.note-card.nc-absorb { pointer-events: none; transform-origin: center; animation: ncAbsorb .42s cubic-bezier(.5, -.4, .7, .3) forwards; z-index: 2; }
@keyframes ncAbsorb { to { transform: translateY(60px) scale(.06); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .note-card.nc-absorb { animation: none; opacity: 0; } }
/* Reorder = spring settle (owner-approved motion): the dropped card gives a brief lift + spring into place. */
.note-card.nc-pop { animation: ncPop .5s cubic-bezier(.2, 1.3, .35, 1); }
@keyframes ncPop { 0% { transform: scale(1.05); box-shadow: 0 16px 34px rgba(40, 25, 80, .24); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .note-card.nc-pop { animation: none; } }
/* Bottom composer — sticks to the bottom of the panel (cancels #view's 16/24px padding to sit flush). */
.opito-composer {
  /* Sits flush at the bottom; when the on-screen keyboard opens, --kb-inset (PF3 visualViewport)
     lifts it to sit just ABOVE the keyboard instead of being covered — the page itself doesn't move. */
  position: sticky; bottom: calc(var(--kb-inset, 0px) - 24px); z-index: 3;
  margin: 10px -16px -24px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; gap: 6px; align-items: flex-end;
  transition: bottom .18s ease;
}
/* The clear-(✕) helper wraps the textarea in a .clr-wrap; make THAT the flex child so the pad
   still stretches edge-to-edge (otherwise the wrapper collapses and leaves dead space at right). */
.opito-composer .clr-wrap { flex: 1 1 auto; min-width: 0; display: flex; }
.opito-composer .clr-wrap textarea { width: 100%; }
.opito-composer textarea {
  flex: 1 1 auto; resize: none; min-height: 88px; max-height: 240px; border-radius: 14px; /* taller resting area (owner #1: composer felt too small) */
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  /* font-size MUST be >= 16px: mobile Safari auto-zooms the whole page into any focused input
     with a smaller font. 16px keeps focus from zooming — the keyboard just slides up instead. */
  padding: 12px 14px; font-family: inherit; font-size: 16px; line-height: 1.4;
}
/* All composer buttons share one height and bottom-align with the pad, so the row reads clean. */
.opito-composer .oc-btn {
  flex: 0 0 auto; width: 48px; height: 48px; border: none; border-radius: 14px; cursor: pointer;
  background: var(--accent, #5b4fe6); color: #fff; font-size: 20px; display: inline-flex;
  align-items: center; justify-content: center;
}
.opito-composer .oc-ink {
  flex: 0 0 auto; width: 44px; height: 48px; border: 1px solid var(--line); border-radius: 12px;
  cursor: pointer; background: var(--bg); color: var(--fg); font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
}
.opito-composer .oc-btn:disabled { opacity: .45; cursor: default; }
/* Folder cards + breadcrumb (Phase 2). */
.note-folder-card { background: color-mix(in srgb, var(--accent, #5b4fe6) 9%, var(--card)); border-color: color-mix(in srgb, var(--accent, #5b4fe6) 22%, var(--line)); justify-content: center; }
.note-folder-card .nc-name { color: var(--accent, #5b4fe6); }
.note-folder-card .nc-body { margin-top: 2px; }
.opito-crumbs { font-size: 13px; color: var(--muted); margin: 8px 2px 12px; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.opito-crumbs b { color: var(--fg); }
.opito-demo-hint { font-size: 12.5px; line-height: 1.4; color: var(--muted); background: color-mix(in srgb, var(--accent, #5b4fe6) 8%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent, #5b4fe6) 20%, var(--line)); border-radius: 10px; padding: 8px 11px; margin: 6px 2px 10px; }
/* Paper styles for the writing + descriptive-answer surfaces (owner 2026-08-14: blank/ruled/grid,
   default blank). Faint mid-grey lines (subtle on light AND dark; no color-mix dependency), 28px ruling.
   Element-scoped (2-class) so they override .npe-page / textarea `background` shorthands while KEEPING
   the paper background-COLOUR (only background-image + position are replaced). */
.paper-ruled, .paper-grid { --pl: rgba(70,78,110,.6); } /* clearly-visible ruling (bolder — owner still couldn't see .22 then .5) */
.npe-page.paper-ruled, .desc-text.paper-ruled { background-image: repeating-linear-gradient(to bottom, transparent 27px, var(--pl) 27px, var(--pl) 28px); background-position: 0 14px; }
.npe-page.paper-grid, .desc-text.paper-grid { background-image: repeating-linear-gradient(to bottom, transparent 27px, var(--pl) 27px, var(--pl) 28px), repeating-linear-gradient(to right, transparent 27px, var(--pl) 27px, var(--pl) 28px); background-position: 0 14px; }
.opito-crumbs a { color: var(--accent, #5b4fe6); cursor: pointer; }
.opito-crumbs .crumb-sep { opacity: .5; }
/* Drag-to-reorder + gravity delete-zone (Phase 3). */
.nc-ghost { position: fixed; top: 0; left: 0; z-index: 200; margin: 0; pointer-events: none; opacity: .97;
  box-shadow: 0 14px 34px rgba(0,0,0,.32); will-change: transform; }
.nc-drag-src { opacity: .32; }
.note-card.nc-drop-before { box-shadow: inset 0 3px 0 0 var(--accent, #5b4fe6); }
.note-card.nc-drop-after { box-shadow: inset 0 -3px 0 0 var(--accent, #5b4fe6); }
#opito-delzone { position: fixed; left: 50%; bottom: -100px; transform: translateX(-50%); z-index: 190;
  width: 130px; height: 130px; display: flex; align-items: center; justify-content: center; pointer-events: none;
  transition: bottom .3s cubic-bezier(.2,.8,.2,1); }
#opito-delzone.show { bottom: 26px; }
#opito-delzone .dz-orb { width: 78px; height: 78px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 30px; color: #fff;
  background: radial-gradient(circle at 50% 38%, #ff6b6b, #d11a2a);
  box-shadow: 0 8px 22px rgba(209,26,42,.45); transition: transform .18s ease, box-shadow .3s ease, background .2s ease; }
#opito-delzone.pull .dz-orb { transform: scale(1.16); box-shadow: 0 0 46px 10px rgba(209,26,42,.55); }
#opito-delzone.armed .dz-orb { transform: scale(1.42); background: radial-gradient(circle at 50% 38%, #ff4d4d, #a3001c); }
#opito-delzone.boom .dz-orb { transform: scale(1.9); opacity: 0; transition: transform .3s ease, opacity .3s ease; }
@media (prefers-reduced-motion: reduce) { .nc-ghost, #opito-delzone, #opito-delzone .dz-orb { transition: none !important; } }
/* Circle share chips that rise from the top while dragging a note — drop a note on one to share it there. */
#opito-sharebar { position: fixed; left: 0; right: 0; top: -140px; z-index: 190; display: flex; flex-direction: column;
  align-items: center; gap: 8px; padding: 12px 12px 16px; transition: top .22s cubic-bezier(.2,.8,.3,1);
  background: linear-gradient(180deg, var(--card, #fff) 60%, transparent); pointer-events: none; }
#opito-sharebar.show { top: 0; }
#opito-sharebar .sb-label { font-size: 12px; font-weight: 800; color: var(--muted, #6b7280); }
#opito-sharebar .sb-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
#opito-sharebar .sb-chip { border: 1.5px solid var(--accent, #5b4fe6); border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 700; color: var(--accent, #5b4fe6); background: var(--card, #fff); transition: transform .12s ease, background .12s ease; }
#opito-sharebar .sb-chip.armed { transform: scale(1.14); background: var(--accent, #5b4fe6); color: #fff; box-shadow: 0 6px 20px rgba(91,79,230,.4); }
@media (prefers-reduced-motion: reduce) { #opito-sharebar, #opito-sharebar .sb-chip { transition: none !important; } }
/* The immersive Opito/Shelfito panels have a full-bleed top STRIP. #view's 16px top padding was
   leaving a 16px band of the canvas colour (#f1f2f8) ABOVE the light-blue strip (#eef4ff) — a
   visible colour mismatch (owner flag 2026-08-12). The topbar's negative top-margin doesn't take
   effect inside the flex panel, so zero #view's top padding whenever an immersive top bar is
   present; the strip then reaches the very top. Horizontal padding stays, so the side-bleed
   (-16px left/right) still works. */
#view:has(.opito-topbar) { padding-top: 0; }
/* Opito as its own immersive panel — a distinct top bar with a Back-to-Stancito control.
   Owner 2026-08-12 (screenshots): the old violet/teal gradient bars swallowed the wordmarks
   ("pito" vanished on violet; "Shelf" fought the teal) and broke parity. Both module bars now
   use the SAME card-surface treatment as the main app bar, so O|pito and Shelf|ito render in
   the true logo pattern; module identity comes from the emoji + the wordmark itself. */
.opito-topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  margin: -16px -16px 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--strip); color: var(--ink);
  border-bottom: 1px solid var(--strip-line);
  box-shadow: 0 2px 10px rgba(28,32,51,.04); }
.opito-topbar .opito-back { width: 36px; height: 36px; border: none; border-radius: 50%; cursor: pointer;
  background: var(--strip-pill); color: var(--strip-pill-ink); font-size: 21px; line-height: 1; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; transition: transform .12s ease; }
.opito-topbar .opito-back:active { transform: scale(.9); }
/* The module lockup (icon + wordmark) is ONE inline unit that may NEVER stack (owner 2026-08-12)
   NOR clip (owner regression flag same day: overflow:hidden cut "Shelfito" short). The name keeps
   its FULL natural width always — when the bar is tight, the ACTION buttons compact (media query
   below) and, as a last resort, scroll, so the identity is never the thing that gives way. */
.opito-topbar .opito-brand { font-weight: 800; font-size: 17px; flex: 0 0 auto; letter-spacing: -0.02em; white-space: nowrap; }
.opito-topbar .opito-top-actions { display: flex; gap: 6px; flex: 1 1 auto; justify-content: flex-end; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.opito-topbar .opito-top-actions::-webkit-scrollbar { display: none; }
@media (max-width: 430px) {
  .opito-topbar { gap: 8px; padding-left: 10px; padding-right: 10px; }
  .opito-topbar .opito-back { width: 32px; height: 32px; font-size: 19px; }
  .opito-topbar .ot-btn { width: 32px; height: 32px; font-size: 15px; }
  .opito-topbar .opito-brand { font-size: 16px; }
}
.opito-topbar .ot-btn { width: 36px; height: 36px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--strip-pill); color: var(--strip-pill-ink); font-size: 16px; transition: transform .12s ease; }
.opito-topbar .ot-btn:active { transform: scale(.9); }
/* Center the button contents so the finalised calendar glyph (and emoji) sit dead-centre. */
.opito-topbar .ot-btn { display: inline-flex; align-items: center; justify-content: center; }
/* The ONE finalised calendar icon (calGlyphHtml) reused in the Opito/Shelfito 📅 entry buttons —
   em-based, so a single font-size scales it to fit the 32–36px top-bar button (≈24×30px). */
.opito-topbar .ot-btn .cal-glyph { font-size: 8px; box-shadow: none; }
/* Shelfito shares the same bar treatment (parity, owner ask); the class stays as the hook for
   any future Shelfito-specific accent. */
.shelfito-topbar { background: var(--strip) !important; }
.shelf-composer { justify-content: center !important; }
.shelf-composer .btn { max-width: 360px; margin: 0 auto; }
.shelf-item-card .nc-name { display: flex; gap: 6px; align-items: baseline; }
.shelf-drop-note { font-size: 12px; opacity: .6; text-align: center; margin-top: 6px; }
/* OS drag-and-drop upload: whole-screen affordance + per-folder drop target */
body.shelf-dragging .opito-panel { outline: 2.5px dashed #15a3ad; outline-offset: -8px; border-radius: 16px; background: rgba(21,163,173,.05); }
.note-folder-card.shelf-drop-hot { outline: 2.5px solid #15a3ad; background: rgba(21,163,173,.12); }
/* In-app file preview */
.shelf-preview { display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.shelf-pv-img { max-width: 100%; max-height: 72vh; margin: 0 auto; object-fit: contain; border-radius: 8px; }
.shelf-pv-frame { width: 100%; height: 72vh; border: 0; border-radius: 8px; background: #fff; }
.shelf-pv-media { width: 100%; max-height: 72vh; }
.shelf-pv-text { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; background: rgba(127,127,127,.08); padding: 12px; border-radius: 8px; max-height: 72vh; overflow: auto; }
.shelf-pv-none { text-align: center; opacity: .8; padding: 40px 12px; }
.shelf-pv-icon { font-size: 54px; }
.shelf-pv-actions { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }
/* Multi-select + bulk bar */
.shelf-selectable { cursor: pointer; }
.shelf-selectable.sel-on { outline: 2px solid #15a3ad; background: rgba(21,163,173,.10); }
.shelf-check { display: inline-block; min-width: 1.2em; }
.shelf-bulkbar { flex-direction: column; gap: 8px; align-items: stretch !important; }
.shelf-bulkbar .sbb-count { text-align: center; font-weight: 600; font-size: 13px; opacity: .85; }
.shelf-bulkbar .sbb-actions { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.shelf-bulkbar .is-disabled { opacity: .4; pointer-events: none; }
.shelf-usage { font-size: 12px; opacity: .7; padding: 2px 2px 8px; text-align: center; }
.shelf-usage-trash { opacity: .85; }
.shelf-ver { cursor: pointer; opacity: .85; }
.shelf-ver:hover { opacity: 1; text-decoration: underline; }
.shelf-shared { color: #0e7c86; font-weight: 600; }
@media (prefers-color-scheme: dark) { .shelf-shared { color: #4fd0da; } }
/* Shelfito file version-history sheet */
.shelf-vlist { display: flex; flex-direction: column; gap: 8px; }
.shelf-vrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line, #e2e6ea); border-radius: 12px; background: var(--card, #fff); }
.shelf-vrow-cur { border-color: #15a3ad; background: rgba(21,163,173,.06); }
.shelf-vrow-act { display: flex; gap: 6px; flex-shrink: 0; }
.shelf-vmeta { font-size: 12px; opacity: .65; margin-top: 2px; }
/* Shelfito kind-#1: cross-app attachment umbrellas */
.shelf-umbrella { margin: 0 0 14px; }
.shelf-umbrella-head { font-size: 13px; font-weight: 600; opacity: .8; padding: 4px 2px 8px; word-break: break-word; }
/* Kind-#1 source-area grouping: a top-level band per source (Opito / Topics / Circles / My answers). */
.shelf-source { margin: 0 0 18px; }
.shelf-source + .shelf-source { border-top: 1px solid var(--strip-line); padding-top: 14px; }
.shelf-source-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 10px; }
.shelf-source-ic { font-size: 17px; line-height: 1; }
.shelf-source-name { font-size: 15px; font-weight: 800; color: var(--ink); letter-spacing: .01em; }
.shelf-source-count { margin-left: auto; min-width: 20px; text-align: center; font-size: 12px; font-weight: 700;
  color: var(--muted); background: var(--chip); border-radius: 999px; padding: 1px 8px; }
.shelf-source .shelf-umbrella { margin-left: 4px; }
/* ── Calendar (posted + due items on their dates) ── */
.cal-screen { padding: 6px 10px 24px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }
.cal-title { font-size: 17px; font-weight: 800; color: var(--ink); text-align: center; flex: 1; }
button.cal-title { border: 0; background: transparent; font-family: inherit; cursor: pointer; padding: 6px 4px; border-radius: 10px; justify-content: center; }
button.cal-title:hover { background: var(--card); }
.cal-nav { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--strip-line); background: var(--card);
  color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer; flex-shrink: 0; }
.cal-nav:hover { border-color: var(--brand); }
.cal-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
/* Module passthrough bar (All / Stancito / Opito / Shelfito) — a horizontal chip row like the emoji categories. */
.cal-modbar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 9px; margin: 0 -2px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.cal-modbar::-webkit-scrollbar { display: none; }
.cal-modbar .sf-chip { flex: 0 0 auto; white-space: nowrap; }
.cal-toggle { display: inline-flex; gap: 6px; margin-left: auto; }
.cal-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 0 2px 10px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
/* Lifecycle palette (owner-approved 2026-08-14): a clear yellow→orange→red urgency ramp, well apart. */
.cal-dot.st-posted { background: #16a34a; }
.cal-dot.st-later  { background: #eab308; }
.cal-dot.st-soon   { background: #f97316; }
.cal-dot.st-overdue{ background: #dc2626; box-shadow: 0 0 0 2px rgba(220, 38, 38, .30); } /* ring: distinct from orange even at a glance */
.cal-dot.st-exam   { background: #4f46e5; }
.cal-dot.st-done   { background: #16a34a; opacity: .42; } /* resolved → muted */
.cal-dot.st-missed { background: #dc2626; opacity: .42; }
/* legacy aliases (any lingering markup) */
.cal-dot.posted { background: #16a34a; }
.cal-dot.due { background: #f97316; }
.cal-dot.due.over { background: #dc2626; }
/* Month-at-a-glance summary strip */
.cal-month-strip { display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 8px 11px; margin: 0 0 10px; border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); font-size: 12px; }
.cal-strip-item { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-weight: 600; }
/* Lifecycle badge (item rows in the day sheet + agenda) */
.cal-badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.cal-badge.st-posted { background: #16a34a; }
.cal-badge.st-later  { background: #eab308; color: #3a2f00; }
.cal-badge.st-soon   { background: #f97316; }
.cal-badge.st-overdue{ background: #dc2626; }
.cal-badge.st-exam   { background: #4f46e5; }
.cal-badge.st-done   { background: #dcfce7; color: #166534; }
.cal-badge.st-missed { background: #fee2e2; color: #991b1b; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { position: relative; min-height: 46px; border-radius: 10px; border: 1px solid var(--strip-line); background: var(--card);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 5px 2px 3px; }
.cal-cell.out { opacity: .4; }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-cell { cursor: pointer; } /* every day is selectable now */
.cal-cell:hover { border-color: var(--brand); }
.cal-cell.sel { border-color: var(--brand); background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--brand); } /* the tapped day */
.cal-num { font-size: 13px; font-weight: 650; color: var(--ink); }
.cal-cell.out .cal-num { font-weight: 500; }
.cal-dots { display: flex; gap: 3px; margin-top: 4px; min-height: 8px; }
.cal-cnt { position: absolute; top: 3px; right: 4px; font-size: 9px; font-weight: 700; color: var(--muted); }
.cal-day-list { display: flex; flex-direction: column; gap: 8px; }
.cal-day-add { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cal-day-add .btn { width: 100%; }
/* Agenda view (Grid ⇄ Agenda) */
.cal-view-toggle { margin-left: auto; }
/* Directional month-swipe slide (owner 2026-08-14). */
@keyframes calSlideNext { from { transform: translateX(26px); opacity: .35; } to { transform: none; opacity: 1; } }
@keyframes calSlidePrev { from { transform: translateX(-26px); opacity: .35; } to { transform: none; opacity: 1; } }
.cal-slide-next { animation: calSlideNext .2s ease; }
.cal-slide-prev { animation: calSlidePrev .2s ease; }
@media (prefers-reduced-motion: reduce) { .cal-slide-next, .cal-slide-prev { animation: none; } }
.cal-agenda { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.cal-agenda-day { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 700; color: var(--muted); padding: 2px 2px 8px; }
.cal-agenda-day.today { color: var(--brand); }
.cal-agenda-day:hover { color: var(--brand); }
/* Type-umbrella grouping (agenda days + the day popup). */
.cal-umb + .cal-umb { margin-top: 10px; }
.cal-umb-head { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted);
  margin: 0 2px 6px; text-transform: uppercase; letter-spacing: .03em; }
.cal-umb-cnt { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--strip); border: 1px solid var(--strip-line);
  border-radius: 999px; padding: 1px 7px; }
.cal-umb .cal-item + .cal-item { margin-top: 6px; }
.cal-day-list .cal-umb .cal-item, .cal-umb .cal-item { margin-top: 6px; }
.cal-item { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--strip-line);
  border-radius: 12px; padding: 10px 11px; cursor: pointer; }
.cal-item:hover { border-color: var(--brand); }
.cal-item-ic { font-size: 19px; flex-shrink: 0; }
.cal-item-txt { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.cal-item-title { font-size: 14px; font-weight: 650; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item-sub { font-size: 11.5px; color: var(--muted); }
.cal-item-badges { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; flex-shrink: 0; }
/* Dark-mode nudge banner (Home, one-time until tried) — brand-tinted, dismissible, non-intrusive. */
.dark-nudge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px;
  padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--strip-line);
  border-left: 3px solid var(--brand-ito); }
.dark-nudge-txt { flex: 1; min-width: 180px; font-size: 13.5px; color: var(--ink); }
.dark-nudge-acts { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.dark-nudge-x { border: none; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.dark-nudge-x:hover { color: var(--ink); background: var(--chip); }
/* ── Warm Oak — Shelfito shelf look (owner-approved). Applies ONLY to the shelf furniture (file/folder
   cards + group planks). The Stancito wordmark, its two-tone colours, and the teal top strip are never
   touched. Theme-aware (walnut on dark). No DOM change → drag/menu/select interactions are unaffected. */
.shelf-oak .opito-list > .note-card { position: relative; margin-bottom: 14px; }
.shelf-oak .opito-list > .note-card:not(.note-folder-card):not(.sel-on) {
  background: var(--oak-face); border-color: rgba(124, 58, 237, .26); box-shadow: 0 5px 7px -5px rgba(76, 29, 149,.32); }
/* the wooden plank each card rests on */
.shelf-oak .opito-list > .note-card:not(.sel-on)::after {
  content: ""; position: absolute; left: -3px; right: -3px; bottom: -9px; height: 6px; border-radius: 2px;
  background-image: linear-gradient(180deg, var(--oak-1), var(--oak-2) 60%, var(--oak-edge)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .09) 0 2px, transparent 2px 22px);
  box-shadow: 0 3px 5px -2px rgba(76, 29, 149,.45), inset 0 1px 0 rgba(255, 255, 255, .22); }
/* folder cards = little oak boxes */
.shelf-oak .opito-list > .note-folder-card { background: linear-gradient(180deg, var(--oak-1), var(--oak-2)); border-color: var(--oak-edge); }
.shelf-oak .opito-list > .note-folder-card .nc-name,
.shelf-oak .opito-list > .note-folder-card .nc-body { color: #ffffff; }
.shelf-oak .opito-list > .note-folder-card .nc-menu { color: rgba(255, 255, 255, .92); }
/* attachments view: each source group's items sit on a shelf plank */
.shelf-oak .shelf-umbrella { position: relative; padding-bottom: 11px; }
.shelf-oak .shelf-umbrella::after {
  content: ""; display: block; height: 7px; margin: 3px 2px 0; border-radius: 2px;
  background-image: linear-gradient(180deg, var(--oak-1), var(--oak-2) 60%, var(--oak-edge)),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .09) 0 2px, transparent 2px 22px);
  box-shadow: 0 3px 6px -3px rgba(76, 29, 149,.4); }
/* Opito search / filter + arrangement-history panels. */
.sf-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.sf-lab { font-size: 12px; font-weight: 700; opacity: .7; margin-right: 2px; }
.sf-chip { border: 1px solid var(--strip-line); border-radius: 999px; background: var(--card); color: var(--ink);
  padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .1s ease;
  box-shadow: 0 1px 2px rgba(28,32,51,.04); }
.sf-chip:active { transform: scale(.95); }
.sf-chip.on { background: linear-gradient(90deg, var(--accent, #5b4fe6), var(--accent-2, #8a43dd));
  border-color: transparent; color: #fff; box-shadow: 0 2px 8px rgba(91,79,230,.28); }
.sf-results { margin-top: 6px; display: flex; flex-direction: column; gap: 8px; }
.sf-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card, var(--bg));
  cursor: pointer; transition: transform .1s ease; }
.sf-card:active { transform: scale(.99); }
.sf-title { font-size: 14px; font-weight: 700; line-height: 1.3; word-break: break-word; }
.sf-card .log-meta, .ch-row .log-meta { font-size: 12px; opacity: .72; margin-top: 3px; }
/* Umbrellas: content-type "place" cards + item tags (owner taxonomy). */
.umb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 6px; }
.umb-card { display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 12px; background: var(--card, var(--bg)); cursor: pointer; font: inherit; color: inherit; transition: transform .1s ease, border-color .1s ease; }
.umb-card:active { transform: scale(.99); }
.umb-card.on { border-color: var(--accent, #7c3aed); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #7c3aed) 20%, transparent); }
.umb-g { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; background: color-mix(in srgb, var(--accent, #7c3aed) 10%, var(--card)); }
.umb-g-fontito { background: rgba(124,58,237,.13); } .umb-g-slatito { background: rgba(14,138,134,.15); }
.umb-g-inkito { background: rgba(79,70,229,.14); } .umb-g-pixito { background: rgba(209,71,122,.14); } .umb-g-files { background: rgba(107,111,134,.15); }
.umb-txt { min-width: 0; flex: 1; }
.umb-name { display: block; font-weight: 750; font-size: 14px; letter-spacing: -.01em; }
.umb-kind { display: block; font-size: 11.5px; opacity: .66; }
.umb-count { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; opacity: .85; }
.umb-tag { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #7c3aed) 10%, transparent); color: var(--accent, #7c3aed); }
.umb-tag-topic { background: rgba(14,138,134,.14); color: var(--slatito, #0e8a86); }
.umb-item { position: relative; padding-right: 42px; }
.umb-item-topics { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.umb-tagbtn { position: absolute; right: 8px; top: 8px; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--card, var(--bg)); cursor: pointer; font-size: 15px; display: grid; place-items: center; opacity: .8; }
.umb-tagbtn:active { transform: scale(.94); }
.umb-tag-x { border: none; background: none; color: inherit; cursor: pointer; font-size: 11px; padding: 0 0 0 2px; opacity: .7; }
.ch-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; background: var(--card, var(--bg)); margin-bottom: 8px; }
.ch-row.cur { border-color: var(--accent, #5b4fe6); background: color-mix(in srgb, var(--accent, #5b4fe6) 8%, transparent); }
.ch-row .sf-title { flex: 1 1 auto; }
.ch-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px;
  background: var(--accent, #5b4fe6); color: #fff; vertical-align: middle; margin-left: 4px; }
.share-onward { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin: 4px 0 14px; cursor: pointer; }
.share-onward input { width: 18px; height: 18px; flex: 0 0 auto; }
/* Note formatting toolbar (typed multi-level lists). */
.note-fmt { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.note-fmt button { min-width: 36px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg); cursor: pointer; font-size: 14px; font-weight: 700; }
.note-fmt button:active { background: color-mix(in srgb, var(--accent, #5b4fe6) 16%, transparent); }
/* Note EDIT panel — one aligned toolbar on top: formatting · handwrite · attach · save (mirrors the composer). */
.note-edit-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.note-edit-bar .nfmt-group { display: flex; gap: 4px; flex-wrap: wrap; }
.note-edit-bar .nfmt-group button { min-width: 34px; height: 38px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--bg); color: var(--fg); cursor: pointer; font-size: 14px; font-weight: 700; }
.note-edit-bar .nfmt-group button:active { background: color-mix(in srgb, var(--accent, #5b4fe6) 16%, transparent); }
.note-edit-bar .neb-spacer { flex: 1 1 auto; }
.note-edit-bar .neb-tool { width: 42px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--fg); cursor: pointer; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center; }
.note-edit-bar .neb-tool:active { transform: scale(.92); }
.note-edit-bar .neb-save { height: 38px; padding: 0 16px; border: none; border-radius: 10px; cursor: pointer;
  background: var(--accent, #5b4fe6); color: #fff; font-weight: 700; font-size: 14px; white-space: nowrap; }
.note-edit-bar .neb-save:active { transform: scale(.96); }
#note-body { width: 100%; box-sizing: border-box; resize: vertical; min-height: 220px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  /* >=16px so mobile Safari doesn't auto-zoom on focus (matches the composer). */
  padding: 13px 15px; font-family: inherit; font-size: 16px; line-height: 1.55; }
.note-ink-wrap { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.note-ink-wrap img { max-width: 100%; border: 1px solid var(--line); border-radius: 10px; }
/* ── Opito page/block editor ── */
.npe-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.npe-pagenav { display: flex; align-items: center; gap: 6px; }
/* ALL editor icon buttons (page nav + undo/redo/download/export) share this look — the selector was
   scoped to .npe-pagenav only, leaving undo/redo/download UNSTYLED (owner: "not looking nice"). */
.npe-nav { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg);
  color: var(--fg); cursor: pointer; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; }
.npe-nav:active { background: var(--strip-pill, var(--bg)); transform: scale(.94); }
.npe-nav:disabled { opacity: .4; cursor: default; }
.npe-pagelbl { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; width: 88px; box-sizing: border-box; text-align: center; }
/* Jump-to-any-page: an editable page-number field (owner 2026-08-14 — not a dropdown). 16px floor stops iOS focus-zoom. */
/* FIXED width (not min-width) matching .npe-pagelbl so the ＋ button NEVER shifts as the page count
   changes (1↔2) or as the total grows into 2–3 digits — owner: adding many pages kept moving ＋. The
   input + "/N" stay centered within this fixed box; 🗑 also sits on the far side, never next to ＋. */
.npe-pagejump { display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 88px; box-sizing: border-box; }
.npe-pageinput { flex: none; }
.npe-pageinput { font-size: max(16px, 0.9em); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 4px 4px; height: 34px; width: 46px; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.npe-pageinput::-webkit-outer-spin-button, .npe-pageinput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.npe-pagetot { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Save-as-Send: the editor's save moved to a prominent full-width button at the BOTTOM (owner 2026-08-14),
   matching the composer's purple ➤ send so "finish a note" feels like "send" and sits under the thumb. */
.npe-send { width: 100%; margin-top: 12px; border: none; border-radius: 14px; background: var(--accent, #5b4fe6); color: #fff; font-size: 16px; font-weight: 700; padding: 13px; cursor: pointer; }
.npe-send:active { transform: scale(.99); }
.npe-spacer { flex: 1 1 auto; }
.npe-insert { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.npe-insert .neb-tool { min-width: 42px; }
.npe-hint { font-size: 12px; color: var(--muted); line-height: 1.3; }
/* Note NAME at the top of the editor — derived from the first heading (#5 name-from-heading),
   not a separate field. Mirrors the title as the user types the H1; muted when still untitled. */
.npe-namewrap { padding: 2px 2px 6px; margin-bottom: 2px; }
.npe-name { font-size: 19px; font-weight: 800; color: var(--fg); line-height: 1.25; word-break: break-word; }
.npe-name.is-untitled { color: var(--muted); font-weight: 700; }
.npe-namehint { font-size: 11.5px; color: var(--muted); margin-top: 2px; opacity: .9; }
.npe-attrib { font-size: 12px; color: var(--muted, #6b7280); margin: 2px 0 8px; line-height: 1.4; word-break: break-word; }
/* Contributor chain (originator → editors), each chip opens that person's profile. */
.npe-contrib { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin: 0 0 8px; font-size: 12px; }
.npe-contrib .npe-clabel { color: var(--muted); font-weight: 600; }
.npe-cchip { border: 1px solid var(--accent-soft); background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; }
.npe-cchip:active { transform: scale(.94); }
.npe-carrow { color: var(--muted); opacity: .6; }
.npe-seen { color: var(--muted); font-size: 12px; } /* WhatsApp-style "Seen by …" receipt row */
/* Print / Save-as-PDF: a hidden clean rendering of the note pages, shown only while printing. */
#npe-print { display: none; }
@media print {
  body.npe-printing > *:not(#npe-print) { display: none !important; }
  body.npe-printing #npe-print { display: block !important; }
  #npe-print .pp-page { position: relative; page-break-after: always; padding: 10mm; box-sizing: border-box; }
  #npe-print .pp-text { white-space: pre-wrap; font: 13px/1.55 system-ui, sans-serif; color: #111; margin: 3px 0; }
  #npe-print .pp-img { max-width: 100%; display: block; margin: 6px 0; }
  #npe-print .pp-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
  #npe-print .pp-table td { border: 1px solid #888; padding: 4px 7px; font: 12px system-ui, sans-serif; color: #111; }
  #npe-print .pp-table .pp-hd { background: #eee; font-weight: 700; }
  #npe-print .pp-overlay { position: absolute; left: 10mm; top: 10mm; width: calc(100% - 20mm); pointer-events: none; }
}
/* The page area is ONE blank sheet (paper): text, handwriting, images and tables all flow on it,
   inserted inline — not a stack of boxed widgets. Owner: the page is ALWAYS WHITE like real paper
   (dark ink on white), in BOTH light and dark app themes and in the demo — never a dark sheet. */
/* The note PAGE is always white paper with dark ink, in BOTH themes. --npe-ctrl is a paper-relative grey for
   controls that sit ON the paper (grip ⠿, delete ×, size, table strip) — theme-INDEPENDENT so they stay
   visible on white in dark mode too (they used the theme --muted, which flips light in dark → invisible; owner #7). */
:root, :root[data-theme="dark"], :root[data-theme="light"] { --npe-paper: #ffffff; --npe-ink: #1a1a22; --npe-rule: #e7e7ee; --npe-ctrl: #6b6f80; }
@media (prefers-color-scheme: dark) { :root { --npe-paper: #ffffff; --npe-ink: #1a1a22; --npe-rule: #e7e7ee; --npe-ctrl: #6b6f80; } }
.npe-page { display: flex; flex-direction: column; gap: 4px; min-height: 70vh; touch-action: pan-y; /* fill more of the screen (owner #1); pan-y: native vertical scroll, horizontal reaches the page flip */
  background-color: var(--npe-paper); color: var(--npe-ink); border: 1px solid var(--npe-rule); border-radius: 12px; /* background-COLOR (not shorthand) so ruled/grid lines never get wiped */
  box-shadow: 0 6px 22px rgba(0,0,0,.10); padding: 18px 16px; }
.npe-block { position: relative; padding: 2px 0; }
.npe-block .npe-bdel { position: absolute; top: 2px; right: 0; width: 24px; height: 24px; border: none; background: none;
  color: var(--npe-ctrl); font-size: 14px; cursor: pointer; border-radius: 6px; opacity: 0; transition: opacity .12s; }
.npe-block:hover .npe-bdel, .npe-block:focus-within .npe-bdel { opacity: .8; }
/* Compact/expand a file card — sits just left of the ✕, same hover-reveal (owner: a hide-to-compact icon). */
.npe-block .npe-bcompact { position: absolute; top: 2px; right: 26px; width: 24px; height: 24px; border: none; background: none;
  color: var(--npe-ctrl); font-size: 14px; cursor: pointer; border-radius: 6px; opacity: 0; transition: opacity .12s; }
.npe-block:hover .npe-bcompact, .npe-block:focus-within .npe-bcompact { opacity: .8; }
.npe-block .npe-ta { width: 100%; box-sizing: border-box; border: none; background: transparent; color: var(--npe-ink);
  caret-color: var(--npe-ink); /* dark caret so the cursor is visible on the white page (esp. dark theme) */
  resize: none; overflow: hidden; min-height: 32px; font-family: inherit; font-size: 1em; line-height: 1.6; padding: 2px 54px 2px 0; }
  /* font-size:1em (not a fixed 16px) so the page A± scale on #npe-page (font-size:1.15em etc.) cascades to
     the text + headings — the fixed px pinned it and made the A± control appear to do nothing (owner #2). */
.npe-block .npe-ta:focus { outline: none; }
/* Per-block text size (owner #6 slice): a title-size heading + subheading, cycled by the Aa button. */
.npe-block .npe-ta.npe-h1 { font-size: 1.6em; font-weight: 700; line-height: 1.3; }
.npe-block .npe-ta.npe-h2 { font-size: 1.25em; font-weight: 600; line-height: 1.35; }
/* Rich text (owner #6): the text block is now a contenteditable field. pre-wrap keeps list-indent spaces
   and wraps long lines; the placeholder shows only while it's empty. */
.npe-block .npe-rt { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; cursor: text; }
.npe-block .npe-rt:empty::before, .npe-block .npe-rt.npe-rt-empty::before { content: attr(data-ph); color: var(--muted); pointer-events: none; }
.npe-block .npe-rt b, .npe-block .npe-rt strong { font-weight: 700; }
/* Formatting toolbar + the font / colour / highlight picker strip it toggles. */
.npe-fmtbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.npe-fmtbar .neb-tool { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); font-size: 15px; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.npe-fmtbar .neb-tool:active { transform: scale(.92); }
.npe-fmtsep { width: 1px; height: 22px; background: var(--line); margin: 0 2px; }
.npe-fmtstrip { display: none; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; padding-top: 8px; margin-top: 2px; border-top: 1px dashed var(--line); }
.npe-fmtbar[data-strip="font"] .npe-fmtstrip-font,
.npe-fmtbar[data-strip="color"] .npe-fmtstrip-color,
.npe-fmtbar[data-strip="hilite"] .npe-fmtstrip-hilite { display: flex; }
.npe-fmtbar[data-strip="font"] [data-s="font"],
.npe-fmtbar[data-strip="color"] [data-s="color"],
.npe-fmtbar[data-strip="hilite"] [data-s="hilite"] { background: color-mix(in srgb, var(--accent, #5b4fe6) 22%, transparent); border-color: var(--accent, #5b4fe6); }
/* Font picker: grouped Work / Fun, each option a live sample rendered in its own font. Scrolls if tall. */
.npe-fmtbar[data-strip="font"] .npe-fontlist { display: block; max-height: 210px; overflow-y: auto; }
.npe-fontgrp { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 4px 2px 4px; }
.npe-fontrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.npe-fontopt { font-size: 15px; padding: 4px 12px !important; height: auto !important; min-height: 34px; }
/* Insert-toolbar buttons — clearer, crisper (owner: they looked plain/faded). */
.npe-insert .neb-tool { min-width: 42px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font-size: 17px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.npe-insert .neb-tool:hover { border-color: color-mix(in srgb, var(--accent, #5b4fe6) 50%, var(--line)); background: color-mix(in srgb, var(--accent, #5b4fe6) 6%, var(--card)); }
.npe-insert .neb-tool:active { transform: scale(.93); }
/* A4 / MS-Word-like page layout (owner #2/#7): a bordered sheet with margins on a subtle desk, + a ruler. */
.npe-pagewrap.npe-a4wrap { background: color-mix(in srgb, var(--fg, #2b2b3a) 8%, var(--card, #fff)); padding: 14px 10px 20px; border-radius: 8px; overflow-x: auto; }
.npe-page.npe-a4 { width: min(100%, 760px); margin: 0 auto; aspect-ratio: 210 / 297; background-color: var(--npe-paper); border: 1px solid var(--line); box-shadow: 0 3px 16px rgba(0,0,0,.20); padding: 40px 48px; box-sizing: border-box; } /* background-COLOR (not shorthand) so ruled/grid background-image survives in A4 */
.npe-page.npe-a4.npe-a4-land { width: min(100%, 1040px); aspect-ratio: 297 / 210; }
/* ── Free placement (owner: free A4 layout) — each block positioned absolutely by its pos (% of the page
   box); the ⠿ grip drags it anywhere. Padding is dropped in A4 so on-screen drag coords match the % box. ── */
.npe-page.npe-free { display: block; position: relative; }
.npe-page.npe-free.npe-a4 { padding: 0; }
/* A non-A4 free page is still a placement surface — give it height + a faint boundary so the user sees the canvas. */
.npe-page.npe-free:not(.npe-a4) { min-height: 90vh; outline: 1px dashed var(--line); outline-offset: -2px; border-radius: 8px; }
.npe-block.npe-block-free { position: absolute; padding: 8px 10px 8px 28px; background: var(--npe-paper, var(--card)); border: 1px solid var(--npe-rule, var(--line)); border-radius: 9px; box-shadow: 0 1px 5px rgba(0,0,0,.10); box-sizing: border-box; }
/* Move handle is ALWAYS visible in free mode (no hover on touch) — a clear, tappable accent pill. */
.npe-page.npe-free .npe-grip { opacity: 1; top: 6px; left: 5px; width: 18px; height: 22px; display: grid; place-items: center;
  border-radius: 6px; background: rgba(124,58,237,.14); color: var(--accent, #7c3aed); cursor: move; touch-action: none; }
.npe-block.npe-block-free.npe-dragging { opacity: .95; box-shadow: 0 8px 22px rgba(0,0,0,.30); z-index: 5; }
/* Width-resize handle on the right edge of a free block (owner: free A4 layout, manual sizing). */
.npe-block-free .npe-rsz { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 12px; height: 34px;
  border-radius: 6px; background: rgba(124,58,237,.16); border: 1px solid var(--accent, #7c3aed); cursor: ew-resize; touch-action: none; z-index: 4; }
.npe-block.npe-resizing { outline: 1px dashed var(--accent, #7c3aed); z-index: 6; }
.npe-ruler { width: min(100%, 760px); margin: 0 auto; height: 20px; position: relative; background-color: var(--card); background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 37.85px); border: 1px solid var(--line); border-bottom: none; border-radius: 4px 4px 0 0; }
.npe-ruler-land { width: min(100%, 1040px); }
.npe-ruler-line { position: absolute; left: 48px; right: 48px; top: 3px; bottom: 3px; background: color-mix(in srgb, var(--accent, #5b4fe6) 10%, transparent); border-left: 2px solid var(--accent, #5b4fe6); border-right: 2px solid var(--accent, #5b4fe6); border-radius: 2px; }
/* Live-update banner (a collaborator edited this open note) — non-destructive; never overwrites your edits. */
.npe-livebar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--accent, #5b4fe6) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent, #5b4fe6) 45%, var(--line)); font-size: 13px; font-weight: 600; color: var(--fg); }
.npe-livebar span { flex: 1; }
/* Live writing session (owner 2026-08-23). Red marks ONLY the live state (owner-approved in the preview);
   backgrounds color-mix over the card so both themes stay legible. */
.npe-live-toggle.on { border-color: #e0384f; background: color-mix(in srgb, #e0384f 13%, var(--card)); color: #e0384f; font-weight: 700; }
.npe-livewrite { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: #e0384f; background: color-mix(in srgb, #e0384f 9%, var(--card)); border: 1px solid color-mix(in srgb, #e0384f 32%, var(--line)); }
.npe-livedot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e0384f; box-shadow: 0 0 0 0 #e0384f; animation: npeLivePulse 1.8s infinite; flex: none; }
@keyframes npeLivePulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, #e0384f 55%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .npe-livedot { animation: none; } }
/* S2 live-writing content: a view-only viewer sees the pen holder's ongoing text; the caret's LINE gets a soft
   wash (owner D4). Same live-red family as the S1 indicator, just fainter — no new hue. Lines stack (block). */
/* Live overlay only (view-only viewer): let the caret's name flag escape the block instead of being clipped by
   the editor block's own `overflow: hidden` — otherwise the flag vanishes whenever the caret sits on line 1. */
.npe-ta.npe-lw-live { transition: background .1s ease; overflow: visible; }
.npe-ta.npe-lw-live .npe-lwline { display: block; min-height: 1.1em; padding: 0 2px; border-radius: 4px; }
.npe-ta.npe-lw-live .npe-lwline-active { background: color-mix(in srgb, #e0384f 11%, transparent); box-shadow: -0.45em 0 0 color-mix(in srgb, #e0384f 11%, transparent); }
/* S3 live cursor: a precise, blinking caret at the writer's exact column, flagged with their name (live-red only —
   one writer in turn-based mode; per-user colours arrive with the previewed simultaneous-editing slice). */
.npe-lwcaret { display: inline-block; width: 0; border-left: 2px solid #e0384f; height: 1.05em; margin: 0 -1px; vertical-align: text-bottom; position: relative; animation: npeCaretBlink 1.1s steps(1) infinite; }
.npe-lwcaret-flag { position: absolute; top: -1.3em; left: -1px; font-size: 10px; font-weight: 700; line-height: 1.5; padding: 0 5px; border-radius: 5px 5px 5px 0; background: #e0384f; color: #fff; white-space: nowrap; pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.22); z-index: 2; }
@keyframes npeCaretBlink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: .15; } }
@media (prefers-reduced-motion: reduce) { .npe-ta.npe-lw-live { transition: none; } .npe-lwcaret { animation: none; } }
.npe-livex { border: none; background: transparent; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 4px; }
.npe-block .npe-bsize { position: absolute; top: 2px; right: 26px; height: 24px; min-width: 26px; padding: 0 5px; border: 1px solid var(--npe-rule); background: var(--npe-paper); color: var(--npe-ctrl); border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1; opacity: 0; cursor: pointer; }
.npe-block:hover .npe-bsize, .npe-block:focus-within .npe-bsize { opacity: .85; }
/* Per-block size stepper (owner #5): two tiny A− / A+ buttons, sat to the left of the size/delete controls. */
.npe-block .npe-bscale { position: absolute; top: 2px; right: 56px; display: flex; gap: 3px; opacity: 0; z-index: 2; }
.npe-block:hover .npe-bscale, .npe-block:focus-within .npe-bscale { opacity: .85; }
.npe-block .npe-bstep { height: 24px; min-width: 24px; padding: 0 5px; border: 1px solid var(--npe-rule); background: var(--npe-paper); color: var(--npe-ctrl); border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 1; cursor: pointer; }
.npe-media { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 6px 0; }
.npe-media img { max-width: 100%; border-radius: 8px; border: 1px solid var(--npe-rule); background: #fff; }
.npe-media-acts { display: flex; gap: 8px; opacity: 0; transition: opacity .12s; }
.npe-block.npe-media:hover .npe-media-acts, .npe-block.npe-media:focus-within .npe-media-acts { opacity: 1; }
.npe-file { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.npe-filechip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; text-decoration: none;
  border: 1.5px solid var(--npe-rule, #d7d9e0); border-radius: 10px; padding: 9px 13px; background: #fff; color: #1a1a2e;
  font-size: 14px; font-weight: 600; overflow: hidden; }
.npe-filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-filechip:active { transform: scale(.98); }
/* Inline attachment PREVIEW card (owner): thumbnail for image files, type-badge for others + name/kind/size. */
.npe-filecard { display: inline-flex; align-items: center; gap: 12px; max-width: 100%; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: border-color .14s, box-shadow .14s; }
.npe-filecard:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.npe-filecard:active { transform: scale(.99); }
.npe-filebadge { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 24px; background: var(--accent-soft); }
.npe-filethumb { flex: none; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--accent-soft); }
/* Letterhead circulate member-picker */
.lhc-scoperow { display: flex; align-items: center; gap: 8px; margin: 2px 0; font-weight: 500; }
.lhc-memlist { max-height: 40vh; overflow: auto; margin: 6px 0; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.lhc-memrow { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
/* In-editor image CROP sub-sheet: the image + a draggable/resizable crop box with a dark mask outside it. */
.imgcrop-stage { position: relative; display: inline-block; max-width: 100%; margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.imgcrop-stage img { display: block; max-width: 100%; max-height: 58vh; }
.imgcrop-box { position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); box-sizing: border-box; cursor: move; touch-action: none; }
.imgcrop-h { position: absolute; width: 16px; height: 16px; background: #fff; border: 1.5px solid #555; border-radius: 3px; touch-action: none; }
.imgcrop-h.tl { left: -9px; top: -9px; cursor: nwse-resize; } .imgcrop-h.tr { right: -9px; top: -9px; cursor: nesw-resize; }
.imgcrop-h.bl { left: -9px; bottom: -9px; cursor: nesw-resize; } .imgcrop-h.br { right: -9px; bottom: -9px; cursor: nwse-resize; }
/* First-page (PDF) / first-frame (video) preview: a badge-styled placeholder until rendered, then the rendered
   image fills the slot. The play badge marks a video. object-position:top so a document's header/title shows. */
.npe-mediathumb { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center;
  font-size: 24px; background: var(--accent-soft); overflow: hidden; position: relative; }
.npe-mediathumb.has-media { background: #fff; }
.npe-mediaimg { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; border-radius: 10px; }
.npe-playbadge { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 20px; height: 20px;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; display: grid; place-items: center;
  padding-left: 2px; pointer-events: none; }
.npe-filemeta { display: flex; flex-direction: column; min-width: 0; }
.npe-filename { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-filesub { font-size: 12px; color: var(--muted); letter-spacing: .02em; }
/* COMPACTED file card (owner): collapse the preview to a small pill — icon + name only, still tap-to-open. The
   compact/remove buttons flow inline here (the pill is narrow, so no absolute-corner overlay) + stay visible. */
.npe-file-min { gap: 4px; }
.npe-filecard-min { flex: 0 1 auto; min-width: 0; gap: 7px; padding: 5px 11px; border-radius: 999px; }
.npe-filebadge-min { width: 24px; height: 24px; border-radius: 7px; font-size: 15px; }
.npe-filecard-min .npe-filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-file-min .npe-bcompact, .npe-file-min .npe-bdel { position: static; opacity: .75; width: 22px; height: 22px; flex: none; }
/* Universal LINK block (owner 2026-08-22): a live-status card for any app object. Paper-relative colours so it
   is legible on the always-white note page in both themes (like the table controls); status chips reuse the
   app's own .chip colour classes. */
.npe-link { display: flex; align-items: flex-start; gap: 6px; padding: 6px 0; }
.npe-linkcard { flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: 10px; text-decoration: none; color: var(--npe-ink); background: var(--npe-paper); border: 1px solid var(--npe-rule); border-radius: 12px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: border-color .14s, box-shadow .14s; }
.npe-linkcard[role="button"] { cursor: pointer; }
.npe-linkcard[role="button"]:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.npe-linkic { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 17px; background: color-mix(in srgb, var(--accent, #5b4fe6) 12%, var(--npe-paper)); }
.npe-linkbody { flex: 1 1 auto; min-width: 0; line-height: 1.34; }
.npe-linkcap { font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-linktitle { font-weight: 700; font-size: 14px; color: var(--npe-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-linksub { font-size: 12px; color: var(--npe-ctrl); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.npe-lk-chip { margin-top: 5px; }
.npe-linkopen, .npe-linkrefresh { flex: none; align-self: center; width: 30px; height: 30px; min-width: 30px; border: 1px solid var(--npe-rule); background: var(--npe-paper); color: var(--npe-ctrl); border-radius: 8px; font-size: 14px; line-height: 1; cursor: pointer; }
.npe-linkopen:hover, .npe-linkrefresh:hover { border-color: var(--accent); color: var(--accent); }
.npe-link .npe-bdel { position: static; opacity: .7; width: 26px; height: 26px; min-width: 26px; flex: none; align-self: center; }
.npe-link-unavail .npe-linkic { filter: grayscale(1); opacity: .65; }
.npe-link-unavail .npe-linktitle { color: var(--npe-ctrl); font-weight: 600; }
.npe-lk-skl { display: inline-block; width: 62%; height: 11px; border-radius: 5px; background: linear-gradient(90deg, var(--npe-rule), color-mix(in srgb, var(--npe-ctrl) 22%, var(--npe-paper)), var(--npe-rule)); background-size: 200% 100%; animation: npeLkSh 1.3s ease-in-out infinite; }
@keyframes npeLkSh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .npe-lk-skl { animation: none; } }
/* The "⧉ Link" picker sheet — normal (theme-token) surface, not the white page. */
.link-picker { display: flex; flex-direction: column; gap: 12px; }
.lp-types { display: flex; flex-wrap: wrap; gap: 8px; }
.lp-type { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; cursor: pointer; }
.lp-type.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.lp-type-ic { font-size: 15px; }
.lp-results { display: flex; flex-direction: column; gap: 6px; max-height: 44vh; overflow-y: auto; }
.lp-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font-size: 13.5px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.lp-row:hover { border-color: var(--accent); }
.lp-row-ic { flex: none; font-size: 15px; }
.lp-row-t { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-row-m { flex: none; font-size: 12px; color: var(--muted); }
.lp-caplbl { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
/* Attachment COUNT strip above the page (owner): quick overview + jump-to-file. Horizontally scrollable so
   many files never balloon the header; the inline cards on the page are unchanged. */
.npe-attstrip { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 6px 2px; margin-bottom: 8px; scrollbar-width: thin; }
.npe-attstrip::-webkit-scrollbar { height: 5px; } .npe-attstrip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.npe-attcount { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 800;
  color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 4px 10px; letter-spacing: .02em; }
.npe-attchip { flex: none; display: inline-flex; align-items: center; gap: 5px; max-width: 168px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px; transition: border-color .14s, box-shadow .14s, transform .1s; }
.npe-attchip:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.07); }
.npe-attchip:active { transform: scale(.96); }
.npe-attname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Many-attachment mode: per-type group chips + the "‹ back to all types" chip carry a touch more weight. */
.npe-attgroup, .npe-attback { font-weight: 700; }
.npe-attback { color: var(--accent-ink, var(--accent)); }
/* the block we jump to briefly flashes (reuses the Page-Map jump highlight) */
/* File attachment on the Page Map / Print */
.npe-spread .pp-file { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
.npe-spread .pp-file-ic { font-size: 18px; } .npe-spread .pp-file-nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .npe-spread .pp-file-sub { font-size: 11px; color: var(--muted); }
#npe-print .pp-file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #ccc; border-radius: 8px; padding: 6px 10px; margin: 6px 0; }
#npe-print .pp-file-ic { font-size: 18px; } #npe-print .pp-file-nm { font-weight: 600; } #npe-print .pp-file-sub { color: #666; font-size: 11px; }
/* Link cards on the Page Map / Print — inert (no live open); status is stamped "as of <date>" so a frozen PDF never masquerades as live. */
.npe-spread .pp-link, #npe-print .pp-link { display: flex; align-items: flex-start; gap: 8px; max-width: 100%; border: 1px solid var(--line, #ccc); border-radius: 8px; padding: 7px 10px; margin: 6px 0; }
.npe-spread .pp-link-ic, #npe-print .pp-link-ic { font-size: 17px; flex: none; }
.npe-spread .pp-link-b, #npe-print .pp-link-b { display: flex; flex-direction: column; min-width: 0; }
.npe-spread .pp-link-t, #npe-print .pp-link-t { font-weight: 700; font-size: 13px; }
.npe-spread .pp-link-cap, #npe-print .pp-link-cap { font-size: 11px; color: var(--muted, #666); }
.npe-spread .pp-link-s, #npe-print .pp-link-s { font-size: 11px; color: var(--muted, #666); }
#npe-print .pp-link { border-color: #ccc; } #npe-print .pp-link-cap, #npe-print .pp-link-s { color: #666; }
.npe-table { padding: 6px 0; }
.npe-table .npe-table-scroll { overflow-x: auto; }
.npe-table table { border-collapse: collapse; width: 100%; }
.npe-table td { border: 1px solid rgba(120,124,148,.45); padding: 7px 9px; min-width: 64px; font-size: 1em; color: var(--npe-ink); caret-color: var(--npe-ink); } /* font-size:1em (not 16px) so the per-block A±/scale on the wrapper cascades to cells (owner per-item resize); composes with the page scale */
.npe-table td:focus { outline: 2px solid var(--accent, #5b4fe6); outline-offset: -2px; }
.npe-table tr.npe-hdr td { background: color-mix(in srgb, var(--accent, #5b4fe6) 34%, var(--npe-paper)); font-weight: 700; }
.npe-table-acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
/* Collapsible table controls: a compact ⚙ toggle; the full control strip stays hidden until opened. */
.npe-table-toolsbar { display: flex; justify-content: flex-end; margin-top: 6px; }
.npe-tools-toggle { opacity: .8; }
.npe-tools-toggle.on { opacity: 1; }
/* Compact table controls — small icon buttons, minimal space. */
/* Table toolbar buttons sit ON the white paper, so they must be paper-relative in BOTH themes — they were
   background:var(--card) + color:var(--fg) (undefined), i.e. dark text on a dark card in dark mode = invisible (owner #7). */
.npe-tbtn { min-width: 34px; height: 32px; padding: 0 10px; border: 1px solid var(--npe-rule); border-radius: 8px;
  background: color-mix(in srgb, var(--npe-ink) 5%, var(--npe-paper)); color: var(--npe-ink); cursor: pointer; font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap; }
.npe-tbtn.on { background: var(--accent, #5b4fe6); border-color: var(--accent, #5b4fe6); color: #fff; }
.npe-tbtn.danger { color: #d11a2a; }
/* Freeze heading row / column: sticky within a scrollable table. */
.npe-table .npe-table-scroll { max-height: 52vh; overflow: auto; }
.npe-table td { background: var(--npe-paper); }
.npe-table tr.npe-hdr td { position: sticky; top: 0; z-index: 2; }
.npe-table td.npe-hdc { position: sticky; left: 0; z-index: 1; background: color-mix(in srgb, var(--accent, #5b4fe6) 22%, var(--npe-paper)); font-weight: 700; }
.npe-table tr.npe-hdr td.npe-hdc { z-index: 3; }
/* Σ auto-totals footer row: read-only, tinted, bold, right-aligned numbers, top border to detach it from data. */
.npe-table tr.npe-tfoot td { background: color-mix(in srgb, var(--accent, #5b4fe6) 16%, var(--npe-paper)); font-weight: 800;
  text-align: right; border-top: 2px solid color-mix(in srgb, var(--accent, #5b4fe6) 55%, var(--npe-paper)); font-variant-numeric: tabular-nums; }
.npe-table tr.npe-tfoot td.npe-tf-lbl { text-align: left; font-weight: 700; color: color-mix(in srgb, var(--accent, #5b4fe6) 80%, var(--npe-ink)); }
#npe-print .pp-table .pp-tf { background: #f2f1fb; font-weight: 700; text-align: right; border-top: 2px solid #b9b4e6; }
/* # row-number gutter: narrow, non-editable, muted, sticky on the left so it stays visible while scrolling wide tables. */
.npe-table td.npe-rownum { min-width: 30px; width: 30px; text-align: center; font-weight: 700; font-size: 13px;
  color: var(--muted); background: color-mix(in srgb, var(--accent, #5b4fe6) 10%, var(--npe-paper));
  position: sticky; left: 0; z-index: 1; caret-color: transparent; user-select: none; }
.npe-table td.npe-rownum-h { color: color-mix(in srgb, var(--accent, #5b4fe6) 75%, var(--npe-ink)); }
.npe-table tr.npe-hdr td.npe-rownum { z-index: 3; }
/* Sort/filter (#10): a strip under the table toolbar; hidden rows collapse; the active sort column reads solid. */
.npe-table tr.npe-row-hidden { display: none; }
.npe-table-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.npe-strip-lbl { font-size: 12px; font-weight: 700; color: var(--npe-ctrl); }
.npe-table-strip .npe-sortcol.on { background: var(--accent, #5b4fe6); border-color: var(--accent, #5b4fe6); color: #fff; }
.npe-filter-input { flex: 1 1 140px; min-width: 120px; height: 32px; padding: 0 10px; border: 1px solid var(--npe-rule); border-radius: 8px;
  background: var(--npe-paper); color: var(--npe-ink); font-size: 16px; } /* on the white paper, in both themes (was var(--fg), undefined) */
.npe-filter-input:focus { outline: none; border-color: var(--accent, #5b4fe6); }
/* Block drag handle (⠿) + drop indicator — reorder any item on the page. */
.npe-block { padding-left: 18px; }
.npe-grip { position: absolute; left: 0; top: 3px; width: 16px; color: var(--npe-ctrl); cursor: grab; opacity: 0;
  transition: opacity .12s; font-size: 14px; line-height: 1; user-select: none; touch-action: none; }
.npe-block:hover .npe-grip, .npe-block:focus-within .npe-grip { opacity: .55; }
/* Touch devices have no hover, so a file card's controls (compact / delete) — and the grip — would be invisible.
   On a coarse/no-hover pointer (this is a mobile-first app) surface them at a gentle opacity so they're reachable.
   Critical for the file COMPACT toggle: a file card's only focusable child is its <a download>, so :focus-within
   never fires by tapping it — without this the compact icon is undiscoverable on a phone. */
@media (hover: none), (pointer: coarse) {
  .npe-block .npe-grip, .npe-block .npe-bdel, .npe-block .npe-bcompact, .npe-block .npe-bscale { opacity: .5; }
}
.npe-grip:active { cursor: grabbing; }
.npe-block.npe-dragging { opacity: .45; }
.npe-block.npe-drop-before { box-shadow: 0 -3px 0 -1px var(--accent, #5b4fe6); }
.npe-block.npe-drop-after { box-shadow: 0 3px 0 -1px var(--accent, #5b4fe6); }
/* On-page pen overlay: draw ticks / annotations / a signature anywhere over the page. */
.npe-pagewrap { position: relative; }
.npe-overlay { position: absolute; left: 0; top: 0; z-index: 5; pointer-events: none; touch-action: none; }
.npe-pagewrap.pen .npe-overlay { pointer-events: auto; cursor: crosshair; }
.npe-pagewrap.pen .npe-page { user-select: none; }
.npe-penlbl { font-size: 13px; font-weight: 700; color: var(--accent, #5b4fe6); margin-right: 4px; }
.npe-swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.npe-swatch.on { border-color: var(--npe-ink); transform: scale(1.15); }
.npe-insert .neb-tool.on { background: color-mix(in srgb, var(--accent, #5b4fe6) 22%, transparent); border-color: var(--accent, #5b4fe6); }
/* Drag a block onto a page arrow to send it to that page. */
.npe-nav.npe-navhot { background: var(--accent, #5b4fe6); color: #fff; border-color: var(--accent, #5b4fe6); transform: scale(1.12); }

/* ───────── Sharpening pass (owner-approved preview 2026-08-12) ─────────
   Principles distilled from the reference (not copied): tight heading tracking, brand-tinted
   hairlines + lift-shadows, clear focus rings, chips with a self-coloured hairline. Brand
   colours, the logo lockup and every layout stay exactly as they were. */
.screen-title, .q-title, .profile-name { letter-spacing: -0.02em; }
/* Primary (filled) buttons get a crisp brand-tinted lift; ghost/small stay flat so dense lists
   don't turn noisy. */
.btn:not(.ghost):not(.danger-ghost):not(.small) { box-shadow: 0 3px 10px rgba(91, 79, 230, 0.22); }
/* A clear, consistent focus ring on every text control (sharpness + accessibility). */
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 79, 230, 0.18);
}
/* Soft chips gain a hairline of their OWN colour (currentColor) for definition — green chips get
   a green hairline, red get red — never a clashing violet border on semantic colours. */
.chip { border: 1px solid color-mix(in srgb, currentColor 16%, transparent); }

/* ───────── Demo welcome tour — attractive intro (owner 2026-08-12) ─────────
   A polished card: brand accent bar, a floating gradient icon badge, a step counter,
   a gradient progress bar, an always-present Skip (corner ✕ + button) and a gradient Next.
   Theme-token based so it looks right in dark mode too. */
.demotour-ov { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(12,13,20,.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.demotour-card { position: relative; background: var(--card); color: var(--ink); max-width: 344px; width: 100%;
  border-radius: 20px; padding: 30px 22px 22px; text-align: center; overflow: hidden;
  box-shadow: 0 24px 70px rgba(12,13,20,.55), 0 2px 8px rgba(91,79,230,.2);
  animation: demotourIn .32s cubic-bezier(.22,1,.36,1) both; }
.demotour-accent { position: absolute; top: 0; left: 0; right: 0; height: 5px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.demotour-x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: none; cursor: pointer;
  border-radius: 50%; background: var(--chip); color: var(--muted); font-size: 15px; line-height: 1; }
.demotour-x:active { transform: scale(.9); }
.demotour-badge { width: 76px; height: 76px; margin: 4px auto 4px; border-radius: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(91,79,230,.4); animation: demotourFloat 3s ease-in-out infinite; }
.demotour-badge span { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.demotour-step { font-size: 11px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--accent); margin: 10px 0 4px; }
.demotour-title { font-weight: 800; font-size: 19px; letter-spacing: -.02em; margin: 0 0 7px; }
.demotour-text { font-size: 14px; color: var(--muted); line-height: 1.55; }
.demotour-prog { height: 6px; border-radius: 999px; background: var(--chip); margin: 18px 4px 4px; overflow: hidden; }
.demotour-prog > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .35s cubic-bezier(.22,1,.36,1); }
.demotour-btns { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.demotour-skip { flex: 0 0 auto; border: 1.5px solid var(--line); background: none; color: var(--muted); cursor: pointer;
  font-weight: 700; font-size: 14px; padding: 10px 16px; border-radius: 12px; font-family: inherit; }
.demotour-skip:active { transform: scale(.96); }
.demotour-next { flex: 1 1 auto; border: none; cursor: pointer; color: #fff; font-weight: 800; font-size: 15px;
  padding: 11px 16px; border-radius: 12px; font-family: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 3px 12px rgba(91,79,230,.32); }
.demotour-next:active { transform: scale(.97); }
@keyframes demotourIn { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes demotourFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .demotour-card, .demotour-badge { animation: none; } }

/* Tapped-control busy state — universal instant feedback while an action round-trips to the server.
   Applied centrally by runAction() to the tapped [data-action] only if the op outlasts a short delay.
   Dim + un-tappable + progress cursor + a gentle pulse works on ANY control (buttons, role=button
   cards, chips) with zero layout risk — no overlay that could sit on top of an emoji/label. */
.is-busy { pointer-events: none; cursor: progress; opacity: .6; animation: isBusyPulse 1s ease-in-out infinite; }
@keyframes isBusyPulse { 0%, 100% { opacity: .6; } 50% { opacity: .34; } }
@media (prefers-reduced-motion: reduce) { .is-busy { animation: none; } }

/* Guided-tour auto-advance ("video-feel") progress bar — drains over the step's dwell time; the CSS
   animation restarts each step because renderTour rebuilds the tip. Duration is set inline per step. */
.tour-prog { height: 3px; border-radius: 3px; background: rgba(127,127,127,.22); overflow: hidden; margin: 0 0 9px; }
.tour-prog-fill { height: 100%; width: 100%; background: var(--accent, #5b4fe6); transform-origin: left center; animation-name: tourProg; animation-timing-function: linear; animation-fill-mode: forwards; }
@keyframes tourProg { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.tour-auto-btn { min-width: 34px; padding-left: 8px; padding-right: 8px; }
@media (prefers-reduced-motion: reduce) { .tour-prog { display: none; } }

/* Shelfito grid view (toggle) — files & folders as compact cards in a responsive grid (list is the default). */
.opito-list.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: start; }
.opito-list.shelf-grid .note-card { margin: 0; min-height: 74px; }
.opito-list.shelf-grid .nc-name { white-space: normal; overflow-wrap: anywhere; }
.opito-list.shelf-grid .empty { grid-column: 1 / -1; } /* the empty-folder message spans the whole grid row, not one narrow track */

/* Smart searchable + fuzzy dropdown (turns a text field into a searchable list, typed value always valid). */
.smartsel { position: relative; }
.smartsel-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; background: var(--card, #fff); border: 1px solid var(--line, #d7d9e0); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 5px; max-height: 260px; overflow: auto; }
.smartsel-opt { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink, #1a1a2e); font: 500 14.5px system-ui, sans-serif; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.smartsel-opt:hover, .smartsel-opt:focus-visible { background: var(--accent-soft, #eef0ff); }
.smartsel-opt .ss-e { font-size: 18px; flex: none; width: 22px; text-align: center; }
.smartsel-use { color: var(--accent, #7c3aed); font-weight: 600; border-top: 1px solid var(--line, #eee); border-radius: 0 0 8px 8px; margin-top: 2px; }

/* Read-only TWO-PAGE SPREAD (screen) — reuses the export .pp-* markup. Two-up on wide screens; a phone
   stacks one-per-row (mobile-first). Theme-aware via tokens. Does not affect the print (#npe-print) rules. */
.npe-spread { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.npe-spread .pp-page { position: relative; background: var(--card, #fff); color: var(--ink, #1c2033); border: 1px solid var(--line, #e4e7f0); border-radius: 10px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); aspect-ratio: 210 / 297; overflow: auto; }
.npe-spread .pp-text { white-space: pre-wrap; font: 14px/1.55 system-ui, sans-serif; margin: 3px 0; }
/* Heading sizes in the Page Map + Print preview (match the editor's Aa/H1/H2), so the preview is faithful. */
.pp-h1 { font-size: 1.5em; font-weight: 700; margin: 6px 0 4px; }
.pp-h2 { font-size: 1.2em; font-weight: 700; margin: 5px 0 3px; }
/* Paper style + orientation on Page Map / Print pages, matching the editor's page (faithful preview). */
.npe-spread .pp-page.paper-ruled { background-image: repeating-linear-gradient(to bottom, transparent 27px, var(--pl) 27px, var(--pl) 28px); }
.npe-spread .pp-page.paper-grid { background-image: repeating-linear-gradient(to bottom, transparent 27px, var(--pl) 27px, var(--pl) 28px), repeating-linear-gradient(to right, transparent 27px, var(--pl) 27px, var(--pl) 28px); }
.npe-spread .pp-page.pp-land { aspect-ratio: 297 / 210; }
.npe-spread .pp-img { max-width: 100%; display: block; margin: 6px 0; border-radius: 6px; }
.npe-spread .pp-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.npe-spread .pp-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.npe-spread .pp-table td { border: 1px solid var(--line, #ccc); padding: 4px 7px; font: 13px system-ui, sans-serif; }
.npe-spread .pp-table .pp-hd { background: rgba(127,127,127,.12); font-weight: 700; }
.npe-spread .pp-table .pp-tf { background: rgba(124,58,237,.10); font-weight: 700; text-align: right; }
@media (max-width: 640px) { .npe-spread { grid-template-columns: 1fr; } }
/* Page Map: pages (and blocks) are tappable to jump into the editor there. Signal it + give feedback. */
.npe-spread.npe-map .pp-page { cursor: pointer; transition: box-shadow .14s ease, transform .14s ease, border-color .14s ease; }
.npe-spread.npe-map .pp-page:hover { border-color: var(--accent, #7c3aed); box-shadow: 0 4px 14px rgba(124,58,237,.18); }
.npe-spread.npe-map .pp-page:active { transform: scale(.995); }
.npe-spread.npe-map .pp-text, .npe-spread.npe-map .pp-img, .npe-spread.npe-map .pp-table { cursor: pointer; }
.npe-spread.npe-map .pp-text:hover { background: rgba(124,58,237,.06); border-radius: 4px; }
/* Page-number badge on each Page Map page. */
.npe-spread.npe-map .pp-page { position: relative; padding-top: 26px; }
.npe-spread.npe-map .pp-pnum { position: absolute; top: 6px; left: 8px; font: 700 11px system-ui, sans-serif; color: var(--muted, #6b7280); background: rgba(127,127,127,.10); border-radius: 999px; padding: 1px 8px; letter-spacing: .02em; }
/* The page the map was opened from (and the one scrolled into view). */
.npe-spread.npe-map .pp-page.pp-current { border-color: var(--accent, #7c3aed); box-shadow: 0 0 0 2px rgba(124,58,237,.25); }
/* Brief highlight on the block the user tapped, once the editor reopens on that page. */
@keyframes npeMapFlash { 0% { background: rgba(124,58,237,.22); } 100% { background: transparent; } }
.npe-mapflash { animation: npeMapFlash 1s ease-out; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .npe-mapflash { animation: none; } .npe-spread.npe-map .pp-page { transition: none; } }
