/* ═══════════════════════════════════════════════════════
   @file theme.css
   @description AIMEAT Unified Theme — single source of truth for all portal
     CSS variables (tokens), base styles, animations, and shared components.
     Defines the light theme in :root, a dark override in [data-theme="dark"],
     and a drift-alias layer so undefined-but-referenced vars resolve.
   @structure :root tokens, drift aliases, [data-theme="dark"] override,
     base/reset, animations, topnav, buttons, cards, badges, inputs, modal,
     toast, alert.
   @usage Loaded first in spa.html <head>; the theme is toggled by /js/theme.js
     which flips the data-theme attribute on <html>.
   @version-history
     v1.19.0 — 2026-06-10 — Controls get their own surface: new --control-bg/--control-border tokens
       (light: white + gray-300; dark: raised #262934 + #4A4E5A). .btn-outline/.btn-ghost drop
       background:transparent (they melted into the page as "framed text") and .input-field drops
       background:var(--bg) (fields were LITERALLY the page color) — all three now use the control
       tokens, buttons additionally get --shadow-sm so they read as pressable.
     v1.18.0 — 2026-06-02 — Component unification (#10 third toast pathway): tokenize the shared .toast color literals. Added a theme-invariant --toast-success-bg (green-500 #22C55E @ .95, the legacy toast green — deliberately NOT --success emerald, which would shift the hue), --toast-danger-bg (= --danger #EF4444 @ .95) and --toast-fg (white), same rationale as the badge palette. The base .toast and the .toast.error/.toast-error/.toast-success modifiers now reference these tokens instead of raw rgba()/#fff. Appearance-preserving: identical resolved values; solid saturated pills intentionally do not flip in dark mode. profile.js keeps its own showToast pathway (distinct .pf.toast-container wrapper + .toast.error markup) — left as a convergence candidate, NOT migrated, to avoid changing DOM/behavior.
     v1.17.0 — 2026-06-02 — Component unification (#26 recipient badge): add a theme-invariant --badge-*-bg palette (wildcard→danger, ghii→purple, organism→success, gaii→blue; domain #F97316 / node #6B7280 kept as own invariant swatches as they have no palette match) + --badge-fg white, so the profile .badge-* recipient classifier can drop its hardcoded hex (#8b5cf6/#f97316/#6b7280/#3b82f6) and dead light-only fallbacks (var(--success,#22c55e)/var(--danger,#ef4444)). Appearance-preserving: values resolve identically and these solid swatches intentionally do not flip in dark mode.
     v1.16.0 — 2026-06-02 — Component unification (#25 pill base): add a canonical token-only .pill shape primitive (inline-flex chip, --radius-full, compact padding, small bold text, pointer + opacity hover) — shape only, no colors; tints come from caller classes. Mirrors the shape the profile .vis-pill already used. The scoped .pf .vis-pill keeps its own shape declaration (the (0,2,0)-beats-bare-.pill specificity trap) but its radius was retokenized to the same --radius-full so the two stay in lockstep.
     v1.15.0 — 2026-06-02 — Component unification (#23 collapsible): add canonical .collapsible / .collapsible-header / .collapsible-chevron (chevron rotates 180° via .open) / .collapsible-body block, backing /components/Collapsible.js. All colors are theme tokens so it flips in dark mode. Establishes the canonical expand/collapse section for the hand-rolled toggles (.expand-btn + .pf-chevron, .scope-advanced-toggle, .pkv-entry-arrow); those bespoke toggles are left in place where their expanded markup is wired into view state.
     v1.14.0 — 2026-06-02 — Component unification (#24 search bar): add canonical .search-bar (flex row, gap, flex:1) + .search-bar-input (flex:1) shell, backing /components/SearchBar.js. The input reuses .input-field for all visuals, so the shell only owns layout. Consolidates the hand-rolled search inputs (.pkv-search / .cap-search-input / .pf-agd-search-input) and the profile .search-bar + .input-field combo; the profile-scoped .pf .search-bar (max-width) coexists.
     v1.13.0 — 2026-06-02 — Component unification (#21 key/value rows): add canonical .kv-row / .kv-label / .kv-value (flex space-between, muted label, emphasized value, --border-subtle divider, last-child no border; .kv-value.mono for monospace ids/amounts), backing /components/KeyValueRow.js. Extracted as the common look of the admin .adm-erow/.adm-hrow and profile .pf-agd-info-row families. Existing per-view classes left in place where their look differs.
     v1.12.0 — 2026-06-02 — Component unification (#13 tables): add canonical .data-table block (full-width collapsed table, uppercase muted header divided by --border, cells by --border-subtle, --bg-surface hover, .mono cell) + generic .scrollable wrapper, backing /components/DataTable.js. Extracted as the common look of .adm table + .pf .consent-table so both converge on tokens that flip in dark mode.
     v1.11.0 — 2026-06-02 — Component unification (#16 tags): add --accent-border token (translucent accent hairline, light rgba(232,86,74,0.2) / dark rgba(255,111,98,0.30)) so tag/badge clones (mk-tag, hb-tag) can replace their hardcoded rgba(232,86,74,0.2) borders and flip in dark mode.
     v1.10.0 — 2026-06-02 — Component unification (#17 pagination): add canonical .pagination (prev / "Page X / Y" / next, token-based) + .pagination-info + .load-more (centered load-more wrapper), backing /components/Pagination.js. Consolidates the .adm-mem-pagination shape and the centered load-more wrapper. The numbered .hb-pagination variant is intentionally left in place (different UI).
     v1.9.0 — 2026-06-02 — Component unification (#18 category cards): add canonical .category-card / -icon / -name / -count (token-based, anchor- and div-safe) so the marketplace .mk-category-* and hobbies .hb-category-* clones converge. Tokenized the formerly hardcoded hover colors (#E8564A → var(--accent); 0 2px 8px rgba(0,0,0,0.06) → var(--shadow-md)) — dark-mode fix. Per-view *-categories-grid wrappers kept (column density differs).
     v1.8.0 — 2026-06-02 — Component unification (#11 status dots): add canonical .status-dot base + semantic token modifiers (online/active/healthy/live → success; warn/degraded/syncing/pending → warn; error/offline/dead/down → danger; idle/inactive/detached/muted → text-muted), backing /components/StatusDot.js, so per-view dots (.peer-dot/.pn-status-dot/.ext-status-dot/.dv-dot/.live-dot) converge. Tokenized away hardcoded hex in the former .ext-status-dot (#4ade80/#9ca3af) so dots flip in dark mode.
     v1.7.0 — 2026-06-02 — Component unification (#15 headers): add canonical .section-title/.section-desc (in-page accent header, lifted generic from .pf) + .page-title/.page-subtitle (top-of-view gradient header), all token-based, so per-view title/subtitle clones (mk-/hb-/cl-welcome-/adm-page-title) can converge.
     v1.6.0 — 2026-06-02 — Component unification (#22): add .card-glass modifier (Card variant="glass") reproducing the former profile .pf-glass-card appearance, fully tokenized (--surface / --border), so profile's GlassCard folds into the canonical Card.
     v1.5.0 — 2026-06-02 — Component unification (#6 stat cards): add canonical .stat-card-value tone (.accent/.success/.danger) + .mono modifiers and a .stat-grid wrapper, so per-view stat clones (mk-stat/hb-stat/dv-stat/wl-stat/...) converge onto .stat-card without losing accent-tint / earned-spent / monospace semantics.
     v1.4.0 — 2026-06-02 — Component unification (#5 inputs): add canonical textarea.input-field (resize/min-height) + select.input-field (cursor) so .input-field works on all field types and views can drop per-view form-input/textarea/select clones (mk-form/hb-form/...).
     v1.3.0 — 2026-06-02 — Component unification (#4): make canonical .btn-* anchor-safe (text-decoration:none) so views can drop their per-view <a>-button clones (mk-btn/hb-btn/...) and use the canonical classes.
     v1.2.0 — 2026-06-02 — Tokenize shell component literals (semantic tints, scrollbar, overlay scrim, morsel pill, lang-btn active, input focus) so the whole shell flips for dark mode.
     v1.1.0 — 2026-06-02 — Add dark theme override + drift-alias layer + .theme-toggle-btn.
     v1.0.0 — prior — Light theme tokens, base styles, shared components.
   ═══════════════════════════════════════════════════════ */

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Root Variables ── */
:root {
  /* Background */
  --bg: #FAFAF8;
  --bg-surface: #F3F4F6;
  --bg-card: #FFFFFF;
  --bg-elevated: #FFFFFF;

  /* Cards & Surfaces */
  --card-bg: #FFFFFF;
  --card-bg-hover: #FFFFFF;
  --card-bg-solid: #FFFFFF;
  --card-bg-alt: #F3F4F6;
  --card-border: #E5E7EB;

  /* Accent (coral heart) */
  --accent: #E8564A;
  --accent-bright: #FF6B6B;
  --accent-deep: #E8564A;
  --accent-glow: rgba(232, 86, 74, 0.3);
  --accent-subtle: rgba(232, 86, 74, 0.06);
  --accent-border: rgba(232, 86, 74, 0.2);   /* translucent accent hairline for tag/badge edges */

  /* Love palette (profile gradients — now coral-based) */
  --love1: #E8564A;
  --love2: #FF6B6B;
  --love3: #FF8A80;
  --love4: #FF6B6B;
  --love5: #E8564A;

  /* Text */
  --text: #1A1A2E;
  --text-bright: #1A1A2E;
  --text-dim: #6B7280;
  --text-muted: #9CA3AF;

  /* Semantic colors */
  --success: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;
  --purple: #8B5CF6;

  /* Accent palette */
  --blue: #3B82F6;
  --mint: #34D399;
  --teal: #06B6D4;
  --pink: #F472B6;
  --orange: #FB923C;
  --yellow: #FBBF24;

  /* Recipient badge palette (profile permission-recipient classifier:
     wildcard/ghii/organism/domain/node/gaii). Theme-INVARIANT on purpose —
     these are saturated solid swatches carrying white text in both themes, so
     they are defined only here and NOT re-overridden in [data-theme="dark"].
     Four map onto existing palette tokens (identical values); domain/node have
     no palette match and are kept as their own invariant swatches rather than
     borrowed from --orange/--text-dim (which differ / flip in dark). */
  --badge-wildcard-bg: var(--danger);   /* #EF4444 */
  --badge-ghii-bg:     var(--purple);   /* #8B5CF6 */
  --badge-organism-bg: var(--success);  /* #10B981 */
  --badge-domain-bg:   #F97316;         /* no palette match (≠ --orange #FB923C) */
  --badge-node-bg:     #6B7280;         /* invariant gray (≠ --text-dim, which flips dark) */
  --badge-gaii-bg:     var(--blue);     /* #3B82F6 */
  --badge-fg:          #FFFFFF;          /* white text on every saturated swatch */

  /* Toast palette (floating notification pill). Theme-INVARIANT on purpose,
     same rationale as the badge palette above: saturated solid fills carrying
     white text read correctly on any background in both themes, so they are
     defined only here and NOT re-overridden in [data-theme="dark"].
     NOTE: --toast-success-bg is green-500 (#22C55E), the legacy toast green —
     it is deliberately NOT --success (emerald #10B981); swapping would shift
     the hue. --toast-danger-bg equals --danger at the legacy 0.95 alpha. */
  --toast-success-bg: rgba(34, 197, 94, 0.95);
  --toast-danger-bg:  rgba(239, 68, 68, 0.95);  /* = --danger #EF4444 @ .95 */
  --toast-fg:         #FFFFFF;

  /* Borders */
  --border: #E5E7EB;
  --border-subtle: #F3F4F6;
  --border-focus: #E8564A;

  /* Radii */
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Layout */
  --nav-height: 56px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
  --shadow-heart: 0 4px 14px rgba(232,86,74,0.3);

  /* Input */
  --bg-input: var(--bg);
  --bg-input-focus: #FFFFFF;

  /* Controls (outline/ghost buttons, input fields) — a surface DISTINCT from both the page bg and
     white cards: white fill + a clearly visible border, so controls read as controls instead of
     "framed text" that melts into the background. */
  --control-bg: #FFFFFF;
  --control-border: #D1D5DB;

  /* Code */
  --code-bg: #F3F4F6;

  /* Semantic tints (chip/banner backgrounds + readable text/border on them).
     The accent semantic colors (--success/--warn/--danger/--info) keep their
     meaning across themes; only these tint surfaces flip. */
  --success-bg: #D1FAE5; --success-fg: #047857; --success-border: #A7F3D0;
  --warn-bg: #FEF3C7;    --warn-fg: #B45309;    --warn-border: #FDE68A;
  --danger-bg: #FEE2E2;  --danger-fg: #DC2626;  --danger-border: #FECACA;
  --info-bg: #EFF6FF;    --info-fg: #1D4ED8;    --info-border: #BFDBFE;
  --purple-bg: #F5F3FF;  --purple-fg: #6D28D9;  --purple-border: #DDD6FE;

  /* Shell surfaces */
  --scrollbar-thumb: #D1D5DB;
  --overlay-scrim: rgba(26, 26, 46, 0.4);
  --morsel-bg: linear-gradient(135deg, #FFF1F0, #FFE0DE);

  /* Decorative view gradients (theme-aware) */
  --pf-hero-gradient: linear-gradient(135deg, #FAFAF8 0%, #FFF1F0 40%, #EFF6FF 100%);
  --pf-cta-gradient: linear-gradient(135deg, #FFF1F0, #EFF6FF);
  --pf-callout-gradient: linear-gradient(135deg, #EEF0FF, #F8F0FF);

  /* ── Drift-alias layer ──
     Variables referenced across view CSS but never defined (rendered with no
     fallback = broken). Defined here as aliases of the canonical tokens above,
     so they (a) work now and (b) inherit the dark override automatically — no
     entry needed in [data-theme="dark"]. The --sp-* scale is theme-invariant. */
  --card: var(--bg-card);
  --surface: var(--bg-surface);
  --bg-dim: var(--bg-surface);
  --bg-hover: var(--card-bg-hover);
  --muted: var(--text-dim);
  --error: var(--danger);
  --warning: var(--warn);
  --primary: var(--accent);
  --accent-faint: var(--accent-subtle);
  --accent-soft: var(--accent-subtle);   /* highlight/hover surfaces (was #FFF0EE) */
  --accent-dark: var(--accent-deep);      /* darker coral for button gradients/hovers */
  --border-soft: var(--border);           /* was #f0f0ec */
  --bg2: var(--bg-surface);               /* secondary panel bg (was #f5f5f5) */
  --surface-hover: var(--bg-surface);     /* hover surface (had a stale dark #252540 fallback) */
  --on-inverted: var(--bg); /* readable text on a var(--text) background — inverts opposite to --text */
  --mono: var(--font-mono);
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
}

/* ── Dark Theme Override ──
   Redefines only the color/depth variables that must flip for dark mode.
   Brand identity (coral accent) preserved; accents brightened for dark
   contrast. Text tiers verified WCAG-AA on both --bg and --bg-card.
   Aliases above point at these tokens, so they invert automatically. */
[data-theme="dark"] {
  /* Background */
  --bg: #14151A;
  --bg-surface: #23262F;
  --bg-card: #1C1E26;
  --bg-elevated: #23262F;

  /* Cards & Surfaces */
  --card-bg: #1C1E26;
  --card-bg-hover: #23262F;
  --card-bg-solid: #1C1E26;
  --card-bg-alt: #23262F;
  --card-border: #33363F;

  /* Accent (coral heart — brightened for dark contrast, brand stays coral) */
  --accent: #FF6F62;
  --accent-bright: #FF7A6E;
  --accent-deep: #E8564A;
  --accent-glow: rgba(255, 111, 98, 0.35);
  --accent-subtle: rgba(255, 111, 98, 0.10);
  --accent-border: rgba(255, 111, 98, 0.30);   /* translucent accent hairline for tag/badge edges */

  /* Text */
  --text: #EDEEF2;
  --text-bright: #FFFFFF;
  --text-dim: #A4A9B6;
  --text-muted: #868C9B;

  /* Borders */
  --border: #33363F;
  --border-subtle: #26282F;
  --border-focus: #FF6F62;

  /* Shadows (deeper/more opaque so elevation reads on dark surfaces) */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.50);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.55);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.65);
  --shadow-heart: 0 4px 14px rgba(255,111,98,0.40);

  /* Input */
  --bg-input: #1C1E26;
  --bg-input-focus: #23262F;

  /* Controls — slightly lighter than the card surface so they read as raised, with a visible border */
  --control-bg: #262934;
  --control-border: #4A4E5A;

  /* Code */
  --code-bg: #0E0F13;

  /* Semantic tints (translucent so they read as native dark surfaces) */
  --success-bg: rgba(16, 185, 129, 0.16); --success-fg: #6EE7B7; --success-border: rgba(16, 185, 129, 0.32);
  --warn-bg: rgba(245, 158, 11, 0.16);    --warn-fg: #FCD34D;    --warn-border: rgba(245, 158, 11, 0.32);
  --danger-bg: rgba(239, 68, 68, 0.16);   --danger-fg: #FCA5A5;  --danger-border: rgba(239, 68, 68, 0.34);
  --info-bg: rgba(59, 130, 246, 0.16);    --info-fg: #93C5FD;    --info-border: rgba(59, 130, 246, 0.32);
  --purple-bg: rgba(139, 92, 246, 0.18);  --purple-fg: #C4B5FD;  --purple-border: rgba(139, 92, 246, 0.34);

  /* Shell surfaces */
  --scrollbar-thumb: #3A3D47;
  --overlay-scrim: rgba(0, 0, 0, 0.6);
  --morsel-bg: rgba(255, 111, 98, 0.16);

  /* Decorative view gradients — subtle dark tints matching the light intent */
  --pf-hero-gradient: linear-gradient(135deg, #16151A 0%, #201820 45%, #15191F 100%);
  --pf-cta-gradient: linear-gradient(135deg, #231A1E, #1A1F28);
  --pf-callout-gradient: linear-gradient(135deg, #1C1A29, #221A29);
}

/* ── Base ── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Animations ── */
@keyframes heartPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

@keyframes twinkle {
  0%, 100% { opacity: 0.05; transform: scale(0.8); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes livePulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
  50% { opacity: 0.4; box-shadow: 0 0 18px rgba(34, 197, 94, 0.9); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes btnGlow {
  0%, 100% { box-shadow: 0 4px 12px rgba(232, 86, 74, 0.3); }
  50% { box-shadow: 0 6px 20px rgba(232, 86, 74, 0.4); }
}

@keyframes expandGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(232, 86, 74, 0.08); }
  50% { box-shadow: 0 0 24px rgba(232, 86, 74, 0.15); }
}

@keyframes worldOpen {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pageIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nebulaDrift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.15); }
}

@keyframes auroraShift {
  0% { transform: translateX(-20%) scaleY(1); }
  100% { transform: translateX(-10%) scaleY(0.8); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Background layers ── */
.bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  background: var(--bg);
}

.bg-canvas .star { display: none; }

/* Aurora waves — hidden in light theme */
.bg-aurora { display: none; }
.aurora-wave { display: none; }

/* ── App root — must sit above bg-canvas (z-index:0) so all non-positioned
   descendants form a stacking context that paints over the fixed background ── */
#app {
  position: relative;
  z-index: 1;
}

/* ── Top Navigation ── */
.topnav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.topnav-brand {
  font-weight: 800;
  font-size: 1.125rem;
  color: var(--text);
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
}

.topnav-brand .brand-name { white-space: nowrap; }

.brand-morsels {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--accent-glow);
  background: var(--morsel-bg);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
}

.brand-morsels::before { content: '\2665 '; color: var(--accent); }

.topnav-brand .heart {
  color: var(--accent);
  font-style: normal;
  margin: 0 1px;
  font-size: 1rem;
  animation: none;
  filter: none;
}
.topnav-brand .brand-at {
  color: var(--accent);
}

.topnav-center {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
  padding: 0;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Header notification bell + dropdown */
.notif-bell { position: relative; display: inline-flex; }
.notif-bell-btn { position: relative; background: none; border: none; cursor: pointer; font-size: 1.15rem; line-height: 1; padding: 4px 6px; border-radius: 8px; }
.notif-bell-btn:hover { background: var(--bg-dim); }
.notif-badge { position: absolute; top: -1px; right: -1px; background: var(--accent); color: #fff; border-radius: 10px; font-size: 0.6rem; font-weight: 700; min-width: 15px; height: 15px; padding: 0 3px; display: flex; align-items: center; justify-content: center; }
.notif-dropdown { position: absolute; right: 0; top: calc(100% + 6px); width: 320px; max-height: 60vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); z-index: 1200; }
.notif-dropdown-head { font-weight: 700; font-size: 0.9rem; color: var(--text); padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0; background: var(--card); }
.notif-empty { padding: 1rem 0.85rem; color: var(--muted); font-size: 0.85rem; }
.notif-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border-subtle); padding: 0.55rem 0.85rem; cursor: pointer; }
.notif-item:hover { background: var(--bg-dim); }
.notif-item.unread { background: var(--accent-subtle); }
.notif-item-title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.notif-item-body { font-size: 0.78rem; color: var(--muted); margin-top: 0.15rem; }
.notif-item-time { font-size: 0.7rem; color: var(--muted); margin-top: 0.2rem; }

.topnav-right a {
  font-size: 0.84rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  transition: all 0.15s;
  font-weight: 500;
  border: none;
}

.topnav-right a:hover {
  color: var(--text);
  background: var(--bg-surface);
}

.topnav-right a.active {
  color: var(--accent);
  background: var(--accent-subtle);
}

.topnav-right .profile-link {
  display: none;
  color: var(--accent);
  background: var(--accent-subtle);
}

.topnav-right .profile-link.visible { display: inline-flex; }

.header-auth-slot {
  display: inline-flex;
  align-items: center;
}

/* ── Header nav: desktop inline; mobile = hamburger + dropdown (see @media) ── */
.topnav-menu { display: flex; align-items: center; gap: 0.75rem; }
.topnav-burger { display: none; }
/* Truncate a long GHII in the gold pill so it never blows out the bar (desktop). */
.aimeat-auth-ghii { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Collapse the header to a hamburger well before the full inline nav (links +
   theme/lang + gold pill, wider still for operators with the Admin link) runs
   out of room — otherwise the pill overflows in the ~900–1180px band. */
@media (max-width: 1180px) {
  .topnav { padding: 0 0.5rem; }
  .topnav-right { gap: 0.5rem; }
  /* Free up bar width so the gold pill never overflows — the morsel count is
     still shown in the profile dashboard. */
  .brand-morsels { display: none !important; }
  .topnav-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 34px; padding: 0; font-size: 1.2rem; line-height: 1;
    background: none; color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-xs); cursor: pointer;
  }
  .topnav-menu {
    display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg-card); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0,0,0,.18)); padding: 0.4rem;
  }
  .topnav-menu.open { display: flex; }
  .topnav-menu a { width: 100%; padding: 0.7rem 0.9rem; font-size: 0.95rem; border-radius: var(--radius-xs); }
  .topnav-menu .topnav-center { width: fit-content; margin: 0.45rem 0.6rem 0.2rem; }
  /* Compact gold pill: keep the green dot + Logout, drop the wordy label + GHII. */
  .aimeat-auth-pill .aimeat-auth-label,
  .aimeat-auth-pill .aimeat-auth-ghii { display: none !important; }
  .aimeat-auth-pill { padding: 5px 11px !important; gap: 6px !important; }
}

/* ── Language Buttons ── */
.lang-btn {
  padding: 4px 10px;
  border-radius: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  transition: all 0.15s;
  cursor: pointer;
  background: transparent;
  border: none;
  font-family: var(--font);
}

.lang-btn.active {
  background: var(--text);
  color: var(--on-inverted);
  box-shadow: none;
}

.lang-btn:not(.active):hover {
  color: var(--text);
  background: var(--bg-surface);
}

/* ── Theme Toggle ── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  padding: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}

.theme-toggle-btn:hover {
  color: var(--accent);
  background: var(--bg-surface);
}

/* ── Buttons ── */
/* Button classes are anchor-safe: applied to <a> they render as buttons,
   not underlined links (lets views use canonical .btn-* on link-buttons). */
.btn-primary, .btn-outline, .btn-ghost, .btn-danger, .btn-danger-solid,
.btn-success, .btn-info {
  text-decoration: none;
}
.btn-primary {
  padding: 8px 20px;
  background: linear-gradient(135deg, #E8564A 0%, #FF6B6B 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-heart);
  letter-spacing: 0;
  animation: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(232, 86, 74, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.success {
  background: linear-gradient(135deg, #10B981, #059669);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  animation: none;
}

.btn-outline {
  padding: 0.65rem 1.5rem;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0;
  box-shadow: var(--shadow-sm);
  animation: none;
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--control-bg);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  border-radius: var(--radius-xs);
}

.btn-success {
  padding: 0.65rem 1.5rem;
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

.btn-info {
  padding: 0.65rem 1.5rem;
  background: #3B82F6;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}
.btn-info:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border: 1px solid var(--danger-border);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.81rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: var(--control-bg);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-solid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* Glass variant (Card variant="glass") — reproduces the former profile
   .pf-glass-card appearance, fully tokenized. Overrides .card defaults
   (2rem padding, var(--radius), shadow) with the glass card's flatter geometry. */
.card-glass {
  padding: 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  box-shadow: none;
}
/* Glass card is flat — neutralize the generic .card:hover lift so it looks
   identical to the former static .pf-glass-card. */
.card-glass:hover {
  box-shadow: none;
  transform: none;
}

/* ── Content Group Container ── */
.content-group {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 3rem auto 0;
  padding: 2rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

.content-group > *:first-child { margin-top: 0; }
.content-group > *:last-child { margin-bottom: 0; }

/* ── Stat Cards ── */
.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.stat-card-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.stat-card-value {
  font-size: 1.35rem;
  color: var(--text);
  font-weight: 800;
  margin-top: 0.15rem;
}
/* Value tone + mono modifiers — let accent-tinted / earned-spent / monospace stat
   clones converge onto canonical .stat-card-value without losing their semantics. */
.stat-card-value.accent  { color: var(--accent); }
.stat-card-value.success { color: var(--success-fg); }
.stat-card-value.danger  { color: var(--danger-fg); }
.stat-card-value.mono    { font-family: var(--font-mono, monospace); }
/* Shared responsive stat grid wrapper. */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 32px; }

/* ── Category Card ── */
/* Canonical clickable directory tile (icon + name + optional count) shared by the
   marketplace category grid and the hobbies interest grid. Works on both <a> and
   <div> (text-decoration:none keeps anchors un-underlined). The grid wrapper stays
   per-view because column density differs (marketplace 160px / hobbies 200px min). */
.category-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-align: center; text-decoration: none;
  transition: all 0.2s; cursor: pointer;
}
.category-card:hover { background: var(--bg-surface); border-color: var(--accent); box-shadow: var(--shadow-md); }
.category-icon { font-size: 2rem; margin-bottom: 8px; }
.category-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.category-count { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }

/* ── Pill (canonical shape primitive) ──
   The common pill-chip *shape* only — no colors. Small inline-flex chip with
   pill radius, compact padding, small bold text, pointer cursor and a soft
   opacity hover. Colors are supplied by the caller's own tint classes (e.g.
   .vis-public / .vis-private) so this base stays theme-neutral. Matches the
   shape the profile visibility pill (.vis-pill) already used. New pill-shaped
   chips should build on this base + a tint class instead of re-declaring the
   shape. Note: the profile pills are styled via the higher-specificity
   `.pf .vis-pill`, which keeps its own shape declaration to avoid the
   scoped-override specificity trap; it now references the same --radius-full
   token so the two stay in lockstep. */
.pill {
  display: inline-flex;
  align-items: center;
  border: none;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  transition: opacity 0.15s;
}
.pill:hover { opacity: 0.8; }

/* ── Segmented control (canonical) ──
   A row of buttons in a bordered pill; the active segment is filled with the accent. Token-only so
   it flips in dark mode. The start of the deferred #8 tab-family consolidation — use this for new
   in-place view toggles (Draft/Published, picker tabs, scope toggles) instead of a per-view clone. */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg-btn { padding: 0.25rem 0.7rem; font-size: 0.8rem; line-height: 1.3; background: transparent; color: var(--text-dim); border: none; cursor: pointer; transition: background 0.15s, color 0.15s; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover:not(:disabled) { background: var(--bg-surface); }
.seg-btn.active { background: var(--accent); color: #fff; }
.seg-btn:disabled { opacity: 0.6; cursor: default; }

/* ── Status dot (canonical) ──
   Small circle whose color is driven by a semantic status token. Consolidates
   the bespoke per-view dots (.live-dot, .peer-dot, .pn-status-dot,
   .ext-status-dot, .dv-dot). Component: /components/StatusDot.js.
   All colors are theme tokens so the dot flips correctly in dark mode. */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}
.status-dot--online,
.status-dot--active,
.status-dot--healthy,
.status-dot--alive,
.status-dot--live { background: var(--success); }
.status-dot--warn,
.status-dot--degraded,
.status-dot--syncing,
.status-dot--pending { background: var(--warn); }
.status-dot--error,
.status-dot--offline,
.status-dot--dead,
.status-dot--down { background: var(--danger); }
.status-dot--idle,
.status-dot--inactive,
.status-dot--detached,
.status-dot--muted { background: var(--text-muted); }
/* Online keeps the soft glow the former .pn-status-dot.online had */
.status-dot--online { box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
/* Live additionally pulses (matches former .live-dot behaviour) */
.status-dot--live {
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  animation: livePulse 1.5s ease-in-out infinite;
}

/* ── Key/value detail row (canonical) ──
   Backed by /components/KeyValueRow.js. A label/value pair laid out flex
   space-between: muted label on the left, emphasized value on the right,
   separated by a subtle bottom border (none on the last row). Consolidates the
   common label+value-pair shape (admin .adm-erow / .adm-hrow, profile
   .pf-agd-info-row). All colors are theme tokens so it flips correctly in dark
   mode. `.kv-value.mono` renders the value in the monospace font (ids, hashes,
   amounts). The existing per-view classes are intentionally left in place where
   their look differs. */
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.84rem;
}
.kv-row:last-child { border-bottom: none; }
.kv-label {
  color: var(--text-dim);
  flex-shrink: 0;
}
.kv-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  word-break: break-word;
}
.kv-value.mono {
  font-family: var(--font-mono);
  font-size: 0.81rem;
}

/* ── Pagination + Load more (canonical) ──
   Backed by /components/Pagination.js. `.pagination` is the prev / "Page X / Y"
   / next control (arrow buttons + disabled ends); `.load-more` centers a single
   "load more" button. Consolidates the near-identical .adm-mem-pagination shape
   and the centered load-more wrapper. All colors are theme tokens so both flip
   correctly in dark mode. The numbered .hb-pagination variant is intentionally
   left in place (different UI). */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}
.pagination-info {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.load-more {
  text-align: center;
  margin-top: 1.5rem;
}

/* ── Collapsible (canonical) ──
   Backed by /components/Collapsible.js. A clickable header (title + a chevron
   that rotates 180° when open) with the body shown only while open. This is the
   canonical shape for the hand-rolled expand/collapse toggles scattered across
   views (.expand-btn + .pf-chevron, .scope-advanced-toggle, .pkv-entry-arrow).
   All colors are theme tokens so it flips correctly in dark mode. Callers own
   the open state (controlled component). The bespoke per-view toggles are left
   in place where their expanded markup is wired into view state; this block is
   the target for new collapsible sections. */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
}
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s;
}
.collapsible-header:hover {
  color: var(--accent);
}
.collapsible-chevron {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.7rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}
.collapsible-chevron.open {
  transform: rotate(180deg);
}
.collapsible-body {
  padding: 0 0.85rem 0.75rem;
}

/* ── Data table (canonical) ──
   Generic table look backed by /components/DataTable.js. Extracted as the common
   denominator of the admin `.adm table` and profile `.pf .consent-table` /
   `.audit-table` shapes: full-width collapsed borders, an uppercase muted header
   row divided by `--border`, cells divided by `--border-subtle`, a subtle hover,
   and a `.mono` cell modifier. All colors are theme tokens so the table flips
   correctly in dark mode. The `.scrollable` wrapper caps height (admin reuses its
   own `.adm .scrollable`; this generic one applies outside `.adm`). Callers supply
   their own container (`.card` / `.adm-card`); this block adds none. */
.data-table { width: 100%; border-collapse: collapse; font-size: .81rem; }
.data-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: .69rem;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-dim);
}
.data-table tr:hover td { background: var(--bg-surface); }
.data-table .mono { font-family: var(--font-mono); font-size: .78rem; }
/* Generic scrollable wrapper (the admin-scoped `.adm .scrollable` already exists
   for admin tables; this one covers DataTable used outside `.adm`). */
.scrollable { max-height: 600px; overflow-y: auto; }

/* ── Section divider ── */
.section-divider {
  position: relative;
  z-index: 1;
  max-width: 520px;
  margin: 1rem auto 1.5rem;
  height: 1px;
  background: var(--border);
}

/* ── Inputs ── */
.input-field {
  width: 100%;
  padding: 11px 14px;
  background: var(--control-bg);
  border: 1.5px solid var(--control-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.94rem;
  outline: none;
  transition: all 0.15s;
}

.input-field::placeholder { color: var(--text-muted); }

.input-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--bg-input-focus);
}

/* Textarea + select behavior so .input-field works on all field types (lets views
   drop per-view form-input/textarea/select clones). */
textarea.input-field { resize: vertical; min-height: 80px; }
select.input-field { cursor: pointer; }

/* ── Search bar (canonical shell) ──
   Backed by /components/SearchBar.js. `.search-bar` is the flex row that wraps a
   single `type="search"` input; the input itself reuses `.input-field` so all
   visuals (border, focus ring, placeholder, dark-mode flip) are token-driven and
   need no per-view restyling. `.search-bar-input` only makes the input grow to
   fill the row. Consolidates the hand-rolled search inputs (.pkv-search,
   .cap-search-input, .pf-agd-search-input) and the profile .search-bar +
   .input-field combo. The profile-scoped `.pf .search-bar` rule (with max-width)
   coexists; this base provides the layout everywhere else. */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}
.search-bar-input { flex: 1; }

.prompt-box {
  width: 100%;
  min-height: 140px;
  max-height: 300px;
  padding: 1rem 1.2rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  resize: vertical;
  outline: none;
  text-align: left;
}

.prompt-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Empty state ── */
.empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}
/* Optional icon for the canonical EmptyState component (#9). */
.empty-icon { display: block; font-size: 2.5rem; opacity: 0.4; margin-bottom: 0.5rem; font-style: normal; }

/* ── Toggle Switch (canonical /components/ToggleSwitch.js, #14) ── */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: relative; display: inline-block; width: 44px; height: 24px;
  background: var(--border); border-radius: 12px; transition: background 0.2s;
}
.toggle-slider::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-input:checked + .toggle-slider { background: var(--success); }
.toggle-input:checked + .toggle-slider::after { transform: translateX(20px); }
.toggle-label { font-size: .85rem; color: var(--text); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }

/* ── Footer ── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.25rem 3.5rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.7;
  max-width: 500px;
  margin: 0 auto;
}

.footer .heart-icon {
  display: inline-block;
  color: var(--accent);
  font-size: 0.85rem;
  margin: 0 0.1rem;
}

/* ── Page entrance ── */
.page-content { animation: pageIn 0.8s ease; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .content-group { margin-top: 2rem; padding: 1.5rem 1rem; }
  .topnav { padding: 0 0.4rem; }
}

/* ═══════════════════════════════════════════════════════
   Shared Components
   ═══════════════════════════════════════════════════════ */

/* ── Alert ── */
.alert {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.75rem 1rem; border-radius: var(--radius-xs);
  font-size: 0.85rem; margin-bottom: 1rem;
}
.alert-icon { font-weight: 700; flex-shrink: 0; }
.alert-msg { flex: 1; }
.alert-close { background: none; border: none; color: inherit; cursor: pointer; font-size: 1rem; padding: 0 0.25rem; opacity: 0.7; }
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-bg); color: var(--success-fg); border: 1px solid var(--success-border); }
.alert-error { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-border); }
.alert-warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-border); }
.alert-info { background: var(--info-bg); color: var(--info-fg); border: 1px solid var(--info-border); }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%);
  z-index: 9999; max-width: min(90vw, 420px); width: fit-content;
  padding: 0.75rem 1.25rem; border-radius: var(--radius-xs);
  font-size: 0.85rem; font-weight: 600;
  background: var(--toast-success-bg); color: var(--toast-fg);
  animation: toastIn 0.3s ease, toastOut 0.4s ease 2.4s forwards;
  pointer-events: auto; box-sizing: border-box;
}
.toast.error, .toast-error { background: var(--toast-danger-bg); color: var(--toast-fg); }
.toast-success { background: var(--toast-success-bg); color: var(--toast-fg); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; pointer-events: none; } }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--overlay-scrim); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl); padding: 1.5rem;
  min-width: 320px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 1.2rem; padding: 0.25rem; opacity: 0.7; }
.modal-close:hover { opacity: 1; }
.modal-confirm-message { color: var(--text-dim); margin: 0 0 1.25rem; line-height: 1.5; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding-top: 0.5rem; }
.btn-danger-solid { padding: 8px 20px; background: var(--danger,#ef4444); color: #fff; border: none; border-radius: var(--radius-sm); font-size: 0.84rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-danger-solid:hover { background: #dc2626; }

/* ── Card extensions ── */
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.card-title { font-weight: 600; font-size: 1rem; }
.card-subtitle { color: var(--text-dim); font-size: 0.8rem; }
.card-hoverable { cursor: pointer; }

/* ── Form Group ── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.75rem; font-weight: 600; color: var(--text-dim); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-hint { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ── Loading text ── */
.loading-text { margin-left: 0.5rem; color: var(--text-dim); font-size: 0.85rem; }

/* ── Section & page headers (canonical title + subtitle pairs) ──
   Single source of truth for the "title + supporting copy" header that every
   view re-implements. Use .section-title/.section-desc for in-page section
   headers (accent title) and .page-title/.page-subtitle for top-of-view page
   headers (gradient title). All values are theme tokens so they flip with
   dark/light mode. Per-view clones (mk-/hb-/cl-/adm-page-title) are
   token-equivalent and should converge onto these over time. */
.section-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 0.4rem; color: var(--accent); }
.section-desc { color: var(--text-dim); font-size: 0.85rem; margin-bottom: 1.25rem; line-height: 1.5; max-width: 700px; }
.page-title {
  font-size: 1.8rem; font-weight: 700; margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.page-subtitle { color: var(--text-dim); font-size: 1rem; margin-bottom: 32px; }

/* ── Accessibility ── */
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
