/* EVO TrustGuard — page-admin.css
 *
 * Owned by:    admin.html — AND the admin dark-glass shell layer (.ash-*)
 *              shared by the THREE admin pages: admin.html,
 *              sales-pipeline.html, outreach.html (M8.1). The shell is
 *              implemented ONCE here and loaded by all three pages BEFORE
 *              their own page-*.css; see /css/AGENTS.md "Admin dark-glass
 *              shell" for the pattern + rationale.
 * Category:    admin shell page (PERMANENTLY DARK — data-theme="dark" is
 *              pinned statically on <html> of all three admin pages; no
 *              light variant, no theme toggle on admin surfaces)
 * Cascade:     tokens → base → utilities → components → portal-chrome →
 *              shared → shared-themes → page-admin (+ page-sales-pipeline /
 *              page-outreach after it on those pages)
 * Edit policy: .ash-* shell rules + admin.html page rules live here.
 *              Anything used by 5+ pages should be promoted to
 *              /css/components.css with a /css/AGENTS.md update.
 *
 * History:     extracted C56 (verbatim move); dark Glass pass C107; M8.1
 *              replaced the light .dash-nav / .tab-bar chrome with the
 *              dark-glass sidebar shell. The pre-M8.1 light base rules below
 *              are retained where markup survives — the static dark pin means
 *              the [data-theme="dark"] overrides are always active.
 */

  body { font-family: var(--font-sans); background: var(--bg); color: var(--dark); line-height: var(--leading-relaxed); min-height: 100vh; display: flex; flex-direction: column; }

  /* ════════════════════════════════════════════════════════════════════════
     ADMIN DARK-GLASS SHELL (.ash-*) — M8.1. One chrome across admin.html /
     sales-pipeline.html / outreach.html: glass top bar (brand + env badge +
     static search + Portal link + avatar), grouped left sidebar, main column.
     Built from the 3G.1 Glass tokens; page-scoped accent vars follow the
     rule-2 --sp-* precedent. Alpha washes are literal rgba() of token hues
     (the C103 status-wash pattern).
     ════════════════════════════════════════════════════════════════════════ */
  :root {
    --ash-red-lit: #ff6f6a;   /* lightened brand red — active nav text on near-black (mockup .item.on) */
    --ash-side-w:  218px;     /* sidebar column width (mockup) */
  }

  /* Tier-0 vignette page background (never flat black). */
  body { background: var(--glass-page-grad); background-attachment: fixed; }

  /* Pre-gate spinner. */
  .ash-gate { flex: 1; min-height: 70vh; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); font-size: var(--text-base); }

  /* Top bar — sticky glass. */
  .ash-top {
    position: sticky;
    top: 0;
    z-index: var(--z-nav);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: calc(var(--space-2-5) + env(safe-area-inset-top)) var(--space-5) var(--space-2-5);
    background: var(--tier3-tint);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border-bottom: 1px solid var(--hairline);
  }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .ash-top { background: var(--tier3-tint-opaque); }
  }
  .ash-brand { display: flex; align-items: center; gap: var(--space-3); text-decoration: none; flex: none; }
  .ash-brand .brand-logo { display: block; height: 42px; width: auto; }
  /* Theme-adaptive wordmark fills (LOCKED C38 — shield PNG + EVO red + serif
     white; CSS fills win over any legacy presentation attributes). */
  .ash-brand .brand-evo { fill: var(--red); }
  .ash-brand .brand-trustguard { fill: var(--text); }
  .ash-brand-admin {
    color: var(--text-muted);
    font-size: var(--text-md);
    padding-left: var(--space-3-5);
    border-left: 1px solid var(--border);
    white-space: nowrap;
  }
  /* Environment badge — amber STAGING pill on localhost/staging, absent on
     prod (hostname-derived client-side via window.TG.env(); render-only). */
  .ash-env {
    flex: none;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.08em;
    color: var(--amber);
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 6px;
    padding: 3px var(--space-2-5);
  }
  /* Static visual-parity search chrome — unwired (M8.2+ candidate). */
  .ash-search {
    flex: 1 1 auto;
    max-width: 420px;
    margin-left: auto;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: var(--text-disabled);
    background: var(--tier2-bg);
    border: 1px solid var(--hairline);
    box-shadow: var(--tier2-inset);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3-5);
    font-size: var(--text-md);
  }
  .ash-portal { color: var(--text-muted); font-size: var(--text-md); text-decoration: none; white-space: nowrap; flex: none; }
  .ash-portal:hover { color: var(--text); }

  /* Shell grid — sidebar + main. */
  .ash-shell { flex: 1; display: grid; grid-template-columns: var(--ash-side-w) 1fr; align-items: stretch; }
  .ash-side {
    border-right: 1px solid var(--hairline);
    padding: var(--space-5) var(--space-3);
    background: rgba(0, 0, 0, 0.25); /* translucent sidebar wash over the vignette (mockup .side) */
  }
  .ash-grp {
    font-size: var(--text-xxs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-disabled);
    margin: var(--space-4-5) var(--space-2-5) var(--space-2);
  }
  .ash-grp:first-child { margin-top: 0; }
  .ash-item {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    width: 100%;
    padding: var(--space-2-5) var(--space-3);
    min-height: 40px;
    margin-bottom: 2px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: none;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }
  .ash-item:hover { background: var(--surface); color: var(--text); }
  .ash-item.on {
    background: var(--red-wash);
    border-color: rgba(229, 52, 46, 0.35);
    color: var(--ash-red-lit);
    font-weight: var(--weight-medium);
  }
  .ash-item.is-disabled { opacity: 0.45; cursor: not-allowed; }
  .ash-item.is-disabled:hover { background: none; color: var(--text-muted); }
  .ash-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.7; flex: none; }
  .ash-main { padding: var(--space-6); min-width: 0; }

  /* Shell action buttons (page headers + pagers on the admin pages). */
  .ash-btn {
    font-family: var(--font-sans);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    padding: var(--space-2) var(--space-3-5);
    min-height: 40px;
    border-radius: var(--btn-radius);
    background: var(--btn-secondary-bg);
    border: var(--btn-secondary-border);
    box-shadow: var(--btn-secondary-shadow);
    color: var(--btn-secondary-text);
    cursor: pointer;
    white-space: nowrap;
    transition: filter 0.15s ease, transform 0.18s var(--ease-spring);
  }
  .ash-btn:hover:not(:disabled) { filter: brightness(1.06); }
  .ash-btn:active:not(:disabled) { transform: scale(var(--press-scale)); }
  .ash-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .ash-btn-primary {
    background: var(--btn-primary-bg);
    border: var(--btn-primary-border);
    box-shadow: var(--btn-primary-shadow);
    color: var(--btn-primary-text);
  }

  /* ── M8.4.1 — STICKY DESKTOP SIDEBAR (≥900px): WINDOW scroll + sticky
     sidebar. The desktop scroll container is the WINDOW (NOT .ash-main) so
     in-content position:sticky elements — the shared .list-filterbar
     (list-header.css), authored for window-scroll at top:calc(77px + …) —
     keep resolving against the window and pin correctly at the top of the
     card list. The reverted M8.4 approach made .ash-main the scroll
     container, which reparented every descendant sticky's offset context
     and floated the filter bar 77px into the list (M8.4.1 BUG 2).
     align-self:start collapses the otherwise-stretched grid item to content
     height so position:sticky engages; top:62px is the desktop top-bar
     height (10px pad + 42px brand-logo + 10px pad; env(safe-area-inset-top)
     resolves to 0 at desktop). Own overflow-y + max-height keep an
     over-long group list reachable. .ash-top keeps its own sticky top:0
     rule (admin.css line ~49). 100vh max-height line is the no-dvh
     fallback. ── */
  @media (min-width: 900px) {
    .ash-side {
      position: sticky;
      top: 62px;
      align-self: start;
      max-height: calc(100vh - 62px);
      max-height: calc(100dvh - 62px);
      overflow-y: auto;
    }
  }

  /* ── M8.4 — MOBILE NAV (≤899px): glass nav sheet replaces the M8.1
     horizontal-scroll strip. The sidebar hides entirely; .ash-navtrigger (a
     real native <select> grouped via <optgroup>, fronted by the C97-B glass
     dropdown — bottom sheet <640px per the component's LOCKED C101
     breakpoint, anchored popover 640–899px) is the only small-width nav.
     The trigger surface (.tg-dd-select-trigger, 44px min) is styled by
     /css/_lib/dropdown.css; this block only places the bar. Group labels,
     current-item accent (red checkmark), keyboard + Escape + scrim dismissal
     and focus-return all come from the shared component. ── */
  .ash-navtrigger { display: none; }
  @media (max-width: 899px) {
    .ash-shell { display: block; }
    .ash-side { display: none; }
    .ash-navtrigger {
      display: block;
      padding: var(--space-2) var(--space-3);
      border-bottom: 1px solid var(--hairline);
    }
    .ash-search { display: none; }
    .ash-main { padding: var(--space-4) var(--space-3-5); }
  }

  /* Phone compression (≤560px): the full brand row (154px wordmark + Admin
     divider + badge + Portal + avatar) exceeds 375px — shrink the wordmark,
     drop the Admin divider label, tighten gaps, and allow the row to wrap so
     staging-only extras (the demo-reset button) fold to a second line instead
     of panning the document horizontally. */
  @media (max-width: 560px) {
    .ash-top { gap: var(--space-2); padding-left: var(--space-3); padding-right: var(--space-3); flex-wrap: wrap; }
    .ash-brand .brand-logo { height: 32px; }
    .ash-brand-admin { display: none; }
  }

  /* [hidden] must beat the explicit display values above (source-order win at
     equal specificity — keep these LAST in the shell section). */
  .ash-top[hidden], .ash-shell[hidden] { display: none; }

  /* ── Dashboard view (admin.html default, M8.1) — greeting + KPI tiles from
     the existing admin-list totals + Sales engine deep-link tiles. ── */
  .adb-greet { margin-bottom: var(--space-5); }
  .adb-greet-title { font-family: var(--font-serif); font-size: var(--text-3xl); color: var(--text); margin: 0; }
  .adb-greet-date { color: var(--text-muted); font-size: var(--text-md); margin-top: var(--space-1); }
  /* M8.2a: 5-up — the four admin-list tiles + the follow-ups-due tile;
     collapses to the existing 2-up at ≤899px. */
  .adb-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
  .adb-kpi {
    position: relative;
    background: var(--tier1-bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: var(--space-4);
    font-family: var(--font-sans);
    font-size: var(--text-md);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.18s var(--ease-spring);
  }
  .adb-kpi:hover { border-color: var(--border-strong); }
  .adb-kpi:active { transform: scale(var(--press-scale)); }
  .adb-kpi-n { display: block; font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; }
  /* Follow-ups tile (M8.2a): quiet at 0; the count goes red when ≥1 is due. */
  .adb-kpi-n.is-due { color: var(--danger); }
  .adb-kpi-l { display: block; color: var(--text-muted); font-size: var(--text-sm); margin-top: 2px; }
  .adb-sect-title {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-disabled);
    margin: 0 0 var(--space-2-5);
  }
  .adb-engine { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
  .adb-engine-tile {
    display: block;
    background: var(--tier1-bg);
    border: 1px solid var(--hairline);
    border-left: 4px solid var(--red);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: var(--space-4) var(--space-4-5);
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.18s var(--ease-spring);
  }
  .adb-engine-tile:hover { border-top-color: var(--border-strong); border-right-color: var(--border-strong); border-bottom-color: var(--border-strong); }
  .adb-engine-tile:active { transform: scale(var(--press-scale)); }
  .adb-engine-title { color: var(--text); font-size: var(--text-base); font-weight: var(--weight-semibold); }
  .adb-engine-sub { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }
  @media (max-width: 899px) {
    .adb-kpis { grid-template-columns: repeat(2, 1fr); }
    .adb-engine { grid-template-columns: 1fr; }
  }

  /* CONTENT — sits inside .ash-main as of M8.1 (the shell owns the padding;
     the old standalone page padding would double up). */
  .admin-content { width: 100%; max-width: 1200px; margin: 0; padding: 0; }

  /* TOOLBAR */
  .toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-4); gap: var(--space-3); flex-wrap: wrap; }
  .toolbar-left { display: flex; align-items: center; gap: var(--space-3); }
  /* C107: was color:var(--white) — invisible on the light --bg. Foreground
     tokens flip correctly per theme (dark override in the DARK MODE block). */
  .toolbar-title { font-family: var(--font-serif); font-size: var(--text-3xl); color: var(--dark); }
  .toolbar-count { font-size: var(--text-md); color: var(--light); font-weight: var(--weight-regular); }
  .toolbar-right { display: flex; align-items: center; gap: var(--space-2); }
  .toolbar-toggle { display: flex; align-items: center; gap: var(--space-1-5); font-size: var(--text-md); color: var(--dark); cursor: pointer; user-select: none; }
  .toolbar-toggle input { margin: 0; cursor: pointer; }

  /* CARD */
  .admin-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: 0 2px 8px rgba(0,0,0,0.20); overflow: hidden; }

  /* TABLE (desktop) */
  .admin-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
  .admin-table thead { background: var(--surface-light); }
  .admin-table th { text-align: left; padding: var(--space-3) var(--space-3-5); font-weight: var(--weight-bold); color: var(--dark); border-bottom: 1px solid var(--border); font-size: var(--text-sm); text-transform: uppercase; letter-spacing: var(--tracking-wide); white-space: nowrap; }
  .admin-table td { padding: var(--space-3) var(--space-3-5); border-bottom: 1px solid var(--border); color: var(--dark); vertical-align: middle; }
  .admin-table tbody tr:last-child td { border-bottom: none; }
  .admin-table tbody tr:hover { background: var(--surface-light); }
  .admin-table .cell-mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: var(--text-sm); color: var(--mid); }
  .admin-table .cell-muted { color: var(--light); }
  .admin-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; }
  .admin-table .cell-nowrap { white-space: nowrap; }
  .admin-table select, .admin-table input[type="number"], .admin-table input[type="text"] {
    font-family: var(--font-sans); font-size: var(--text-md); padding: var(--space-1-5) var(--space-2-5);
    border: 1.5px solid var(--border); border-radius: 6px; color: var(--dark); background: var(--white); outline: none;
  }
  .admin-table select:focus, .admin-table input:focus { border-color: var(--red); }
  /* M8.4 — the leads-table status selects are C97-B glass selects: the native
     select is visually hidden, so the Tier-2 trigger carries the control.
     Bound its width inside the cell (the component default is width:100%,
     which is degenerate inside an auto-sized <td>). */
  .admin-table .tg-dd-select-trigger { width: auto; min-width: 120px; }
  .admin-table button { font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-semibold); padding: var(--space-1-5) var(--space-3); border: none; border-radius: 6px; background: var(--dark); color: var(--white); cursor: pointer; transition: opacity 0.15s; }
  .admin-table button:hover { opacity: 0.85; }
  .admin-table button:disabled { opacity: 0.5; cursor: not-allowed; }
  .admin-table button.btn-ghost { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border: var(--btn-secondary-border); box-shadow: var(--btn-secondary-shadow); border-radius: var(--btn-radius); transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .admin-table button.btn-ghost:hover { filter: brightness(1.06); }
  .admin-table button.btn-ghost:active { transform: scale(var(--press-scale)); }

  /* BADGES */
  .badge-pill { display: inline-block; padding: var(--space-0-5) var(--space-2); border-radius: 10px; font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: 0.2px; }
  .badge-green { background: #e7f7ec; color: var(--status-active-hover); }
  .badge-amber { background: #fef3c7; color: #92400e; }
  .badge-red { background: var(--danger-wash); color: #991b1b; }
  .badge-gray { background: var(--surface-light); color: #4b5563; }
  .badge-blue { background: var(--status-pending-wash); color: var(--status-pending-hover); }
  .badge-purple { background: #ede9fe; color: #5b21b6; }

  /* GRANT CREDITS INLINE */
  .grant-inline { display: flex; align-items: center; gap: var(--space-1-5); }
  .grant-inline input { width: 80px; }

  /* PAGINATION */
  .pagination { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3-5) var(--space-4); border-top: 1px solid var(--border); font-size: var(--text-md); color: var(--light); }
  .pagination-btns { display: flex; gap: var(--space-2); }
  .page-btn { padding: 7px 14px; border: var(--btn-secondary-border); border-radius: var(--btn-radius); background: var(--btn-secondary-bg); box-shadow: var(--btn-secondary-shadow); color: var(--btn-secondary-text); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .page-btn:hover:not(:disabled) { filter: brightness(1.06); }
  .page-btn:active { transform: scale(var(--press-scale)); }
  .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* LOADING + EMPTY */
  .state-wrap { padding: 60px 20px; text-align: center; color: var(--light); }
  .state-wrap h3 { font-family: var(--font-serif); font-size: var(--text-xl); color: var(--dark); margin-bottom: var(--space-1-5); }
  .spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--red); border-radius: 50%; animation: spin 0.6s linear infinite; margin: 0 auto 12px; }
  @keyframes spin { to { transform: rotate(360deg); } }

  /* TOAST — z-toast (M8.4 tier fix: was var(--z-modal), which left the toast
     UNDER the compose overlay's then-z-toast — the two were swapped). */
  .toast { position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%); background: var(--dark); color: var(--white); padding: var(--space-3) var(--space-5); border-radius: var(--radius-md); font-size: var(--text-md); font-weight: var(--weight-medium); box-shadow: 0 4px 14px rgba(0,0,0,0.3); z-index: var(--z-toast); opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; }
  .toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
  .toast.error { background: var(--red); }
  .toast.success { background: var(--green); }

  /* GATE (pre-auth check) */
  .gate { flex: 1; display: flex; align-items: center; justify-content: center; color: #aaa; font-size: var(--text-base); }

  /* MOBILE */
  @media (max-width: 699px) {
    .dash-nav { padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
    .dash-nav-title { font-size: var(--text-input); }
    .tab-bar { padding: 0 var(--space-3); top: 65px; }
    .tab-btn { padding: var(--space-3) var(--space-3); font-size: var(--text-md); }
    .admin-content { padding: var(--space-3-5); }
    .toolbar-title { font-size: var(--text-xl); }
    .admin-table th, .admin-table td { padding: var(--space-2-5) var(--space-2-5); font-size: var(--text-sm); }
  }

  /* PRIMARY BUTTON (Compose) */
  .btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); border: var(--btn-primary-border); box-shadow: var(--btn-primary-shadow); padding: var(--space-2) var(--space-3-5); border-radius: var(--btn-radius); font-family: var(--font-sans); font-size: var(--text-md); font-weight: var(--weight-semibold); cursor: pointer; transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .btn-primary:hover { filter: brightness(1.06); }
  .btn-primary:active { transform: scale(var(--press-scale)); }
  .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
  .btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border: var(--btn-secondary-border); box-shadow: var(--btn-secondary-shadow); padding: var(--space-2) var(--space-3-5); border-radius: var(--btn-radius); font-family: var(--font-sans); font-size: var(--text-md); font-weight: var(--weight-semibold); cursor: pointer; transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .btn-secondary:hover { filter: brightness(1.06); }
  .btn-secondary:active { transform: scale(var(--press-scale)); }
  .btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

  /* UPDATES TAB — list */
  .upd-list { display: flex; flex-direction: column; gap: var(--space-2-5); padding: var(--space-3-5); }
  .upd-row { background: var(--white); border: 1px solid var(--border); border-left: 4px solid var(--text-dim); border-radius: 10px; padding: var(--space-3) var(--space-3-5); display: flex; flex-direction: column; gap: var(--space-1); }
  .upd-row.t-feature, .upd-row.t-improvement { border-left-color: var(--status-active-hover); }
  .upd-row.t-fix          { border-left-color: #6b7280; }
  .upd-row.t-news         { border-left-color: var(--red); }
  .upd-row.t-maintenance  { border-left-color: var(--amber); }
  .upd-row-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; font-size: var(--text-xs); color: var(--light); }
  .upd-row-pill { display: inline-block; font-size: var(--text-xxs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: 0.4px; padding: var(--space-0-5) var(--space-2); border-radius: 6px; background: var(--border); color: #4b5563; }
  .upd-row-pill.t-feature, .upd-row-pill.t-improvement { background: var(--status-active-wash); color: var(--status-active-hover); }
  .upd-row-pill.t-fix         { background: var(--border); color: #4b5563; }
  .upd-row-pill.t-news        { background: var(--red-light); color: var(--red); }
  .upd-row-pill.t-maintenance { background: #fef3c7; color: #92400e; }
  .upd-row-title { font-size: var(--text-base); font-weight: var(--weight-bold); color: var(--dark); }
  .upd-row-body  { font-size: var(--text-md); color: var(--mid); white-space: pre-wrap; line-height: 1.45; }
  .upd-row-foot  { font-size: var(--text-xs); color: var(--light); display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-1); }

  /* MODAL — Compose. z-modal (M8.4 tier fix: was var(--z-toast)=2000, which
     (a) sat ABOVE the toast and (b) would bury the C97-B glass select panel
     (z-modal=1000) opened from #composeType. At z-modal the dropdown panel —
     a LATER <body> sibling at equal z — paints above the overlay, and the
     toast (now z-toast) floats over everything.) */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); display: none; align-items: center; justify-content: center; z-index: var(--z-modal); padding: var(--space-4); }
  .modal-overlay.show { display: flex; }
  .modal { background: var(--white); border-radius: 14px; max-width: 720px; width: 100%; max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.4); }
  .modal-head { padding: var(--space-4) var(--space-4-5); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
  .modal-title { font-family: var(--font-serif); font-size: var(--text-2xl); color: var(--dark); }
  .modal-close { background: none; border: none; padding: var(--space-1-5); cursor: pointer; color: var(--light); font-size: var(--text-3xl); line-height: 1; }
  .modal-body { padding: var(--space-4-5); overflow: auto; display: flex; flex-direction: column; gap: var(--space-3-5); }
  .modal-foot { padding: var(--space-3-5) var(--space-4-5); border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--space-2-5); }

  .field { display: flex; flex-direction: column; gap: var(--space-1-5); }
  .field-label { font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--mid); text-transform: uppercase; letter-spacing: 0.4px; }
  .field input[type="text"], .field input[type="url"], .field select, .field textarea { width: 100%; padding: var(--space-2-5) var(--space-3); border: 1.5px solid var(--border); border-radius: var(--radius-md); font-family: var(--font-sans); font-size: var(--text-base); color: var(--dark); background: var(--white); outline: none; transition: border-color 0.15s; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
  .field textarea { font-family: ui-monospace, 'SF Mono', Menlo, monospace; resize: vertical; min-height: 200px; line-height: var(--leading-relaxed); }
  .char-counter { font-size: var(--text-xs); color: var(--light); margin-top: var(--space-1); align-self: flex-end; }
  .char-counter.over { color: var(--red); font-weight: var(--weight-bold); }

  /* Toggle for "Send push" */
  .toggle-row { display: flex; align-items: center; justify-content: space-between; padding: var(--space-2-5) var(--space-3); background: var(--surface-light); border: 1px solid var(--border); border-radius: 10px; }
  .toggle-row-label { font-size: var(--text-md); font-weight: var(--weight-semibold); color: var(--dark); }
  .toggle-row-help  { font-size: var(--text-xs); color: var(--light); margin-top: var(--space-0-5); }
  .toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
  .toggle input { opacity: 0; width: 0; height: 0; }
  .toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-strong); transition: 0.2s; border-radius: 22px; }
  .toggle-slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: var(--white); transition: 0.2s; border-radius: 50%; }
  .toggle input:checked + .toggle-slider { background: var(--red); }
  .toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

  /* Live preview */
  .preview-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-3-5); background: var(--surface-light); display: flex; flex-direction: column; gap: var(--space-1-5); }
  .preview-card.is-unread { border-left: 4px solid var(--red); padding-left: 11px; }
  .preview-pill { display: inline-block; font-size: var(--text-xxs); font-weight: var(--weight-bold); text-transform: uppercase; letter-spacing: 0.4px; padding: var(--space-0-5) var(--space-2); border-radius: 6px; background: var(--border); color: #4b5563; align-self: flex-start; }
  .preview-pill.t-feature, .preview-pill.t-improvement { background: var(--status-active-wash); color: var(--status-active-hover); }
  .preview-pill.t-fix         { background: var(--border); color: #4b5563; }
  .preview-pill.t-news        { background: var(--red-light); color: var(--red); }
  .preview-pill.t-maintenance { background: #fef3c7; color: #92400e; }
  .preview-title { font-size: var(--text-input); font-weight: var(--weight-bold); color: var(--dark); }
  .preview-body  { font-size: var(--text-md); color: var(--mid); white-space: pre-wrap; line-height: var(--leading-relaxed); }

  /* Header image picker — sits between Body + Learn-more in the compose
     form. Native file input is hidden; the visible button triggers it.
     Once a file is picked the preview <img> appears + Remove button
     swaps in. The compose live preview also renders the image at the
     top of the .preview-card so admins see exactly what publishes. */
  .img-picker { display: flex; flex-direction: column; gap: var(--space-2); }
  .img-picker-row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
  .img-picker-btn { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border: var(--btn-secondary-border); box-shadow: var(--btn-secondary-shadow); padding: var(--space-2) var(--space-3-5); border-radius: var(--btn-radius); font-family: var(--font-sans); font-size: var(--text-md); font-weight: var(--weight-semibold); cursor: pointer; transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .img-picker-btn:hover { filter: brightness(1.06); }
  .img-picker-btn:active { transform: scale(var(--press-scale)); }
  .img-picker-btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .img-picker-remove { color: var(--red); background: none; border: none; padding: var(--space-1-5) var(--space-2); font-family: var(--font-sans); font-size: var(--text-sm); font-weight: var(--weight-semibold); cursor: pointer; }
  .img-picker-thumb { display: block; width: 100%; max-width: 360px; aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-light); }
  .img-picker-help { font-size: var(--text-xs); color: var(--light); }

  .preview-card { overflow: hidden; }
  .preview-header-img { display: block; width: calc(100% + 28px); margin: -14px -14px 6px; aspect-ratio: 16 / 9; object-fit: cover; background: var(--border); }
  .preview-card.is-unread .preview-header-img { width: calc(100% + 25px); margin-left: -11px; margin-right: -14px; }

  /* ── RESET DEMO DATA button (C107) — danger styling via the
     --btn-destructive-* tokens. M8.1: relocated from the (removed) tab bar to
     the .ash-top header action region, between the search chrome and the
     Portal link (pre-exec MEDIUM-3 approval) — flag-gating unchanged: hidden
     by default, page-admin.js removes [hidden] only after is_admin confirms
     AND window.TG.flags.get('demo_reset') is true (false on prod → physically
     absent on evotrustguard.com; C107 quadruple-lock gate #1). [hidden] MUST
     re-assert display:none over display:inline-flex (the hidden attribute is
     overruled by an explicit display). */
  .demo-reset-btn { flex-shrink: 0; align-self: center; display: inline-flex; align-items: center; justify-content: center; padding: var(--space-1-5) var(--space-3); border-radius: var(--btn-radius); font-family: var(--font-sans); font-size: var(--text-md); font-weight: var(--weight-semibold); background: var(--btn-destructive-bg); color: var(--btn-destructive-text); border: var(--btn-destructive-border); box-shadow: none; cursor: pointer; white-space: nowrap; transition: filter 0.15s ease, transform 0.18s var(--ease-spring); }
  .demo-reset-btn:hover { filter: brightness(1.1); }
  .demo-reset-btn:active { transform: scale(var(--press-scale)); }
  .demo-reset-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
  .demo-reset-btn[hidden] { display: none; }
  @media (max-width: 699px) {
    .demo-reset-btn { padding: var(--space-1) var(--space-2); font-size: var(--text-sm); }
  }

  /* ════════════════════════════════════════════════════════════════════════
     TrustGuard Glass — DARK MODE OVERRIDES (LOCKED C97-A / C99-A, dark-only).
     The admin page was the last unconverted portal surface — converted in C107.
     Light base above stays the pre-Glass flat surface (provisional, reworked at
     the Phase 4 light sprint). Recipe mirrors the just-shipped page-invoice-
     detail.css: Tier-1 raised cards (gradient + hairline + ::before edge
     highlight + float shadow + 18px radius), Tier-3 glass modal (tint + blur +
     saturate + glass edge + drop shadow + @supports opaque fallback), Tier-2
     recessed form wells. Monochromatic per C97-A — NO decorative red card
     chrome; MEANING colors (status pills, update-type border-lefts, the unread
     red border, the brand-red toggle/focus) are PRESERVED.
     ════════════════════════════════════════════════════════════════════════ */

  /* Chrome — header + tab bar adopt the dark surface (C38 header rule). */
  [data-theme="dark"] .dash-nav,
  [data-theme="dark"] .tab-bar { background: var(--surface); border-bottom-color: var(--border); }
  [data-theme="dark"] .dash-nav-title { color: var(--text); }
  [data-theme="dark"] .dash-nav-link { color: var(--text-muted); }
  [data-theme="dark"] .dash-nav-link:hover { color: var(--text); }
  [data-theme="dark"] .tab-btn { color: var(--text-muted); }
  [data-theme="dark"] .tab-btn:hover { color: var(--text); }
  [data-theme="dark"] .tab-btn.active { color: var(--red); }

  /* Toolbar text (also fixes the former light var(--white) invisibility). */
  [data-theme="dark"] .toolbar-title { color: var(--text); }
  [data-theme="dark"] .toolbar-count { color: var(--text-muted); }
  [data-theme="dark"] .toolbar-toggle { color: var(--text); }
  [data-theme="dark"] .gate,
  [data-theme="dark"] .state-wrap { color: var(--text-muted); }
  [data-theme="dark"] .state-wrap h3 { color: var(--text); }

  /* Tier-1 RAISED card — .admin-card (table shell). Monochromatic; depth carries
     the hierarchy. overflow:hidden is retained for the table corner clip; the
     float shadow is unaffected (shadow paints outside the box). */
  [data-theme="dark"] .admin-card {
    position: relative;
    background: var(--tier1-bg);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-float);
    color: var(--text);
  }
  [data-theme="dark"] .admin-card::before {
    content: ""; position: absolute; top: 0; left: 14px; right: 14px;
    height: 1px; background: linear-gradient(90deg, transparent, var(--edge-highlight), transparent);
    pointer-events: none; z-index: 1;
  }

  /* Table interior (dark). */
  [data-theme="dark"] .admin-table thead { background: var(--surface-elevated); }
  [data-theme="dark"] .admin-table th { color: var(--text-muted); border-bottom-color: var(--border); }
  [data-theme="dark"] .admin-table td { color: var(--text); border-bottom-color: var(--border); }
  [data-theme="dark"] .admin-table tbody tr:hover { background: var(--surface-elevated); }
  [data-theme="dark"] .admin-table .cell-muted,
  [data-theme="dark"] .admin-table .cell-mono { color: var(--text-muted); }
  /* Tier-2 recessed wells for the inline table controls. The :focus red border
     (base rule) is preserved — red signals interactivity (MEANING). */
  [data-theme="dark"] .admin-table select,
  [data-theme="dark"] .admin-table input[type="number"],
  [data-theme="dark"] .admin-table input[type="text"] {
    background: var(--tier2-bg); border: 1px solid var(--hairline);
    box-shadow: var(--tier2-inset); color: var(--text);
  }
  [data-theme="dark"] .admin-table input::placeholder { color: var(--text-disabled); }
  /* The inline Grant button base is var(--dark)/var(--white) — repaint to a
     legible elevated surface in dark. */
  [data-theme="dark"] .admin-table button { background: var(--surface-elevated); color: var(--text); }
  [data-theme="dark"] .admin-table button:hover { opacity: 1; filter: brightness(1.15); }

  /* Pagination divider. */
  [data-theme="dark"] .pagination { color: var(--text-muted); border-top-color: var(--border); }

  /* Tier-1 RAISED card — .upd-row (Updates list). The status-type border-LEFT
     (meaning) is preserved; only top/right/bottom flip to hairline (NOT the
     `border` shorthand, which would clobber the accent). */
  [data-theme="dark"] .upd-row {
    position: relative;
    background: var(--tier1-bg);
    border-top: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-float);
  }
  [data-theme="dark"] .upd-row::before {
    content: ""; position: absolute; top: 0; left: 14px; right: 14px;
    height: 1px; background: linear-gradient(90deg, transparent, var(--edge-highlight), transparent);
    pointer-events: none;
  }
  [data-theme="dark"] .upd-row-title { color: var(--text); }
  [data-theme="dark"] .upd-row-body { color: var(--text-muted); }
  [data-theme="dark"] .upd-row-head,
  [data-theme="dark"] .upd-row-foot { color: var(--text-muted); }

  /* Tier-3 GLASS modal — Compose Update. Mirrors the shared .sheet / .invd-sheet
     recipe: translucent tint + blur + saturate + glass edge + drop shadow +
     inset top-edge highlight. Head/foot go transparent so the glass reads as one
     surface. (.modal was deferred out of the 3G.2 shared sprint as admin-only —
     converted here in C107.) */
  [data-theme="dark"] .modal {
    background: var(--tier3-tint);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
    border: 1px solid var(--glass-edge);
    color: var(--text);
    box-shadow: var(--glass-shadow), inset 0 1px 0 var(--edge-highlight);
  }
  [data-theme="dark"] .modal-head,
  [data-theme="dark"] .modal-foot { background: transparent; border-color: var(--glass-edge); }
  [data-theme="dark"] .modal-title { color: var(--text); }
  [data-theme="dark"] .modal-close { color: var(--text-muted); }
  /* Opaque-tint fallback where backdrop-filter is unsupported (mirrors the
     shared-themes.css @supports block). */
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    [data-theme="dark"] .modal { background: var(--tier3-tint-opaque); }
  }

  /* Tier-2 RECESSED form wells inside the modal. :focus red border preserved. */
  [data-theme="dark"] .field-label { color: var(--text-muted); }
  [data-theme="dark"] .field input[type="text"],
  [data-theme="dark"] .field input[type="url"],
  [data-theme="dark"] .field select,
  [data-theme="dark"] .field textarea {
    background: var(--tier2-bg); border: 1px solid var(--hairline);
    box-shadow: var(--tier2-inset); color: var(--text);
  }
  [data-theme="dark"] .field input::placeholder,
  [data-theme="dark"] .field textarea::placeholder { color: var(--text-disabled); }
  [data-theme="dark"] .char-counter { color: var(--text-muted); }

  /* Grouped-setting "Send push" row — Tier-2 recessed container (toggle keeps
     its brand-red checked state). */
  [data-theme="dark"] .toggle-row {
    background: var(--tier2-bg); border: 1px solid var(--hairline); box-shadow: var(--tier2-inset);
  }
  [data-theme="dark"] .toggle-row-label { color: var(--text); }
  [data-theme="dark"] .toggle-row-help { color: var(--text-muted); }

  /* Live preview card — recessed elevated surface; the unread red left-border
     (meaning) is preserved. */
  [data-theme="dark"] .preview-card {
    background: var(--surface-elevated);
    border-top: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
  }
  [data-theme="dark"] .preview-title { color: var(--text); }
  [data-theme="dark"] .preview-body { color: var(--text-muted); }
  [data-theme="dark"] .img-picker-help { color: var(--text-muted); }

  /* Toast — opaque glass surface (a toast floats over arbitrary content, so NO
     backdrop-filter, per the C97-A toast carve-out). .error/.success keep their
     meaning colors from the base rules. */
  [data-theme="dark"] .toast {
    background: var(--glass-surface); color: var(--text);
    border: 1px solid var(--glass-edge); box-shadow: var(--glass-shadow);
  }
