/* ══════════════════════════════════════════════════════════════════════════
   shared/report-theme.css — sitewide color tokens (design system) + dark mode.

   :root defines the light-mode value of every token; :root[data-theme="dark"]
   overrides them for dark mode. <html data-theme="..."> is set by
   shared/report-theme.js (before first paint, to avoid a flash of the wrong theme)
   and flipped by the toggle injected by shared/report-theme-toggle.js.

   Every stylesheet on the site references these via
   var(--token-name, <original-literal>) — the second argument is always the
   color that rule used to hardcode, so linking this file for the first time
   changes nothing until data-theme="dark" is actually set.

   NAMING: roles, not colors — a token describes what a color is FOR
   (page background, primary text, a border) so dark mode only means
   changing the value here, not touching every rule that uses it.

   A handful of near-duplicate literals found across the 25 per-report
   stylesheets (e.g. #E3ECF7 vs #EEF4FB, both "light blue tint fill") were
   deliberately consolidated onto one token rather than kept as separate
   one-off tokens — this centralizes the palette per the instruction to
   tokenize "as much as possible," and the visual difference between the
   merged literals was imperceptible. Tokens already shipped in Phase 1
   (index.css, shared/report-notes.css, shared/report-bugreport.css, shared/report-pdf-export.css,
   shared/report-env-banner.css) keep their original light-mode values unchanged. ══
   ══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Surfaces ── */
  --bg-page: #F0F4F8;              /* page/body background */
  --bg-surface: #FFFFFF;           /* cards, modals, panels, inputs */
  --bg-surface-alt: #F9FAFB;       /* subtle fill (disabled inputs, chip backgrounds, zebra rows) */
  --bg-subtle: #F3F4F6;            /* hover backgrounds, secondary buttons */
  --bg-panel-tint: #F0F0F5;        /* soft lavender-gray panel fill */
  --bg-surface-translucent: rgba(255,255,255,.92); /* semi-see-through surface (index.css card-bookmark-btn resting state) */
  --brand-blue-tint: #E3ECF7;      /* light blue fill (icon chips, hover backgrounds, table zebra) */
  --brand-blue-tint-strong: #A8C5E8; /* more saturated light-blue fill (chart bands, stronger hover) */

  /* ── Text ── */
  --text-primary: #333333;      /* default body/heading text */
  --text-primary-alt: #1F2430;  /* shared/report-bugreport.css's own body text shade */
  --text-secondary: #666666;    /* secondary copy, captions */
  --text-tertiary: #374151;     /* form labels, secondary emphasis */
  --text-muted: #9CA3AF;        /* placeholders, muted counts, disabled icons */
  --text-faint: #6B7280;        /* a slightly darker muted tone */
  --text-strong: #111827;       /* near-black emphasis text (table totals, strong labels) */
  --text-on-brand: #FFFFFF;     /* text/icons sitting on a brand-blue button or fill */
  --link-blue: #1D4ED8;         /* generic link/info text distinct from brand blue */

  /* ── Borders / dividers ── */
  --border: #D1D5DB;         /* default border, section dividers */
  --border-subtle: #E5E7EB;  /* lighter input/card borders */
  --border-faint: #EEEEEE;   /* lightest divider (modal header/footer rules) */

  /* ── Brand ── */
  --brand-blue: #3A7BC8;        /* primary accent, links, active states */
  --brand-blue-dark: #0B5394;   /* headings, hover-darken state, table headers */

  /* ── Status ── */
  --status-error: #DC2626;          /* error text/icons */
  --status-success: #059669;        /* success text/icons */
  --status-success-tint: #E6F4EC;   /* light green fill (success icon chips, rows) */
  --status-warning: #F59E0B;        /* warning text/icons */

  /* ── Alert / callout boxes (bg + text pairs used across ops & ads reports) ── */
  --alert-error-bg: #FEE2E2;
  --alert-error-text: #991B1B;
  --alert-warning-bg: #FEF3C7;
  --alert-warning-text: #92400E;
  --alert-info-bg: #DBEAFE;
  --alert-info-icon: #3B82F6;

  /* ── Badges / tags ── */
  --badge-warning-bg: #FFF4E5;      /* "In Progress" badge fill */
  --badge-warning-bg-alt: #FDF3E0;  /* ad-platform note tag fill (distinct literal, same family) */
  --badge-warning-text: #B45309;    /* text for both warning badges above */
  --tag-blue-bg: #EAF1FA;           /* client-note tag fill */

  /* ── Report-specific accents (Sales Assistant / Admin Tracker / DM Scorecard) ── */
  --accent-purple: #5B3ECC;
  --accent-purple-tint: #EDE9FE;
  --accent-purple-tint-strong: #EAE3FF; /* image-widget / stronger purple hover fill */
  --accent-teal: #2EC4B6;
  --accent-teal-tint: #E8FAF8;          /* teal pill/badge fill (client tags, department pills) */
  --pill-pink-bg: #FCE7F3;              /* campaign-objective category pill (e.g. LinkedIn "Job applicants") */
  --pill-rose-bg: #FFE4E6;              /* campaign-objective category pill (e.g. LinkedIn "Video views") */
  --pill-indigo-bg: #E0E7FF;            /* status pill category fill (e.g. Admin Tracker "Startup") */
  --pill-cyan-bg: #CFFAFE;              /* status pill category fill (e.g. Admin Tracker "<1yr") */
  --accent-navy: #0D0D1A;          /* already a deep near-black — used as an intentionally-dark card/section */
  --accent-lavender-bg: #F5F5FA;
  --brand-blue-tint-subtle: #F7FAFD;    /* very light blue tint (hover rows, popovers) */

  /* ── Environment banners ── */
  --banner-testing-bg: #B3261E;  /* testing.* deployment banner */
  --banner-local-bg: #FCEEDA;    /* localhost banner fill */
  --banner-local-text: #A15C00;  /* localhost banner text */
}

:root[data-theme="dark"] {
  /* 2026-08-06: tells the browser its OWN native UI chrome (the popup list a
     <select> opens, its hover/highlight row, checkboxes, radios, scrollbars,
     spin buttons) should render using dark-appropriate colors instead of the
     OS light default. Every report styles a <select>'s CLOSED box correctly
     via var(--bg-surface)/var(--text-primary) above, but that open popup is
     drawn by the browser itself, not by our CSS — without this, it stayed
     light-chrome regardless of data-theme, so hovering an <option> combined
     our dark-mode (light-colored) text with the browser's light-mode hover
     highlight, making the hovered row unreadable (e.g. the Reporting
     dashboard's "Show: All Sources" data-source filter, #rptLibSource in
     ads/reporting/report-reporting.css). Purely additive — doesn't recolor
     anything already styled explicitly, only the native chrome that wasn't. */
  color-scheme: dark;

  /* ── Surfaces ── */
  /* 2026-08-05: widened the gap between page/card/border after explicit
     feedback that cards were too close to the page background and borders
     were too subtle to read in dark mode. */
  --bg-page: #0B1420;
  --bg-surface: #1C2B3D;
  --bg-surface-alt: #24384D;
  --bg-subtle: #2A3F56;
  --bg-panel-tint: #223448;
  --bg-surface-translucent: rgba(28,43,61,.92); /* --bg-surface's #1C2B3D at the same alpha as light mode */
  --brand-blue-tint: #1F3A56;
  --brand-blue-tint-strong: #35608C;
  --brand-blue-tint-subtle: #16222E;   /* very light blue tint (hover rows, popovers) */

  /* ── Text ── */
  --text-primary: #E5E7EB;
  --text-primary-alt: #E5E7EB;
  --text-secondary: #9CA3AF;
  --text-tertiary: #C7CDD6;
  --text-muted: #7C8896;
  --text-faint: #8B95A3;
  --text-strong: #F3F4F6;
  --text-on-brand: #FFFFFF;
  --link-blue: #60A5FA;

  /* ── Borders / dividers ── */
  --border: #4A6079;
  --border-subtle: #37495E;
  --border-faint: #2C3B4D;

  /* ── Brand ── */
  --brand-blue: #6FA3DD;
  --brand-blue-dark: #4C8FC9;

  /* ── Status ── */
  --status-error: #F87171;
  --status-success: #34D399;
  --status-success-tint: #1B3A2C;
  --status-warning: #FBBF24;

  /* ── Alert / callout boxes ── */
  --alert-error-bg: #3A1F1F;
  --alert-error-text: #FCA5A5;
  --alert-warning-bg: #3A2E14;
  --alert-warning-text: #FCD34D;
  --alert-info-bg: #1E2F45;
  --alert-info-icon: #60A5FA;

  /* ── Badges / tags ── */
  --badge-warning-bg: #3A2A14;
  --badge-warning-bg-alt: #3A2A14;
  --badge-warning-text: #FBBF24;
  --tag-blue-bg: #1F3A56;

  /* ── Report-specific accents ── */
  --accent-purple: #9B8AE0;
  --accent-purple-tint: #2A2145;
  --accent-purple-tint-strong: #3D2F5C;
  --accent-teal: #5FDCCF;
  --accent-teal-tint: #16342F;
  --pill-pink-bg: #3A1F30;
  --pill-rose-bg: #3A1F24;
  --pill-indigo-bg: #262C52;
  --pill-cyan-bg: #163A3D;
  --accent-navy: #0D0D1A;
  --accent-lavender-bg: #1D1F2B;

  /* ── Environment banners ── */
  --banner-testing-bg: #B3261E;
  --banner-local-bg: #4A3200;
  --banner-local-text: #FFD27A;
}

/* ── Header logo: light/dark swap ──────────────────────────────────────────
   assets/atlas_logo.svg's fills (#707377 gray / #2d74b9 blue / #05213c near-black)
   are tuned for a light backdrop — the near-black main lettering has a
   1.39:1 contrast ratio against the dark-mode --brand-blue-tint chip
   (#1F3A56), i.e. it nearly disappears. assets/atlas_logo_dark.svg is the same
   artwork with those three fills swapped for existing dark-mode text/brand
   tokens (#C7CDD6 / #6FA3DD / #E5E7EB — 7.3:1 / 4.4:1 / 9.4:1 against that
   same chip). Every header-logo-box now renders BOTH <img> tags side by
   side (class="logo-light"/"logo-dark") and this rule shows only the one
   that matches the current theme — pure CSS, so it's correct on first
   paint (shared/report-theme.js sets data-theme before any layout happens) with
   no flash of the wrong variant. */
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: inline !important; }
