/**
 * sb-theme.css — Stewart Baxter Portal design system
 * Shared visual layer for all portal pages. Load AFTER the page's own <style>.
 * Pairs with Tabler Icons (injected by portal-nav.js) + Playfair/Lato fonts.
 */

:root {
  /* Refined elevation — layered, softer than single-blur shadows */
  --shadow-sm: 0 1px 2px rgba(0,5,58,.05), 0 1px 6px rgba(0,5,58,.06);
  --shadow:    0 2px 4px rgba(0,5,58,.05), 0 8px 24px rgba(0,5,58,.09);
  --shadow-lg: 0 4px 8px rgba(0,5,58,.06), 0 16px 48px rgba(0,5,58,.14);
  --ring-gold: 0 0 0 3px rgba(251,175,66,.25);

  /* Motion */
  --ease-out: cubic-bezier(.22,1,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);

  /* Radii scale */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px;

  /* Spacing scale (D1, July 7 audit) — new pages should reach for these
     instead of one-off px margins/paddings. Not retrofitted onto existing
     per-page inline styles (20 pages' worth, too much regression risk in
     one pass) — this is the source of truth going forward. */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;

  /* Type scale (D3, July 7 audit) — grep showed 11px/12px/12.5px/13px etc.
     scattered across pages. Fixed scale for new work: Playfair for page
     titles + stat numerals only, Lato everywhere else. */
  --fs-1: 12px; --fs-2: 13px; --fs-3: 14px; --fs-4: 16px; --fs-5: 20px; --fs-6: 26px; --fs-7: 34px;

  /* Tint palette for icon chips / accents */
  --tint-gold:  rgba(251,175,66,.14);
  --tint-green: rgba(74,124,89,.12);
  --tint-blue:  rgba(58,96,128,.12);
  --tint-amber: rgba(196,120,58,.12);
  --tint-navy:  rgba(0,5,58,.06);
  --tint-rose:  rgba(184,64,100,.10);
  --rose: #b84064;
}

/* ── Entrance choreography ─────────────────────────────────────────
   Add .sb-rise to elements; they fade-rise in sequence via --d index. */
@keyframes sbRise { from { opacity:0; transform:translateY(14px); } to { opacity:1; transform:none; } }
.sb-rise { opacity:0; animation: sbRise .55s var(--ease-out) forwards; animation-delay: calc(var(--d,0) * 70ms); }

/* PERF (July 20, 2026): was an infinite box-shadow ring (not GPU-composited →
   repaints every frame). Now a composited pseudo-element ring scaling out with
   transform/opacity — runs on the compositor thread. Same "attention" pulse. */
@keyframes sbPulseRing {
  0%   { transform: scale(1);   opacity: .5; }
  70%  { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}
.sb-pulse { position: relative; }
.sb-pulse::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  border: 2px solid rgba(251,175,66,.5); will-change: transform, opacity;
  animation: sbPulseRing 2.6s var(--ease-out) infinite;
}
@media (prefers-reduced-motion: reduce) { .sb-pulse::after { animation: none; opacity: 0; } }

@keyframes sbFloat { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-6px); } }

/* ── Interactive surfaces ── */
.sb-lift { transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s; }
.sb-lift:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.sb-lift:active { transform: translateY(-1px); transition-duration: .08s; }

.sb-press { transition: transform .12s var(--ease-out); }
.sb-press:active { transform: scale(.97); }

/* ── Icon chips — colored squircle behind an icon ── */
.sb-chip {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
  transition: transform .25s var(--ease-spring);
}
.sb-chip.gold  { background: var(--tint-gold);  color: var(--gold-text); }
.sb-chip.green { background: var(--tint-green); color: var(--green); }
.sb-chip.blue  { background: var(--tint-blue);  color: var(--blue); }
.sb-chip.amber { background: var(--tint-amber); color: var(--amber); }
.sb-chip.navy  { background: var(--tint-navy);  color: var(--navy); }
.sb-chip.rose  { background: var(--tint-rose);  color: var(--rose); }
*:hover > .sb-chip, .sb-chip-host:hover .sb-chip { transform: scale(1.12) rotate(-4deg); }

/* ── Section titles with gold rule ── */
.section-title { display: flex; align-items: center; gap: 10px; }
.section-title::after { content:''; flex: 0 0 28px; height: 2px; border-radius: 1px;
  background: linear-gradient(90deg, var(--gold), transparent); }

/* ── Card refinements — every page's card family gets the same surface ── */
.card, .glance-card, .quick-card, .docs-connect-card, .doc-folder-card,
.section-card, .pkg-card, .stat-card, .table-card, .form-card,
.staff-card, .case-card, .cal-card, .podium-card, .status-card {
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card, .section-card, .stat-card, .staff-card, .case-card, .pkg-card, .podium-card {
  transition: box-shadow .25s var(--ease-out);
}
.card:hover, .section-card:hover, .stat-card:hover,
.staff-card:hover, .case-card:hover, .pkg-card:hover, .podium-card:hover { box-shadow: var(--shadow); }

/* ── Custom scrollbar (webkit) — quieter than default ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,5,58,.14); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(0,5,58,.28); }
::-webkit-scrollbar-track { background: transparent; }

/* ── Touch targets (D4, extended in the July 8 audit closeout) — icon-only
   action buttons under WCAG's 40px guidance on mobile, where staff use this
   portal one-handed at 2am death calls. D4 covered row remove ✕ and settings
   delete; this pass adds the modal-close/remove-row classes that recur
   across ~18 files (call-log, unclaimed-remains, settings, billing-
   reconciliation, fleet, cremation-log, case-tracker, case-detail, hub),
   each with its own page-local CSS at 32-34px or no explicit box at all
   (just an icon glyph). !important is deliberate: the point is to win over
   every page's own page-local rule for the same class name, rather than
   editing the sizing rule in 18 separate <style> blocks. */
@media (max-width: 768px) {
  .row-x, .set-del { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
  .modal-x, .modal-close, .dc-modal-close, .ap-modal-close, .btn-remove {
    min-width: 40px !important; min-height: 40px !important;
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
  }
}

/* ── Focus visibility — keyboard users get the gold ring ── */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; box-shadow: var(--ring-gold);
}

/* ── Empty states — icon + one line + optional primary action (D5) ──
   Most pages still carry their own duplicated .empty-state CSS (dc-tracker,
   cremation-log, call-log, etc.) with slightly different padding/markup per
   page. Deliberately NOT overriding the bare .empty-state name here — since
   sb-theme.css loads after each page's own <style>, that would silently
   change spacing on every page that already has a working one, with no way
   to visually verify the result in this pass. .sb-empty is the standard for
   any NEW empty state (or a page opting to migrate on purpose). */
.sb-empty { display:flex; flex-direction:column; align-items:center; gap:8px;
  padding: 32px 22px; color: var(--muted); text-align:center; }
.sb-empty .ti { font-size: 26px; opacity:.45; display:block; margin-bottom:4px; }
.sb-empty .sb-empty-title { font-size: var(--fs-2); font-weight: 700; color: var(--text-soft); }
.sb-empty .sb-empty-sub { font-size: var(--fs-1); line-height: 1.5; max-width: 260px; }
.sb-empty .sb-empty-action {
  margin-top: 6px; padding: 8px 16px; border-radius: var(--r-sm);
  background: var(--navy); color: #fff; border: none; font-family: 'Lato', sans-serif;
  font-size: var(--fs-1); font-weight: 700; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
}
.sb-empty .sb-empty-action:hover { background: var(--navy-mid, var(--navy)); }

/* ── Inline error card with retry (audit closeout, July 8) — a load/save
   failure gets a dismissible-by-fixing-itself inline card instead of only a
   toast, which disappears in a few seconds and is easy to miss if you
   looked away. Sibling to .sb-empty above: same "icon + one line + one
   action" shape, red-toned instead of neutral. See window.SBErrorCard in
   portal-nav.js for the two ways to render one. */
.sb-error-card { display:flex; flex-direction:column; align-items:center; gap:8px;
  padding: 28px 22px; text-align:center;
  border: 1px dashed rgba(184,64,64,.35); border-radius: var(--r-md);
  background: rgba(184,64,64,.05); }
.sb-error-card .ti { font-size: 24px; color: #b84040; opacity:.85; display:block; margin-bottom:2px; }
.sb-error-card-msg { font-size: var(--fs-2); color: var(--text-soft); max-width: 320px; line-height:1.5; }
.sb-error-card-retry {
  margin-top: 4px; padding: 8px 18px; border-radius: var(--r-sm);
  background: var(--navy); color: #fff; border: none; font-family: 'Lato', sans-serif;
  font-size: var(--fs-1); font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.sb-error-card-retry:hover { background: var(--navy-mid, var(--navy)); }
html.sb-dark .sb-error-card { background: rgba(255,120,120,.08); border-color: rgba(255,120,120,.3); }
html.sb-dark .sb-error-card .ti { color: #ff8d8d; }

/* ── Namespaced component classes (D1) — new pages should reach for these
   instead of inventing another one-off .btn/.field/.table/.badge. Deliberately
   NOT named .btn/.field/.table/.badge: those names are already used with
   drifted per-page meanings on ~20 pages, and since sb-theme.css loads after
   each page's own <style>, reusing the bare names here would silently
   override every page's existing buttons/fields. Prefixed sb- avoids that. ── */
.sb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-family: 'Lato', sans-serif; font-size: var(--fs-2); font-weight: 700;
  cursor: pointer; transition: all .15s var(--ease-out); text-decoration: none;
}
.sb-btn-primary { background: var(--navy); color: #fff; }
.sb-btn-primary:hover { background: var(--navy-mid, #0a1250); }
.sb-btn-secondary { background: rgba(251,175,66,.1); color: var(--gold-text); border-color: rgba(251,175,66,.3); }
.sb-btn-secondary:hover { background: rgba(251,175,66,.18); }
.sb-btn-ghost { background: var(--surface,#fff); color: var(--muted); border-color: var(--border); }
.sb-btn-ghost:hover { color: var(--text); border-color: var(--muted); }

.sb-field { display: flex; flex-direction: column; gap: 5px; }
.sb-field label { font-size: var(--fs-1); font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--muted); }
.sb-field input, .sb-field select, .sb-field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: 'Lato', sans-serif; font-size: var(--fs-2); color: var(--text);
  background: var(--surface,#fff);
}
.sb-field input:focus, .sb-field select:focus, .sb-field textarea:focus { outline: none; border-color: var(--navy); }

.sb-table { width: 100%; border-collapse: collapse; }
.sb-table th { background: #f4f1ec; color: var(--muted); font-size: var(--fs-1); font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; padding: 11px 16px; text-align: left;
  white-space: nowrap; border-bottom: 1px solid var(--border); }
.sb-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle;
  font-size: var(--fs-2); }
.sb-table tr:last-child td { border-bottom: none; }

.sb-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
  border-radius: 20px; font-size: var(--fs-1); font-weight: 700; }
.sb-badge-green { background: var(--tint-green); color: var(--green); border: 1px solid rgba(74,124,89,.3); }
.sb-badge-amber { background: var(--tint-amber); color: var(--amber, #c4783a); border: 1px solid rgba(196,120,58,.25); }
.sb-badge-muted { background: rgba(0,5,58,.05); color: var(--muted); border: 1px solid var(--border); }

/* ── Tabler icon alignment inside text ── */
.ti { line-height: 1; vertical-align: -0.125em; }

/* ── Number ticker (paired with sbCountUp in sb-theme.js consumers) ── */
.sb-num { font-variant-numeric: tabular-nums; }

/* ── Live dot ── */
.sb-livedot { width:7px; height:7px; border-radius:50%; background:var(--green); display:inline-block; }
.sb-livedot::after { content:''; display:block; width:100%; height:100%; border-radius:50%;
  background:inherit; animation: sbPing 1.8s var(--ease-out) infinite; }
@keyframes sbPing { 0% { transform:scale(1); opacity:.7; } 80%,100% { transform:scale(2.6); opacity:0; } }

/* ── Sidebar nav — larger, animated (applies on every page) ────────── */
.sb-nav-item, .ct-nav-item {
  font-size: 14px !important;
  padding: 11px 22px !important;
  position: relative;
  transition: color .2s var(--ease-out), background .2s var(--ease-out), padding-left .25s var(--ease-spring) !important;
}
.sb-nav-item .ni, .ct-nav-item .ni { font-size: 18px !important; width: 22px !important;
  transition: transform .25s var(--ease-spring); }
/* The nudge takes the 6px back off the right, so the text keeps its width. Taking
   it from the label made a long one ("Imminent / Shopper Calls") wrap to two lines
   on hover at 100% zoom, which shifted the menu under the cursor and flickered. */
.sb-nav-item:hover, .ct-nav-item:hover { padding-left: 28px !important; padding-right: 16px !important; }
.sb-nav-item:hover .ni, .ct-nav-item:hover .ni { transform: scale(1.18); }
.sb-nav-item.active, .ct-nav-item.active { border-left-color: transparent !important; }
.sb-nav-item.active::before, .ct-nav-item.active::before { content:''; position:absolute; left:0; top:18%; bottom:18%;
  width:3px; border-radius:0 3px 3px 0; background:var(--gold);
  box-shadow: 0 0 12px rgba(251,175,66,.7); animation: sbNavGlow .4s var(--ease-out); }
@keyframes sbNavGlow { from { transform:scaleY(0); } to { transform:scaleY(1); } }
.sb-section-label { font-size: 10px !important; }

/* ── Sidebar brand — larger presence (nav list is short, use the room) ── */
.sb-emblem, .ct-logo-mark { width: 50px !important; height: 50px !important; font-size: 18px !important; }
.sb-name, .ct-logo-name { font-size: 19px !important; line-height: 1.2 !important; }
.sb-name span, .ct-logo-name span { font-size: 11px !important; letter-spacing: 2.8px !important; margin-top: 4px !important; }
.sb-tagline, .ct-tagline { font-size: 11px !important; letter-spacing: 1.5px !important; color: rgba(255,255,255,.34) !important; }
.sb-logo, .ct-sidebar-logo { padding: 32px 24px 24px !important; }

/* ── Sidebar logo and signed-in user: one look on every page (Nov 17). Pages each
   carried their own copy of these styles, and they had drifted: the logo image was
   missing on some pages and squeezed on others, and the avatar colors differed. ── */
.sb-logo-mark, .ct-logo-wrap { display: flex !important; align-items: center !important; gap: 12px !important; }
.sb-emblem, .ct-logo-mark { flex-shrink: 0 !important; border-radius: 50% !important; overflow: hidden !important;
  border: 2px solid rgba(251,175,66,.3) !important; background: #00053a url("icons/icon-512.png") center/130% no-repeat !important; }
.ct-logo-mark img { display: none !important; }
.sb-footer, .ct-sidebar-footer { padding: 16px 22px !important; border-top: 1px solid rgba(255,255,255,.07) !important; }
.sb-user, .ct-user { display: flex !important; align-items: center !important; gap: 10px !important; margin: 0 !important; padding: 0 !important; background: transparent !important; min-width: 0; }
.sb-avatar, .ct-avatar { width: 32px !important; height: 32px !important; border-radius: 50% !important; flex-shrink: 0 !important; overflow: hidden !important;
  border: 2px solid rgba(184,151,92,.4) !important; background: #15206e !important; color: #fcc96a !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font: 700 11px 'Lato', sans-serif !important; }
.sb-avatar img, .ct-avatar img { width: 100% !important; height: 100% !important; object-fit: cover !important; border-radius: 50% !important; }
.sb-user-info, .ct-user-info { min-width: 0 !important; }
.sb-user-info .name, .ct-user-info .name, .sb-user-info .role, .ct-user-info .role { margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; }
.sb-user-info .name, .ct-user-info .name { font: 400 12px/1.3 'Lato', sans-serif !important; color: rgba(255,255,255,.7) !important;
  white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
.sb-user-info .role, .ct-user-info .role { font: 400 10px/1.3 'Lato', sans-serif !important; letter-spacing: .5px !important; color: rgba(255,255,255,.3) !important;
  white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
.sb-footer .sign-out-btn, .ct-sidebar-footer .ct-sign-out { width: auto !important; margin: 8px 0 0 42px !important; padding: 0 !important;
  background: none !important; border: 0 !important; border-radius: 0 !important; font: 400 10px 'Lato', sans-serif !important;
  color: rgba(255,255,255,.3) !important; text-decoration: underline !important; cursor: pointer !important; display: block !important; }
.sb-footer .sign-out-btn:hover, .ct-sidebar-footer .ct-sign-out:hover { color: rgba(255,255,255,.6) !important; }

/* ── Hero countdown + weather ── */
.hero-countdown { display:inline-flex; align-items:center; gap:8px; margin-top:14px;
  max-width:100%; min-width:0;
  background:rgba(251,175,66,.1); border:1px solid rgba(251,175,66,.3);
  border-radius:10px; padding:8px 14px; font-size:var(--fs-2); color:var(--gold-lt);
  font-variant-numeric:tabular-nums; }
.hero-countdown .ti { font-size:15px; }
.hero-countdown b { color:#fff; font-weight:700; }
.hero-countdown span { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.hero-weather { display:flex; gap:8px; margin-top:10px; justify-content:flex-end; flex-wrap:wrap; }
.wx-chip { display:inline-flex; align-items:center; gap:6px; background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.14); border-radius:20px; padding:4px 12px;
  font-size:11px; color:rgba(255,255,255,.75); font-variant-numeric:tabular-nums; }
.wx-chip .ti { font-size:14px; color:var(--gold-lt); }
.wx-chip .wx-loc { color:rgba(255,255,255,.45); }

/* ── Today timeline (vertical list) ── */
.sb-timeline { background:var(--surface,#fff); border:1px solid var(--border); border-radius:var(--r-md);
  box-shadow:var(--shadow-sm); padding:16px 20px 20px; margin-bottom:32px; }
.sb-tl-head { display:flex; align-items:baseline; justify-content:space-between; margin-bottom:12px; }
.sb-tl-title { font-size:11px; font-weight:700; letter-spacing:2px; text-transform:uppercase; color:var(--muted); }
.sb-tl-sub { font-size:11px; color:var(--muted); }
.sb-tl-track { }
.sb-tl-list { display:flex; flex-direction:column; }
.sb-tl-item { display:flex; gap:10px; }
.sb-tl-item.past { opacity:0.38; }
.sb-tl-tick { display:flex; flex-direction:column; align-items:center; width:10px; flex-shrink:0; padding-top:3px; }
.sb-tl-dot { width:8px; height:8px; border-radius:50%; background:var(--navy); flex-shrink:0; }
.sb-tl-item.past .sb-tl-dot { background:var(--border); }
.sb-tl-line { width:2px; background:var(--border); flex:1; margin-top:3px; min-height:8px; }
.sb-tl-body { display:flex; align-items:baseline; gap:8px; flex:1; padding-bottom:9px; }
.sb-tl-time { font-size:11px; color:var(--muted); white-space:nowrap; flex-shrink:0; width:54px; font-variant-numeric:tabular-nums; }
.sb-tl-name { font-size:12px; font-weight:600; color:var(--navy); flex:1; }
.sb-tl-loc { font-size:10px; color:var(--muted); flex-shrink:0; }
.sb-tl-now-row { display:flex; gap:10px; align-items:center; margin:2px 0; }
.sb-tl-now-tick { width:10px; flex-shrink:0; display:flex; justify-content:center; }
.sb-tl-now-pip { width:10px; height:10px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 3px rgba(251,175,66,.22); flex-shrink:0; }
.sb-tl-now-body { display:flex; align-items:center; gap:8px; flex:1; }
.sb-tl-now-label { font-size:9px; font-weight:800; letter-spacing:1.5px; color:var(--gold); white-space:nowrap; }
.sb-tl-now-line { flex:1; height:1.5px; background:linear-gradient(to right,rgba(251,175,66,.7),transparent); }

/* ── Sparkline ── */
.sb-spark { display:block; margin-top:10px; width:100%; height:34px; }
.sb-spark polyline { fill:none; stroke:var(--blue); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.sb-spark .spark-fill { fill:url(#sparkGrad); stroke:none; opacity:.5; }
.sb-spark-label { font-size:10px; color:var(--muted); margin-top:2px; }

/* ── Live indicator ── */
.sb-live-pill { display:inline-flex; align-items:center; gap:7px; font-size:10px; font-weight:700;
  letter-spacing:1px; text-transform:uppercase; color:var(--green);
  background:var(--tint-green); border:1px solid rgba(74,124,89,.25);
  border-radius:20px; padding:4px 12px 4px 9px; }

@keyframes sbTick { 0% { transform:translateY(0); opacity:1; } 40% { transform:translateY(-6px); opacity:0; }
  60% { transform:translateY(6px); opacity:0; } 100% { transform:translateY(0); opacity:1; } }
.sb-tick { animation: sbTick .45s var(--ease-out); }

/* ════ COMPONENT LAYER — forms, buttons, tabs, tables ════════════════ */

/* Form fields — gold focus ring, calmer hover (covers .field on all pages) */
.field input, .field select, .field textarea,
.form-input, .form-select, .form-textarea {
  transition: border-color .2s var(--ease-out), box-shadow .2s var(--ease-out), background .2s !important;
  border-radius: 8px !important;
}
.field input:hover, .field select:hover, .field textarea:hover,
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: #cfc6b8 !important; }
.field input:focus, .field select:focus, .field textarea:focus,
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold) !important;
  box-shadow: var(--ring-gold) !important;
  outline: none !important;
}
.field label { transition: color .2s; }
.field:focus-within label { color: var(--gold-text) !important; }

/* Primary buttons — gradient, lift, press (covers all pages' variants) */
.btn-primary, .btn-save, .btn-new, .btn-save-main, .btn.primary {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-mid) 100%) !important;
  transition: transform .18s var(--ease-out), box-shadow .18s var(--ease-out) !important;
}
.btn-primary:hover, .btn-save:hover, .btn-new:hover, .btn-save-main:hover, .btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0,5,58,.28);
}
.btn-primary:active, .btn-save:active, .btn-new:active, .btn-save-main:active, .btn.primary:active {
  transform: translateY(0) scale(.98);
}
.btn-ghost, .btn-secondary, .btn.secondary, .btn-cancel {
  transition: all .18s var(--ease-out) !important;
}
.btn-ghost:hover, .btn-secondary:hover, .btn.secondary:hover, .btn-cancel:hover {
  border-color: var(--gold) !important; color: var(--gold-text) !important;
  background: var(--gold-pale) !important;
}

/* Case-detail tab bar — animated underline + larger text */
.tab-btn { font-size: 13px !important; position: relative; }
.tab-btn { border-bottom: 3px solid transparent !important; }
.tab-btn::after { content:''; position:absolute; left:14px; right:14px; bottom:-1px; height:3px;
  border-radius:3px 3px 0 0; background:var(--gold);
  transform:scaleX(0); transform-origin:center; transition:transform .25s var(--ease-out); }
.tab-btn.active { border-bottom-color: transparent !important; }
.tab-btn.active::after { transform:scaleX(1); }
.tab-btn:hover:not(.active)::after { transform:scaleX(.4); opacity:.4; }

/* Tables — sticky header, zebra, refined hover (log table + table cards) */
.log-table thead th, .table-card thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f4f1ec;
}
.log-table tbody tr:nth-child(even):not(.drawer-row) td { background: rgba(249,246,240,.5); }
.log-table tr.data-row td, .table-card tbody tr td { transition: background .15s; }
.log-table tr.data-row:hover td { background: var(--gold-pale) !important; }
.table-card tbody tr:hover td { background: rgba(251,175,66,.07); }

/* Custody / status pills — pop-in when marked done */
@keyframes sbPopIn { 0% { transform:scale(.6); opacity:0; } 70% { transform:scale(1.08); } 100% { transform:scale(1); opacity:1; } }
.cs-done, .badge-complete { animation: sbPopIn .3s var(--ease-spring); }
.custody-step { transition: transform .15s var(--ease-out); }
.custody-step:hover { transform: translateY(-1px); }

/* Sticky save bar (case-detail) — frosted glass */
/* PERF: no live blur on a sticky bar — it re-blurred the page every scroll
   frame on case-detail (same bug as the topbars). Near-opaque bg instead. */
.save-bar {
  background: rgba(253,251,248,.96) !important;
  box-shadow: 0 -4px 24px rgba(0,5,58,.08) !important; }

/* Toasts — slide up with spring */
@keyframes sbToastIn { from { transform:translateY(16px); opacity:0; } to { transform:none; opacity:1; } }
.toast { animation: sbToastIn .35s var(--ease-spring); border-radius: 10px !important;
  box-shadow: var(--shadow-lg) !important; }

/* Modals — scale-fade entrance */
@keyframes sbModalIn { from { transform:scale(.96) translateY(8px); opacity:0; } to { transform:none; opacity:1; } }
.modal, .modal-overlay.open .modal { animation: sbModalIn .28s var(--ease-out); }

/* ════ ELEVATION LAYER — the year-two polish ═════════════════════════ */

/* Cross-fade page navigation (View Transitions API — progressive enhancement) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .18s; }
::view-transition-new(root) { animation-duration: .26s; }

/* Smooth in-page anchor scrolling */
/* PERF: scope smooth scrolling to keyboard/anchor navigation only — a global
   `html { scroll-behavior:smooth }` also animates programmatic scrollTop writes
   and fights fast wheel scrolling. */
html:focus-within { scroll-behavior: smooth; }

/* Brand text selection */
::selection { background: rgba(251,175,66,.35); color: var(--navy); }

/* Frosted-glass sticky topbars — content glides underneath */
.topbar, .ct-topbar, .page-topbar, .tab-bar {
  background: rgba(253,251,248,.82) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Sidebar depth — gradient falloff + hairline edge glow */
.sidebar, .ct-sidebar {
  background: linear-gradient(165deg, #010840 0%, var(--navy) 45%, #00031f 100%) !important;
}
.sidebar::after, .ct-sidebar::after {
  content:''; position:absolute; top:0; right:0; bottom:0; width:1px;
  background: linear-gradient(180deg, rgba(251,175,66,.25), rgba(251,175,66,.04) 30%, transparent);
  pointer-events:none;
}

/* Sidebar logo emblem — soft gold breathing glow.
   PERF: animate opacity on a pre-rendered pseudo-element glow, not box-shadow
   (box-shadow isn't compositable — it repainted the region every frame forever). */
.sb-emblem, .ct-logo-mark { position: relative; }
.sb-emblem::after, .ct-logo-mark::after {
  content: ''; position: absolute; inset: -8px; border-radius: 50%;
  pointer-events: none; background: radial-gradient(circle, rgba(251,175,66,.22), transparent 70%);
  opacity: 0; animation: sbEmblemGlow 5s ease-in-out infinite;
}
@keyframes sbEmblemGlow { 0%,100% { opacity: 0; } 50% { opacity: 1; } }
html.sb-anim-rest .sb-emblem::after, html.sb-anim-rest .ct-logo-mark::after { animation-play-state: paused !important; }

/* ════ 2035 LAYER — ambient light, reactive surfaces, film grain ════ */

/* Ambient aurora — two soft light fields drifting behind everything.
   Injected as <div class="sb-ambient"> by portal-nav.js. */
.sb-ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* Nov 19: no blur and no drift. A 30px blur on two 38vmax circles was redrawn by
   the graphics card every frame on every page; measured, it cut the Staff
   Directory from 53 to 19 frames a second and the dashboard to single digits.
   The radial gradients are already soft, so it looks the same without it. */
.sb-ambient::before, .sb-ambient::after {
  content: ''; position: absolute; width: 44vmax; height: 44vmax; border-radius: 50%;
  opacity: .45;
}
.sb-ambient::before {
  background: radial-gradient(circle, rgba(251,175,66,.10) 0%, transparent 60%);
  top: -22vmax; right: -17vmax;
}
.sb-ambient::after {
  background: radial-gradient(circle, rgba(0,5,58,.08) 0%, transparent 60%);
  bottom: -27vmax; left: -12vmax;
}
@keyframes sbAurora1 { from { transform: translate(0,0) scale(1); } to { transform: translate(-12vmax, 10vmax) scale(1.25); } }
@keyframes sbAurora2 { from { transform: translate(0,0) scale(1.15); } to { transform: translate(10vmax, -8vmax) scale(.95); } }
/* Pause the drifting aurora during scroll / when hidden / cached — re-rasterizing
   this large blurred layer every frame is the main scroll + idle GPU cost on every
   page. Toggled by portal-nav.js (and by SBAtmos on the hub). Drifts when idle. */
html.sb-anim-rest .sb-ambient::before,
html.sb-anim-rest .sb-ambient::after,
.sb-ambient.sb-anim-rest::before,
.sb-ambient.sb-anim-rest::after { animation-play-state: paused !important; }
/* Entering the back/forward cache → fully drop the heavy decorative layers
   (blurred aurora, memorial star-glows) so cached pages don't retain large GPU
   layers. Without this, navigating around piled up GPU memory. Restored on
   pageshow. Toggled by portal-nav.js. */
html.sb-bfhide .sb-ambient,
html.sb-bfhide .hero-memorial { display: none !important; }
/* Content sits above the ambient layer (sidebars keep their own fixed/sticky positioning) */
.main, .ct-main, .main-wrap { position: relative; z-index: 1; }
.sidebar, .ct-sidebar { z-index: 200; }

/* Film grain REMOVED (July 3, 2026 audit) — a full-viewport fixed layer at max
   z-index forced every scrolled frame to composite through it and blocked
   Chrome's direct-scroll fast path. At 4.5% opacity it was invisible; pure cost. */

/* Cursor spotlight — cards catch the light under the pointer.
   portal-nav.js sets --mx / --my (px, element-relative) on hover. */
.card, .glance-card, .quick-card, .section-card, .pkg-card, .stat-card,
.staff-card, .case-card, .podium-card, .doc-folder-card {
  position: relative;
}
.card::before, .glance-card::after, .quick-card::after, .section-card::after,
.pkg-card::after, .stat-card::after, .staff-card::after, .case-card::after,
.podium-card::after, .doc-folder-card::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .35s var(--ease-out);
  /* Toned down (June 2026): smaller, fainter — a hint of warmth, not a flashlight */
  background: radial-gradient(180px circle at var(--mx, 50%) var(--my, 50%),
    rgba(251,175,66,.035), rgba(251,175,66,.012) 40%, transparent 60%);
  z-index: 0;
}
.card:hover::before, .glance-card:hover::after, .quick-card:hover::after,
.section-card:hover::after, .pkg-card:hover::after, .stat-card:hover::after,
.staff-card:hover::after, .case-card:hover::after, .podium-card:hover::after,
.doc-folder-card:hover::after { opacity: 1; }

/* Hero title — quiet white-to-gold gradient, no animation gimmicks */
.hero-title {
  background: linear-gradient(115deg, #fff 55%, var(--gold-lt) 140%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Gentle breathing for small gold accents (used by the hero greeting line) */
@keyframes sbBreathLine { 0%,100% { opacity:.35; transform:scaleX(.9); } 50% { opacity:.85; transform:scaleX(1); } }

/* ════ BANNER SYSTEM — every page gets the hub's hero treatment ════ */

/* Page banners (.page-hero / .lb-hero on subpages) inherit the hub hero's depth */
.page-hero, .lb-hero {
  background:
    radial-gradient(ellipse 480px 320px at 88% -10%, rgba(251,175,66,.16) 0%, transparent 60%),
    radial-gradient(ellipse 600px 400px at -5% 110%, rgba(21,32,110,.85) 0%, transparent 65%),
    linear-gradient(135deg, var(--navy) 0%, #0a1250 100%) !important;
  border-radius: var(--r-lg) !important;
  position: relative; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,5,58,.22);
}
.page-hero::before, .lb-hero::before { content:''; position:absolute; inset:0 0 auto 0; height:3px;
  background:linear-gradient(90deg, transparent, var(--gold) 30%, var(--gold-lt) 50%, var(--gold) 70%, transparent); opacity:.85; }

/* Living sky on subpage banners — phase set by portal-nav.js */
.sb-banner-sky { position:absolute; inset:0; pointer-events:none; z-index:0; transition:opacity 3s; }
[data-phase="dawn"]  > .sb-banner-sky { background: radial-gradient(ellipse 70% 150% at 85% 100%, rgba(252,168,110,.14) 0%, transparent 60%); }
[data-phase="day"]   > .sb-banner-sky { background: radial-gradient(ellipse 80% 160% at 75% -20%, rgba(140,185,255,.09) 0%, transparent 65%); }
[data-phase="dusk"]  > .sb-banner-sky { background: linear-gradient(100deg, transparent 40%, rgba(216,118,60,.13) 85%, rgba(252,168,110,.09) 100%); }
[data-phase="night"] > .sb-banner-sky { background: radial-gradient(ellipse 90% 170% at 80% -30%, rgba(10,18,80,.5) 0%, transparent 70%); }
.sb-banner-stars { position:absolute; inset:0; pointer-events:none; z-index:0; opacity:0; transition:opacity 3s; }
[data-phase="night"] > .sb-banner-stars { opacity:1; }
[data-phase="dusk"]  > .sb-banner-stars { opacity:.4; }
.sb-banner-stars i { position:absolute; width:2px; height:2px; border-radius:50%; background:#fff;
  box-shadow: 9vw 18px #fff, 17vw 52px rgba(255,255,255,.7), 26vw 30px #fff, 34vw 64px rgba(255,255,255,.6),
    42vw 14px #fff, 50vw 44px rgba(255,255,255,.8), 58vw 70px #fff, 66vw 26px rgba(255,255,255,.6),
    73vw 56px #fff, 80vw 38px rgba(255,255,255,.7);
  animation: sbTwinkle 4.5s ease-in-out infinite; }
@keyframes sbTwinkle { 0%,100% { opacity:.35; } 50% { opacity:.9; } }
/* Banner children sit above the sky layers */
.page-hero > *:not(.sb-banner-sky):not(.sb-banner-stars):not(.hero-orb),
.lb-hero  > *:not(.sb-banner-sky):not(.sb-banner-stars):not(.hero-orb) { position:relative; z-index:1; }

/* Sun/moon orb — rides the banner's gold horizon line by time of day.
   Injected + positioned by portal-nav.js on any .hero / .page-hero. */
.hero-orb { position:absolute; top:1px; width:11px; height:11px; border-radius:50%;
  transform:translate(-50%,-40%); z-index:2; transition:left 2s var(--ease-out); pointer-events:none; }
.hero-orb.arc { transform:translate(-50%,-50%); transition:left 2s var(--ease-out), top 2s var(--ease-out); }
@media (max-width:700px) { .hero-orb.arc { display:none; } }
.hero-orb.sun { background:radial-gradient(circle at 35% 35%, #fff7d8, var(--gold) 60%, rgba(251,175,66,0) 80%);
  box-shadow:0 0 12px 3px rgba(251,175,66,.55), 0 0 30px 8px rgba(251,175,66,.18); }
.hero-orb.moon { background:radial-gradient(circle at 38% 35%, #ffffff, #cfd8ec 60%, rgba(207,216,236,0) 80%);
  box-shadow:0 0 10px 2px rgba(214,225,255,.45), 0 0 24px 6px rgba(214,225,255,.14); overflow:hidden; }
/* Lunar phase — a dark disc slides to reveal tonight's actual moon */
.hero-orb.moon::after { content:''; position:absolute; inset:-1px; border-radius:50%;
  background:#0a1148; opacity:.92;
  transform: translateX(var(--moon-off, 0px)); }

/* ── Press ripple — tactile gold pulse from the click point ── */
@keyframes sbRipple { from { transform:scale(0); opacity:.5; } to { transform:scale(2.6); opacity:0; } }
.sb-ripple { position:absolute; border-radius:50%; pointer-events:none; z-index:3;
  background:radial-gradient(circle, rgba(251,175,66,.45) 0%, rgba(251,175,66,.15) 40%, transparent 70%);
  animation: sbRipple .55s var(--ease-out) forwards; }

/* Quick-access cards — diagonal light sweep on hover */
.quick-card { overflow: hidden; }
.quick-card::before { content:''; position:absolute; top:0; left:-130%; width:60%; height:100%;
  background:linear-gradient(105deg, transparent, rgba(251,175,66,.10), rgba(255,255,255,.25), transparent);
  transform:skewX(-12deg); transition:left .55s var(--ease-out); pointer-events:none; z-index:1; }
.quick-card:hover::before { left:160%; }

/* ── Body-level motion on every page ─────────────────────────────── */
/* Table rows cascade in when (re)rendered */
@keyframes sbRowIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.log-table tbody tr, .table-card tbody tr { animation: sbRowIn .35s var(--ease-out) backwards; }
.log-table tbody tr:nth-child(1), .table-card tbody tr:nth-child(1) { animation-delay: .02s; }
.log-table tbody tr:nth-child(2), .table-card tbody tr:nth-child(2) { animation-delay: .06s; }
.log-table tbody tr:nth-child(3), .table-card tbody tr:nth-child(3) { animation-delay: .10s; }
.log-table tbody tr:nth-child(4), .table-card tbody tr:nth-child(4) { animation-delay: .14s; }
.log-table tbody tr:nth-child(5), .table-card tbody tr:nth-child(5) { animation-delay: .18s; }
.log-table tbody tr:nth-child(n+6), .table-card tbody tr:nth-child(n+6) { animation-delay: .22s; }

/* Stat numbers get tabular digits everywhere (count-up runs via portal-nav) */
.stat-num, .glance-num, .lb-num { font-variant-numeric: tabular-nums; }

/* ════ PORTAL-WIDE BODY REDESIGN ═════════════════════════════════════ */

/* Page titles (pages without navy banners) — bigger, with the gold mark */
.page-hd h1 {
  font-size: 30px !important;
  display: flex; align-items: center; gap: 12px;
}
.page-hd h1::before { content:''; width: 5px; height: 30px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--gold-lt)); flex-shrink: 0; }
.page-hd p { font-size: 13.5px !important; }

/* Stat cards on every page — gold accent edge + serif numerals + lift */
.stat-card, .stat { position: relative; overflow: hidden;
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out) !important; }
.stat-card::before, .stat::before { content:''; position:absolute; left:0; top:0; bottom:0; width:3px;
  border-radius:0 2px 2px 0; background: var(--gold); opacity:.85; }
.stat-card:hover, .stat:hover { transform: translateY(-3px); box-shadow: var(--shadow) !important; }

/* Filter pills & tabs — one tactile language everywhere */
.filter-btn, .tab, .view-tab, .dc-filter-btn {
  border-radius: 20px !important;
  transition: all .2s var(--ease-out) !important;
  position: relative; overflow: hidden;
}
.filter-btn:hover, .tab:hover, .view-tab:hover, .dc-filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,5,58,.10);
}
.filter-btn.active, .tab.active, .dc-filter-btn.active {
  box-shadow: 0 3px 12px rgba(251,175,66,.35);
}
.view-tab.active { box-shadow: 0 3px 12px rgba(0,5,58,.30); }

/* Search fields — soft pill, gold focus bloom */
.search-input, .tb-search, input[type="search"] {
  border-radius: 22px !important;
  transition: box-shadow .25s var(--ease-out), border-color .25s !important;
}
.search-input:focus, .tb-search:focus, input[type="search"]:focus {
  border-color: var(--gold) !important;
  box-shadow: var(--ring-gold), 0 4px 16px rgba(251,175,66,.12) !important;
}

/* Badges & status pills — gentle lift on hover so they feel alive */
.badge, .case-badge, .dc-badge, .custody-step, .case-status-pill {
  transition: transform .15s var(--ease-out);
}
.badge:hover, .case-badge:hover, .dc-badge:hover, .case-status-pill:hover { transform: translateY(-1px); }

/* ════ 2050 LAYER — physical depth, magnetism, cosmos ═══════════════ */

/* 3D tilt — cards lean toward the cursor (vars set by portal-nav.js) */
.card:hover, .glance-card:hover, .quick-card:hover, .section-card:hover,
.pkg-card:hover, .stat-card:hover, .staff-card:hover, .case-card:hover,
.podium-card:hover, .doc-folder-card:hover {
  transform: perspective(900px) translateY(-3px)
             rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) !important;
  will-change: transform;
}

/* Magnetic CTA — the death-call bar leans into the cursor */
.death-call-btn { transform: translate(calc(var(--bx, 0) * 1px), calc(var(--by, 0) * 1px)); }

/* Scroll progress — gold hairline across the very top of the viewport */
.sb-scroll-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-lt));
  box-shadow: 0 0 8px rgba(251,175,66,.5); z-index: 2147483645; pointer-events: none;
  transition: width .1s linear; }

/* Ambient glow no longer drifts with scroll (Nov 19): moving a full-screen layer
   on every scroll frame was part of the lag. It stays put. */

/* Shooting star — streaks across night banners (spawned by portal-nav.js) */
@keyframes sbMeteor {
  0%   { transform: translate(0, 0) rotate(-18deg); opacity: 0; }
  8%   { opacity: 1; }
  100% { transform: translate(-340px, 110px) rotate(-18deg); opacity: 0; }
}
.sb-meteor { position: absolute; width: 90px; height: 1.5px; pointer-events: none; z-index: 1;
  background: linear-gradient(270deg, #fff, rgba(255,255,255,0));
  border-radius: 2px; animation: sbMeteor 1.6s var(--ease-out) forwards; }
.sb-meteor::before { content:''; position:absolute; right:-1px; top:-1.5px; width:4px; height:4px;
  border-radius:50%; background:#fff; box-shadow: 0 0 10px 2px rgba(255,255,255,.8); }

/* Game open — pause the expensive ambient layers so the canvas gets the GPU */
body.sb-game-open::after { display:none; }
body.sb-game-open .sb-ambient { display:none; }

/* ── Predictive intake chips ── */
.sb-suggest { display:flex; gap:6px; flex-wrap:wrap; margin-top:5px; min-height:0; }
.sb-suggest-chip { padding:3px 11px; border-radius:14px; border:1px solid rgba(251,175,66,.4);
  background:var(--tint-gold); color:var(--gold-text); font-size:11px; font-weight:700;
  font-family:'Lato',sans-serif; cursor:pointer; transition:all .15s var(--ease-out);
  animation: sbRise .25s var(--ease-out) backwards; }
.sb-suggest-chip:nth-child(2){animation-delay:.04s;} .sb-suggest-chip:nth-child(3){animation-delay:.08s;}
.sb-suggest-chip:nth-child(4){animation-delay:.12s;}
.sb-suggest-chip:hover { background:var(--gold); color:var(--navy); border-color:var(--gold); transform:translateY(-1px); }

/* ── Anniversary light — a star burning brighter on its day ── */
@keyframes memAnniv { 0%,100% { box-shadow:0 0 8px 2px rgba(252,201,106,.7), 0 0 22px 6px rgba(252,201,106,.25); }
  50% { box-shadow:0 0 12px 4px rgba(252,201,106,.95), 0 0 34px 10px rgba(252,201,106,.4); } }
.mem-star.anniv { width:5px !important; height:5px !important; opacity:.95 !important;
  background:#fff7e0; animation: memAnniv 3s ease-in-out infinite !important; }

/* ── Reduced motion: respect the preference, kill the choreography ── */
@media (prefers-reduced-motion: reduce) {
  .sb-rise { animation: none; opacity: 1; }
  .sb-pulse, .sb-livedot::after, .sb-tick, .sb-nav-item.active::before,
  .cs-done, .badge-complete, .toast, .modal, .sb-emblem, .ct-logo-mark,
  .sb-ambient::before, .sb-ambient::after, .hero-greeting::before, .hero-orb, .sb-ripple, .quick-card::before, .sb-banner-stars i, .log-table tbody tr, .table-card tbody tr, .sb-meteor { animation: none; transition: none; }
  .sb-scroll-progress { display: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .sb-lift, .sb-press, .sb-chip, .sb-nav-item, .sb-nav-item .ni, .sb-tl-event,
  .tab-btn::after, .custody-step { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   POLISH PACKAGE (June 2026) — view transitions, scrollbars, glass,
   unified lift, pulses, skeletons, toasts, dark mode
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page transitions — cross-fade between portal pages (MPA View Transitions) ── */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: sbVtOut .18s var(--ease-out) both; }
::view-transition-new(root) { animation: sbVtIn  .26s var(--ease-out) both; }
@keyframes sbVtOut { to   { opacity: 0; transform: translateY(-6px); } }
@keyframes sbVtIn  { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ── Custom scrollbars — thin, brand-toned ── */
* { scrollbar-width: thin; scrollbar-color: rgba(0,5,58,.28) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(0,5,58,.22); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(251,175,66,.55); background-clip: content-box; }
::selection { background: rgba(251,175,66,.35); }

/* ── Glassmorphism — modals & overlays get depth-blurred translucency ── */
/* Modals: solid white, no backdrop blur (cleaner + no per-frame re-blur lag) */
.modal, .modal-overlay .modal {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

/* ── Hover lift — one motion curve for the whole card family ── */
.card, .glance-card, .quick-card, .section-card, .pkg-card, .stat-card,
.staff-card, .case-card, .podium-card, .doc-folder-card, .table-card, .cal-card {
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out), border-color .25s var(--ease-out);
}
.card:hover, .glance-card:hover, .quick-card:hover, .pkg-card:hover, .stat-card:hover,
.staff-card:hover, .case-card:hover, .podium-card:hover, .doc-folder-card:hover, .cal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

/* ── Status pulses — urgency breathes instead of shouting ── */
@keyframes sbRingScale {
  0%   { transform: scale(.85); opacity: .55; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}
/* Pulse via a composited pseudo-element (transform/opacity only — no repaints) */
.badge.b-urgent, .b-urgent { position: relative; border-radius: 20px; }
.badge.b-urgent::after, .b-urgent::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit;
  border: 2px solid rgba(196,120,58,.5); pointer-events: none;
  animation: sbRingScale 2.4s var(--ease-out) infinite;
  will-change: transform, opacity;
}
@keyframes sbBreathDot { 0%,100% { opacity:.75; transform:scale(1); } 50% { opacity:1; transform:scale(1.25); } }
.oncall-dot, .live-dot, .status-dot.on { animation: sbBreathDot 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .badge.b-urgent, .b-urgent, .oncall-dot, .live-dot, .status-dot.on { animation: none; }
}

/* ── Skeleton shimmer — global (portal-nav swaps "Loading…" text for these) ── */
@keyframes sbShimmer { to { background-position: -200% 0; } }
.sb-skel {
  background: linear-gradient(90deg, rgba(0,5,58,.055) 25%, rgba(0,5,58,.11) 50%, rgba(0,5,58,.055) 75%);
  background-size: 200% 100%;
  animation: sbShimmer 1.4s linear infinite;
  border-radius: 6px; min-height: 13px;
}
.sb-skel + .sb-skel { margin-top: 9px; }

/* ── Unified toasts (SBToast in portal-nav.js) ── */
#sb-toast-stack {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 99999; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.sb-toast {
  display: flex; align-items: center; gap: 10px;
  background: rgba(10,16,58,.86); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.14);
  padding: 10px 18px; border-radius: 30px;
  font: 600 13px 'Lato', sans-serif;
  box-shadow: 0 8px 30px rgba(0,5,58,.35);
  pointer-events: auto;
  animation: sbToastIn .3s var(--ease-spring) both;
}
.sb-toast.out { animation: sbToastOut .25s var(--ease-out) both; }
.sb-toast i { font-size: 16px; }
.sb-toast.ok i { color: #7ed29a; } .sb-toast.warn i { color: var(--gold); } .sb-toast.err i { color: #ff8d8d; }
.sb-toast button {
  background: rgba(251,175,66,.18); border: 1px solid rgba(251,175,66,.4);
  color: var(--gold); font: 700 11px 'Lato',sans-serif;
  padding: 3px 12px; border-radius: 14px; cursor: pointer; margin-left: 4px;
}
@keyframes sbToastIn  { from { opacity:0; transform: translateY(16px) scale(.95); } }
@keyframes sbToastOut { to   { opacity:0; transform: translateY(10px) scale(.97); } }

/* ── TRUE DARK MODE — html.sb-dark overrides every page's palette vars ── */
html.sb-dark { color-scheme: dark; }
html.sb-dark, html.sb-dark body {
  --bg:#0a0d24; --cream:#0a0d24; --warm-white:#10142e;
  --card:#131836; --card2:#171c3e; --card3:#1b2046;
  --border:rgba(255,255,255,.10);
  --text:#f3f2f9; --soft:#cfccdf; --text-soft:#cfccdf; --muted:#aaa7bf;
  --navy:#f0eef9;            /* "navy" is used as the dark-ink color on light pages */
  --navy2:#dddbeb; --navy-mid:#dddbeb; --navy-lt:#bdbad4;
  --gold-text:#fcc96a; --gold-pale:rgba(251,175,66,.14);
  --green-lt:rgba(74,124,89,.16); --amber-lt:rgba(196,120,58,.16);
  --blue-lt:rgba(90,140,190,.14); --purple-lt:rgba(140,120,200,.14);
  --rose-lt:rgba(190,90,120,.14); --teal-lt:rgba(60,150,145,.14);
  --green-bg:rgba(74,164,109,.14); --red-bg:rgba(220,90,90,.12); --amber-bg:rgba(216,150,80,.14);
  --green:#6dbd8d; --amber:#e0a060; --red:#e08080; --blue:#7aa8d8; --purple:#a89ae0; --rose:#d88aa8; --teal:#5ec4bd;
  --tint-navy:rgba(255,255,255,.07);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 1px 6px rgba(0,0,0,.25);
  --shadow:    0 2px 4px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.35), 0 16px 48px rgba(0,0,0,.5);
}
html.sb-dark body { background: var(--bg); color: var(--text); }
/* Surfaces that hardcode white */
html.sb-dark .modal, html.sb-dark .modal-overlay .modal {
  background: rgba(22,27,58,.92); border-color: rgba(255,255,255,.12);
}
html.sb-dark input, html.sb-dark select, html.sb-dark textarea {
  background-color: #171c3e; color: var(--text); border-color: rgba(255,255,255,.14);
}
html.sb-dark input::placeholder, html.sb-dark textarea::placeholder { color: #6f6c86; }
html.sb-dark .sb-skel {
  background: linear-gradient(90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.13) 50%, rgba(255,255,255,.06) 75%);
  background-size: 200% 100%;
}
html.sb-dark * { scrollbar-color: rgba(255,255,255,.25) transparent; }
html.sb-dark *::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); background-clip: content-box; }
html.sb-dark img, html.sb-dark .signet-svg { filter: brightness(.92); }

/* ── Phones: text boxes at 16px so iPhones don't zoom in when one is tapped (phone check Nov 17) ── */
@media (max-width: 700px) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),
  select, textarea { font-size: 16px !important; }
}

/* ── Theme toggle button (injected by portal-nav.js) ── */
#sb-theme-toggle {
  position: fixed; right: 18px; bottom: 18px; z-index: 9000;
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.75); border: 1px solid rgba(0,5,58,.12);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: #00053a; font-size: 19px; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .25s var(--ease-spring), background .3s;
}
#sb-theme-toggle:hover { transform: scale(1.12) rotate(12deg); }
html.sb-dark #sb-theme-toggle { background: rgba(25,30,64,.85); color: #fcc96a; border-color: rgba(255,255,255,.14); }

/* ── Dark mode repairs — components that use var(--navy) as a SURFACE.
   In dark mode --navy becomes light ink (so navy text stays readable),
   which would wash out these dark-surface components; restore them. ── */
html.sb-dark { --navy-surface: #1b2150; }
html.sb-dark .sidebar, html.sb-dark .ct-sidebar,
html.sb-dark .modal-header, html.sb-dark .dc-modal-head, html.sb-dark .case-header,
html.sb-dark .vc-header, html.sb-dark .est-summary-hd, html.sb-dark .pe-save-bar,
html.sb-dark .page-hero, html.sb-dark .lb-hero, html.sb-dark .loading-overlay,
html.sb-dark .btn-primary, html.sb-dark .btn.primary, html.sb-dark .btn.navy,
html.sb-dark .btn-new, html.sb-dark .btn-save, html.sb-dark .btn-save-main,
html.sb-dark .btn-new-case, html.sb-dark .nc-submit, html.sb-dark .btn-load,
html.sb-dark .btn-ms, html.sb-dark .back-btn, html.sb-dark .doc-note button,
html.sb-dark .timeline-input button, html.sb-dark .dc-copy-btn, html.sb-dark .est-copy-btn,
html.sb-dark .est-qty-btn, html.sb-dark .pdf-btn.view,
html.sb-dark .filter-btn.active, html.sb-dark .view-tab.active, html.sb-dark .log-tab.active,
html.sb-dark .vs-btn.active, html.sb-dark .tab-btn.active, html.sb-dark .loc-btn.active,
html.sb-dark .view-btn.active, html.sb-dark .topbar-avatar, html.sb-dark .tb-avatar,
html.sb-dark .page-topbar-avatar, html.sb-dark .staff-avatar, html.sb-dark .review-avatar,
html.sb-dark .podium-avatar, html.sb-dark .td-avatar, html.sb-dark .chart-bar.cases-bar,
html.sb-dark .fun-card, html.sb-dark .death-call-btn, html.sb-dark .dc-voice-btn.listening {
  background: var(--navy-surface) !important;
  color: #e8e7f2;
}
html.sb-dark .hamburger span, html.sb-dark .hamburger-btn span, html.sb-dark .ct-hamburger span {
  background: #e8e7f2 !important;
}

/* Death-call "Next" button stays gold in dark mode too — otherwise it gets
   swept up in the .btn.primary dark-mode repair above (navy-surface bg). */
html.sb-dark #dc-next-btn {
  background: var(--gold) !important;
  color: var(--navy-surface) !important;
}
/* The hub is already a dark-art page: its hero/banner stays as designed */
html.sb-dark .sb-banner, html.sb-dark .hero-memorial { filter: none; }
/* Legacy per-page toasts (now unified, but harmless if any slip through) */
html.sb-dark .toast { background: var(--navy-surface) !important; color: #e8e7f2; }
/* Inline style="background:var(--navy)" uses (19 across pages) */
html.sb-dark [style*="background:var(--navy)"] { background: var(--navy-surface) !important; color: #e8e7f2; }

/* ── Dark mode: SURFACES go dark too (many pages hardcode white cards).
   This is the fix for white-on-white text — every light surface family
   is forced onto the dark card palette. ── */
html.sb-dark .card, html.sb-dark .glance-card, html.sb-dark .quick-card,
html.sb-dark .section-card, html.sb-dark .pkg-card, html.sb-dark .stat-card,
html.sb-dark .staff-card, html.sb-dark .case-card, html.sb-dark .podium-card,
html.sb-dark .doc-folder-card, html.sb-dark .table-card, html.sb-dark .cal-card,
html.sb-dark .vehicle-card, html.sb-dark .pdf-card, html.sb-dark .site-card,
html.sb-dark .award-card, html.sb-dark .skel-card, html.sb-dark .est-summary-card,
html.sb-dark .est-section, html.sb-dark .stat, html.sb-dark .doc-item,
html.sb-dark .info-item, html.sb-dark .signoff-item, html.sb-dark .no-results,
html.sb-dark .stats-table, html.sb-dark .pdf-viewer, html.sb-dark .modal-body {
  background: var(--card) !important;
  color: var(--text);
}
html.sb-dark .topbar, html.sb-dark .ct-topbar {
  background: #0e1230 !important; border-bottom-color: rgba(255,255,255,.08);
}
html.sb-dark .tab, html.sb-dark .filter-btn, html.sb-dark .vs-btn, html.sb-dark .loc-btn,
html.sb-dark .role-btn, html.sb-dark .qa-btn, html.sb-dark .btn-ghost, html.sb-dark .btn-cancel,
html.sb-dark .btn-secondary, html.sb-dark .view-tabs, html.sb-dark .btn-add,
html.sb-dark .est-reset-btn, html.sb-dark .btn-vehicle, html.sb-dark .btn-pdf,
html.sb-dark .pdf-btn.download, html.sb-dark .search-input, html.sb-dark .dir-search,
html.sb-dark .case-select, html.sb-dark .dc-yn {
  background: var(--card2) !important; color: var(--text); border-color: rgba(255,255,255,.13);
}
html.sb-dark .modal, html.sb-dark .dc-modal, html.sb-dark .ap-modal, html.sb-dark .dc-foot {
  background: rgba(22,27,58,.94) !important; color: var(--text);
}
/* Hub hero keeps its hand-tuned night-sky art — pin its base coat dark */
html.sb-dark .hero {
  background:
    radial-gradient(ellipse 480px 320px at 88% -10%, rgba(251,175,66,.16) 0%, transparent 60%),
    radial-gradient(ellipse 600px 400px at -5% 110%, rgba(21,32,110,.85) 0%, transparent 65%),
    linear-gradient(120deg, #0a0e2e 0%, #10164a 100%) !important;
}
html.sb-dark .page-hero, html.sb-dark .lb-hero { background: var(--navy-surface) !important; }
/* Generic hardcoded-white inline styles */
html.sb-dark [style*="background:#fff"], html.sb-dark [style*="background: #fff"],
html.sb-dark [style*="background:white"] { background: var(--card) !important; color: var(--text); }

/* ── Dark mode: source-level theming hooks.
   All pages' hardcoded navy ink is now rgba(var(--ink-rgb),…) and hardcoded
   white surfaces are var(--surface…) — flipping these two knobs themes
   every remaining literal color portal-wide. ── */
html.sb-dark {
  --ink-rgb: 236, 235, 248;   /* navy ink → light ink everywhere it was hardcoded */
  --surface:  #131836;        /* white cards/panels → dark card */
  --surface2: #171c3e;
  --surface3: #1b2046;
}

/* ═══ FUTURE PACK (June 2026) — moon, glass, tilt, bloom, gold leaf ═══ */

/* ── Liquid glass — refractive chrome for the portal's chrome ── */
.topbar, .ct-topbar {
  /* near-opaque cream — still reads as frosted glass, but without the
     per-frame backdrop-filter re-blur that caused scroll lag */
  background: rgba(253, 251, 248, .95) !important;
  border-bottom: 1px solid rgba(255,255,255,.5);
  box-shadow: 0 1px 0 rgba(0,5,58,.06), inset 0 1px 0 rgba(255,255,255,.7);
}
html.sb-dark .topbar, html.sb-dark .ct-topbar {
  background: rgba(14, 18, 48, .96) !important;
  border-bottom-color: rgba(255,255,255,.10);
  box-shadow: 0 1px 0 rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.07);
}
.modal, .modal-overlay .modal {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
html.sb-dark .modal, html.sb-dark .modal-overlay .modal {
  background: rgba(20, 25, 56, .72) !important;
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.10);
}
/* (sheen removed — it shared ::before with the rim ring and produced
   a skewed animating artifact on the topbar) */
.topbar, .ct-topbar { overflow: hidden; }

/* ── Case journey: the gold line draws itself; the active step blooms ── */
.tl-fill {
  background: linear-gradient(90deg, rgba(251,175,66,.55), var(--gold,#fbaf42)) !important;
  box-shadow: 0 0 8px rgba(251,175,66,.45);
  transition: width 1.1s var(--ease-out);
}
/* PERF (July 20, 2026): the active-step marker is now fully STATIC — no
   animation at all. It used to run `sbBloom` INFINITELY with !important,
   animating box-shadow on the dot itself; with one active dot per case card
   that meant dozens of dots repainting on the main thread every frame, which a
   Performance profile pinned as the case tracker's continuous-Rendering lag.
   A static gold ring reads exactly as "this is the current step" and costs
   nothing after first paint — no animation, no compositor layers, no repaints.
   (There is deliberately no @keyframes sbBloom anymore.) */
.step.active .step-dot { position: relative; }
.step.active .step-dot::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid rgba(251,175,66,.45); pointer-events: none;
}

/* ── Gold-leaf burst particles (sbGoldBurst in portal-nav.js) ── */
.sb-gold-fleck {
  position: fixed; z-index: 99998; pointer-events: none;
  width: 7px; height: 4px; border-radius: 1px;
  background: linear-gradient(120deg, #fcc96a, #fbaf42 60%, #d89030);
  box-shadow: 0 0 6px rgba(251,175,66,.6);
  animation: sbFleck .9s var(--ease-out) forwards;
}
@keyframes sbFleck {
  0%   { opacity: 1; transform: translate(0,0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(var(--fr)) scale(.4); }
}

/* ── Seasonal aurora (winter nights, hub hero) ── */
@keyframes sbAurora {
  0%,100% { opacity:.25; transform: translateX(-4%) skewX(-6deg); }
  50%     { opacity:.5;  transform: translateX(4%)  skewX(4deg); }
}
.sb-aurora {
  position: absolute; left: 15%; right: 20%; top: -10%; height: 55%;
  background: linear-gradient(100deg, transparent, rgba(80,220,170,.10) 30%, rgba(120,160,255,.12) 55%, rgba(80,220,170,.08) 75%, transparent);
  pointer-events: none; will-change: transform, opacity;
  animation: sbAurora 11s ease-in-out infinite;
}
/* Nov 19: the blur(14px) on this wide band was re-rasterized every frame all
   evening (it was the one hero effect never put to rest), and the dashboard lagged
   on winter nights. The gradient is soft on its own; it now rests with the rest. */
html.sb-anim-rest .sb-aurora { animation-play-state: paused !important; }

/* ═══ LIQUID GLASS 2.0 — a real material, not just blur ═══════════════
   Recipe: deep blur+saturation backdrop · refractive edge lensing (bright
   top rim, dark bottom bevel) · gradient hairline border · cursor-tracking
   specular highlight (--gx/--gy from portal-nav) · scroll-deepening chrome. */

.sb-glass {
  position: relative;
  background: rgba(255,255,255,.46);
  backdrop-filter: blur(11px) saturate(1.8) brightness(1.06);
  -webkit-backdrop-filter: blur(11px) saturate(1.8) brightness(1.06);
  /* Edge lensing: light enters the top, falls off the bottom */
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.85),
    inset 0 -1px 0 rgba(0,5,58,.10),
    inset 1px 0 0 rgba(255,255,255,.35),
    inset -1px 0 0 rgba(255,255,255,.20),
    0 8px 32px rgba(0,5,58,.10);
  border: 1px solid rgba(255,255,255,.45);
}
/* Cursor-tracking specular — wet-glass highlight under the pointer */
.sb-glass::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity .4s var(--ease-out);
  background: radial-gradient(190px circle at var(--gx, 50%) var(--gy, 0%),
    rgba(255,255,255,.34), rgba(255,255,255,.08) 45%, transparent 70%);
  mix-blend-mode: soft-light;
}
.sb-glass:hover::after { opacity: 1; }

html.sb-dark .sb-glass {
  background: rgba(16,21,52,.52);
  backdrop-filter: blur(12px) saturate(1.6) brightness(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.6) brightness(1.1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.13),
    inset 0 -1px 0 rgba(0,0,0,.35),
    inset 1px 0 0 rgba(255,255,255,.05),
    0 8px 32px rgba(0,0,0,.45);
  border-color: rgba(255,255,255,.12);
}
html.sb-dark .sb-glass::after {
  background: radial-gradient(190px circle at var(--gx, 50%) var(--gy, 0%),
    rgba(180,200,255,.20), rgba(180,200,255,.05) 45%, transparent 70%);
  mix-blend-mode: screen;
}

/* Topbars: glass deepens once you scroll (chrome "condenses") */
.topbar, .ct-topbar { transition: background .35s, box-shadow .35s; }
.topbar.sb-scrolled, .ct-topbar.sb-scrolled {
  background: rgba(253,251,248,.98) !important;
  box-shadow: 0 6px 24px rgba(0,5,58,.10), inset 0 1px 0 rgba(255,255,255,.7);
}
html.sb-dark .topbar.sb-scrolled, html.sb-dark .ct-topbar.sb-scrolled {
  background: rgba(10,14,38,.98) !important;
  box-shadow: 0 6px 24px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.08);
}

/* Sidebars — Apple-widget read: deep, calm, near-opaque obsidian.
   The glass is in the restraint (hairline rim, faint blur), not see-through. */
.sidebar.sb-glass-navy, .ct-sidebar.sb-glass-navy {
  /* LIGHT MODE: translucent navy over cream washes out — stay nearly
     opaque brand navy; the glass lives in the rim + inner light. */
  background:
    radial-gradient(420px 260px at 20% 4%, rgba(251,175,66,.10), transparent 60%),
    linear-gradient(170deg, rgba(13,21,84,.97), rgba(0,5,58,.97) 45%, rgba(1,4,34,.98)) !important;
  border-right: 1px solid rgba(255,255,255,.09);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    inset -1px 0 0 rgba(255,255,255,.05),
    8px 0 40px rgba(0,5,58,.25);
}
/* DARK MODE: now the page behind is dark + glowing, real glass works —
   deep translucency, heavy blur, layered inner light = visible depth */
html.sb-dark .sidebar.sb-glass-navy, html.sb-dark .ct-sidebar.sb-glass-navy {
  /* near-opaque so the fixed sidebar doesn't re-blur the page on every
     scroll frame; layered glows keep the depth/glass read */
  background:
    radial-gradient(420px 260px at 18% 4%, rgba(251,175,66,.09), transparent 60%),
    radial-gradient(360px 500px at -20% 80%, rgba(60,90,255,.13), transparent 70%),
    linear-gradient(170deg, rgba(26,36,110,.96), rgba(8,14,66,.97) 45%, rgba(3,7,40,.98)) !important;
  border-right: 1px solid rgba(255,255,255,.10);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.13),
    inset -1px 0 0 rgba(255,255,255,.06),
    inset 3px 0 24px rgba(120,150,255,.07),
    inset 0 -40px 60px -40px rgba(60,90,255,.12),
    10px 0 48px rgba(0,0,0,.55);
}
/* Rim catch-light down the sidebar's outer edge */
.sidebar.sb-glass-navy::after, .ct-sidebar.sb-glass-navy::after {
  content:''; position:absolute; top:0; bottom:0; right:0; width:1px; pointer-events:none; z-index:5;
  background: linear-gradient(180deg, rgba(255,255,255,.30), rgba(255,255,255,.05) 30%, rgba(255,255,255,.02) 70%, rgba(255,255,255,.16));
}

/* Glass-gold primaries — molten metal under glass */
.btn-primary, .btn.primary, .btn-save, .btn-save-main, .nc-submit, .btn-new-case {
  position: relative;
  background: linear-gradient(160deg, rgba(252,201,106,.92), rgba(251,175,66,.88) 55%, rgba(216,144,48,.92)) !important;
  color: #1d1604 !important;
  border: 1px solid rgba(255,255,255,.5) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.65),
    inset 0 -2px 4px rgba(140,85,10,.30),
    0 4px 14px rgba(251,175,66,.35);
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  transition: transform .18s var(--ease-out), box-shadow .25s var(--ease-out), filter .2s;
}
.btn-primary:hover, .btn.primary:hover, .btn-save:hover, .btn-save-main:hover,
.nc-submit:hover, .btn-new-case:hover {
  filter: brightness(1.07);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.75),
    inset 0 -2px 4px rgba(140,85,10,.25),
    0 6px 22px rgba(251,175,66,.5);
  transform: translateY(-1px);
}
.btn-primary:active, .btn.primary:active, .btn-save:active { transform: translateY(0) scale(.985); }

/* Modals & step panels: full material */
.modal, .dc-modal, .ap-modal, .step-panel.open { border-radius: var(--r-lg); }
.step-panel.open {
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
}

/* Dialogs must stay fully readable no matter what's behind them — initGlass()
   (portal-nav.js) auto-adds .sb-glass to every modal, which makes them only
   ~46% opaque (translucent, hard to read over a busy dashboard). Force ALL
   modals back to solid. (July 20: extended from .dc-modal to every modal.) */
.dc-modal.sb-glass, .modal.sb-glass, .ap-modal.sb-glass,
.dc-modal, .modal, .ap-modal {
  background: #fff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.dc-modal.sb-glass::before, .modal.sb-glass::before, .ap-modal.sb-glass::before { display: none !important; }
html.sb-dark .dc-modal.sb-glass, html.sb-dark .modal.sb-glass, html.sb-dark .ap-modal.sb-glass,
html.sb-dark .dc-modal, html.sb-dark .modal, html.sb-dark .ap-modal {
  background: var(--surface, #131836) !important;
}

/* Graceful fallback — solid surfaces where backdrop-filter is unsupported */
@supports not (backdrop-filter: blur(10px)) {
  .sb-glass { background: rgba(255,255,255,.94); }
  html.sb-dark .sb-glass { background: rgba(16,21,52,.96); }
  .sidebar.sb-glass-navy, .ct-sidebar.sb-glass-navy { background: #060a26 !important; }
}

/* ═══ LIQUID GLASS 2.1 — the Apple read ═══════════════════════════════
   Three corrections over 2.0:
   1. REFRACTION — an SVG displacement map (injected by portal-nav as
      #sb-lens) bends the backdrop, declared after the plain blur so
      browsers that can't do it fall back gracefully (Chrome-only today).
   2. RIM LIGHT — a crisp 1.2px gradient ring hugging the border, bright
      where light hits (top + opposing lower edge), replacing soft insets.
   3. CLARITY — far less white wash; the glass is clear, heavy blur does
      the legibility work. */

.sb-glass {
  background: rgba(255,255,255,.22);
  box-shadow: 0 10px 40px rgba(0,5,58,.14);
  border: none;
  /* fallback first, then the refractive declaration (dropped if unsupported) */
  backdrop-filter: blur(10px) saturate(1.8);
  -webkit-backdrop-filter: blur(10px) saturate(1.8);
}
/* Rim light — conic gradient ring masked to a 1.2px border */
.sb-glass::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  padding: 1.2px; pointer-events: none;
  background: conic-gradient(from 210deg,
    rgba(255,255,255,.9), rgba(255,255,255,.18) 22%,
    rgba(255,255,255,.05) 42%, rgba(255,255,255,.65) 58%,
    rgba(255,255,255,.12) 78%, rgba(255,255,255,.9));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
html.sb-dark .sb-glass {
  background: rgba(14,19,48,.30);
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  backdrop-filter: blur(10px) saturate(1.6) brightness(1.12);
  -webkit-backdrop-filter: blur(10px) saturate(1.6) brightness(1.12);
}
html.sb-dark .sb-glass::before {
  background: conic-gradient(from 210deg,
    rgba(255,255,255,.45), rgba(255,255,255,.08) 22%,
    rgba(255,255,255,.02) 42%, rgba(255,255,255,.3) 58%,
    rgba(255,255,255,.05) 78%, rgba(255,255,255,.45));
}
/* Bigger, softer corners — glass wants curvature to catch light */
.modal.sb-glass, .dc-modal.sb-glass, .ap-modal.sb-glass { border-radius: 22px; }
/* Jelly press — glass gives slightly under the finger */
.sb-glass:active { transform: scale(.995); transition: transform .1s var(--ease-out); }
.topbar.sb-glass:active, .ct-topbar.sb-glass:active,
.sidebar.sb-glass-navy:active { transform: none; }
/* Scrolled topbar keeps clarity — near-opaque, no live blur */
.topbar.sb-scrolled, .ct-topbar.sb-scrolled {
  background: rgba(253,251,248,.98) !important;
}
html.sb-dark .topbar.sb-scrolled, html.sb-dark .ct-topbar.sb-scrolled {
  background: rgba(9,13,36,.98) !important;
}

/* ── PERF: kill backdrop-filter on sticky topbars (re-blurs the page on
   every scroll frame). Modals/panels keep their blur — they're transient.
   Topbars get the .sb-glass class from initGlass, so override that here. ── */
.topbar, .ct-topbar, .page-topbar, .tab-bar,
.topbar.sb-glass, .ct-topbar.sb-glass,
.topbar.sb-scrolled, .ct-topbar.sb-scrolled {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ═══ GLASS CARDS (dark mode) — panels float as translucent glass over an
   ambient glowing backdrop, the BlurAdmin/visionOS dashboard read. ═══ */

/* Ambient backdrop: the dark page is no longer flat — two soft glows
   (brand gold + indigo) sit behind everything, so glass has light to bend */
html.sb-dark body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 720px 480px at 85% -8%, rgba(251,175,66,.07), transparent 60%),
    radial-gradient(ellipse 900px 620px at -10% 108%, rgba(40,60,190,.14), transparent 65%),
    radial-gradient(ellipse 560px 420px at 55% 50%, rgba(70,90,220,.05), transparent 70%),
    #0a0d24;
}

/* Cards become glass panels over that glow */
html.sb-dark .card, html.sb-dark .glance-card, html.sb-dark .quick-card,
html.sb-dark .section-card, html.sb-dark .pkg-card, html.sb-dark .stat-card,
html.sb-dark .staff-card, html.sb-dark .case-card, html.sb-dark .podium-card,
html.sb-dark .doc-folder-card, html.sb-dark .table-card, html.sb-dark .cal-card,
html.sb-dark .vehicle-card, html.sb-dark .pdf-card, html.sb-dark .award-card,
html.sb-dark .stat {
  background: rgba(22, 28, 66, .42) !important;
  /* no backdrop-filter: dozens of cards × live blur = lag; the page bg is a
     smooth gradient, so translucency alone is visually identical */
  border: 1px solid rgba(255,255,255,.075) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 28px rgba(0,0,0,.32);
}
@supports not (backdrop-filter: blur(10px)) {
  html.sb-dark .card, html.sb-dark .section-card, html.sb-dark .stat-card,
  html.sb-dark .case-card { background: #141a3d !important; }
}

/* ── Dark glass cards 2.0 — deeper material: gradient body, rim ring via
   shadow stack (pseudo-elements are taken by the spotlight), inner glow ── */
html.sb-dark .card, html.sb-dark .glance-card, html.sb-dark .quick-card,
html.sb-dark .section-card, html.sb-dark .pkg-card, html.sb-dark .stat-card,
html.sb-dark .staff-card, html.sb-dark .case-card, html.sb-dark .podium-card,
html.sb-dark .doc-folder-card, html.sb-dark .table-card, html.sb-dark .cal-card,
html.sb-dark .sb-timeline, html.sb-dark .stat {
  background: linear-gradient(155deg, rgba(34,42,96,.62), rgba(18,24,58,.52) 55%, rgba(12,17,46,.58)) !important;
  /* opacity raised slightly to compensate for removing live blur */
  border: 1px solid transparent !important;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.08),
    inset 0 1.5px 0 rgba(255,255,255,.14),
    inset 0 -18px 36px -24px rgba(90,120,255,.18),
    0 12px 36px rgba(0,0,0,.38);
}

/* Emblems/crests carry the logo as a background-image — recolor without wiping it */
html.sb-dark .sb-emblem, html.sb-dark .emblem, html.sb-dark .ct-logo-mark, html.sb-dark .hero-crest {
  background-color: var(--navy-surface, #1b2150) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PORTAL-WIDE LUMINOUS SYSTEM (July 20, 2026) — carries the hub's designed look
   to every page: a static night-sky ambient + refined card material + luminous
   stat figures. STATIC gradients only (no blur/animation → perf-safe; unrelated
   to the animated .sb-ambient aurora). To revert: delete this whole block.
   Backup: _backup-hub-visual-july20/sb-theme.css.round2
   ═══════════════════════════════════════════════════════════════════════════ */

/* Ambient wash + soft vignette behind every page (same values as the hub) */
body::before {
  content:''; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(1100px 480px at 88% -6%, rgba(251,175,66,.06), transparent 60%),
    radial-gradient(820px 460px at -6% 5%,  rgba(21,32,110,.05), transparent 58%);
}
body::after {
  content:''; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:radial-gradient(120% 80% at 50% 0%, transparent 62%, rgba(21,32,110,.04) 100%);
}
html.sb-dark body::before {
  background:
    radial-gradient(1100px 480px at 88% -6%, rgba(251,175,66,.05), transparent 60%),
    radial-gradient(820px 460px at -6% 5%,  rgba(60,80,200,.10), transparent 58%);
}
html.sb-dark body::after { background:none; }

/* Card material — softer radius + layered shadow + glass edge. Small cards also
   get a tactile hover lift; table cards keep still (a lifting table reads odd). */
.stat-card, .table-card, .log-card, .vehicle-card, .loc-card, .fun-card,
.doc-folder-card, .award-card, .podium-card, .pkg-card, .cal-card {
  border-radius:14px !important;
  box-shadow:0 1px 2px rgba(0,5,58,.04), 0 10px 26px rgba(0,5,58,.05) !important;
  transition:transform .2s var(--ease-out,ease), box-shadow .2s !important;
}
.stat-card:hover, .log-card:hover, .vehicle-card:hover, .loc-card:hover,
.fun-card:hover, .doc-folder-card:hover, .award-card:hover, .pkg-card:hover {
  transform:translateY(-2px);
  box-shadow:0 2px 4px rgba(0,5,58,.05), 0 18px 44px rgba(0,5,58,.09), 0 0 0 1px rgba(251,175,66,.16) !important;
}

/* Luminous stat figures — tabular alignment + a subtle depth glow. Color is
   left untouched so status-colored numbers (green/red/amber) keep their meaning. */
.stat-num, .big-num, .fun-num, .vc-stat-num {
  font-variant-numeric:tabular-nums; letter-spacing:-.5px;
  text-shadow:0 2px 12px rgba(21,32,110,.10);
}
html.sb-dark .stat-num, html.sb-dark .big-num, html.sb-dark .fun-num, html.sb-dark .vc-stat-num {
  text-shadow:0 2px 14px rgba(0,0,0,.35);
}

/* ── Menu groups that fold (November 16 design pass) ───────────────── */
.sb-group-head { display:flex; align-items:center; justify-content:space-between; width:100%;
  background:none; border:none; cursor:pointer; text-align:left; font-family:'Lato',sans-serif;
  font-size:10px; font-weight:700; letter-spacing:2.2px; text-transform:uppercase;
  color:rgba(255,255,255,.42); padding:16px 20px 7px 22px; transition:color .15s; }
.sb-group-head:hover, .sb-group-head:focus-visible { color:rgba(255,255,255,.85); outline:none; }
.sb-group-head .ti { font-size:13px; opacity:.7; transition:transform .22s var(--ease-out, ease); }
.sb-group-head.open .ti { transform:rotate(90deg); }
.sb-group { display:grid; grid-template-rows:0fr; transition:grid-template-rows .24s var(--ease-out, ease); }
.sb-group.open { grid-template-rows:1fr; }
.sb-group-in { min-height:0; overflow:hidden; }
.sb-group:not(.open) .sb-group-in { visibility:hidden; transition:visibility 0s .24s; }

/* ── One look for page tops (November 17) ─────────────────────────────
   Pages that opened with a plain title now use the same navy banner as the
   rest. Their buttons stay where they were, on the right of the banner. */
.page-hero.sb-hero-row { display:flex !important; align-items:center; justify-content:space-between; gap:16px 20px; flex-wrap:wrap;
  padding:26px 30px !important; margin:0 0 22px !important; border:none !important; color:#fff; }
.page-hero.sb-hero-row .page-title { margin:0 !important; padding:0 !important; border:none !important; background:none !important; }
.page-hero.sb-hero-row h1 { font-family:'Playfair Display',serif !important; font-size:26px !important; font-weight:400 !important;
  color:#fff !important; margin:0 0 6px !important; padding:0 !important; display:flex; align-items:center; gap:10px; letter-spacing:0; }
.page-hero.sb-hero-row h1::before, .page-hero.sb-hero-row h1::after { display:none !important; }
.page-hero.sb-hero-row h1 .ti { color:var(--gold) !important; }
.page-hero.sb-hero-row p { color:rgba(255,255,255,.62) !important; font-size:12.5px !important; margin:0 !important; max-width:680px; line-height:1.5; }
@media (max-width:700px) { .page-hero.sb-hero-row { padding:20px 18px !important; } .page-hero.sb-hero-row h1 { font-size:21px !important; } }
.page-hero.sb-hero-row .btn-new { background:var(--gold) !important; color:#00053a !important; border-color:var(--gold) !important; }
