/* ═══════════════════════════════════════════════════════════════════
   Kodo design tokens: the single source of truth for every colour.
   Loaded first on every page (landing, marketing, platform, auth, admin).

   Light is the base. Dark applies when <html data-theme="dark">, which
   static/js/theme.js sets in <head> before first paint.

   Page and surfaces (the background rule):
     --bg       the page canvas behind everything, including the sidebar,
                top bar and footer areas: pure white (#FFFFFF) in light
                mode, pure black (#000000) in dark mode.
     --bg-alt   a solid surface one clear step off the page (dropdowns,
                modals, inputs). From Nov 2026 cards, charts and tables are
                transparent instead (--card-bg, docs/ui-standard.md); pages
                not yet moved over still fill them with --bg-alt.
     --bg-hover nested elements inside a card (and hovers): one more step.
   Never paint a page-sized area with --bg-alt: a band that needs setting
   apart uses a --border line, not another grey page.

   Families (1 blue, 2 green, 3 orange, 4 violet, 5 sky, 6 grey, 7 red)
   each have three parts:
     --cat-N-tint     pale fill behind a label
     --cat-N-text     readable text on that tint (AA 4.5:1 at small sizes)
     --cat-N-text-lg  text for large labels (24px+, AA 3:1), e.g. hero pill
     --cat-N-dot      bright base colour: dots, chart marks, lines, markers.
                      Never used as a text colour or as a large fill.
   Red (7) is semantic only (loss / error), never a chart series.

   Values marked "AA" were nudged from the brief's palette by the smallest
   amount that reaches WCAG AA; they match what the landing page already uses.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Neutrals */
  --bg:      #FFFFFF;   /* page */
  --bg-alt:  #F4F4F2;   /* cards and containers */
  --border:  #E5E3DF;   /* card edges and dividers */
  --text:    #1F1E1C;
  --text-2:  #5F5B55;
  --text-3:  #948D85;
  --bg-hover: color-mix(in srgb, var(--text) 4%, var(--bg-alt));
  --overlay:  rgba(31,30,28,0.35);   /* behind modals, drawers, search */

  /* Action blue */
  --action:        #0075DE;
  --action-hover:  #0877DA;   /* AA: brief #097FE8 gives 4.0:1 with a white label */
  --action-press:  #005BAB;
  --action-text:   #006BCC;   /* AA: 4.8:1 on --bg-alt #F4F4F2, 5.3:1 on white (brief #0075DE gives 4.2:1) */
  --action-tint:   #E6F3FE;
  --action-tint-2: #F2F9FF;
  --on-action:     #FFFFFF;

  /* 1 blue */
  --cat-1-dot: #0075DE;  --cat-1-text: #006DD0;  --cat-1-text-lg: #0075DE;  --cat-1-tint: #E6F3FE;
  /* 2 green */
  --cat-2-dot: #24CB71;  --cat-2-text: #127F48;  --cat-2-text-lg: #148A4E;  --cat-2-tint: #E4F8EC;
  /* 3 orange */
  --cat-3-dot: #FF7237;  --cat-3-text: #BB4A0E;  --cat-3-text-lg: #C9500F;  --cat-3-tint: #FFEEE6;
  /* 4 violet */
  --cat-4-dot: #7B5CE0;  --cat-4-text: #5B3FC4;  --cat-4-text-lg: #5B3FC4;  --cat-4-tint: #EEE9FD;
  /* 5 sky */
  --cat-5-dot: #00B6FF;  --cat-5-text: #0976A6;  --cat-5-text-lg: #0A7FB3;  --cat-5-tint: #E3F6FF;
  /* 6 grey */
  --cat-6-dot: #8A857E;  --cat-6-text: #5F5B55;  --cat-6-text-lg: #5F5B55;  --cat-6-tint: #F1F0EE;
  /* 7 red (semantic only) */
  --cat-7-dot: #E03E3E;  --cat-7-text: #C4332F;  --cat-7-text-lg: #C4332F;  --cat-7-tint: #FDECEC;
  /* (light-mode -text values for 1, 2, 3 and 5 are AA-nudged from the brief) */

  /* Semantic */
  --positive:      var(--cat-2-text);
  --positive-tint: var(--cat-2-tint);
  --positive-dot:  var(--cat-2-dot);
  --negative:      var(--cat-7-text);
  --negative-tint: var(--cat-7-tint);
  --negative-dot:  var(--cat-7-dot);
  --warning:       var(--cat-3-text);
  --warning-tint:  var(--cat-3-tint);
  --warning-dot:   var(--cat-3-dot);

  /* UI standard (docs/ui-standard.md): black, white and grey; blue only
     for the selected item, primary actions and focus */
  --card-bg:   transparent;   /* cards, charts, tables: the page shows through */
  --line:      var(--border); /* the 1px container edge and the header hairline */
  --row-hover: color-mix(in srgb, var(--text) 4%, transparent);
  --selected:  var(--action);
  --pop-bg:    var(--text);   /* tooltips: solid, inverted */
  --pop-text:  var(--bg);
  --menu-bg:   var(--bg-alt); /* dropdowns and menus: solid */

  /* Owners */
  --owner-state:   6;  /* grey   */
  --owner-listed:  1;  /* blue   */
  --owner-private: 2;  /* green  */
  --owner-family:  3;  /* orange */
}

:root[data-theme="dark"] {
  --bg:      #000000;   /* page */
  --bg-alt:  #121212;   /* cards and containers */
  --border:  #2C2C2B;   /* card edges and dividers: visible on both #000 and #121212 */
  --text:    #F2F1EE;
  --text-2:  #A8A39C;
  --text-3:  #6F6B66;
  --bg-hover: color-mix(in srgb, var(--text) 7%, var(--bg-alt));   /* a visible step inside #121212 cards */
  --overlay:  rgba(0,0,0,0.65);
  --row-hover: color-mix(in srgb, var(--text) 7%, transparent);

  --action:        #0075DE;
  --action-hover:  #0E78D5;   /* AA: brief #1A8CF0 gives 3.5:1 with a white label */
  --action-press:  #005BAB;
  --action-text:   #4DA3F0;
  --action-tint:   rgba(0,117,222,0.18);
  --action-tint-2: rgba(0,117,222,0.10);
  --on-action:     #FFFFFF;

  --cat-1-text: #4DA3F0;  --cat-1-text-lg: #4DA3F0;  --cat-1-tint: rgba(0,117,222,0.18);
  --cat-2-text: #3DDC87;  --cat-2-text-lg: #3DDC87;  --cat-2-tint: rgba(36,203,113,0.18);
  --cat-3-text: #FF8A57;  --cat-3-text-lg: #FF8A57;  --cat-3-tint: rgba(255,114,55,0.18);
  --cat-4-text: #A58BF5;  --cat-4-text-lg: #A58BF5;  --cat-4-tint: rgba(123,92,224,0.18);
  --cat-5-text: #3CC6FF;  --cat-5-text-lg: #3CC6FF;  --cat-5-tint: rgba(0,182,255,0.18);
  --cat-6-text: #A8A39C;  --cat-6-text-lg: #A8A39C;  --cat-6-tint: rgba(138,133,126,0.18);
  --cat-7-text: #FF7B72;  --cat-7-text-lg: #FF7B72;  --cat-7-tint: rgba(224,62,62,0.16);
  /* (green, orange and sky tints are 18%, as on the landing page; the brief lists 16%) */
}

/* ═══ Pills ═════════════════════════════════════════════════════════
   Coloured label: tint fill, text colour, bright dot before the text.
   Geometry follows the platform's Reports .list-pill.
   ═══════════════════════════════════════════════════════════════════ */
.pill--blue, .pill--green, .pill--orange, .pill--violet,
.pill--sky, .pill--grey, .pill--red, .pill--plan {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 4px 10px;
  border: none;
  border-radius: 999px;
  outline: none;
  box-shadow: none;
  background: var(--pill-tint);
  color: var(--pill-text);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}
.pill--blue::before, .pill--green::before, .pill--orange::before, .pill--violet::before,
.pill--sky::before, .pill--grey::before, .pill--red::before, .pill--plan::before {
  content: "";
  flex: none;
  width: 0.3em;
  height: 0.3em;
  min-width: 5px;
  min-height: 5px;
  border-radius: 50%;
  background: var(--pill-dot);
}
.pill--blue   { --pill-tint: var(--cat-1-tint); --pill-text: var(--cat-1-text); --pill-dot: var(--cat-1-dot); }
.pill--green  { --pill-tint: var(--cat-2-tint); --pill-text: var(--cat-2-text); --pill-dot: var(--cat-2-dot); }
.pill--orange { --pill-tint: var(--cat-3-tint); --pill-text: var(--cat-3-text); --pill-dot: var(--cat-3-dot); }
.pill--violet { --pill-tint: var(--cat-4-tint); --pill-text: var(--cat-4-text); --pill-dot: var(--cat-4-dot); }
.pill--sky    { --pill-tint: var(--cat-5-tint); --pill-text: var(--cat-5-text); --pill-dot: var(--cat-5-dot); }
.pill--grey   { --pill-tint: var(--cat-6-tint); --pill-text: var(--cat-6-text); --pill-dot: var(--cat-6-dot); }
.pill--red    { --pill-tint: var(--cat-7-tint); --pill-text: var(--cat-7-text); --pill-dot: var(--cat-7-dot); }

/* ═══ Plans ═════════════════════════════════════════════════════════
   The one mapping from plan key to colour. Plan keys are the "tier" on a
   user (users.json) and the "plan" on an organisation (organisations.json):
   benchmarker | advisory. Any element with data-plan="<key>"
   gets the family's --pill-* values; .pill--plan gives it the pill shape.
   A missing or unknown key gets the neutral grey. "admin" is the internal
   account tag: an ink pill (--text fill, --bg label; white on near-black
   in light mode, inverted in dark). Green and red stay semantic, never
   plans.
   ═══════════════════════════════════════════════════════════════════ */
[data-plan]                 { --pill-tint: var(--cat-6-tint); --pill-text: var(--cat-6-text); --pill-dot: var(--cat-6-dot); }  /* default, unknown */
[data-plan="benchmarker"]   { --pill-tint: var(--cat-1-tint); --pill-text: var(--cat-1-text); --pill-dot: var(--cat-1-dot); }  /* blue */
[data-plan="advisory"]      { --pill-tint: var(--cat-4-tint); --pill-text: var(--cat-4-text); --pill-dot: var(--cat-4-dot); }  /* violet */
[data-plan="admin"]         { --pill-tint: var(--text);       --pill-text: var(--bg);         --pill-dot: var(--bg); }          /* ink */

/* Sample data pill: marks anything showing sample (illustrative) figures,
   never live data. Grey family tint, no dot, no border. */
.pill--sample {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: none;
  border-radius: 999px;
  outline: none;
  box-shadow: none;
  background: var(--cat-6-tint);
  color: var(--cat-6-text);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
  vertical-align: middle;
}
.pill--sample::before { content: none; }

/* Solid blue pill (selected filter, "Featured"): always a white label */
.pill--solid {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  border: 1px solid var(--action);
  border-radius: 999px;
  background: var(--action);
  color: var(--on-action);
  font-weight: 600;
  white-space: nowrap;
}
.pill--solid::before { content: none; }

/* Outlined blue pill (default / inactive filter) */
.pill--outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  border: 1px solid var(--action);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  white-space: nowrap;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.pill--outline::before { content: none; }
.pill--outline:hover { background: var(--action-tint); }

/* ═══ Brand logo ════════════════════════════════════════════════════
   --nav-logo-h: wordmark height in every top nav (landing and marketing
   pages, platform, admin), the mobile menu panels and the marketing
   footer (.lp-footer-logo-img). Width follows from the image's aspect
   ratio (320 x 104). Auth pages use 28px. Never under 20px (the logo's
   minimum, _handoff/kodo_logo/README.txt).

   The wordmark is the slanted-dot "kodo." (static/images/brand, SVG:
   outlined paths, the dot always #0075DE). Every page renders both
   (.logo-light: kodo-logo-black.svg, for light backgrounds; .logo-dark:
   kodo-logo-white.svg). Only the one for the current <html data-theme>
   shows, so the swap is instant and never flashes.
   ═══════════════════════════════════════════════════════════════════ */
:root[data-theme="dark"] .logo-light,
:root:not([data-theme="dark"]) .logo-dark { display: none !important; }
:root { --nav-logo-h: 26px; }
@media (max-width: 767px) { :root { --nav-logo-h: 22px; } }
