/* ── tokens ──────────────────────────────────────────────────────────────────────────────────
   Every colour the app uses, named by the role it plays rather than by what it looks like, so a
   component asks for --ink or --stroke and gets the right answer in either theme.

   The dark block is not a tint of the light one: the two were tuned separately against WCAG, and
   several pairs differ in more than lightness. Changing a value here changes it everywhere, which
   is the point — and components.html will show you what you changed.

   Load first: everything after this reads from it.
   ───────────────────────────────────────────────────────────────────────────────────────────── */
  /* design tokens: light theme with a teal accent */
  :root, [data-mode="light"] {
    --ink: #1a232a;
    --ink-soft: #323c44;
    --step-solid: #6a7280;   /* the action badge: a grey of its own, lighter than text */
    --muted: #525f65;
    --muted-2: #5f6b72;

    --rule: rgba(90, 100, 105, 0.11);
    --stroke: rgba(90, 100, 105, 0.17);
    /* A control's border is how you tell it is a control, so WCAG 1.4.11 asks 3:1 of it, where a card's
       edge is decoration and does not. One token for the boundaries that have to be seen. */
    --field: rgba(90, 100, 105, 0.17);
    --stroke-strong: rgba(90, 100, 105, 0.25);
    --wash: rgba(90, 100, 105, 0.09);
    /* --wash already flattened onto the page. A chip that sits on a tinted row cannot be translucent,
       or it takes that tint and stops matching the same chip elsewhere. */
    --chip: #f0f1f2;
    --wash-hover: rgba(13, 144, 127, 0.15);

    --page: #ffffff;
    --surface: #fafbfb;
    --frame: #eff1f1;
    --panel-bg: #f8f9f9;

    /* The hover card is the only thing in the app that floats, so it is the only thing that lifts.
       On white it cannot go lighter, so the shadow carries it; in dark it steps up a surface instead. */
    --pop-bg: var(--page);
    --lift: 0 1px 2px rgba(90, 100, 105, .06), 0 10px 26px rgba(90, 100, 105, .13);
    --rib-hi: rgba(255, 255, 255, 0.58);
    --rib-lo: rgba(58, 98, 96, 0.26);
    --rib-glow: rgba(229, 242, 239, 0.95);
    --rib-shade: rgba(58, 98, 96, 0.28);
    --rib-base: rgba(92, 140, 134, 0.18);

    /* softened, and a teal leaning toward green */
    --accent: #0d907f;
    --accent-hover: #0a7c6e;
    --btn: #0a7a6c;
    --accent-deep: #0a6d63;
    --accent-wash: rgba(13, 144, 127, 0.1);
    --mark-strong: rgba(13, 144, 127, 0.26);
    --accent-line: rgba(13, 144, 127, 0.34);
    --row-sel: linear-gradient(to right, rgba(13, 144, 127, .03) 0%, rgba(13, 144, 127, .05) 50%, rgba(13, 144, 127, .03) 100%);
    --row-rule: linear-gradient(to right, rgba(13, 144, 127, .2) 0%, rgba(13, 144, 127, .34) 38%, rgba(13, 144, 127, .42) 46%,
                rgba(13, 144, 127, .66) 50%, rgba(13, 144, 127, .42) 54%, rgba(13, 144, 127, .3) 62%, rgba(13, 144, 127, .1) 100%);
    --row-rule-edge: rgba(13, 144, 127, .23);
    /* the row rule, folded about a card's own centre: --row-rule fades from one side of the
       table to the other, which on a 324px card puts its two ends on the card's two sides and
       leaves one of them visibly dimmer than the other. The ends sit well above the row
       rule's: a card is drawn by its edge, so the quietest point still has to out-read the
       grey stroke an unselected card carries, or selecting one looks like losing its border. */
    --card-rule: linear-gradient(to right, rgba(13, 144, 127, .3) 0%, rgba(13, 144, 127, .46) 25%,
                rgba(13, 144, 127, .66) 50%, rgba(13, 144, 127, .46) 75%, rgba(13, 144, 127, .3) 100%);
    --fill-grad: linear-gradient(to right, #0aa8a2, var(--accent));

    --warning: #a44200;
    --error: #b0175f;
    --error-border: rgba(208, 50, 117, 0.22);
    --danger: #c92323;   /* deep enough to clear 4.5:1 on its own wash, not only on the page */
    --danger-wash: rgba(201, 35, 35, .1);
    /* A button filled with the danger colour, which is not the same colour in both themes: here it is
       deep enough to carry white, and in dark it is a light red carrying dark text instead. */
    --danger-btn: #c92323;
    --danger-btn-hover: #b01c1c;
    --danger-btn-ink: #fff;

    --avatar-text: #27383d;
    --avatar-blue: #d0e7ea;
    --avatar-teal: #cce8e3;
    --avatar-violet: #d9e3ec;

    color-scheme: light;
    --font: "Figtree", -apple-system, "Segoe UI", sans-serif;
  }

  /* dark mode: same structure, a cool teal-slate palette. Set by the toggle in the top bar (or the system setting). */
  /* Also matched as a plain attribute selector, not only on :root, so a dark block can be nested
     inside a light page. Nothing in the app does that — components.html does, to show the two
     themes side by side, which is the one view that makes a token change legible. */
  :root[data-mode="dark"], [data-mode="dark"] {
    color-scheme: dark;
    --ink: #e9edee;
    --ink-soft: #cbd1d3;
    --step-solid: #b9c0c6;
    --muted: #a0a9ac;
    --muted-2: #9aa2a5;

    --rule: rgba(180, 195, 200, 0.11);
    --stroke: rgba(180, 195, 200, 0.18);
    --field: rgba(180, 195, 200, 0.55);
    --stroke-strong: rgba(180, 195, 200, 0.30);
    --wash: rgba(180, 195, 200, 0.09);
    --chip: #313639;
    --wash-hover: rgba(49, 170, 152, 0.16);

    --page: #1f2224;
    --surface: #262a2c;
    --frame: #17191b;
    --panel-bg: #1b1e20;

    --pop-bg: var(--surface);
    --lift: 0 1px 2px rgba(0, 0, 0, .22), 0 10px 26px rgba(0, 0, 0, .36);
    --rib-hi: rgba(200, 228, 224, 0.15);
    --rib-lo: rgba(0, 0, 0, 0.34);
    --rib-glow: rgba(152, 202, 196, 0.15);
    --rib-shade: rgba(0, 0, 0, 0.30);
    --rib-base: rgba(106, 158, 152, 0.11);

    --accent: #31aa98;
    --accent-hover: #0d8372;   /* deeper than --btn's lift allows, so white on it clears 4.5:1 */
    --btn: #0a7a6c;
    --accent-deep: #6fdcc8;
    --accent-wash: rgba(49, 170, 152, 0.14);
    --mark-strong: rgba(49, 170, 152, 0.32);
    --accent-line: rgba(49, 170, 152, 0.36);
    --row-sel: linear-gradient(to right, rgba(49, 170, 152, .03) 0%, rgba(49, 170, 152, .05) 50%, rgba(49, 170, 152, .03) 100%);
    --row-rule: linear-gradient(to right, rgba(49, 170, 152, .2) 0%, rgba(49, 170, 152, .34) 38%, rgba(49, 170, 152, .42) 46%,
                rgba(49, 170, 152, .66) 50%, rgba(49, 170, 152, .42) 54%, rgba(49, 170, 152, .3) 62%, rgba(49, 170, 152, .1) 100%);
    --row-rule-edge: rgba(49, 170, 152, .23);
    /* the row rule, folded about a card's own centre: --row-rule fades from one side of the
       table to the other, which on a 324px card puts its two ends on the card's two sides and
       leaves one of them visibly dimmer than the other. The ends sit well above the row
       rule's: a card is drawn by its edge, so the quietest point still has to out-read the
       grey stroke an unselected card carries, or selecting one looks like losing its border. */
    --card-rule: linear-gradient(to right, rgba(49, 170, 152, .3) 0%, rgba(49, 170, 152, .46) 25%,
                rgba(49, 170, 152, .66) 50%, rgba(49, 170, 152, .46) 75%, rgba(49, 170, 152, .3) 100%);
    --fill-grad: linear-gradient(to right, #3ec4bd, var(--accent));

    --warning: #e8a26d;
    --error: #ee8ab3;
    --error-border: rgba(238, 138, 179, 0.26);
    --danger: #fb8a8a;
    --danger-wash: rgba(248, 113, 113, .14);
    --danger-btn: #fb8a8a;
    --danger-btn-hover: #ef6b6b;   /* deeper on hover, where a lighter red would lose its dark label */
    --danger-btn-ink: #12191f;

    --avatar-text: #dbe4e6;
    --avatar-blue: #26363a;
    --avatar-teal: #243836;
    --avatar-violet: #2b3339;
  }
