/* Supervisory desk: the theme. One set of tokens, two themes (light, and a dark operations theme), and the shell.
   Loaded by every page straight after the shared kit (/kit/styles.css) and before the page's own stylesheet.

   ------------------------------------------------------------------------------------------------------------
   WHAT A NEW PAGE NEEDS (copy these lines; nothing else is required)

   In <head>, in this order:
     <link rel="stylesheet" href="/kit/styles.css">
     <link rel="stylesheet" href="/theme.css">
     <script src="/shell.js"></script>            (not a module and not deferred: it sets the theme before first paint)
     <link rel="stylesheet" href="/yourpage.css">

   In <body>:
     <body class="d-body">
       <div class="g-app">
         <header class="g-top">
           <desk-shell></desk-shell>              (brand, the list of apps, the theme switch; see shell.js)
           ...the page's own header controls, if it has any (for example <div class="g-space" id="spaces">)...
         </header>
         <div class="g-banner" id="banner" role="status" hidden></div>
         ...the page...
       </div>
       <script type="module" src="/yourpage.js"></script>
     </body>

   In the page's CSS: use the tokens below (var(--ink), var(--card), var(--line) ...). Never a hex value: a hex value
   does not change with the theme.

   In the page's JS, for anything drawn (charts, canvas):
     import {V, palette, onTheme} from '/theme.js';
     - SVG and HTML: set colours to V.blue, V.ink, V.grid ... These are 'var(--c-1)' strings, so the drawing follows
       the theme by itself, with no redraw.           svg('rect', {fill: V.blue})
     - Canvas: read real values at draw time with palette(), and draw again when the theme changes.
                                                      const P = palette(); ctx.fillStyle = P.blue;
                                                      onTheme(() => draw());
     - Something exported as a document (an image, a print) is white paper: palette('light'), whatever the theme.
   The dashboards' chart library (/dash.js) already does all of this; its `C` holds the same var(--...) strings.

   ------------------------------------------------------------------------------------------------------------
   THE RULES THE THEMES KEEP (22 Nov 2026; the design and wording rules are in ../DESIGN.md)
   Dark is the default. Panels are glass: a translucent --card with a blur and a hairline, over the --backdrop glow on
   <html>. Teal (--accent) marks what is current, selected or primary, the focus ring, and the first chart series.
   No solid accent tiles: an accent is a line, a ring, a glow or a mark, never a filled box behind text. Text is never
   set in a series colour. Anything opaque (a chart's ring, a sticky bar) uses --card-solid or --page-solid.
   A glass panel (backdrop-filter) is the containing block of any position:fixed child: append overlays to <body>.

   Chart series: eight hues in a fixed order (teal, orange, violet, green, magenta, yellow, blue, red), checked with
   the dataviz palette validator on each theme's chart surface. Slots 1 to 3 are also safe when any two marks can sit
   side by side (scatter, bubble, the globe, the graph). Use the slots in order; a ninth series folds into "Other".
*/

/* ---------- light: one click away from the default dark; also what prints. Glass on a pale teal wash. ---------- */
:root, [data-theme="light"] {
  color-scheme: light;

  /* surfaces, back to front. --card is glass: see .glass and the panel list below. */
  --page: rgba(244, 248, 248, .55);   /* the backdrop behind tiles; translucent so the wash on <html> shows */
  --page-solid: #f2f6f6;              /* where something must cover what is behind it */
  --card: rgba(255, 255, 255, .74);
  --card-solid: #fbfcfc;
  --raised: rgba(255, 255, 255, .96); /* tooltips, notes, drawers */
  --sunk: rgba(15, 60, 64, .05);
  --hover: rgba(15, 60, 64, .04);

  /* hairlines */
  --line: rgba(15, 60, 64, .10);
  --line-strong: rgba(15, 60, 64, .18);

  /* text */
  --ink: #0a1416;
  --ink-2: #33474b;
  --muted: #5f7276;
  --faint: #66797d;
  --on-ink: #ffffff;

  /* the accent: teal, the hue of #3fc9d0 (the user's teal, 22 Nov 2026), darker here so it reads on white. Spent on what is current, selected or primary, on focus, and on the first chart series. */
  --accent: #007f88;
  --accent-strong: #006a72;
  --accent-ink: #ffffff;               /* text on an accent-filled button */
  --accent-soft: rgba(0, 127, 136, .10);
  --accent-line: rgba(0, 127, 136, .45);
  --accent-glow: 0 0 0 1px rgba(0, 127, 136, .25), 0 10px 28px -12px rgba(0, 127, 136, .45);

  /* states: always beside a word or a shape, never colour alone */
  --gap: #dc2626;
  --gap-bg: rgba(220, 38, 38, .07);
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, .08);
  --warn-ink: #92400e;
  --warn-line: #f0c36d;
  --met: #16a34a;
  --met-bg: rgba(22, 163, 74, .08);
  --na-bg: rgba(15, 60, 64, .05);

  /* focus and selection */
  --focus: #007f88;
  --select: rgba(0, 127, 136, .20);

  --blur: blur(18px) saturate(150%);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 2px rgba(10, 20, 22, .04), 0 14px 34px -18px rgba(10, 40, 44, .22);
  --shadow-hover: inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 2px rgba(10, 20, 22, .05), 0 20px 44px -18px rgba(10, 40, 44, .30);
  --scroll-thumb: #b9c7c9;
  --backdrop: radial-gradient(1100px 620px at 6% -8%, rgba(0, 127, 136, .13), transparent 62%),
              radial-gradient(900px 560px at 100% 0%, rgba(42, 120, 214, .08), transparent 58%),
              radial-gradient(1200px 800px at 50% 115%, rgba(0, 127, 136, .07), transparent 62%), #eef4f4;

  /* chart series, in order: teal, orange, violet, green, magenta, yellow, blue, red.
     Validated on #f9fbfb (dataviz validator, 22 Nov 2026; re-run with teal #00909b, the hue of the user's #3fc9d0): every adjacent pair passes; slot 6 (yellow) is 2.96:1, so
     a chart using it shows labels or a table. The first three pass all-pairs (scatter, bubble, map). */
  --c-1: #00909b;
  --c-2: #eb6834;
  --c-3: #6250d6;
  --c-4: #008300;
  --c-5: #d55181;
  --c-6: #c98500;
  --c-7: #2a78d6;
  --c-8: #e34948;
  --c-quiet: #8a989b;
  --c-absent: #d3dcdd;
  /* chart furniture */
  --c-surface: var(--card-solid);  /* the fill of a hollow mark, the ring round an overlapping one: must be opaque */
  --c-grid: rgba(15, 60, 64, .08);
  --c-axis: rgba(15, 60, 64, .16);
  --c-track: rgba(15, 60, 64, .07);
  --c-soft: #b9c7c9;
  --c-edge: #b9c7c9;
  --c-edge-strong: #8a9c9f;
  --c-band: rgba(0, 127, 136, .14);   /* a forecast's widest range; narrower ranges stack on it */
  /* one sequential ramp for every dashboard: one hue, light to dark, for magnitude (a heat cell, a wind step). Validated as an
     ordinal ramp on #fbfcfc (23 Nov 2026): monotone, every step gap >= 0.06, the lightest step 2.07:1 against the surface. */
  --seq-1: #82bcbc; --seq-2: #649fa0; --seq-3: #478285; --seq-4: #29676b; --seq-5: #034d52; --seq-6: #00343b;

  /* the globe (canvas reads these through theme.js) */
  --stage-0: #ffffff; --stage-1: #f7fafa; --stage-2: #eef4f4;
  --globe-sea-0: #ffffff; --globe-sea-1: #f7fbfb; --globe-sea-2: #e9f1f1;
  --globe-land: #d9e3e4;
  --globe-land-busy: #c2d0d2;
  --globe-land-home: #9fb6b8;
  --globe-coast: #ffffff;
  --globe-ring: #ffffff;
  --globe-halo: rgba(255, 255, 255, .93);
  --globe-graticule: rgba(10, 40, 44, .06);
  --globe-rim: rgba(10, 40, 44, .07);
  --globe-rim-0: rgba(10, 40, 44, 0);
  --globe-outline: #c9d6d7;
  --globe-shadow: rgba(10, 40, 44, .16);
  /* the 3D globe over NASA imagery (globe-3d.js): lines, the air round it, the sea it lifts toward, a one-hue fill */
  --globe-border: rgba(255, 255, 255, .66);
  --globe-coastline: rgba(255, 255, 255, .5);
  --globe-admin: rgba(255, 255, 255, .8);
  --globe-atmo: rgba(120, 190, 205, .6);
  --globe-sea-grade: #9cc4cc;
  --globe-lights: #ffd27a;
  --globe-fill-lo: #d3eaea;
  --globe-fill-hi: #04545a;

  /* scales: use these in new work so pages line up */
  --gutter: 22px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 22px; --sp-6: 32px;
  --fs-micro: 11px; --fs-small: 12px; --fs-ui: 13px; --fs-text: 13.5px; --fs-body: 14.5px; --fs-lead: 17px; --fs-title: 24px; --fs-figure: 26px;
  --r-1: 8px; --r-2: 12px; --r-3: 16px; --r-pill: 999px;
}

/* ---------- dark: the default (the user's word, 22 Nov 2026). Glass panels over a deep teal-black, teal accents.
   Screen only: anything printed is white paper. ---------- */
@media screen {
  :root[data-theme="dark"], [data-theme="dark"] {
    color-scheme: dark;

    --page: rgba(4, 9, 12, .30);
    --page-solid: #070d10;
    --card: rgba(18, 30, 35, .58);
    --card-solid: #0f181c;
    --raised: rgba(14, 24, 28, .95);
    --sunk: rgba(255, 255, 255, .045);
    --hover: rgba(255, 255, 255, .035);

    --line: rgba(150, 225, 218, .09);
    --line-strong: rgba(150, 225, 218, .17);

    --ink: #e7f2f2;           /* high contrast, not pure white */
    --ink-2: #b2c4c6;
    --muted: #84999c;
    --faint: #7b9093;
    --on-ink: #051012;

    --accent: #3fc9d0;
    --accent-strong: #74dde2;
    --accent-ink: #032a2d;
    --accent-soft: rgba(63, 201, 208, .11);
    --accent-line: rgba(63, 201, 208, .50);
    --accent-glow: 0 0 0 1px rgba(63, 201, 208, .30), 0 10px 32px -10px rgba(63, 201, 208, .40);

    --gap: #e66767;   /* stepped 23 Nov 2026: beside --warn the earlier #f26d6a was 14.5 apart for full colour vision (floor 15); this is 15.7, and 10.3 under deutan. 5.57:1 as text on the card */
    --gap-bg: rgba(230, 103, 103, .10);
    --warn: #e0a44a;
    --warn-bg: rgba(224, 164, 74, .10);
    --warn-ink: #e8b260;
    --warn-line: #7a5a22;
    --met: #2fb561;
    --met-bg: rgba(47, 181, 97, .10);
    --na-bg: rgba(255, 255, 255, .045);

    --focus: #3fc9d0;
    --select: rgba(63, 201, 208, .30);

    --blur: blur(20px) saturate(150%);
    --shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 0 0 1px rgba(0, 0, 0, .15), 0 18px 40px -20px rgba(0, 0, 0, .85);
    --shadow-hover: inset 0 1px 0 rgba(255, 255, 255, .07), 0 0 0 1px rgba(0, 0, 0, .2), 0 24px 52px -20px rgba(0, 0, 0, .9);
    --scroll-thumb: rgba(150, 225, 218, .18);
    --backdrop: radial-gradient(1100px 640px at 4% -10%, rgba(31, 164, 172, .17), transparent 62%),
                radial-gradient(900px 600px at 102% -4%, rgba(57, 135, 229, .10), transparent 58%),
                radial-gradient(1200px 820px at 55% 118%, rgba(31, 164, 172, .09), transparent 62%), #050a0d;

    /* the same eight hues stepped for the dark surface. Validated on #0f171b (22 Nov 2026; re-run with teal #1fa4ac, one step deeper than
       the accent #3fc9d0, which is too light to sit among chart series): all checks pass,
       adjacent and, for the first three, all-pairs. */
    --c-1: #1fa4ac;
    --c-2: #d95926;
    --c-3: #9085e9;
    --c-4: #0ca30c;
    --c-5: #d55181;
    --c-6: #c98500;
    --c-7: #3987e5;
    --c-8: #e66767;
    --c-quiet: #7b9093;
    --c-absent: #3d4f53;
    --c-surface: var(--card-solid);
    --c-grid: rgba(150, 225, 218, .075);
    --c-axis: rgba(150, 225, 218, .16);
    --c-track: rgba(255, 255, 255, .06);
    --c-soft: #4a5d61;
    --c-edge: #34474b;
    --c-edge-strong: #5d7579;
    --c-band: rgba(63, 201, 208, .13);
    /* the same ramp stepped for the dark surface, dark to light. Validated on #0f181c (23 Nov 2026): the lowest step 2.61:1. */
    --seq-1: #0d646b; --seq-2: #2c8185; --seq-3: #46a0a1; --seq-4: #61c0bd; --seq-5: #7ce0d9; --seq-6: #98fff5;

    --stage-0: #0f1b20; --stage-1: #0b1418; --stage-2: #070e11;
    --globe-sea-0: #10222a; --globe-sea-1: #0b1a20; --globe-sea-2: #071216;
    --globe-land: #1f3237;
    --globe-land-busy: #2d4a50;
    --globe-land-home: #3f6a6c;
    --globe-coast: #08141a;
    --globe-ring: #08141a;
    --globe-halo: rgba(6, 14, 17, .9);
    --globe-graticule: rgba(150, 225, 218, .07);
    --globe-rim: rgba(63, 201, 208, .12);
    --globe-rim-0: rgba(63, 201, 208, 0);
    --globe-outline: #2a3f44;
    --globe-shadow: rgba(0, 0, 0, .55);
    --globe-border: rgba(170, 235, 228, .36);
    --globe-coastline: rgba(170, 235, 228, .3);
    --globe-admin: rgba(214, 250, 245, .72);
    --globe-atmo: rgba(63, 201, 208, .62);
    --globe-sea-grade: #06141a;
    --globe-lights: #ffd58a;
    --globe-fill-lo: #133a40;
    --globe-fill-hi: #8af2e8;
  }
}
@media (max-width: 640px) { :root { --gutter: 16px; } }

/* ---------- glass: the backdrop, and the panels that float on it ---------- */
html { background: var(--backdrop); background-attachment: fixed; min-height: 100%; }
.glass, :where(.b-box, .db-tile, .db-card, .o-board, .o-tone, .o-rail, .o-stage, .s-box, .st-box, .card) {
  background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: var(--shadow);
}
@media print { html { background: #fff; } .glass, :where(.b-box, .db-tile, .db-card, .o-board, .o-tone, .o-rail, .o-stage, .s-box, .st-box, .card) { -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: none; } }

/* ---------- what the kit hard-codes, restated in tokens (the kit itself is not edited) ---------- */
/* Buttons: the primary one is teal; the quiet one is glass with a hairline that turns teal on hover. */
.btn { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: var(--accent-glow); font-weight: 600; }
.btn:hover { box-shadow: var(--accent-glow), 0 0 0 3px var(--accent-soft); }
.btn.ghost { color: var(--ink); background: var(--card); border-color: var(--line-strong); box-shadow: none; font-weight: 500; -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.btn.ghost:hover { border-color: var(--accent-line); box-shadow: none; }
.btn:active:not(:disabled) { transform: none; box-shadow: none; opacity: .86; }
.btn.ghost:active:not(:disabled) { background: var(--sunk); opacity: 1; }
.btn:disabled { background: var(--sunk); border-color: var(--line-strong); color: var(--muted); box-shadow: none; opacity: 1; }
/* The Glass wordmark (shell.js), in the text colour, with no logo beside it. */
.brand .wordmark { display: block; flex: none; height: 13px; width: auto; color: var(--ink); }
.brand .wordmark + span { margin-left: 2px; }
input, select, textarea { background-color: var(--card); color: var(--ink); }
::placeholder { color: var(--muted); opacity: 1; }
::selection { background: var(--select); }

/* Keyboard focus: one ring, everywhere, in both themes. A page's own, more specific focus style still wins. */
:root :focus-visible:where(:not([tabindex="-1"])) { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Full-width rows sit in scrolling panes, which would cut a ring drawn outside them. */
:root :is(.db-row, .w-row, .g-item, .g-kpi, .d-convs button, .g-nav a, .d-starters button):focus-visible { outline-offset: -2px; }

/* Figures line up: the same digit width everywhere a number is read against another. */
.g-kpi b, .db-fig b, .r-fig b, .d-layer dd, .db-table .n, .r-rows .num, .w-score, .l-step em, .l-bars em, .mono { font-variant-numeric: tabular-nums; }

/* Scrollbars in dark: thin and quiet. Light keeps the system's. */
@media screen {
  :root[data-theme="dark"] * { scrollbar-color: var(--scroll-thumb) transparent; }
  :root[data-theme="dark"] ::-webkit-scrollbar { width: 10px; height: 10px; }
  :root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
  :root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background-color: rgba(150, 225, 218, .3); }
  :root[data-theme="dark"] ::-webkit-scrollbar-track, :root[data-theme="dark"] ::-webkit-scrollbar-corner { background: transparent; }
}

/* ---------- the shell: one header on every page (shell.js draws it from one list) ---------- */
desk-shell { display: contents; }
/* A page read in Arabic: the header runs right to left (shell.js sets the class; a class, not the dir attribute, so a page's own rules for right-to-left text leave the header alone). */
.g-top.g-rtl { direction: rtl; }
.g-top { display: flex; align-items: center; gap: 20px; min-height: 52px; padding: 0 var(--gutter); border-bottom: 1px solid var(--line); background: var(--card); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); position: relative; z-index: 30; }
.g-top [hidden] { display: none; }
.g-top .brand { white-space: nowrap; color: var(--ink); font-size: 14.5px; border-radius: 8px; min-height: 32px; align-items: center; }
/* The apps. One row that never wraps. On a wide screen shell.js leaves out of the row any app that does not fit
   whole (it is in the All pages menu); on a phone the row scrolls sideways inside the header. */
.g-nav { display: flex; align-self: stretch; gap: 0; flex: 1 1 0; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.g-nav::-webkit-scrollbar { display: none; }
.g-nav a { position: relative; display: flex; align-items: center; flex: none; padding: 0 9px; font-size: 13px; letter-spacing: -0.005em; color: var(--ink-2); text-decoration: none; white-space: nowrap; border-radius: 6px; transition: color .12s; }
.g-nav a:hover { color: var(--ink); }
.g-nav a:active { color: var(--muted); }
.g-nav a::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; transition: background .12s; }
.g-nav a:hover::after { background: var(--line-strong); }
.g-nav a[aria-current] { color: var(--ink); font-weight: 500; }
.g-nav a[aria-current]::after { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
/* More apps than fit (a phone): the cut edge fades, so it reads as "there is more this way". */
.g-nav[data-more="r"] { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 32px); mask-image: linear-gradient(to left, transparent 0, #000 32px); }
.g-nav[data-more="l"] { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px); mask-image: linear-gradient(to right, transparent 0, #000 32px); }
.g-nav[data-more="lr"] { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 32px, #000 calc(100% - 32px), transparent 100%); }
/* All pages: the button beside the last app in the row, and the panel it opens with every page in six groups. */
/* The apps row shrinks to its links, and the button takes the free space after it, so it sits beside the last app. */
@media (min-width: 761px) { .g-top .g-nav { flex: 0 1 auto; } }
.g-more { flex: none; align-self: stretch; display: flex; margin-inline-start: -12px; margin-inline-end: auto; }
.g-more-btn { all: unset; box-sizing: border-box; position: relative; display: flex; align-items: center; gap: 4px; padding: 0 9px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; border-radius: 6px; transition: color .12s; }
.g-more-btn:hover, .g-more-btn[aria-expanded="true"] { color: var(--ink); }
.g-more-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.g-more-btn svg { flex: none; width: 13px; height: 13px; transition: transform .15s ease-out; }
.g-more-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.g-more-btn[data-current] { color: var(--ink); font-weight: 500; }
.g-more-btn[data-current]::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.g-more-btn[lang="ar"] { font-family: var(--ar-ui, inherit); font-size: 13.5px; letter-spacing: 0; }
.g-menu { position: absolute; top: calc(100% + 6px); inset-inline-start: var(--gutter); width: min(1080px, calc(100% - 2 * var(--gutter))); box-sizing: border-box; padding: 14px 10px 10px;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 6px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--card-solid, var(--card));
  box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .45); z-index: 40; text-align: start; }
.g-menu[hidden] { display: none; }
.g-menu-group { min-width: 0; }
.g-menu h3 { margin: 0 0 4px; padding: 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.g-menu h3[lang="ar"] { font-family: var(--ar-ui, inherit); font-size: 12.5px; letter-spacing: 0; }
.g-menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.g-menu a { display: flex; align-items: center; min-height: 34px; padding: 3px 10px; box-sizing: border-box; border-radius: 8px; font-size: 13px; line-height: 1.25; color: var(--ink-2); text-decoration: none; transition: color .12s, background .12s; }
.g-menu a[lang="ar"] { font-family: var(--ar-ui, inherit); font-size: 13.5px; }
.g-menu a:hover { color: var(--ink); background: var(--sunk); }
.g-menu a:focus-visible { color: var(--ink); background: var(--sunk); outline: 2px solid var(--focus); outline-offset: -2px; }
.g-menu a[aria-current] { position: relative; color: var(--ink); font-weight: 500; }
.g-menu a[aria-current]::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 0; width: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
@media (max-width: 1100px) { .g-menu { grid-template-columns: repeat(3, minmax(0, 1fr)); width: min(640px, calc(100% - 2 * var(--gutter))); } }
/* The menu's own tools: on a phone only, where the row has no room for their words (Expert input, the theme). */
.g-more-bars, .g-menu-phone { display: none; }
.g-menu-act { all: unset; box-sizing: border-box; display: flex; align-items: center; width: 100%; min-height: 34px; padding: 3px 10px; border-radius: 8px; font-size: 13px; line-height: 1.25; color: var(--ink-2); cursor: pointer; transition: color .12s, background .12s; }
.g-menu-act[lang="ar"] { font-family: var(--ar-ui, inherit); font-size: 13.5px; }
.g-menu-act:hover { color: var(--ink); background: var(--sunk); }
.g-menu-act:focus-visible { color: var(--ink); background: var(--sunk); outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 760px) {
  /* Phone: the menu is one button in the header's row, three lines with its name read out; the panel is a sheet across the screen, two groups a row. */
  .g-top.g-top .g-more { order: 6; align-self: center; margin: 0; }
  .g-more-btn { width: 32px; height: 32px; padding: 0; justify-content: center; border: 1px solid var(--line-strong); border-radius: 8px; transition: color .12s, border-color .12s; }
  .g-more-btn:hover, .g-more-btn[aria-expanded="true"] { border-color: var(--accent-line); }
  .g-more-btn:focus-visible { outline-offset: 2px; }
  .g-more-btn > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .g-more-btn .g-more-chev, .g-more-btn[data-current]::after { display: none; }
  .g-more-btn .g-more-bars { display: block; width: 15px; height: 15px; }
  .g-more-btn[aria-expanded="true"] svg { transform: none; }
  .g-menu { inset-inline: 8px; width: auto; top: calc(100% + 4px); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 4px; max-height: calc(100dvh - 90px); overflow-y: auto; overscroll-behavior: contain; padding: 12px 6px 8px; }
  .g-menu a, .g-menu-act { min-height: 38px; }
  .g-menu-phone { display: block; }
}
body.present .g-more, body.present .g-menu { display: none; }
@media (prefers-reduced-motion: reduce) { .g-more-btn, .g-more-btn svg, .g-menu a { transition: none; } }
@media print { .g-more, .g-menu { display: none; } }
/* The theme switch: last in the header on every page. */
.t-switch { all: unset; box-sizing: border-box; order: 9; flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink-2); cursor: pointer; transition: color .12s, border-color .12s, background .12s; }
.t-switch:hover { color: var(--ink); border-color: var(--accent-line); }
.t-switch:active { background: var(--sunk); }
.t-switch svg { width: 15px; height: 15px; }
.t-switch .t-sun, :root[data-theme="dark"] .t-switch .t-moon { display: none; }
/* Expert input: on every page, beside the theme switch. */
.x-open { all: unset; box-sizing: border-box; order: 8; flex: none; height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--ink-2); font-size: 13px; cursor: pointer; white-space: nowrap; transition: color .12s, border-color .12s, background .12s; }
.al-slot { order: 8; flex: none; display: inline-flex; }
/* The reviewer's count (decision U-54): a link to the review queue on the Learning page, for the approver role only. */
.g-review { order: 7; flex: none; box-sizing: border-box; height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--ink-2); font-size: 13px; text-decoration: none; white-space: nowrap; transition: color .12s, border-color .12s; }
.g-review[hidden] { display: none; }
.g-review:hover { color: var(--ink); border-color: var(--accent-line); }
.g-review:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.g-review svg { width: 14px; height: 14px; flex: none; }
.g-review b { font: inherit; font-variant-numeric: tabular-nums; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--ink); }
.g-review[data-n="0"] b { box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); }
@media print { .g-review { display: none; } }
@media (prefers-reduced-motion: reduce) { .g-review { transition: none; } }
.x-open:hover { color: var(--ink); border-color: var(--accent-line); }
.x-open:active { background: var(--sunk); }
.x-open:focus-visible, .t-switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.x-open svg { width: 14px; height: 14px; }
.x-open b { font: inherit; display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 11px; font-variant-numeric: tabular-nums; }
.x-open b:empty { display: none; }
:root[data-theme="dark"] .t-switch .t-sun { display: block; }

/* The switch between sets of data (live, synthetic example) that several pages put in the header. */
.g-space button { transition: color .12s; }
.g-top .g-space button { box-sizing: border-box; min-height: 32px; display: inline-flex; align-items: center; }      /* every header control is 32px tall */
.g-space button:hover:not([aria-pressed="true"]) { color: var(--ink); }

@media (max-width: 1180px) { .g-top { gap: 14px; } .g-top .brand > span:last-child { display: none; } }
.g-top.g-tight .brand > span:last-child { display: none; }      /* set by shell.js when the apps would not fit */
@media (max-width: 1100px) {
  /* A narrow window, a tablet or a phone: the header's tools are icons with their counts, not words, so the row keeps
     room for the apps and never runs off the side. The word stays for a screen reader and in the button's title. */
  .g-top.g-top .g-review, .g-top.g-top > button.eq-open, .g-top.g-top .x-open { padding: 0 9px; gap: 6px; }
  .g-top.g-top .g-review > span, .g-top.g-top > button.eq-open > span, .g-top.g-top .x-open > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 760px) {
  /* Phone: one row. The brand, then the counts and tools as icons (each with its name read out and in its title), the
     menu and the person. No row of apps: every page is in the menu, by its full name. A page's own header controls
     go on a line under the row. The class is doubled so these rules hold over the buttons' own styles, which their
     scripts add to the page later. */
  .g-top.g-top { flex-wrap: wrap; gap: 0 8px; padding: 0 var(--gutter); }
  .g-top .brand { order: 0; min-height: 46px; margin-inline-end: auto; }
  .g-top.g-top .g-nav { display: none; }
  .g-top.g-top .g-review { order: 1; }
  .g-top.g-top > button.eq-open { order: 2; margin: 0; }
  .g-top.g-top .al-slot { order: 3; }
  .g-top.g-top .x-open { order: 4; }
  .g-top.g-top .t-switch { order: 5; }
  .g-top.g-top > span.pm-slot { order: 7; margin: 0; }
  .g-top.g-has-menu .t-switch { display: none; }      /* the theme is in the menu on a phone */
  .g-top::after { content: ""; order: 8; flex: 0 0 100%; height: 0; }      /* ends the row */
  .g-top.g-top > :not(desk-shell, .t-switch, .x-open, .al-slot, .eq-open, .pm-slot) { order: 9; flex: 0 1 auto; max-width: 100%; margin: 0 0 10px; margin-inline-end: auto; }
  .g-top.g-top > :not(desk-shell, .t-switch, .x-open, .al-slot, .eq-open, .pm-slot):empty { display: none; }
}
@media (max-width: 480px) {
  /* A narrow phone: every tool is a 32px square and its count sits on the corner, so brand, tools, menu and person fit one row. */
  .g-top.g-top { gap: 0 6px; }
  .g-top.g-top .g-review, .g-top.g-top > button.eq-open, .g-top.g-top .x-open, .g-top.g-top .al-badge { position: relative; width: 32px; min-width: 32px; padding: 0; gap: 0; justify-content: center; }
  .g-top.g-top .g-review b, .g-top.g-top > button.eq-open b, .g-top.g-top .x-open b, .g-top.g-top .al-badge b { position: absolute; top: -6px; inset-inline-end: -6px; box-sizing: border-box; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
    display: grid; place-items: center; font-size: 10px; line-height: 1; font-weight: 600; background: var(--card-solid, var(--card)); box-shadow: 0 0 0 1px var(--line-strong); }
  .g-top.g-top .g-review b:empty, .g-top.g-top > button.eq-open b:empty, .g-top.g-top .x-open b:empty, .g-top.g-top .g-review[data-n="0"] b, .g-top.g-top .al-badge[data-level="none"] b, .g-top.g-top .al-badge[data-level="off"] b { display: none; }
}
@media (max-width: 374px) { .g-top.g-top { gap: 0 4px; } }
@media (max-width: 340px) { .g-top.g-top .x-open { display: none; } }      /* Expert input is in the menu */
@media (prefers-reduced-motion: reduce) { .g-nav a, .g-nav a::after, .t-switch, .x-open, .g-space button { transition: none; } }
@media print { .t-switch, .x-open, .al-slot { display: none; } }

/* ---------- small things every page shares ---------- */
/* An empty state: a plain dashed box and a sentence. The same on every page. */
.g-empty, .db-empty, .r-empty, .d-nothing { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 12px 14px; }
