/* =====================================================================
   DARK THEME (2026-12)
   Loaded after style.css (and admin.css) on every page. Active when
   <html data-theme="dark">, which the inline script in includes/header.php
   sets before first paint from the visitor's choice (moon/sun button in
   the top nav, "Light | Dark" in the footer; localStorage 'tiposi-theme').
   Light is the default; the device setting is not followed.
   Light mode is untouched by this file.

   How it works:
   1. The semantic tokens from style.css are redefined (surfaces, text,
      borders, feedback colours).
   2. The neutral scale is mirrored (50 <-> 950), so the many
      `var(--color-neutral-*)` uses for text and fills keep working.
   3. Parts that are dark in both themes (header, footer, countdown bar,
      menus) are pinned to fixed dark values.
   4. Hard-coded light colours in style.css, admin.css and inline page
      styles get explicit overrides, grouped by area below.
   Brand red: text uses a lighter red for contrast on dark surfaces;
   solid fills (primary buttons) keep a deep red under white text.
   ===================================================================== */

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

  --color-brand:            #ec5a70;   /* text and outlines on dark */
  --color-brand-dark:       #f47f91;   /* hover = a step lighter in dark */
  --color-brand-light:      #f47f91;
  --color-brand-muted:      rgba(236, 90, 112, 0.12);
  --color-brand-ring:       rgba(236, 90, 112, 0.28);
  --tp-brand-solid:         #c8102e;   /* fills under white text */
  --tp-brand-solid-hover:   #da1f3e;

  --color-neutral-950:      #f4f3f2;
  --color-neutral-900:      #ebeae8;
  --color-neutral-800:      #d5d4d1;
  --color-neutral-700:      #bdbcb9;
  --color-neutral-500:      #9a9996;
  --color-neutral-400:      #7d7c79;
  --color-neutral-200:      #383735;
  --color-neutral-100:      #2b2a28;
  --color-neutral-50:       #222120;

  --color-bg:               #151413;
  --color-surface:          #1c1b1a;
  --color-surface-raised:   #232221;
  --color-surface-hover:    #252423;
  --color-border:           #302f2d;
  --color-border-subtle:    #292826;
  --color-text-primary:     #ebeae8;
  --color-text-secondary:   #a9a8a5;
  --color-text-muted:       #8b8a87;
  --color-text-inverse:     #ffffff;

  --color-success:          #22c55e;
  --color-success-muted:    rgba(34, 197, 94, 0.14);
  --color-warning:          #f59e0b;
  --color-warning-muted:    rgba(245, 158, 11, 0.14);
  --color-danger:           #f05252;
  --color-danger-muted:     rgba(240, 82, 82, 0.14);
  --color-info:             #60a5fa;
  --color-info-muted:       rgba(96, 165, 250, 0.14);

  --color-score-exact:      rgba(34, 197, 94, 0.20);
  --color-score-exact-text: #86efac;
  --color-score-near:       rgba(245, 158, 11, 0.20);
  --color-score-near-text:  #fcd34d;
  --color-score-exact-fl:   rgba(240, 82, 82, 0.22);
  --color-score-near-fl:    rgba(96, 165, 250, 0.22);
  --color-score-fl:         rgba(255, 255, 255, 0.06);

  --color-gold-bg:          rgba(251, 191, 36, 0.10);
  --color-silver-bg:        rgba(148, 163, 184, 0.10);
  --color-bronze-bg:        rgba(217, 119, 6, 0.10);

  --shadow-xs:    0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:    0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md:    0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-xl:    0 16px 48px rgba(0, 0, 0, 0.5);
  --card-shadow:  none;

  /* Fixed tones for chrome that is dark in both themes */
  --tp-chrome:        #0e0d0d;
  --tp-chrome-raised: #1f1e1d;
  --tp-chrome-line:   #2c2b29;
  --tp-on-dark:       #ffffff;
  --tp-on-dark-dim:   #8a8987;

  /* Readable status text on dark tinted fills */
  --tp-ok-text:    #86efac;
  --tp-warn-text:  #fcd34d;
  --tp-bad-text:   #fca5a5;
  --tp-info-text:  #93c5fd;
}

/* The switch itself: smooth only while switching, never on page load. */
:root.theme-switching,
:root.theme-switching *,
:root.theme-switching *::before,
:root.theme-switching *::after {
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease !important;
}

/* ---------------------------------------------------------------------
   Footer theme switch (both themes). Styled like the language links.
   --------------------------------------------------------------------- */
.footer-theme { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-neutral-500); }
.footer-theme button {
  appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: #888888; cursor: pointer; line-height: inherit;
}
.footer-theme button:hover { color: #ffffff; }
.footer-theme button[aria-pressed="true"] { color: var(--color-brand); font-weight: var(--font-semibold); }
.footer-theme button:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

/* Top nav switch: moon in light mode (go dark), sun in dark mode (go light). */
.site-header .theme-toggle { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; color: rgba(255, 255, 255, 0.75); flex-shrink: 0; }
.site-header .theme-toggle:hover { color: #ffffff; }
.theme-toggle svg { display: block; }
.theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }

/* =====================================================================
   Everything below only applies in dark mode.
   ===================================================================== */

/* --- Chrome that stays dark ------------------------------------------ */
[data-theme="dark"] .site-header { background: var(--tp-chrome); border-bottom: 1px solid var(--tp-chrome-line); }
[data-theme="dark"] .site-footer { background: var(--tp-chrome); color: #666666; border-top: 1px solid var(--tp-chrome-line); }
[data-theme="dark"] .footer-links a { color: #8a8987; }
[data-theme="dark"] .footer-links a:hover,
[data-theme="dark"] .footer-theme button:hover { color: #ffffff; }
[data-theme="dark"] .footer-sep { background: #333333; }
[data-theme="dark"] .footer-langs,
[data-theme="dark"] .footer-legal,
[data-theme="dark"] .footer-theme { color: #666666; }
[data-theme="dark"] .footer-theme button { color: #8a8987; }
[data-theme="dark"] .footer-theme button[aria-pressed="true"],
[data-theme="dark"] .footer-langs a.is-current { color: var(--color-brand); }
[data-theme="dark"] .site-footer svg g { fill: var(--tp-chrome) !important; }
[data-theme="dark"] .site-footer svg path[style*="stroke"] { stroke: var(--tp-chrome) !important; }
[data-theme="dark"] .countdown-container { background: var(--tp-chrome-raised); color: var(--tp-on-dark); }
[data-theme="dark"] .dropdown-menu { background-color: var(--tp-chrome-raised); border-color: var(--tp-chrome-line); }
[data-theme="dark"] .dropdown-item { color: #d5d4d1; }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus { background-color: #2c2b29; color: #ffffff; }
[data-theme="dark"] .dropdown-divider { border-top-color: var(--tp-chrome-line); }
[data-theme="dark"] .site-header .text-muted { color: #8a8987 !important; }

/* --- Solid brand fills (white text on deep red) ---------------------- */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .comment-action-button,
[data-theme="dark"] .home-hero-signup-btn,
[data-theme="dark"] .campaign-action-btn,
[data-theme="dark"] .bg-primary,
[data-theme="dark"] .auth-notice-icon,
[data-theme="dark"] .race-weekend-row:hover .race-action-btn,
[data-theme="dark"] .capacity-mini-fill,
[data-theme="dark"] .home-hero-badge-dot,
[data-theme="dark"] .main-tabs-nav .btn.btn-primary,
[data-theme="dark"] .pill-tabs .btn.btn-primary,
[data-theme="dark"] .main-tabs-nav .btn.active,
[data-theme="dark"] .pill-tabs .btn.active,
[data-theme="dark"] .admin-page .btn-primary {
  background: var(--tp-brand-solid);
  background-color: var(--tp-brand-solid);
  border-color: var(--tp-brand-solid);
  color: #ffffff;
}
[data-theme="dark"] .admin-page .bg-primary { background: var(--tp-brand-solid) !important; }
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .comment-action-button:hover,
[data-theme="dark"] .home-hero-signup-btn:hover,
[data-theme="dark"] .campaign-action-btn:hover,
[data-theme="dark"] .admin-page .btn-primary:hover {
  background: var(--tp-brand-solid-hover);
  background-color: var(--tp-brand-solid-hover);
  border-color: var(--tp-brand-solid-hover);
  color: #ffffff;
}
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .home-hero-cta .btn-primary,
[data-theme="dark"] .home-view-all-btn,
[data-theme="dark"] .home-hero-signup-btn,
[data-theme="dark"] .home-register-form .btn-primary { box-shadow: none !important; }
[data-theme="dark"] .btn-outline-primary:hover { color: var(--color-brand-dark); }

/* --- Feedback colours ------------------------------------------------- */
[data-theme="dark"] .badge-success,
[data-theme="dark"] .alert-success,
[data-theme="dark"] .guide-icon.is-success,
[data-theme="dark"] .season-compact-table td.score-exact,
[data-theme="dark"] .btn-outline-success { color: var(--tp-ok-text); }
[data-theme="dark"] .badge-warning,
[data-theme="dark"] .alert-warning { color: var(--tp-warn-text); }
[data-theme="dark"] .badge-danger,
[data-theme="dark"] .alert-danger,
[data-theme="dark"] .btn-outline-danger { color: var(--tp-bad-text); }
[data-theme="dark"] .btn-outline-danger:hover { color: #fecaca; }
[data-theme="dark"] .badge-info,
[data-theme="dark"] .alert-info,
[data-theme="dark"] .guide-icon.is-info { color: var(--tp-info-text); }
[data-theme="dark"] .btn-danger:hover { background: #dc2626; }
[data-theme="dark"] .standings-move.up,
[data-theme="dark"] .standings-gain { color: #4ade80; }
[data-theme="dark"] .standings-move.down { color: #f87171; }
[data-theme="dark"] .delta-minus { color: #34d399; }
[data-theme="dark"] .delta-plus { color: #f87171; }
[data-theme="dark"] .delta-zero { color: #8b8a87; }

/* --- Surfaces that were hard-coded white ------------------------------ */
[data-theme="dark"] .comment,
[data-theme="dark"] .prediction-table,
[data-theme="dark"] .qualifying-table,
[data-theme="dark"] .campaign-row,
[data-theme="dark"] .stats-card,
[data-theme="dark"] .race-cal,
[data-theme="dark"] .cal-summary,
[data-theme="dark"] .guide-cta,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .custom-options,
[data-theme="dark"] .fetch-monitor { background: var(--color-surface); }
[data-theme="dark"] .stats-card,
[data-theme="dark"] .race-cal,
[data-theme="dark"] .fetch-monitor { border-color: var(--color-border); box-shadow: none; }
[data-theme="dark"] .sticky-thead,
[data-theme="dark"] .sticky-thead table,
[data-theme="dark"] .sticky-thead th { background: var(--color-surface); }
[data-theme="dark"] .sticky-thead { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
@media (max-width: 576px) {
  [data-theme="dark"] .compact-view table#race-table .prediction-cell .pill-wrap > .points-scored,
  [data-theme="dark"] .compact-view table#qualifying-results-table .prediction-cell .pill-wrap > .points-scored { background: var(--color-surface); }
}
[data-theme="dark"] .invite-link-input { background: var(--color-neutral-100); }
[data-theme="dark"] .blog-card-excerpt::after,
[data-theme="dark"] .home-news-excerpt::after { background: linear-gradient(to bottom, rgba(28, 27, 26, 0), var(--color-surface)); }
[data-theme="dark"] .news-fade .blog-content::after { background: linear-gradient(to bottom, transparent, var(--color-bg)); }
[data-theme="dark"] .blog-card:hover,
[data-theme="dark"] .home-news-card:hover,
[data-theme="dark"] .home-hero-feature-pill:hover { border-color: #45443f; }
[data-theme="dark"] .blog-card,
[data-theme="dark"] .home-news-card,
[data-theme="dark"] .home-hero-card,
[data-theme="dark"] .home-hero-signup-card,
[data-theme="dark"] .home-hero-feature-pill,
[data-theme="dark"] .view-blog { box-shadow: none; }
[data-theme="dark"] .home-hero-signup-card .form-input { background: var(--color-neutral-50); }

/* Form controls */
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea,
[data-theme="dark"] .form-control {
  background-color: var(--color-neutral-50);
  color: var(--color-text-primary);
  border-color: var(--color-border);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #75746f; }
[data-theme="dark"] .custom-select-trigger,
[data-theme="dark"] .custom-select-trigger:hover,
[data-theme="dark"] .custom-select-trigger.open,
[data-theme="dark"] .custom-select-container.open .custom-select-trigger { background: var(--color-neutral-50); }

/* Typography that was pinned to slate colours */
[data-theme="dark"] .blog-content,
[data-theme="dark"] .blog-content h4 { color: #d5d4d1; }
[data-theme="dark"] .blog-content h2,
[data-theme="dark"] .blog-content h3 { color: var(--color-text-primary); }
[data-theme="dark"] .home-hero-subtitle { color: var(--color-text-secondary); }
[data-theme="dark"] .table-scroll-hint { color: var(--color-text-muted); }
[data-theme="dark"] .auth-notice-link { color: var(--color-text-secondary) !important; }
[data-theme="dark"] .standings-h2h .h2h-score .h2h-lead { color: var(--color-text-primary); }

/* Scroll shadows on wide tables */
[data-theme="dark"] .table-scroll.can-scroll-right { box-shadow: inset -12px 0 10px -8px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .table-scroll.can-scroll-left { box-shadow: inset 12px 0 10px -8px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .table-scroll.can-scroll-left.can-scroll-right { box-shadow: inset 12px 0 10px -8px rgba(0, 0, 0, 0.6), inset -12px 0 10px -8px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .table-responsive::-webkit-scrollbar-track { background: var(--color-neutral-50); }
[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb { background: #45443f; }
[data-theme="dark"] .table-responsive::-webkit-scrollbar-thumb:hover { background: #5a5954; }

/* --- Leagues, pills and result tables --------------------------------- */
[data-theme="dark"] .driver-pill,
[data-theme="dark"] .team-pill,
[data-theme="dark"] .driver-pill.pill-code,
[data-theme="dark"] .team-pill.pill-code {
  background: var(--color-surface-raised);
  border-color: #3a3936;
  box-shadow: none;
  color: var(--color-text-primary);
}
[data-theme="dark"] .driver-pill .pill-label,
[data-theme="dark"] .team-pill .pill-label { color: var(--color-text-primary); }
[data-theme="dark"] .prediction-summary-pill { color: var(--color-text-primary); background: var(--color-neutral-50); border-color: var(--color-border); }

[data-theme="dark"] .score-exact .result-pill { background-color: rgba(34, 197, 94, 0.18) !important; color: #86efac !important; border-color: rgba(34, 197, 94, 0.35); }
[data-theme="dark"] .score-near .result-pill { background-color: rgba(245, 190, 11, 0.16) !important; color: #fcd34d !important; border-color: rgba(245, 190, 11, 0.35); }
[data-theme="dark"] .score-pole .result-pill { background-color: rgba(139, 92, 246, 0.2) !important; color: #c4b5fd !important; border-color: rgba(139, 92, 246, 0.4); }
[data-theme="dark"] .score-exact-fl .result-pill { background-color: rgba(240, 82, 82, 0.2) !important; color: #fca5a5 !important; border-color: rgba(240, 82, 82, 0.4); }
[data-theme="dark"] .score-near-fl .result-pill { background-color: rgba(96, 165, 250, 0.2) !important; color: #93c5fd !important; border-color: rgba(96, 165, 250, 0.4); }
[data-theme="dark"] .result-badge.dsq { background: #4b5563; }

[data-theme="dark"] .leaderboard-row.gold { background: rgba(251, 191, 36, 0.06); }
[data-theme="dark"] .leaderboard-row.silver { background: rgba(255, 255, 255, 0.03); }
[data-theme="dark"] .leaderboard-row.bronze { background: rgba(217, 119, 6, 0.06); }

[data-theme="dark"] .campaign-tag.owner,
[data-theme="dark"] .topic-badge.development-update,
[data-theme="dark"] .topic-badge.dev,
[data-theme="dark"] .topic-badge.development { background: rgba(96, 165, 250, 0.14); color: #93c5fd; }
[data-theme="dark"] .campaign-tag.participant,
[data-theme="dark"] .campaign-tag.member { background: var(--color-neutral-100); color: var(--color-text-secondary); }
[data-theme="dark"] .campaign-tag.public,
[data-theme="dark"] .topic-badge.stats,
[data-theme="dark"] .topic-badge.analysis,
[data-theme="dark"] .topic-badge.stats-analysis { background: rgba(34, 197, 94, 0.14); color: #86efac; }
[data-theme="dark"] .campaign-tag.private,
[data-theme="dark"] .topic-badge.f1-news,
[data-theme="dark"] .topic-badge.news { background: rgba(240, 82, 82, 0.14); color: #fca5a5; }
[data-theme="dark"] .topic-badge.opinion,
[data-theme="dark"] .topic-badge.editorial { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
[data-theme="dark"] .home-hero-feature-icon.green { background: rgba(34, 197, 94, 0.14); color: #4ade80; }
[data-theme="dark"] .home-hero-feature-icon.blue { background: rgba(96, 165, 250, 0.14); color: #93c5fd; }
[data-theme="dark"] .home-hero-feature-icon.amber { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }

/* Champion badge (standings + stats): same gold outline, lighter text */
[data-theme="dark"] .champion-badge,
[data-theme="dark"] .stats-wdc { color: #e3bd5f; border-color: #a88635; }

/* Old stats widgets (stats/*.php) */
[data-theme="dark"] .stats-table th { background: var(--color-neutral-50); color: var(--color-text-secondary); border-bottom-color: var(--color-border); }
[data-theme="dark"] .stats-table td,
[data-theme="dark"] .stats-table-sm td { border-bottom-color: var(--color-border); }
[data-theme="dark"] .stats-table tr:hover { background: var(--color-surface-hover); }
[data-theme="dark"] .stats-table-sm th { color: var(--color-text-muted); }
[data-theme="dark"] .progress-mini { background: var(--color-neutral-100); box-shadow: none; }
[data-theme="dark"] .comparison-section { background: var(--color-neutral-50); border-color: var(--color-border); }
[data-theme="dark"] .comparison-section h4 { border-bottom-color: var(--color-border); }

/* Calendar and stats section */
[data-theme="dark"] .cal-session { background: rgba(255, 255, 255, 0.05); }
[data-theme="dark"] .cal-session-sq,
[data-theme="dark"] .cal-session-quali { background: rgba(245, 158, 11, 0.13); }
[data-theme="dark"] .cal-session-sprint,
[data-theme="dark"] .cal-session-race { background: rgba(236, 90, 112, 0.13); }
[data-theme="dark"] .race-flag,
[data-theme="dark"] .stats-flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }

/* Pagination and modals */
[data-theme="dark"] .pagination .page-link { color: var(--color-text-primary) !important; background-color: var(--color-surface); border-color: var(--color-border); }
[data-theme="dark"] .pagination .page-item:hover .page-link,
[data-theme="dark"] .pagination .page-link:hover { color: var(--color-text-primary) !important; background-color: var(--color-surface-hover); border-color: #45443f; }
[data-theme="dark"] .pagination .page-item.active .page-link { color: #151413 !important; background-color: #ebeae8 !important; border-color: #ebeae8 !important; }
[data-theme="dark"] .pagination .page-item.disabled .page-link { color: #5f5e5a !important; background-color: var(--color-bg); border-color: var(--color-border); }
[data-theme="dark"] .modal-content { border-color: var(--color-border); }
[data-theme="dark"] .modal-body { color: var(--color-text-primary); }
[data-theme="dark"] .modal-footer { background: var(--color-neutral-50); border-top-color: var(--color-border); }
[data-theme="dark"] .auth-notice-card { background: rgba(28, 27, 26, 0.92); border-color: var(--color-border); }

/* Admin tables in style.css */
[data-theme="dark"] .table.admin-table { background: var(--color-surface); border-color: var(--color-border); box-shadow: none; }
[data-theme="dark"] .table.admin-table thead th { background: #0e0d0d !important; border-bottom-color: var(--color-border); }
[data-theme="dark"] .table.admin-table tbody td { color: var(--color-text-primary); border-bottom-color: var(--color-border); }
[data-theme="dark"] .table.admin-table tbody tr:hover td { background-color: var(--color-surface-hover); }
[data-theme="dark"] .table.admin-table .text-secondary-dark { color: var(--color-text-secondary) !important; }
[data-theme="dark"] .table.admin-table .text-muted-dark { color: var(--color-text-muted) !important; }
[data-theme="dark"] .badge-qualy-none,
[data-theme="dark"] .badge-scoring-flat,
[data-theme="dark"] .badge-season-off { background-color: var(--color-neutral-100) !important; color: var(--color-text-secondary) !important; border-color: var(--color-border); }

/* --- Inline styles in page templates ----------------------------------
   Selectors match the inline declaration so nothing else is affected.  */
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #fff;"],
[data-theme="dark"] [style*="background-color: #fff;"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background: var(--color-surface, #fff)"] { background: var(--color-surface) !important; }
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color: #111;"],
[data-theme="dark"] [style*="color:#111;"] { color: var(--color-text-primary) !important; }
[data-theme="dark"] [style*="color: #475569"],
[data-theme="dark"] [style*="color: #666"],
[data-theme="dark"] [style*="color:#666"] { color: var(--color-text-secondary) !important; }
[data-theme="dark"] [style*="color: #999"] { color: var(--color-text-muted) !important; }
[data-theme="dark"] .home-faq h3 { color: var(--color-text-primary) !important; }
[data-theme="dark"] .home-faq p { color: var(--color-text-secondary) !important; }

/* --- Admin (admin.css) ------------------------------------------------ */
[data-theme="dark"] .admin-page {
  --admin-ok: #86efac;
  --admin-warn: #fcd34d;
  --admin-bad: #fca5a5;
  --admin-info: #93c5fd;
  --admin-ok-bg: rgba(34, 197, 94, 0.14);
  --admin-warn-bg: rgba(245, 158, 11, 0.14);
  --admin-bad-bg: rgba(240, 82, 82, 0.14);
  --admin-info-bg: rgba(96, 165, 250, 0.14);
}
/* Section colours stay as fills under white text; their text uses lighter tints. */
[data-theme="dark"] .admin-page .admin-section-operations { --tp-sec-text: #7fb0ff; }
[data-theme="dark"] .admin-page .admin-section-users      { --tp-sec-text: #4fd1c0; }
[data-theme="dark"] .admin-page .admin-section-content    { --tp-sec-text: #b79cff; }
[data-theme="dark"] .admin-page [class*="admin-section-"] .admin-eyebrow,
[data-theme="dark"] .admin-page .admin-header[class*="admin-section-"] .admin-eyebrow,
[data-theme="dark"] .admin-page .admin-nav-group[class*="admin-section-"] .admin-nav-label { color: var(--tp-sec-text, var(--color-text-muted)); }
/* Active states were near-black with white text; on dark they become light with dark text. */
[data-theme="dark"] .admin-page .admin-nav-group:not([class*="admin-section-"]) a.active,
[data-theme="dark"] .admin-page .btn-outline-primary.active,
[data-theme="dark"] .admin-page .btn-outline-dark.active,
[data-theme="dark"] .admin-page .btn-group > .btn.active,
[data-theme="dark"] .admin-page .page-item.active .page-link,
[data-theme="dark"] .admin-page .list-group-item.active { color: #151413; }
[data-theme="dark"] .admin-page .btn-group > .btn-primary { background: var(--tp-brand-solid); border-color: var(--tp-brand-solid); color: #ffffff; }
[data-theme="dark"] .admin-page .nav-pills .nav-link.active,
[data-theme="dark"] .admin-page .nav-tabs .nav-link.active { color: #151413 !important; }
[data-theme="dark"] .admin-page .list-group-item.active .text-muted,
[data-theme="dark"] .admin-page .list-group-item.active .text-white-50 { color: rgba(21, 20, 19, 0.65) !important; }
[data-theme="dark"] .admin-page .list-group-item.active .badge { background: rgba(0, 0, 0, 0.12) !important; color: #151413 !important; }
[data-theme="dark"] .admin-page .bg-dark { background: #2b2a28 !important; color: #ffffff; }
[data-theme="dark"] .admin-page .badge.bg-dark { background: #3a3936 !important; }
[data-theme="dark"] .admin-page .bg-white,
[data-theme="dark"] .admin-page .bg-light { background: var(--color-surface) !important; }
[data-theme="dark"] .admin-page .text-dark { color: var(--color-text-primary) !important; }
[data-theme="dark"] .admin-page .modal-content { box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); }
[data-theme="dark"] .acq-funnel-bar,
[data-theme="dark"] .cohort-mini-bar { background: var(--color-neutral-100); box-shadow: none; }

/* Images and media: soften very bright pictures a touch */
[data-theme="dark"] .blog-content img,
[data-theme="dark"] .prose img { filter: brightness(0.92); }

/* Countdown pill in the header ("Next session to predict") */
[data-theme="dark"] .countdown-container .badge[style*="--color-brand"] { background: var(--tp-brand-solid) !important; }
