/* ==========================================================================
   zUI — shared design system for zSuite ("soft glass + depth")
   Loaded AFTER each app's own stylesheet so its tokens and base components
   win; app-specific layout rules (more specific selectors) still apply.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Core palette */
  --bg: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eceef5;
  --text: #0f1220;
  --text-2: #3c4257;
  --text-3: #62687c;
  --text-4: #62687c;
  --border: rgba(15, 18, 32, 0.09);
  --border-strong: rgba(15, 18, 32, 0.16);
  --fill: rgba(15, 18, 32, 0.045);
  --fill-2: rgba(15, 18, 32, 0.08);

  --accent: #cc4a12;
  --accent-2: #1fa6e8;
  --accent-grad: linear-gradient(#cc4a12, #cc4a12); /* flat: kept as a gradient so background-image uses still work */
  --accent-soft: rgba(204, 74, 18, 0.12);
  --accent-text: #b03a0a;
  --on-accent: #ffffff;

  --positive: #0a6e47;
  --negative: #b4252a;
  --warning: #c27c0e;
  --info: #2f6fe4;
  --positive-bg: rgba(18, 163, 107, 0.11);
  --negative-bg: rgba(229, 72, 77, 0.10);
  --warning-bg: rgba(194, 124, 14, 0.11);
  --info-bg: rgba(47, 111, 228, 0.10);

  /* "Solid" = selected / inverted chips (formerly ink-on-paper) */
  --solid: var(--accent);
  --on-solid: #ffffff;

  /* Glass */
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --blur: blur(22px) saturate(160%);

  /* Aurora */
  --aurora-1: rgba(230, 110, 50, 0.16);
  --aurora-2: rgba(31, 182, 240, 0.10);
  --aurora-3: transparent;

  /* Elevation */
  --shadow-1: 0 1px 2px rgba(15, 18, 32, 0.06), 0 2px 8px -2px rgba(15, 18, 32, 0.06);
  --shadow-2: 0 2px 4px rgba(15, 18, 32, 0.04), 0 12px 32px -8px rgba(15, 18, 32, 0.14);
  --shadow-3: 0 4px 8px rgba(15, 18, 32, 0.05), 0 32px 80px -16px rgba(15, 18, 32, 0.28);
  --glow: 0 8px 24px -8px rgba(204, 74, 18, 0.5);

  /* Shape */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* Type */
  --font-ui: 'Geist', 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: linear(0, 0.006, 0.025 2.8%, 0.101 6.1%, 0.539 18.9%, 0.721 25.3%, 0.849 31.5%, 0.937 38.1%, 0.968 41.8%, 0.991 45.7%, 1.006 50.1%, 1.015 55%, 1.017 63.9%, 1.001 85.2%, 1);
  --t-fast: 120ms;
  --t-med: 220ms;
  --t-slow: 380ms;

  /* ---- Legacy aliases (every app's CSS + inline styles use these) ---- */
  --desk: var(--bg);
  --paper: #ffffff;
  --paper-card: #ffffff;
  --ink: #0f1220;
  --mid: #3c4257;
  --muted: #62687c;
  --soft: #62687c;
  --rule: rgba(15, 18, 32, 0.09);
  --rule-light: rgba(15, 18, 32, 0.06);
  --stamp: #b4252a;
  --field: rgba(15, 18, 32, 0.045);
  --field-active: rgba(15, 18, 32, 0.08);
  --input-bg: rgba(15, 18, 32, 0.045);
  --font: var(--font-ui);
  --font-mono: var(--font-num);

  --ink-blue: #2f6fe4;
  --ink-green: #0a6e47;
  --ink-gold: #c27c0e;
  --ink-purple: #6d4aff;
  --ink-cyan: #0e9fb6;
  --ink-red: #b4252a;
  --amber: #c27c0e;
  --success: #0a6e47;
  --bg-blue: rgba(47, 111, 228, 0.10);
  --bg-green: rgba(18, 163, 107, 0.11);
  --bg-gold: rgba(194, 124, 14, 0.11);
  --bg-purple: rgba(109, 74, 255, 0.10);
  --bg-red: rgba(229, 72, 77, 0.10);

  --text-main: var(--text);
  --text-muted: var(--text-3);
  --text-dim: var(--text-4);
  --border-subtle: var(--border);
  --border-highlight: var(--border-strong);
  --primary: var(--accent);
  --danger: var(--negative);
  --bg-base: var(--bg);
  --bg-surface: var(--surface);

  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);
  --shadow-subtle: var(--shadow-1);
  --shadow-card: var(--shadow-2);
  --ease-out-gentle: var(--ease-out);
  --ease-gentle: var(--ease-out);
  --ease: var(--ease-out);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #08090d;
  --surface: #12141b;
  --surface-2: #181b24;
  --surface-3: #1f2330;
  --text: #eef0f6;
  --text-2: #b9becc;
  --text-3: #868c9c;
  --text-4: #868c9c;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.045);
  --fill-2: rgba(255, 255, 255, 0.08);

  --accent: #e0561a;
  --on-accent: #150a05;
  --on-solid: #150a05;
  --accent-2: #3ec6ff;
  --accent-grad: linear-gradient(#e0561a, #e0561a);
  --accent-soft: rgba(224, 86, 26, 0.18);
  --accent-text: #ff9a62;

  --positive: #3ddc97;
  --negative: #ff6b6b;
  --warning: #ffb547;
  --info: #6ea8ff;
  --positive-bg: rgba(61, 220, 151, 0.12);
  --negative-bg: rgba(255, 107, 107, 0.12);
  --warning-bg: rgba(255, 181, 71, 0.12);
  --info-bg: rgba(110, 168, 255, 0.12);

  --glass: rgba(20, 23, 32, 0.58);
  --glass-strong: rgba(22, 25, 35, 0.86);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --aurora-1: rgba(224, 86, 26, 0.16);
  --aurora-2: rgba(40, 170, 255, 0.08);
  --aurora-3: transparent;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 8px -2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, 0.3), 0 16px 40px -8px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 4px 8px rgba(0, 0, 0, 0.3), 0 40px 100px -20px rgba(0, 0, 0, 0.8);
  --glow: 0 8px 28px -8px rgba(224, 86, 26, 0.6);

  --paper: #12141b;
  --paper-card: #181b24;
  --ink: #eef0f6;
  --mid: #b9becc;
  --muted: #868c9c;
  --soft: #868c9c;
  --rule: rgba(255, 255, 255, 0.075);
  --rule-light: rgba(255, 255, 255, 0.05);
  --stamp: #ff6b6b;
  --field: rgba(255, 255, 255, 0.045);
  --field-active: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(255, 255, 255, 0.045);

  --ink-blue: #6ea8ff;
  --ink-green: #3ddc97;
  --ink-gold: #ffb547;
  --ink-purple: #a78bfa;
  --ink-cyan: #4dd4e6;
  --ink-red: #ff6b6b;
  --amber: #ffb547;
  --success: #3ddc97;
  --bg-blue: rgba(110, 168, 255, 0.12);
  --bg-green: rgba(61, 220, 151, 0.12);
  --bg-gold: rgba(255, 181, 71, 0.12);
  --bg-purple: rgba(167, 139, 250, 0.13);
  --bg-red: rgba(255, 107, 107, 0.12);
}

/* ---------- Themes ----------
   Nine themes, picked by <html data-look> (shared/ztheme.js sets it, with the
   theme's light / dark base in data-theme). Day and Night (zsuite-day /
   zsuite-night) are the tokens above; the seven photo looks repaint them. */
/* Legacy aliases follow each look's tokens (Day and Night keep their own, above) */
:root[data-look]:not([data-look^="zsuite-"]) {
  --solid: var(--accent);
  --on-solid: var(--on-accent);
  --paper: var(--surface);
  --paper-card: var(--surface-2);
  --ink: var(--text);
  --mid: var(--text-2);
  --muted: var(--text-3);
  --soft: var(--text-4);
  --rule: var(--border);
  --rule-light: var(--fill-2);
  --field: var(--fill);
  --field-active: var(--fill-2);
  --input-bg: var(--fill);
}

/* ---------- 1. Studio Light: seamless white paper, softbox highlights, ink accent ---------- */
:root[data-look="studio-light"] {
  --bg: #f3f3f1;
  --surface: #ffffff;
  --surface-2: #f8f8f6;
  --surface-3: #e9e9e6;
  --text: #141414;
  --text-2: #3d3d3b;
  --text-3: #6f6f6b;
  --text-4: #6e6e6b;
  --border: rgba(20, 20, 20, .09);
  --border-strong: rgba(20, 20, 20, .17);
  --fill: rgba(20, 20, 20, .045);
  --fill-2: rgba(20, 20, 20, .08);
  --accent: #1b1b1b;
  --accent-2: #e8a33d;
  --accent-grad: linear-gradient(135deg, #1b1b1b 0%, #4a4a48 60%, #8a8a86 100%);
  --accent-soft: rgba(20, 20, 20, .08);
  --accent-text: #1b1b1b;
  --on-accent: #ffffff;
  --glass: rgba(255, 255, 255, .72);
  --glass-strong: rgba(255, 255, 255, .9);
  --glass-border: rgba(255, 255, 255, .8);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .95);
  --aurora-1: rgba(255, 236, 200, .4);
  --aurora-2: rgba(205, 218, 235, .3);
  --aurora-3: transparent;
  --glow: 0 8px 24px -10px rgba(0, 0, 0, .45);
}

/* ---------- 2. Dark Room: near-black, safelight red ---------- */
:root[data-look="dark-room"] {
  --bg: #0b0a0a;
  --surface: #151313;
  --surface-2: #1b1817;
  --surface-3: #241f1e;
  --text: #f1ece9;
  --text-2: #c4bab6;
  --text-3: #8d8380;
  --text-4: #867f7c;
  --border: rgba(255, 235, 230, .07);
  --border-strong: rgba(255, 235, 230, .14);
  --fill: rgba(255, 235, 230, .04);
  --fill-2: rgba(255, 235, 230, .08);
  --accent: #d83c31;
  --accent-2: #ff8a5c;
  --accent-grad: linear-gradient(135deg, #b3261e 0%, #e0453a 55%, #ff8a5c 100%);
  --accent-soft: rgba(224, 69, 58, .16);
  --accent-text: #ff7a6e;
  --on-accent: #ffffff;
  --glass: rgba(20, 16, 16, .62);
  --glass-strong: rgba(22, 18, 18, .88);
  --glass-border: rgba(255, 235, 230, .07);
  --glass-hi: inset 0 1px 0 rgba(255, 235, 230, .05);
  --aurora-1: rgba(200, 30, 20, .2);
  --aurora-2: rgba(120, 10, 10, .14);
  --aurora-3: transparent;
  --glow: 0 8px 28px -8px rgba(224, 69, 58, .6);
}

/* ---------- 3. Cinematic Matte: lifted blacks, teal & orange grade ---------- */
:root[data-look="cinematic-matte"] {
  --bg: #1c1e20;
  --surface: #24272a;
  --surface-2: #2a2d31;
  --surface-3: #313539;
  --text: #e8e2d6;
  --text-2: #bfb8ab;
  --text-3: #9e9a90;
  --text-4: #9e9a90;
  --border: rgba(232, 226, 214, .08);
  --border-strong: rgba(232, 226, 214, .15);
  --fill: rgba(232, 226, 214, .05);
  --fill-2: rgba(232, 226, 214, .09);
  --accent: #e39a5b;
  --accent-2: #3fa7a3;
  --accent-grad: linear-gradient(135deg, #2f8f8b 0%, #7aa39a 45%, #e39a5b 100%);
  --accent-soft: rgba(227, 154, 91, .16);
  --accent-text: #f0b27c;
  --on-accent: #1c1e20;
  --glass: rgba(36, 39, 42, .64);
  --glass-strong: rgba(38, 41, 45, .9);
  --glass-border: rgba(232, 226, 214, .08);
  --glass-hi: inset 0 1px 0 rgba(232, 226, 214, .06);
  --aurora-1: rgba(63, 167, 163, .16);
  --aurora-2: rgba(227, 154, 91, .12);
  --aurora-3: transparent;
  --glow: 0 8px 28px -8px rgba(227, 154, 91, .5);
}

/* ---------- 4. Classic Chrome: muted, cool-grey film simulation ---------- */
:root[data-look="classic-chrome"] {
  --bg: #e6e6e1;
  --surface: #f4f4f0;
  --surface-2: #eeeeea;
  --surface-3: #dcdcd5;
  --text: #23262a;
  --text-2: #464a50;
  --text-3: #62666b;
  --text-4: #626568;
  --border: rgba(35, 38, 42, .1);
  --border-strong: rgba(35, 38, 42, .18);
  --fill: rgba(35, 38, 42, .05);
  --fill-2: rgba(35, 38, 42, .09);
  --accent: #3f6475;
  --accent-2: #a6493a;
  --accent-grad: linear-gradient(135deg, #3f6475 0%, #6d8a8f 55%, #b4a27e 100%);
  --accent-soft: rgba(63, 100, 117, .14);
  --accent-text: #345869;
  --on-accent: #ffffff;
  --glass: rgba(244, 244, 240, .7);
  --glass-strong: rgba(244, 244, 240, .9);
  --glass-border: rgba(255, 255, 255, .6);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .7);
  --aurora-1: rgba(63, 100, 117, .14);
  --aurora-2: rgba(180, 162, 126, .16);
  --aurora-3: transparent;
  --glow: 0 8px 24px -8px rgba(63, 100, 117, .5);
}

/* ---------- 5. High Contrast Mono: pure black and white ---------- */
:root[data-look="mono"] {
  --bg: #000000;
  --surface: #0d0d0d;
  --surface-2: #141414;
  --surface-3: #1c1c1c;
  --text: #ffffff;
  --text-2: #e0e0e0;
  --text-3: #a8a8a8;
  --text-4: #7d7d7d;
  --border: rgba(255, 255, 255, .16);
  --border-strong: rgba(255, 255, 255, .34);
  --fill: rgba(255, 255, 255, .06);
  --fill-2: rgba(255, 255, 255, .12);
  --accent: #ffffff;
  --accent-2: #bdbdbd;
  --accent-grad: linear-gradient(135deg, #ffffff 0%, #8a8a8a 100%);
  --accent-soft: rgba(255, 255, 255, .14);
  --accent-text: #ffffff;
  --on-accent: #000000;
  --glass: rgba(0, 0, 0, .72);
  --glass-strong: rgba(8, 8, 8, .92);
  --glass-border: rgba(255, 255, 255, .18);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, .1);
  --aurora-1: transparent;
  --aurora-2: transparent;
  --aurora-3: transparent;
  --glow: 0 0 0 1px #ffffff;
}

/* ---------- 6. Sepia / Vintage: aged print, warm browns ---------- */
:root[data-look="sepia"] {
  --bg: #efe5d2;
  --surface: #f8f1e3;
  --surface-2: #f3ead8;
  --surface-3: #e4d6bb;
  --text: #3a2a19;
  --text-2: #5a4630;
  --text-3: #786248;
  --text-4: #75624a;
  --border: rgba(80, 52, 20, .13);
  --border-strong: rgba(80, 52, 20, .24);
  --fill: rgba(80, 52, 20, .05);
  --fill-2: rgba(80, 52, 20, .1);
  --accent: #8c5a2b;
  --accent-2: #b5803f;
  --accent-grad: linear-gradient(135deg, #7a4a22 0%, #a5703a 55%, #c9a46a 100%);
  --accent-soft: rgba(140, 90, 43, .15);
  --accent-text: #7a4a22;
  --on-accent: #fff8ec;
  --glass: rgba(250, 243, 230, .7);
  --glass-strong: rgba(250, 243, 230, .9);
  --glass-border: rgba(255, 250, 240, .7);
  --glass-hi: inset 0 1px 0 rgba(255, 252, 244, .8);
  --aurora-1: rgba(200, 150, 80, .18);
  --aurora-2: rgba(160, 110, 60, .12);
  --aurora-3: transparent;
  --glow: 0 8px 24px -8px rgba(140, 90, 43, .5);
}

/* ---------- 7. Midnight Blue: deep navy, cool blue light ---------- */
:root[data-look="midnight-blue"] {
  --bg: #070d1c;
  --surface: #0e1730;
  --surface-2: #121d3a;
  --surface-3: #1a2747;
  --text: #e6ecfa;
  --text-2: #b4c0dc;
  --text-3: #7d8bae;
  --text-4: #78839f;
  --border: rgba(170, 195, 255, .09);
  --border-strong: rgba(170, 195, 255, .17);
  --fill: rgba(170, 195, 255, .05);
  --fill-2: rgba(170, 195, 255, .09);
  --accent: #5b8cff;
  --accent-2: #8fd3ff;
  --accent-grad: linear-gradient(135deg, #3b5bdb 0%, #5b8cff 50%, #8fd3ff 100%);
  --accent-soft: rgba(91, 140, 255, .18);
  --accent-text: #9bb8ff;
  --on-accent: #070d1c;
  --glass: rgba(12, 20, 42, .6);
  --glass-strong: rgba(14, 23, 48, .88);
  --glass-border: rgba(170, 195, 255, .1);
  --glass-hi: inset 0 1px 0 rgba(170, 195, 255, .07);
  --aurora-1: rgba(60, 90, 220, .24);
  --aurora-2: rgba(90, 170, 255, .14);
  --aurora-3: rgba(140, 100, 255, .08);
  --glow: 0 8px 28px -8px rgba(91, 140, 255, .6);
}

/* ---------- Base ---------- */
@view-transition { navigation: auto; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation; /* pinch to zoom stays; double-tap doesn't zoom by accident while tapping controls */
}

/* iOS zooms the page when a field under 16px takes focus. Pinch zoom is allowed now, so this is what prevents that. */
@supports (-webkit-touch-callout: none) {
  input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], .zui-bare, .editor-title-input),
  select,
  textarea:not(.zui-bare, .writing-textarea) { font-size: max(16px, 1em) !important; }
}

/* The page itself takes focus when what had it is gone: no ring around the whole screen */
main:focus-visible, [role="main"]:focus-visible { outline: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}

body {
  font-family: var(--font-ui);
  color: var(--text);
  background: transparent !important;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

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

* { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 650;
  letter-spacing: -0.022em;
  color: var(--text);
}
h1 { font-size: 22px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.25; }
h3 { font-size: 15px; }
p.subtitle { color: var(--text-3); font-size: 13px; }

/* Numbers, money, codes */
.num, .mono, code, kbd {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums slashed-zero;
  letter-spacing: -0.02em;
}

/* ---------- Shell ---------- */
.container {
  background: var(--glass) !important;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border-color: var(--glass-border) !important;
  box-shadow: var(--glass-hi), var(--shadow-3) !important;
}
@media (min-width: 768px) {
  .container { border-radius: var(--r-xl) !important; }
}

.card {
  background: transparent;
  animation: zuiRise 0.55s var(--ease-out) both;
}
.card::before { display: none !important; }

.nav-breadcrumbs {
  border-bottom: 1px solid var(--border) !important;
  font-size: 13px;
}
.nav-back-link {
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--text-3);
  padding: 4px 10px;
  margin-left: -10px;
  border-radius: var(--r-pill);
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-back-link:hover { color: var(--text); background: var(--fill); }

.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- Controls ---------- */
.btn {
  font-family: var(--font-ui);
  font-weight: 560;
  font-size: 13px;
  letter-spacing: -0.005em;
  text-transform: none;
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--fill);
  color: var(--text);
  box-shadow: var(--glass-hi);
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast),
              box-shadow var(--t-med), transform var(--t-slow) var(--ease-spring), filter var(--t-fast);
  position: relative;
  isolation: isolate;
}
.btn:hover { background: var(--fill-2); border-color: var(--border-strong); opacity: 1; }
.btn:active { transform: scale(0.97); transition-duration: 80ms; }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent-grad) !important;
  color: var(--on-accent) !important;
  border-color: transparent !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), var(--glow);
  overflow: hidden;
}
.btn-primary:hover { filter: brightness(1.07); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.btn-outline:hover { background: var(--fill); }

.btn-sm { border-radius: var(--r-sm); font-size: 12px; }

.btn-theme-toggle {
  border-radius: var(--r-md) !important;
  border: 1px solid var(--border) !important;
  background: var(--fill) !important;
  color: var(--text-2) !important;
  min-width: 34px;
  min-height: 34px;
  transition: background var(--t-fast), transform var(--t-slow) var(--ease-spring) !important;
}
.btn-theme-toggle:hover { background: var(--fill-2) !important; color: var(--text) !important; }
.btn-theme-toggle > svg { width: 16px; height: 16px; display: block; margin: auto; transition: transform var(--t-slow) var(--ease-spring); }
.btn-theme-toggle:hover > svg, .btn-theme-toggle[aria-expanded="true"] > svg { transform: rotate(-18deg) scale(1.08); }

/* Theme picker (shared/ztheme.js): a popover of the nine themes */
.zui-theme-menu {
  position: fixed;
  z-index: 2100;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(276px, calc(100vw - 16px));
  padding: 8px;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: zuiPop .22s var(--ease-out) both;
}
.zui-theme-title {
  grid-column: 1 / -1;
  padding: 2px 6px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.zui-theme-menu button {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  padding: 6px 4px 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  color: var(--text-2);
  background: none;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.zui-theme-menu button:hover, .zui-theme-menu button:focus-visible { color: var(--text); background: var(--fill); outline: none !important; }
.zui-theme-menu button[aria-checked="true"] { color: var(--text); background: var(--fill); box-shadow: inset 0 0 0 1.5px var(--accent); }
.zui-swatch {
  display: block;
  width: 100%;
  height: 32px;
  box-sizing: border-box;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
/* Fixed colours: every theme shows its own while another is active */
.zui-swatch.is-look-studio-light { background: radial-gradient(90% 80% at 30% 20%, #ffffff, #e4e2dc 70%); }
.zui-swatch.is-look-dark-room { background: radial-gradient(70% 90% at 50% 40%, #4a1410, #0b0a0a 75%); }
.zui-swatch.is-look-cinematic-matte { background: linear-gradient(135deg, #2f6f6c 0%, #2a2d31 50%, #b0703f 100%); }
.zui-swatch.is-look-classic-chrome { background: linear-gradient(135deg, #dcdcd5 0%, #8ea3a6 60%, #4f6670 100%); }
.zui-swatch.is-look-mono { background: linear-gradient(90deg, #000 0 50%, #fff 50% 100%); }
.zui-swatch.is-look-sepia { background: linear-gradient(135deg, #f3e7cf 0%, #c9a46a 60%, #7a4a22 100%); }
.zui-swatch.is-look-midnight-blue { background: radial-gradient(80% 100% at 30% 0%, #3b5bdb, #070d1c 75%); }
.zui-swatch.is-look-zsuite-day { background: linear-gradient(135deg, #eef0f6 0 60%, #cc4a12 60% 100%); }
.zui-swatch.is-look-zsuite-night { background: linear-gradient(135deg, #08090d 0 60%, #e0561a 60% 100%); }

.tag {
  font-family: var(--font-ui);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border) !important;
  border-style: solid !important;
  background: var(--fill);
  color: var(--text-2);
}

label {
  font-family: var(--font-ui);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text-3);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(.zui-bare):not(.editor-title-input),
select,
textarea:not(.zui-bare):not(.writing-textarea) {
  font-family: var(--font-ui);
  background: var(--fill);
  border: 1px solid var(--border) !important;
  border-radius: var(--r-md);
  color: var(--text);
  box-shadow: none;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-med);
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(.zui-bare):not(.editor-title-input):hover,
select:hover,
textarea:not(.zui-bare):not(.writing-textarea):hover { border-color: var(--border-strong) !important; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(.zui-bare):not(.editor-title-input):focus,
select:focus,
textarea:not(.zui-bare):not(.writing-textarea):focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px var(--accent-soft) !important;
}
input::placeholder, textarea::placeholder { color: var(--text-4); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }

/* ---------- Overlays ---------- */
.modal-overlay {
  background: rgba(6, 8, 14, 0.5) !important;
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  animation: zuiFade var(--t-med) var(--ease-out) both;
}
.modal-overlay > div,
.modal-overlay > .modal,
.modal-overlay > .modal-content {
  border-radius: var(--r-xl) !important;
  border: 1px solid var(--glass-border) !important;
  background: var(--glass-strong) !important;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glass-hi), var(--shadow-3) !important;
  animation: zuiPop var(--t-slow) var(--ease-spring) both;
}

.toast-banner {
  font-family: var(--font-ui) !important;
  font-weight: 500;
  border-radius: var(--r-pill) !important;
  border: 1px solid var(--glass-border) !important;
  background: var(--glass-strong) !important;
  color: var(--text) !important;
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glass-hi), var(--shadow-2) !important;
  animation: zuiDrop var(--t-slow) var(--ease-spring) both;
}

/* ---------- Utilities ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-hi), var(--shadow-2);
  border-radius: var(--r-lg);
}

/* Cursor-tracked spotlight (zui.js sets --mx / --my) */
.zui-spot {
  background-image: radial-gradient(260px circle at var(--mx, 50%) var(--my, -200px), var(--accent-soft), transparent 65%);
}

.zui-lift {
  transition: transform var(--t-slow) var(--ease-spring), box-shadow var(--t-med), border-color var(--t-fast), background-color var(--t-fast);
}
.zui-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.zui-lift:active { transform: scale(0.98); }

.stagger > * { animation: zuiRise 0.5s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 35ms + 60ms); }

.skeleton {
  color: transparent !important;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 37%, var(--fill) 63%) 0 0 / 400% 100%;
  animation: zuiShimmer 1.4s ease infinite;
}

.zui-flash-up { animation: zuiFlashUp 0.9s var(--ease-out); }
.zui-flash-down { animation: zuiFlashDown 0.9s var(--ease-out); }

.gradient-text {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- App lobby: brand mark, hero, tile grid ----------
   Shared by the app lobbies so they read as one suite. --h is the app's
   hue (same as its row in the zSuite hub). The brand icon + name are what
   the hub's row flies into on navigation (see Page-to-page transitions). */
.zui-brand { display: flex; align-items: center; gap: 12px; }
.zui-brand-icon {
  --tint: hsl(var(--h, 260) 85% 64%);
  display: grid;
  place-items: center;
  flex: none;
  width: 40px; height: 40px;
  border-radius: 12px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 25%, transparent);
  view-transition-name: zapp-icon;
}
.zui-brand-icon svg { width: 20px; height: 20px; }
.zui-brand-name { width: fit-content; view-transition-name: zapp-name; }

.zui-app-hero { margin: 6px 0 22px; text-align: left; animation: zuiRise .6s var(--ease-out) .05s both; }
.zui-app-hero .zui-brand { margin-bottom: 10px; }
.zui-app-hero .zui-brand-icon { width: 48px; height: 48px; border-radius: 14px; }
.zui-app-hero .zui-brand-icon svg { width: 24px; height: 24px; }
.zui-app-hero h1 {
  margin: 0;
  font-size: clamp(30px, 6vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  text-align: left;
  background: linear-gradient(110deg, var(--text) 20%, hsl(var(--h, 260) 85% 66%) 60%, hsl(calc(var(--h, 260) - 62) 85% 70%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.zui-app-hero .subtitle { margin: 0; text-align: left; font-size: 14.5px; color: var(--text-3); }

.zui-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 10px;
  margin-bottom: 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--fill);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}
.zui-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--positive); }
.zui-section-head { margin: 4px 0 10px; animation: zuiRise .5s var(--ease-out) .1s both; }

.zui-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
@media (min-width: 640px) {
  .zui-tiles { grid-template-columns: repeat(auto-fill, minmax(var(--tile-min, 160px), 1fr)); }
}
.zui-tile {
  --tint: hsl(var(--h, 260) 85% 64%);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 140px;
  padding: 16px;
  text-align: left;
  color: inherit;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background-color: var(--fill);
  box-shadow: var(--glass-hi);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  animation: zuiRise .5s var(--ease-out) calc(.12s + var(--i, 0) * .03s) both;
  transition: transform var(--t-slow) var(--ease-spring), border-color var(--t-med), background-color var(--t-med), box-shadow var(--t-med);
}
.zui-tile.zui-spot {
  background-image: radial-gradient(220px circle at var(--mx, 50%) var(--my, -300px), color-mix(in oklab, var(--tint) 22%, transparent), transparent 70%);
}
.zui-tile:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--tint) 45%, transparent);
  background-color: color-mix(in oklab, var(--tint) 8%, var(--fill));
  box-shadow: var(--glass-hi), var(--shadow-2), 0 12px 40px -18px var(--tint);
}
.zui-tile:active { transform: scale(.98); }
.zui-tile-icon {
  display: grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 13px;
  color: var(--tint);
  background: color-mix(in oklab, var(--tint) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--tint) 25%, transparent);
  transition: transform var(--t-slow) var(--ease-spring);
}
.zui-tile-icon svg { width: 22px; height: 22px; stroke-width: 1.75px; }
.zui-tile-title { margin-top: 14px; font-size: 15px; font-weight: 640; letter-spacing: -0.015em; color: var(--text); }
.zui-tile-desc { font-size: 12.5px; line-height: 1.4; color: var(--text-3); }
.zui-tile-badge {
  position: absolute;
  top: 14px; right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--positive);
  background: var(--positive-bg);
}
.zui-tile-badge svg { width: 12px; height: 12px; }
.zui-tile-go {
  position: absolute;
  right: 16px; bottom: 16px;
  color: var(--tint);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--t-med), transform var(--t-slow) var(--ease-spring);
}
.zui-tile-go svg { width: 17px; height: 17px; }
.zui-tile:hover .zui-tile-go { opacity: 1; transform: none; }

/* Not live yet: same tile, locked and blurred. The lock badge and border stay sharp. */
.zui-tile.is-locked { cursor: default; }
.zui-tile.is-locked .zui-tile-icon { filter: blur(9px); opacity: .8; }
.zui-tile.is-locked .zui-tile-title { filter: blur(8px); opacity: .7; }
.zui-tile.is-locked .zui-tile-desc { filter: blur(9px); opacity: .6; }
.zui-tiles-more { margin: -12px 0 22px; text-align: center; font-size: 12.5px; color: var(--text-3); }
.zui-tile.is-locked .zui-tile-badge { padding: 4px; color: var(--text-3); background: var(--fill-2); }
.zui-tile.is-locked:hover {
  transform: none;
  border-color: var(--border-strong);
  background-color: var(--fill);
  box-shadow: var(--glass-hi);
}
.zui-tile.is-locked:hover .zui-tile-icon { transform: none; }

/* Sliding tab indicator (zui.tabs) */
.zui-tabs { position: relative; isolation: isolate; }
.zui-tab-pill {
  position: absolute;
  z-index: -1;
  border-radius: var(--r-md);
  background: var(--fill-2);
  box-shadow: var(--glass-hi), var(--shadow-1);
  transition: transform var(--t-slow) var(--ease-spring), width var(--t-slow) var(--ease-spring), height var(--t-slow) var(--ease-spring), opacity var(--t-med);
  pointer-events: none;
}

/* ---------- Keyframes ---------- */
@keyframes zuiRise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes zuiFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zuiPop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes zuiDrop {
  from { opacity: 0; transform: translate(-50%, -16px) scale(0.96); }
  to   { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes zuiShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@keyframes zuiFlashUp { 0% { color: var(--positive); text-shadow: 0 0 18px var(--positive); } 100% { text-shadow: none; } }
@keyframes zuiFlashDown { 0% { color: var(--negative); text-shadow: 0 0 18px var(--negative); } 100% { text-shadow: none; } }
@keyframes zuiShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* Mobile: overlays become bottom sheets */
@media (max-width: 600px) {
  .modal-overlay > div,
  .modal-overlay > .modal,
  .modal-overlay > .modal-content {
    animation-name: zuiSheet;
  }
}
@keyframes zuiSheet {
  from { opacity: 0.4; transform: translateY(40px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Page-to-page transitions ----------
   Pages opt in by naming their screen `zui-page`; the glass shell and
   backdrop stay in the root crossfade, which is near-identical between
   apps, so only the content moves. Elements named `zapp-icon` /
   `zapp-name` on both pages fly between them. zui.js tags the
   direction: zui-forward (deeper path) or zui-back. */
::view-transition-group(*) {
  animation-duration: .52s;
  animation-timing-function: var(--ease-out);
}
::view-transition-group(zapp-icon),
::view-transition-group(zapp-name) { animation-duration: .6s; }

::view-transition-old(zui-page) { animation: zuiPageOut .26s var(--ease-in-out) both; }
::view-transition-new(zui-page) { animation: zuiPageIn .5s var(--ease-out) .1s both; }
html:active-view-transition-type(zui-back)::view-transition-old(zui-page) { animation-name: zuiPageOutBack; }
html:active-view-transition-type(zui-back)::view-transition-new(zui-page) { animation-name: zuiPageInBack; }

@keyframes zuiPageOut     { to   { opacity: 0; scale: 1.02; } }
@keyframes zuiPageIn      { from { opacity: 0; scale: .97; translate: 0 10px; } }
@keyframes zuiPageOutBack { to   { opacity: 0; scale: .97; translate: 0 10px; } }
@keyframes zuiPageInBack  { from { opacity: 0; scale: 1.02; } }

/* The transition is the entrance, so the arriving page's own load-in
   animations collapse to their end state (zui.js restores them after).
   Scroll-driven ones (zui-scroll-*, sticky headers) are left alone. */
.zui-vt-in .card:not([class*="zui-scroll"]),
.zui-vt-in .anim-header,
.zui-vt-in .hub-hero,
.zui-vt-in .hub-grid-head,
.zui-vt-in .zui-app-hero,
.zui-vt-in .zui-section-head,
.zui-vt-in .footer-note { animation-duration: 0s !important; animation-delay: 0s !important; }

/* ---------- Theme switch ----------
   ztheme.js runs a pick in a view transition. Named page elements are
   folded into the root snapshot so the whole page cross-fades as one. */
.zui-theme-vt * { view-transition-name: none !important; }
.zui-theme-vt::view-transition-group(root) { animation-duration: .5s; }
.zui-theme-vt::view-transition-old(root),
.zui-theme-vt::view-transition-new(root) { animation-duration: .5s; animation-timing-function: var(--ease-in-out); }

/* Fallback where view transitions aren't supported: ease the colors instead. */
.zui-theme-fade, .zui-theme-fade *, .zui-theme-fade *::before, .zui-theme-fade *::after {
  transition: background-color .45s var(--ease-in-out), color .45s var(--ease-in-out),
    border-color .45s var(--ease-in-out), outline-color .45s var(--ease-in-out),
    fill .45s var(--ease-in-out), stroke .45s var(--ease-in-out),
    box-shadow .45s var(--ease-in-out) !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  @view-transition { navigation: none; }
}

/* Opt-out for inputs that are the page itself (editors, inline titles, palette search) */
.zui-bare, .zui-bare:hover, .zui-bare:focus,
textarea.writing-textarea, textarea.writing-textarea:hover, textarea.writing-textarea:focus,
input.editor-title-input, input.editor-title-input:hover, input.editor-title-input:focus {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0;
}
.zui-bare:focus-visible, textarea.writing-textarea:focus-visible, input.editor-title-input:focus-visible { outline: none !important; }

/* ==========================================================================
   Scroll layer — scroll-driven reveals, collapsing headers, edge fades,
   progress bars and snap carousels. Pure CSS: only active where the
   browser supports scroll timelines and the user allows motion, so
   everything is static (and fully visible) otherwise.
   ========================================================================== */
@property --fade-top { syntax: '<length>'; inherits: false; initial-value: 0px; }
@property --fade-bottom { syntax: '<length>'; inherits: false; initial-value: 0px; }

/* Things that only make sense when scroll timelines run */
.zui-scroll-progress, .zui-compact { display: none; }

@supports (animation-timeline: view()) {
@media (prefers-reduced-motion: no-preference) {

  @keyframes zuiFadeOnly { from { opacity: 0; } to { opacity: 1; } }
  @keyframes zuiScrollIn { from { translate: 0 28px; scale: .965; } }
  @keyframes zuiScrollOut { to { opacity: .45; scale: .97; } }
  @keyframes zuiFadeTop { from { --fade-top: 0px; } to { --fade-top: 36px; } }
  @keyframes zuiFadeBottom { from { --fade-bottom: 36px; } to { --fade-bottom: 0px; } }
  @keyframes zuiProgress { from { scale: 0 1; } to { scale: 1 1; } }
  @keyframes zuiHeaderGlass {
    to {
      background-color: color-mix(in oklab, var(--surface) 90%, transparent);
      border-bottom-color: var(--glass-border);
      box-shadow: var(--glass-hi), 0 10px 30px -14px rgba(0, 0, 0, .45);
      -webkit-backdrop-filter: var(--blur);
      backdrop-filter: var(--blur);
    }
  }
  @keyframes zuiHeroOut { to { opacity: 0; translate: 0 -18px; scale: .94; } }
  @keyframes zuiCompactIn { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
  @keyframes zuiSnapFocus {
    0%, 100% { scale: .9; opacity: .5; }
    50% { scale: 1; opacity: 1; }
  }

  /* 1. Reveal-on-scroll: staggered fade on load, then rise/scale/unblur as
     items scroll in and a gentle recede as they leave the top. The scroll
     effects use translate/scale (not transform) so hover lifts still work. */
  .zui-reveal,
  .entity-item, .receipt-accordion, .transfer-item,
  .app-tile, .game-tile, .mode-card, .zui-tile,
  .chart-bar-item, .idea-card, .qa-card,
  .cork-card, .scene-item {
    animation-name: zuiFadeOnly, zuiScrollIn, zuiScrollOut !important;
    animation-duration: .5s, auto, auto !important;
    animation-timing-function: var(--ease-out), linear, linear !important;
    animation-delay: calc(var(--i, 0) * 35ms + 40ms), 0s, 0s !important;
    animation-fill-mode: both !important;
    animation-iteration-count: 1 !important;
    animation-timeline: auto, view(), view() !important;
    animation-range: normal, entry 0% entry min(100%, 160px), exit 25% exit 100% !important;
  }

  /* 2. Edge fades on scroll containers (mask stays fixed to the box) */
  .zui-scroll-fade, .zui-scroll-fade-bottom, .zui-scroll-fade-top {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 var(--fade-top), #000 calc(100% - var(--fade-bottom)), transparent 100%);
  }
  .zui-scroll-fade {
    animation: zuiFadeTop linear both, zuiFadeBottom linear both;
    animation-timeline: scroll(self), scroll(self);
    animation-range: 0px 48px, calc(100% - 48px) 100%;
  }
  .zui-scroll-fade-bottom { animation: zuiFadeBottom linear both; animation-timeline: scroll(self); animation-range: calc(100% - 48px) 100%; }
  .zui-scroll-fade-top { animation: zuiFadeTop linear both; animation-timeline: scroll(self); animation-range: 0px 48px; }

  /* 3. Progress bar (put inside the scroller, or name a timeline) */
  .zui-scroll-progress {
    display: block;
    height: 2px;
    background: var(--accent-grad);
    transform-origin: 0 50%;
    scale: 0 1; /* stays empty if the timeline is inactive (nothing to scroll) */
    animation: zuiProgress linear both;
    animation-timeline: scroll(nearest);
  }

  /* 4. Collapsing glass header: .zui-sticky-head sticks to the top of its
     scroller and turns to glass; .zui-hero children fade away under it and
     .zui-compact (a short title in the header) fades in. The scroller needs
     timeline-scope: --zui-hero. */
  .zui-sticky-head {
    position: sticky;
    top: 0;
    z-index: 20;
    animation: zuiHeaderGlass linear both;
    animation-timeline: scroll(nearest);
    animation-range: 0px 80px;
  }
  .zui-hero { view-timeline: --zui-hero; }
  .zui-hero > * {
    animation: zuiHeroOut linear both !important;
    animation-timeline: --zui-hero !important;
    animation-range: exit 10% exit 90% !important;
  }
  .zui-compact {
    display: inline-block;
    animation: zuiCompactIn linear both;
    animation-timeline: --zui-hero;
    animation-range: exit 55% exit 100%;
  }

  /* 5. Snap carousel on small screens */
  @media (max-width: 639px) {
    .zui-snap-m {
      display: flex !important;
      flex-shrink: 0 !important;
      gap: 12px !important;
      overflow-x: auto !important;
      overscroll-behavior-x: contain;
      scroll-snap-type: x mandatory;
      scroll-padding-inline: var(--snap-bleed, 20px);
      margin-inline: calc(-1 * var(--snap-bleed, 20px)) !important;
      padding: 4px var(--snap-bleed, 20px) 10px !important;
      scrollbar-width: none;
    }
    .zui-snap-m::-webkit-scrollbar { display: none; }
    .zui-snap-m > * {
      flex: 0 0 82% !important;
      scroll-snap-align: center;
      animation-name: zuiSnapFocus !important;
      animation-duration: auto !important;
      animation-delay: 0s !important;
      animation-timing-function: linear !important;
      animation-fill-mode: both !important;
      animation-timeline: view(inline) !important;
      animation-range: cover 0% cover 100% !important;
    }
  }
}
}

/* ---------- zAUTH: suite-wide sign-in (shared/zauth.js) ---------- */
.zauth-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 10px;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.zauth-chip[hidden] { display: none; }
.zauth-chip:hover { color: var(--text); border-color: var(--border-strong); background: var(--fill); }
.zauth-chip svg { width: 14px; height: 14px; }
.zauth-chip.is-in { padding: 2px; border-color: transparent; }
.zauth-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.zauth-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.zauth-chip.is-in:hover .zauth-avatar,
.zauth-chip.is-in[aria-expanded="true"] .zauth-avatar { box-shadow: 0 0 0 2px var(--accent-soft); }

.zauth-menu {
  position: fixed;
  z-index: 1900;
  width: min(280px, calc(100vw - 16px));
  padding: 6px;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  animation: zuiRise .2s var(--ease-out) both;
}
.zauth-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; }
.zauth-menu-head .zauth-avatar { width: 40px; height: 40px; font-size: 16px; }
.zauth-menu-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.zauth-menu-who b { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zauth-menu-who span { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zauth-menu .zauth-error { margin: 0 4px 6px; }
.zauth-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  color: var(--text-2);
  background: none;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
}
.zauth-menu-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.zauth-menu-item:hover:not(:disabled), .zauth-menu-item:focus-visible { color: var(--text); background: var(--fill); outline: none; }
.zauth-menu-item:disabled { opacity: .55; cursor: default; }
.zauth-menu-sep { height: 1px; margin: 5px 4px; background: var(--border); }
.zauth-menu-badge {
  margin-left: auto;
  min-width: 18px;
  padding: 1px 6px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  text-align: center;
  color: var(--accent-text);
  background: var(--accent-soft);
  border-radius: 999px;
}

.zauth-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 10, 18, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.zauth-overlay[hidden] { display: none; }
.zauth-dialog {
  width: min(100%, 400px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 22px;
  text-align: center;
  font-family: var(--font-ui);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  animation: zuiRise .3s var(--ease-out) both;
}
.zauth-dialog h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.zauth-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: var(--r-lg);
  color: var(--accent-text);
  background: var(--accent-soft);
}
.zauth-icon svg { width: 20px; height: 20px; }
.zauth-icon .zauth-avatar { width: 44px; height: 44px; font-size: 18px; border-radius: var(--r-lg); }
.zauth-crop {
  position: relative;
  width: min(100%, 260px);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--fill);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  outline: none;
}
.zauth-crop:active { cursor: grabbing; }
.zauth-crop:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft); }
.zauth-crop img { position: absolute; left: 50%; top: 50%; max-width: none; pointer-events: none; }
/* Dims everything outside the circle that becomes the photo */
.zauth-crop::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 999px rgba(8, 10, 18, 0.55);
  pointer-events: none;
}
.zauth-zoom { display: flex; align-items: center; gap: 10px; width: min(100%, 260px); margin: 14px auto 0; color: var(--text-3); }
.zauth-zoom svg { width: 16px; height: 16px; flex-shrink: 0; }
.zauth-zoom input { flex: 1; min-width: 0; accent-color: var(--accent-text); cursor: pointer; }
.zauth-hint { margin: 0 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-3); overflow-wrap: anywhere; }
.zauth-hint b { color: var(--text-2); }
.zauth-dialog form { text-align: left; }
.zauth-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--fill);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  outline: none;
}
.zauth-input:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.zauth-code { font-family: var(--font-num); font-size: 22px; letter-spacing: 0.35em; text-align: center; }
.zauth-error {
  margin: 10px 0 0;
  padding: 8px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--negative);
  background: var(--negative-bg);
  border-radius: var(--r-md);
}
.zauth-error[hidden] { display: none; }
.zauth-actions { display: flex; gap: 8px; margin-top: 16px; }
.zauth-actions .btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  cursor: pointer;
}
.zauth-actions .btn svg { width: 15px; height: 15px; }
.zauth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  cursor: pointer;
}
.zauth-google:disabled { opacity: .6; cursor: default; }
/* Google's frame is a light page: matching its color-scheme keeps the browser from painting it an opaque white box in dark mode */
.zauth-gsi { display: flex; justify-content: center; color-scheme: light; }
.zauth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  font-size: 12px;
  color: var(--text-3);
}
.zauth-or::before, .zauth-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.zauth-link {
  display: block;
  margin: 12px auto 0;
  padding: 2px 4px;
  font: inherit;
  font-size: 12px;
  color: var(--text-3);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.zauth-link:hover { color: var(--text); }

/* ---------- zREQUESTS: the admin's approvals panel (shared/zrequests.js) ---------- */
.zauth-chip.zauth-has-pending { position: relative; }
.zauth-chip.zauth-has-pending::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e5484d;
  box-shadow: 0 0 0 2px var(--surface);
}
.zrq-dialog { width: min(100%, 560px); text-align: left; }
.zrq-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.zrq-head h2 { margin: 0 0 2px; font-size: 17px; font-weight: 700; }
.zrq-head p { margin: 0; font-size: 12.5px; color: var(--text-3); }
.zrq-tools { display: flex; gap: 4px; flex-shrink: 0; }
.zrq-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
  color: var(--text-2); background: none; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer;
}
.zrq-icon:hover { color: var(--text); background: var(--fill); }
.zrq-icon.is-spinning svg { animation: zrqSpin .8s linear infinite; }
@keyframes zrqSpin { to { transform: rotate(360deg); } }
.zrq-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--fill); }
.zrq-seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 999px; background: none;
  font: 600 12px var(--font-ui); color: var(--text-3); cursor: pointer; white-space: nowrap;
}
.zrq-seg button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.zrq-tabs { margin: 14px 0 4px; }
.zrq-tabs em, .zrq-body h3 em {
  margin-left: 6px; padding: 0 6px; font-size: 11px; font-style: normal; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-text);
}
.zrq-tabs em:empty { display: none; }
.zrq-msg { margin: 10px 0 0; padding: 9px 12px; font-size: 13px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text); }
.zrq-msg.is-error { background: rgba(229, 72, 77, .14); }
.zrq-msg a, .zrq-result a { color: var(--accent-text); font-weight: 600; }
.zrq-body section { margin-top: 16px; }
.zrq-body h3 { margin: 0 0 8px; font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.zrq-empty { margin: 0; font-size: 13px; color: var(--text-3); }
.zrq-card {
  display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--fill);
}
.zrq-card.is-done { opacity: .85; }
.zrq-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.zrq-top strong { font-size: 14.5px; overflow-wrap: anywhere; }
.zrq-when { flex-shrink: 0; font-size: 11.5px; color: var(--text-3); }
.zrq-who { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.zrq-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.zrq-chips span { padding: 2px 8px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); }
.zrq-roster { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.zrq-note { margin: 0; padding: 6px 10px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; border-left: 3px solid var(--border); color: var(--text-2); }
.zrq-grant { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.zrq-gb { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.zrq-gb input {
  width: 72px; height: 32px; padding: 0 8px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.zrq-actions { display: flex; justify-content: flex-end; gap: 8px; }
.zrq-result { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
