/* EVO TrustGuard — shared themes
 *
 * User-selectable dark/light mode toggle (C37 Dark Mode sprint).
 *
 * Theme model:
 *   - Default / [data-theme="light"] → preserves the existing portal palette
 *     from css/shared.css exactly. Do not alter light-mode values here —
 *     the project's existing look is the source of truth.
 *   - [data-theme="dark"] → near-black backdrop (#0a0a0a), elevated
 *     surfaces (#141414 / #1c1c1c), muted borders (#2a2a2a), brand red
 *     shifted to the more legible dark-mode value (#e5342e) per the
 *     approved dark-mode mockups.
 *
 * Loading order on every portal page:
 *     <link rel="stylesheet" href="/css/shared.css">
 *     <link rel="stylesheet" href="/shared-themes.css">
 *     <script src="/theme-toggle.js"></script>   <!-- synchronous, in <head> -->
 * shared-themes.css must come AFTER css/shared.css so its dark-mode
 * overrides win the cascade.
 *
 * Semantic overload note:
 *   Existing portal pages use var(--white) both as a "brand white" token
 *   (white text on red buttons, avatar fg, push-banner copy) AND as a
 *   generic "card surface" background. Swapping --white globally would
 *   break the text-on-red usage. So this stylesheet:
 *     1. Keeps --white == #ffffff in every theme.
 *     2. Adds selector-based overrides for surfaces that must go dark
 *        (cards, tiles, bottom nav, sheets, filter bars, etc.).
 *     3. Explicitly pins the EVO TrustGuard white logo header
 *        (.dash-nav, .top-bar) to white in both themes, and scopes
 *        the nav interior to light-mode CSS variables via a nested
 *        cascade so avatar/back-button/title contrast stays correct
 *        against the white header background.
 *
 * EVO TrustGuard logo header is white in BOTH themes by product decision
 * — do NOT generalize the dark card override to .dash-nav or .top-bar.
 */

/* ── Default / light theme ───────────────────────────────────────────── */

:root,
:root[data-theme="light"] {
  /* Additional semantic aliases that newer mockups reference.
   * Light-mode values picked to match existing shared.css tokens so that
   * any future code can use the semantic name without changing visuals. */
  --surface: #ffffff;
  --surface-elevated: #fafafa;
  --border-strong: #d0d0d0;
  --text: #1a1a1a;
  --text-muted: #666666;
  --text-dim: #999999;
  --purple: #7c3aed;
  --red-dim: #f9e8e8;
}

/* ── Dark theme ──────────────────────────────────────────────────────── */

:root[data-theme="dark"] {
  /* Swap of the 11 core tokens defined in css/shared.css. --white is
   * intentionally NOT swapped (see header comment). */
  --bg: #0a0a0a;
  --dark: #f5f5f5;
  --mid: #cccccc;
  --light: #9a9a9a;
  --border: #2a2a2a;
  --red: #e5342e;
  --red-hover: #c72a25;
  --red-light: rgba(229, 52, 46, 0.12);
  --green: #22c55e;
  --amber: #f59e0b;

  /* New semantic aliases */
  --surface: #141414;
  --surface-elevated: #1c1c1c;
  --border-strong: #3a3a3a;
  --text: #f5f5f5;
  --text-muted: #9a9a9a;
  --text-dim: #6a6a6a;
  --purple: #8b5cf6;
  --red-dim: rgba(229, 52, 46, 0.12);
}

/* ── Dark-mode surface overrides ─────────────────────────────────────── *
 * Target class names known to render card / surface backgrounds across
 * portal pages. Kept narrow so we don't accidentally repaint elements
 * that are meant to be red (buttons), dark (avatars, toasts), or
 * transparent (layout containers).
 */

[data-theme="dark"] body {
  background: var(--bg);
  color: var(--dark);
}

/* Cards, tiles, lead cards, client cards, skeletons, sheets, filter
 * surfaces, load-more, bottom nav, filter selects/chips, menus, tab
 * strips, and the sticky detail topbars. Any surface that uses
 * `background: var(--white)` OR a hardcoded `#ffffff` for its card fill
 * should be in this list. */
[data-theme="dark"] .card,
[data-theme="dark"] .tile,
[data-theme="dark"] .lead-card,
[data-theme="dark"] .client-card,
[data-theme="dark"] .skeleton-card,
[data-theme="dark"] .sheet,
[data-theme="dark"] .bottom-nav,
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .filter-row,
[data-theme="dark"] .filter-tabs,
[data-theme="dark"] .title-row,
[data-theme="dark"] .filter-select,
[data-theme="dark"] .filter-chip,
[data-theme="dark"] .filter-tab,
[data-theme="dark"] .filter-menu,
[data-theme="dark"] .load-more-btn,
[data-theme="dark"] .detail-topbar,
[data-theme="dark"] .card-topbar,
[data-theme="dark"] .doc-action,
[data-theme="dark"] .card-pass,
[data-theme="dark"] .skeleton-line,
[data-theme="dark"] .quote-field textarea,
[data-theme="dark"] .sheet-field input,
[data-theme="dark"] .sheet-field select,
[data-theme="dark"] .sheet-field textarea {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Dashboard tile left-border red accent — the bulk `border-color` override
 * above would otherwise repaint the red accent to var(--border) in dark
 * mode. Re-pin so the accent stays persistent idle AND hover, matching
 * light-mode behavior. */
[data-theme="dark"] .tile { border-left-color: var(--red); }

/* Muted / "Coming soon" tile on dashboard — elevated surface, not the
 * primary surface, so it reads as a disabled state against neighbors. */
[data-theme="dark"] .tile-muted {
  background: var(--surface-elevated);
  border-left-color: var(--red);
}

/* Tile icon chip — shared light-gray chip behind a 20px svg. In dark
 * mode this needs to lift above the card surface. */
[data-theme="dark"] .tile .tile-icon {
  background: var(--surface-elevated);
  color: var(--text);
}
[data-theme="dark"] .tile-priority .tile-icon {
  background: var(--red-dim);
  color: var(--red);
}
[data-theme="dark"] .tile-muted .tile-icon {
  background: #222222;
  color: var(--text-dim);
}
[data-theme="dark"] .tile-coming {
  background: #222222;
  color: var(--text-dim);
}
[data-theme="dark"] .tile-muted .tile-label { color: var(--text-muted); }
[data-theme="dark"] .tile-muted .tile-subtitle { color: var(--text-dim); }

/* Lead-card / client-card internal chrome — the top bar area that uses
 * hardcoded #f8f8f8 across marketplace, my-leads, lead-detail. */
[data-theme="dark"] .card-topbar {
  background: var(--surface-elevated);
  border-bottom-color: var(--border);
}

/* Purchased-lead / client-detail round icon buttons (40×40 #f4f4f4). */
[data-theme="dark"] .icon-btn {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}

/* Filter menu items (my-leads dropdown) — hover uses hardcoded #f5f5f5. */
[data-theme="dark"] .filter-menu-item { color: var(--text); }
[data-theme="dark"] .filter-menu-item:hover { background: var(--surface-elevated); }

/* Dashboard greeting subtitle pins to a visible gray — hardcoded #a8a8a8
 * in light mode was chosen against the dark body backdrop, which still
 * applies in dark mode, so leave it alone unless the author explicitly
 * overrides it. No rule needed. */

/* ── EVO TrustGuard header — theme-adaptive ──────────────────────────── *
 * Header surface now follows the active theme. In light mode it inherits
 * the page-level white from the page's own .dash-nav / .top-bar rule; in
 * dark mode we repaint it to the elevated surface token so it reads as a
 * raised container against the near-black body. The logo itself swaps
 * its text-color fills via CSS variables (see .brand-evo /
 * .brand-trustguard below) so EVO stays red and "TrustGuard" flips from
 * dark-grey (light theme) to light-grey (dark theme).
 */

[data-theme="dark"] .dash-nav,
[data-theme="dark"] .top-bar {
  background: var(--surface);
  border-bottom-color: var(--border);
}

/* ── Theme toggle button (appears in the top nav) ────────────────────── *
 * Circular, ghost-style, matching the rhythm of the nav avatar / back
 * button. Same size on both desktop and mobile. Sun icon shows when
 * the current theme is DARK (so clicking switches back to light); moon
 * icon shows when the current theme is LIGHT.
 */

.nav-theme-toggle {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: 10px;
  background: transparent;
  border: none;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--dark);
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
  flex-shrink: 0;
}
.nav-theme-toggle:hover { background: var(--border); color: var(--dark); }
.nav-theme-toggle:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.nav-theme-toggle svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}
.nav-theme-toggle .theme-icon-sun { display: none; }
.nav-theme-toggle .theme-icon-moon { display: block; }
:root[data-theme="dark"] .nav-theme-toggle .theme-icon-sun { display: block; }
:root[data-theme="dark"] .nav-theme-toggle .theme-icon-moon { display: none; }

/* ── Appearance card (Profile & Settings → Appearance section) ───────── *
 * Segmented Light / Dark control rendered by profile.html. Layout
 * matches the other `.card-body` rows on the Profile page (padding 14px
 * 18px 18px, gap 10px).
 */

.appearance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
}
.appearance-label {
  font-size: 14px;
  color: var(--dark);
  font-weight: 500;
}
.appearance-options {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.appearance-opt {
  appearance: none;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s, color 0.15s;
}
.appearance-opt + .appearance-opt { border-left: 1px solid var(--border); }
.appearance-opt:hover { color: var(--dark); }
.appearance-opt.is-active {
  background: var(--red);
  color: #ffffff;
}
.appearance-opt.is-active:hover { color: #ffffff; }
.appearance-opt svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.appearance-helper {
  font-size: 12px;
  color: var(--light);
  margin-top: 10px;
  line-height: 1.45;
}

/* ── Detail-page surfaces (lead-detail, purchased-lead, client-detail) ─ *
 * These pages render their content in cards that hardcode
 * `background: var(--white)` across their inline <style> blocks. Pin the
 * card surfaces to the dark surface token so the content stays readable
 * when the body backdrop is near-black.
 *
 * Light-mode (default) already paints these as white via the page's own
 * CSS — we only need the dark-theme side.
 */

[data-theme="dark"] .detail-header,
[data-theme="dark"] .detail-section,
[data-theme="dark"] .pl-section,
[data-theme="dark"] .contact-header,
[data-theme="dark"] .contract-card,
[data-theme="dark"] .date-tile,
[data-theme="dark"] .tabs-bar,
[data-theme="dark"] .sticky-panel,
[data-theme="dark"] .lead-sticky-header,
[data-theme="dark"] .purchase-footer,
[data-theme="dark"] .kebab-menu,
[data-theme="dark"] .pl-kebab-menu,
[data-theme="dark"] .quote-sheet,
[data-theme="dark"] .quote-sheet-header,
[data-theme="dark"] .hired-modal {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Elevated surfaces — quote preview, quick action chips, kebab buttons,
 * assignment blocks, and similar raised tiles sitting on top of a
 * surface-level card. These used #f4f4f4 / #f7f7f7 / #f8f8f8 / #ebebeb
 * in light mode; lift them above the surface token in dark mode. */
[data-theme="dark"] .pl-kebab-btn,
[data-theme="dark"] .quick-action,
[data-theme="dark"] .quote-preview-box,
[data-theme="dark"] .asgn-block,
[data-theme="dark"] .asgn-inline-form {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .asgn-header {
  background: #232323;
  border-color: var(--border);
  color: var(--text);
}
[data-theme="dark"] .pl-kebab-btn:hover,
[data-theme="dark"] .quick-action:hover {
  background: #262626;
  border-color: var(--border-strong);
}

/* Kebab / filter menu hover rows (light mode used #f5f5f5). */
[data-theme="dark"] .kebab-item,
[data-theme="dark"] .pl-kebab-item {
  color: var(--text);
}
[data-theme="dark"] .kebab-item:hover,
[data-theme="dark"] .pl-kebab-item:hover {
  background: var(--surface-elevated);
}

/* Inputs, selects, and textareas on detail pages — CIS sheet, assignment
 * editor, quote/notes fields, pass/reminder/SMS pill buttons, pl-select
 * dropdown. They all use `background: #fff` or `background: var(--white)`
 * in light mode; in dark mode they need to sit on the surface token with
 * a legible text color. */
[data-theme="dark"] .cis-input,
[data-theme="dark"] .cis-textarea,
[data-theme="dark"] .cis-select,
[data-theme="dark"] .pl-select,
[data-theme="dark"] .notes-textarea,
[data-theme="dark"] .task-input,
[data-theme="dark"] .btn-pass,
[data-theme="dark"] .btn-sms,
[data-theme="dark"] .btn-reminder,
[data-theme="dark"] .cis-btn-secondary,
[data-theme="dark"] .cis-populate-btn,
[data-theme="dark"] .asgn-day-btn,
[data-theme="dark"] .asgn-btn-dup,
[data-theme="dark"] .asgn-btn-rm,
[data-theme="dark"] .asgn-inline-cancel,
[data-theme="dark"] .asgn-body .cis-input,
[data-theme="dark"] .asgn-body .cis-select,
[data-theme="dark"] .asgn-body .cis-textarea,
[data-theme="dark"] .poc-phone-type-btn,
[data-theme="dark"] .fee-type-btn,
[data-theme="dark"] .cis-ab-btn,
[data-theme="dark"] .cis-totals-btn,
[data-theme="dark"] .hired-btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Keep the red-tinted active states of the toggle pills correct in dark
 * mode — the `.active` variants inline `background: #B31217` which reads
 * fine against dark, but we want to make sure our generic override above
 * does not win over them. These specific rules keep the active visual. */
[data-theme="dark"] .cis-ab-btn.active,
[data-theme="dark"] .cis-totals-btn.active,
[data-theme="dark"] .fee-type-btn.active {
  background: var(--red);
  border-color: var(--red);
  color: #ffffff;
}

/* Chrome/Safari autofill override — by default the browser paints a
 * yellow/white inset background on autofilled inputs (and keeps it after
 * the user types), which clobbers the dark-mode surface treatment above.
 * `-webkit-box-shadow` with a large inset is the only way to repaint the
 * autofill background; `-webkit-text-fill-color` keeps typed text legible
 * in dark mode. Scoped to dark mode so light mode keeps Chrome's default
 * autofill highlight. */
[data-theme="dark"] .cis-input:-webkit-autofill,
[data-theme="dark"] .cis-textarea:-webkit-autofill,
[data-theme="dark"] .cis-select:-webkit-autofill,
[data-theme="dark"] .pl-select:-webkit-autofill,
[data-theme="dark"] .notes-textarea:-webkit-autofill,
[data-theme="dark"] .task-input:-webkit-autofill,
[data-theme="dark"] .asgn-body .cis-input:-webkit-autofill,
[data-theme="dark"] .asgn-body .cis-textarea:-webkit-autofill,
[data-theme="dark"] .asgn-body .cis-select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  border-color: var(--border-strong) !important;
}

/* Billing-mode underline tabs (Hours per shift / Hits per shift) override
 * the generic .cis-ab-btn dark-surface treatment from the block above so
 * the tabs stay transparent and the red underline is the only visual
 * indicator of the active state. Scoped via the .asgn-bill-tabs wrapper
 * so only the billing-mode A/B pair is affected. */
[data-theme="dark"] .asgn-bill-tabs .cis-ab-btn {
  background: none;
  border-color: transparent;
  color: var(--text-muted);
}
[data-theme="dark"] .asgn-bill-tabs .cis-ab-btn.active {
  background: none;
  border-color: transparent;
  border-bottom-color: var(--red);
  color: var(--text);
}

/* Reminder "set" chip uses red-light in light mode (pale pink) — in dark
 * mode that becomes the translucent red-dim token. */
[data-theme="dark"] .btn-reminder.set {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

/* Card-topbar variant — in shared-themes we already override .card-topbar
 * to surface, but on lead-detail / purchased-lead the pill inside
 * (.card-situation-pill) also has a hardcoded #f8f8f8 background and
 * #d0d0d0 border. Bring it up one level so the pill is still visible
 * against the elevated topbar. */
[data-theme="dark"] .card-situation-pill {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-muted);
}

/* Lead-status pills on purchased-lead / my-leads that fall back to a
 * neutral light grey in light mode (#f0f0f0 / #e0e0e0). Dark mode needs
 * a surface-elevated fill.
 *
 * Client-status pills (.client-status-pill on clients.html, .status-pill
 * + .contract-status-pill on client-detail.html) are intentionally NOT
 * listed here — they already render as dark-charcoal + semi-transparent
 * color wash in BOTH themes by design, so no dark-mode override is
 * needed. Adding them here would repaint the charcoal base to
 * surface-elevated and wipe out the status hue. */
[data-theme="dark"] .status-new,
[data-theme="dark"] .status-contacted,
[data-theme="dark"] .status-proposal,
[data-theme="dark"] .status-hired,
[data-theme="dark"] .status-archived,
[data-theme="dark"] .contract-badge {
  background: var(--surface-elevated);
  border-color: var(--border);
  color: var(--text-muted);
}

/* The sticky detail topbar class — already listed above in the surface
 * override block. Re-state separately so the pinned-below-nav variant
 * in client-detail keeps its border-bottom hugging the surface. */
[data-theme="dark"] .detail-topbar {
  border-bottom-color: var(--border);
}

/* Empty / placeholder text in detail panels — light mode uses #bbb, #ccc,
 * which vanish against a dark backdrop. */
[data-theme="dark"] .field-empty,
[data-theme="dark"] .tab-empty-icon {
  color: var(--text-dim);
}

/* Lead-card header info that uses hardcoded muted greys.
 * #888 / #bbb are close enough to the dark-mode muted tokens that they
 * already read, but normalize them to our token for consistency. */
[data-theme="dark"] .card-business,
[data-theme="dark"] .card-location {
  color: var(--text-muted);
}
[data-theme="dark"] .card-time {
  color: var(--text-dim);
}

/* Contact value links on client-detail default to var(--dark) which is
 * correctly re-mapped by the token swap — no rule needed. */

/* Purchased-lead "type-standard" pill (light blue on blue). Keep its
 * light-mode palette in both themes — it is a category badge, not a
 * surface, and the contrast already reads on dark. No rule needed. */

/* Green "notes saved" inline hint reads fine on dark; leave alone. */

/* Success-state banners on lead-detail (.unavailable-banner with
 * red-light bg, .purchased-banner with green bg) are intentionally tinted
 * and read correctly on dark mode via --red-light swap + the green bg
 * that ships the same hue in both themes. No rule needed. */

/* ── Hired success modal (Mark Hired → Client created) ───────────────── *
 * Lives inside the .hired-overlay scrim on purchased-lead.html. The
 * modal body (.hired-modal) is covered by the surface override above;
 * the secondary button (.hired-btn-secondary) is covered by the inputs
 * block above. The green check icon keeps its pale-green bg in both
 * themes — it reads as a success mark regardless of page backdrop, so
 * no override needed. Title + body copy inherit via var(--dark) which
 * resolves to our light text token in dark mode.
 */

/* ── Inline success card (suggestion-box.html) ───────────────────────── *
 * Full-page success state after submit. `.success-card` uses
 * `background: var(--white)` in light mode — swap to the surface token
 * in dark mode. `.success-btn` is a ghost secondary button that also
 * starts on white; route it to surface-elevated. Check icon keeps pale
 * green like the hired modal — success mark is universal.
 */
[data-theme="dark"] .success-card {
  background: var(--surface);
  border-color: var(--border);
  border-left-color: var(--red);
}
[data-theme="dark"] .success-btn {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
  color: var(--text);
}
[data-theme="dark"] .success-btn:hover {
  background: #262626;
  border-color: var(--text-muted);
}

/* ── Create Lead page (create-lead.html) ─────────────────────────────── *
 * CIS / Freeform / Import tabs sit under the sticky white top-bar. The
 * tab selector bar and tab buttons both default to `var(--white)` in
 * light mode — swap to the surface tokens in dark mode so they don't
 * stack as two white bars below the pinned white header.
 *
 * The CIS input stack (`.cis-input`, `.cis-select`, `.cis-textarea`,
 * `.pl-section`, `.asgn-block`, `.asgn-header`, etc.) is already covered
 * by the detail-page overrides above — the rules below only handle
 * surfaces that are unique to create-lead.
 */
[data-theme="dark"] .tab-selector {
  background: var(--surface);
  border-bottom-color: var(--border);
}
/* Scoped to the create-lead underline tab row. Create-lead's inline rules
 * already use var(--dark) / var(--light) so text color auto-adapts — the
 * only reason we need dark overrides here is the default shared-themes
 * `.cis-input / .cis-ab-btn / etc.` block further down in this file paints
 * a surface background on anything with class .cis-ab-btn, and the tab
 * buttons need to stay fully transparent to show the underline cleanly. */
[data-theme="dark"] .tab-selector .tab-btn {
  background: none;
  color: var(--text-muted);
}
[data-theme="dark"] .tab-selector .tab-btn.active {
  background: none;
  color: var(--text);
  border-bottom-color: var(--red);
}

/* Underline-style sticky tab bar (purchased-lead, client-detail, admin).
 * Page-level CSS already uses var(--dark) / var(--light) for the colors,
 * which the theme tokens handle correctly — active goes light in dark
 * mode, inactive stays muted. Pin the bar surface to the dark surface
 * token so it matches the detail topbar it sits beneath. */
[data-theme="dark"] .tabs-bar {
  background: var(--surface);
  border-color: var(--border);
}
[data-theme="dark"] .tabs-bar .tab-btn {
  color: var(--text-muted);
}
[data-theme="dark"] .tabs-bar .tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

/* Freeform textarea + Import dropzone surfaces. */
[data-theme="dark"] .freeform-textarea {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
[data-theme="dark"] .dropzone {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}
[data-theme="dark"] .dropzone:hover {
  background: #262626;
  border-color: var(--text-muted);
}
[data-theme="dark"] .dropzone-label {
  color: var(--text);
}
[data-theme="dark"] .dropzone-subtext,
[data-theme="dark"] .dropzone-file-size,
[data-theme="dark"] .dropzone-icon {
  color: var(--text-muted);
}
[data-theme="dark"] .dropzone-file {
  color: var(--text);
}

/* Multi-file list rows + fee line-items — both sit on #f8f8f8 in light
 * mode. Lift to surface-elevated in dark. */
[data-theme="dark"] .imp-file-row,
[data-theme="dark"] .fees-item {
  background: var(--surface-elevated);
  border-color: var(--border);
}
[data-theme="dark"] .imp-file-name,
[data-theme="dark"] .fees-item-name,
[data-theme="dark"] .fees-item-amt {
  color: var(--text);
}
[data-theme="dark"] .imp-file-meta {
  color: var(--text-muted);
}

/* AI hint row, preview hint, helper copy — light-mode #555/#888/#999. */
[data-theme="dark"] .ai-hint,
[data-theme="dark"] .preview-hint {
  color: var(--text-muted);
}
[data-theme="dark"] .preview-empty {
  color: var(--text-dim);
}
[data-theme="dark"] .preview-back {
  color: var(--text-muted);
}
[data-theme="dark"] .preview-back:hover {
  color: var(--text);
}

/* CIS label / section title / divider — native light-mode #555 + #e0e0e0. */
[data-theme="dark"] .cis-label,
[data-theme="dark"] .cis-section-title,
[data-theme="dark"] .cis-totals-label {
  color: var(--text-muted);
}
[data-theme="dark"] .cis-divider {
  background: var(--border);
}

/* Assignment block header copy + POC helper copy. */
[data-theme="dark"] .poc-text-check,
[data-theme="dark"] .asgn-title {
  color: var(--text);
}

/* ── Suggestion Box page (suggestion-box.html) ───────────────────────── *
 * Form surfaces that the page's own stylesheet pins to var(--white),
 * #fafafa, #f3f3f3 in light mode. The .card / .success-card / .success-btn
 * surfaces are already handled by the generic overrides at the top of
 * this file — the rules below only cover the bits that are unique to
 * this page (intro red-accent card, category chip row, drop zone,
 * uploaded-file preview row, textarea).
 */
[data-theme="dark"] .intro-card {
  background: var(--surface);
  border-color: var(--border);
  border-left-color: var(--red);
}
[data-theme="dark"] .intro-title { color: var(--text); }
[data-theme="dark"] .intro-body { color: var(--text-muted); }

[data-theme="dark"] .cat-chip {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
[data-theme="dark"] .cat-chip:hover {
  background: var(--surface-elevated);
  border-color: var(--text-muted);
}
[data-theme="dark"] .cat-chip.selected {
  background: var(--red-light);
  border-color: var(--red);
  color: var(--red);
}

[data-theme="dark"] .field textarea {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
[data-theme="dark"] .field textarea:focus { border-color: var(--red); }
[data-theme="dark"] .field-label { color: var(--text-muted); }
[data-theme="dark"] .char-counter { color: var(--text-muted); }

[data-theme="dark"] .drop-zone {
  background: var(--surface-elevated);
  border-color: var(--border-strong);
}
[data-theme="dark"] .drop-zone:hover {
  background: #262626;
  border-color: var(--red);
}
[data-theme="dark"] .drop-zone-primary { color: var(--text); }
[data-theme="dark"] .drop-zone-secondary { color: var(--text-muted); }
[data-theme="dark"] .drop-zone-icon { color: var(--text-muted); }

[data-theme="dark"] .file-preview {
  background: var(--surface);
  border-color: var(--border-strong);
}
[data-theme="dark"] .file-preview-thumb { background: var(--surface-elevated); }
[data-theme="dark"] .file-preview-name { color: var(--text); }
[data-theme="dark"] .file-preview-size { color: var(--text-muted); }
[data-theme="dark"] .file-preview-remove { color: var(--text-muted); }
[data-theme="dark"] .file-preview-remove:hover { color: var(--red); }

[data-theme="dark"] .submit-btn:disabled { background: var(--surface-elevated); color: var(--text-dim); }

[data-theme="dark"] .success-body { color: var(--text-muted); }
[data-theme="dark"] .success-title { color: var(--text); }

/* ── EVO TrustGuard header brand (shield + EVO + TrustGuard) ─────────── *
 * The header logo is composed from a single inline <svg class="brand-logo">
 * that embeds the trimmed shield PNG plus two <text> runs. Text fills
 * are driven by CSS variables so the wordmark adapts to the active theme:
 *   EVO         → always var(--red)   (brand-consistent accent)
 *   TrustGuard  → var(--dark)         (primary text token;
 *                                      swaps light ↔ dark via theme)
 *
 * Size is pinned explicitly in BOTH dimensions. The SVG markup ships
 * without width/height attributes — only a viewBox — and some browsers
 * collapse such an SVG to 0×0 when it lives inside a flex parent
 * (`.dash-nav-brand` is `display: flex`). Setting width + height in CSS
 * side-steps that intrinsic-size quirk. flex-shrink: 0 ensures the flex
 * row on narrow viewports can't squeeze the logo either.
 *
 * Rendered footprint: 200px × 54px (viewBox 220×60 → aspect ratio
 * preserved; 200/220 × 60 ≈ 54.5, rounded to 54). EVO font-size=20 and
 * TrustGuard font-size=30 in the viewBox scale to ~18px / ~27px on screen.
 */
.brand-logo {
  width: 200px;
  height: 54px;
  display: block;
  overflow: visible;
  flex-shrink: 0;
}
.brand-logo .brand-evo { fill: var(--red); }
.brand-logo .brand-trustguard { fill: var(--dark); }

/* ── Toast component — platform-wide dark-mode legibility fix ────────── *
 *
 * Several portal pages (clients.html, credits.html, reminders.html,
 * team-members.html, create-lead.html, etc.) declare their toast pill
 * with `background: var(--dark); color: var(--white)`. Because --dark
 * swaps to a near-white token (#f5f5f5) in dark mode while --white is
 * pinned to #ffffff in BOTH themes (see header note above), the toast
 * silently became white-on-white in dark mode — the "burnt toast" bug.
 *
 * Fix: in dark mode, repaint the pill to the same #222 / #fff combo
 * that purchased-lead.html and client-detail.html already used inline,
 * which preserves the tooltip-on-dark contrast that sits well above
 * WCAG AA (16.94:1 — passes AAA at any size). The override targets
 * every shared toast class name in a single rule so future pages auto-
 * inherit the fix without per-page CSS edits.
 *
 * In LIGHT mode the existing per-page rules already produce dark-on-
 * white pills and read fine (var(--dark) = #1a1a1a, var(--white) =
 * #ffffff), so we don't override the light theme.
 */
[data-theme="dark"] .tg-toast,
[data-theme="dark"] .clients-toast,
[data-theme="dark"] .toast {
  background: #2a2a2a;
  color: #ffffff;
  border: 1px solid #3a3a3a;
}

/* ── Card tap / focus / hover suppression ────────────────────────────── *
 * Tapping a card (`<a>` or `<div>`) on mobile Safari / Chrome used to
 * leave a sticky highlight after the finger lifted — caused by a mix of
 * the default `-webkit-tap-highlight-color`, the link `:focus` outline,
 * and the CSS `:hover` state persisting on touch devices until the next
 * tap. The rules below suppress all three across every portal card class
 * so cards feel "clean-press" everywhere (no scroll or tap highlight).
 *
 * `@media (hover: hover)` wrapping of the per-page `:hover` rules still
 * lives in each page's own stylesheet — these rules only cover the tap
 * highlight + focus outline pieces that are shared.
 */
.lead-card,
.client-card,
.reminder-card,
.tile,
.card,
.bottom-nav-item {
  -webkit-tap-highlight-color: transparent;
}
/* Suppress the click/tap focus ring only (`:focus` fires on mouse/touch).
 * `:focus-visible` is intentionally left default so keyboard Tab users
 * still get a visible ring — WCAG 2.4.7 (Focus Visible) parity. */
.lead-card:focus:not(:focus-visible),
.client-card:focus:not(:focus-visible),
.reminder-card:focus:not(:focus-visible),
.tile:focus:not(:focus-visible),
.card:focus:not(:focus-visible) {
  outline: none;
}
