/* =============================================================================================
   Grid Agent styles - presentation layer only. Plain CSS, no framework, no web fonts (the CSP
   allows same-origin resources only, so the type stack uses fonts already on the machine).

   HOW IT IS BUILT
   1. Design tokens: every colour, surface, border, radius and shadow is a CSS custom property.
   2. Themes: each theme only redefines tokens under html[data-theme="..."]. Components never
      hard-code a colour, so switching theme restyles every page without touching any script.
   3. Components: the SAME selectors the original stylesheet had (header.top, .panel, .kpi,
      .chip.ok, tr.clickable, #map, ...). Nothing the JavaScript relies on was renamed or removed.

   Themes: midnight (default), graphite, ocean, emerald, light. Picked by js/theme.js.
   The original stylesheet is kept next to this file as app.original.css.
   ============================================================================================= */

/* ---------------------------------------------------------------------------------------------
   1. TOKENS - shared scale (type, radius, motion)
   --------------------------------------------------------------------------------------------- */
:root {
  --font-sans: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Inter", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;

  --r-xs: 6px; --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 140ms; --t-med: 220ms;
  --blur: 14px;
  --header-h: 64px;
}

/* ---------------------------------------------------------------------------------------------
   2. THEMES - only tokens change here
   --------------------------------------------------------------------------------------------- */

/* Midnight Dark (default): deep navy-charcoal with an indigo and teal glow */
:root, html[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #070b14;
  --bg-glow-1: rgba(99, 102, 241, .20);
  --bg-glow-2: rgba(45, 212, 191, .09);
  --surface: rgba(15, 21, 36, .78);
  --surface-solid: #0f1524;
  --surface-raised: rgba(22, 30, 50, .94);
  --surface-sunken: rgba(4, 8, 16, .55);
  --surface-hover: rgba(141, 157, 255, .07);
  --border: rgba(148, 163, 196, .13);
  --border-strong: rgba(148, 163, 196, .26);
  --highlight: rgba(255, 255, 255, .05);
  --text: #e7ebf4;
  --text-2: #a9b2c6;
  --text-3: #7f899e;
  --accent: #8d9dff;
  --accent-strong: #6b7cf2;
  --accent-2: #5eead4;
  --on-accent: #0a0f22;
  --accent-soft: rgba(141, 157, 255, .14);
  --ring: rgba(141, 157, 255, .45);
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #7aa7ff; --neutral: #94a3b8;
  --header-bg: rgba(7, 11, 20, .74);
  --th-bg: rgb(20, 27, 45);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow: 0 1px 0 var(--highlight) inset, 0 12px 32px -14px rgba(0, 0, 0, .75);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  /* Canvas charts and the schematic map are drawn by script in dark ink on a light ground.
     In dark themes the luminance is flipped (hue kept) so they read naturally; light theme uses none. */
  --canvas-filter: invert(1) hue-rotate(180deg) saturate(1.15) brightness(.96);
  --canvas-bg: transparent;
  --map-bg: #0b1222;
  --log-bg: #050912; --log-text: #c9dcff;
}

/* Graphite: neutral carbon greys with a warm brass accent */
html[data-theme="graphite"] {
  color-scheme: dark;
  --bg: #0d0e10;
  --bg-glow-1: rgba(214, 179, 106, .10);
  --bg-glow-2: rgba(160, 170, 185, .06);
  --surface: rgba(24, 25, 28, .82);
  --surface-solid: #18191c;
  --surface-raised: rgba(32, 34, 38, .96);
  --surface-sunken: rgba(8, 8, 10, .55);
  --surface-hover: rgba(214, 179, 106, .07);
  --border: rgba(200, 200, 210, .11);
  --border-strong: rgba(200, 200, 210, .22);
  --highlight: rgba(255, 255, 255, .045);
  --text: #ecebe8;
  --text-2: #b0aea8;
  --text-3: #8a8883;
  --accent: #d9b56b;
  --accent-strong: #c39a48;
  --accent-2: #f0dba8;
  --on-accent: #1a1407;
  --accent-soft: rgba(217, 181, 107, .14);
  --ring: rgba(217, 181, 107, .45);
  --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #93b4ff; --neutral: #a3a3a3;
  --header-bg: rgba(13, 14, 16, .78);
  --th-bg: rgb(30, 31, 35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 0 var(--highlight) inset, 0 12px 32px -14px rgba(0, 0, 0, .8);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .85);
  --canvas-filter: invert(1) hue-rotate(180deg) saturate(1.05) brightness(.95);
  --canvas-bg: transparent;
  --map-bg: #141518;
  --log-bg: #08090a; --log-text: #e9dfc6;
}

/* Deep Ocean: abyssal blue with a sky-cyan accent */
html[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #03111b;
  --bg-glow-1: rgba(56, 189, 248, .16);
  --bg-glow-2: rgba(14, 116, 144, .16);
  --surface: rgba(7, 27, 41, .80);
  --surface-solid: #071b29;
  --surface-raised: rgba(10, 36, 54, .95);
  --surface-sunken: rgba(1, 9, 15, .55);
  --surface-hover: rgba(56, 189, 248, .08);
  --border: rgba(125, 196, 230, .14);
  --border-strong: rgba(125, 196, 230, .28);
  --highlight: rgba(255, 255, 255, .05);
  --text: #e3f1f9;
  --text-2: #9fbccd;
  --text-3: #7898ab;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --accent-2: #67e8f9;
  --on-accent: #02131d;
  --accent-soft: rgba(56, 189, 248, .14);
  --ring: rgba(56, 189, 248, .45);
  --ok: #2dd4bf; --warn: #fcd34d; --bad: #fb7185; --info: #7dd3fc; --neutral: #94a3b8;
  --header-bg: rgba(3, 17, 27, .76);
  --th-bg: rgb(9, 33, 50);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 0 var(--highlight) inset, 0 12px 32px -14px rgba(0, 10, 20, .85);
  --shadow-lg: 0 24px 60px -20px rgba(0, 8, 16, .9);
  --canvas-filter: invert(1) hue-rotate(180deg) saturate(1.15) brightness(.96);
  --canvas-bg: transparent;
  --map-bg: #061826;
  --log-bg: #010a11; --log-text: #c4ecff;
}

/* Emerald: forest-black with a jade accent */
html[data-theme="emerald"] {
  color-scheme: dark;
  --bg: #04100c;
  --bg-glow-1: rgba(52, 211, 153, .14);
  --bg-glow-2: rgba(20, 184, 166, .08);
  --surface: rgba(9, 26, 20, .80);
  --surface-solid: #091a14;
  --surface-raised: rgba(13, 36, 28, .95);
  --surface-sunken: rgba(2, 8, 6, .55);
  --surface-hover: rgba(52, 211, 153, .07);
  --border: rgba(134, 214, 180, .13);
  --border-strong: rgba(134, 214, 180, .26);
  --highlight: rgba(255, 255, 255, .045);
  --text: #e4f3ec;
  --text-2: #a3c2b5;
  --text-3: #7d9f91;
  --accent: #34d399;
  --accent-strong: #10b981;
  --accent-2: #a7f3d0;
  --on-accent: #02170f;
  --accent-soft: rgba(52, 211, 153, .14);
  --ring: rgba(52, 211, 153, .45);
  --ok: #4ade80; --warn: #facc15; --bad: #fb7185; --info: #7dd3fc; --neutral: #9ca3af;
  --header-bg: rgba(4, 16, 12, .76);
  --th-bg: rgb(12, 33, 26);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 0 var(--highlight) inset, 0 12px 32px -14px rgba(0, 0, 0, .85);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .9);
  --canvas-filter: invert(1) hue-rotate(180deg) saturate(1.1) brightness(.95);
  --canvas-bg: transparent;
  --map-bg: #07170f;
  --log-bg: #020906; --log-text: #c8f5df;
}

/* Aqua Night: near-black with a green tint, dark teal glass and a bright aqua accent, lit by a soft aqua glow from below */
html[data-theme="aqua"] {
  color-scheme: dark;
  --bg: #020910;
  --bg-glow-1: rgba(24, 226, 222, .17);
  --bg-glow-2: rgba(56, 140, 255, .10);
  --surface: rgba(9, 22, 31, .80);
  --surface-solid: #09171f;
  --surface-raised: rgba(13, 32, 43, .95);
  --surface-sunken: rgba(1, 6, 11, .6);
  --surface-hover: rgba(34, 230, 220, .08);
  --border: rgba(140, 228, 230, .11);
  --border-strong: rgba(140, 228, 230, .22);
  --highlight: rgba(255, 255, 255, .05);
  --text: #eaf7fa;
  --text-2: #a3bfc8;
  --text-3: #76949e;
  --accent: #22e6dc;
  --accent-strong: #10c3cf;
  --accent-2: #4a9dff;
  --on-accent: #01181a;
  --accent-soft: rgba(34, 230, 220, .13);
  --ring: rgba(34, 230, 220, .48);
  --ok: #3ee08f; --warn: #fbbf24; --bad: #ff5d72; --info: #4a9dff; --neutral: #93a9ab;
  --header-bg: rgba(3, 10, 12, .78);
  --th-bg: rgb(11, 28, 38);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 1px 0 var(--highlight) inset, 0 14px 34px -14px rgba(0, 0, 0, .9);
  --shadow-lg: 0 26px 64px -20px rgba(0, 0, 0, .92);
  --canvas-filter: invert(1) hue-rotate(180deg) saturate(1.1) brightness(.95);
  --canvas-bg: transparent;
  --map-bg: #05111a;
  --log-bg: #01070a; --log-text: #c4f6f4;
}

/* Light: crisp porcelain with an indigo accent */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f2f4f8;
  --bg-glow-1: rgba(79, 101, 230, .10);
  --bg-glow-2: rgba(20, 184, 166, .07);
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #ffffff;
  --surface-raised: #ffffff;
  --surface-sunken: #f7f9fc;
  --surface-hover: rgba(54, 83, 214, .055);
  --border: #e1e6ef;
  --border-strong: #c9d1de;
  --highlight: rgba(255, 255, 255, .9);
  --text: #101828;
  --text-2: #475467;
  --text-3: #5d6b80;
  --accent: #3653d6;
  --accent-strong: #2a43b8;
  --accent-2: #0f9f8f;
  --on-accent: #ffffff;
  --accent-soft: rgba(54, 83, 214, .09);
  --ring: rgba(54, 83, 214, .35);
  --ok: #15803d; --warn: #b45309; --bad: #c62828; --info: #1d4ed8; --neutral: #64748b;
  --header-bg: rgba(255, 255, 255, .82);
  --th-bg: #f6f8fb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .12);
  --shadow-lg: 0 24px 50px -18px rgba(16, 24, 40, .25);
  --canvas-filter: none;
  --canvas-bg: #ffffff;
  --map-bg: #e9eef4;
  --log-bg: #0f1720; --log-text: #cfe3ff;
}

/* Names used by the original stylesheet, kept as aliases so nothing that read them changes meaning. */
:root, html[data-theme] {
  --ink: var(--text); --muted: var(--text-2); --line: var(--border); --panel: var(--surface);
  --brand: var(--accent-strong); --grey: var(--neutral);
}

/* ---------------------------------------------------------------------------------------------
   2b. GLASS TOKENS - applied on top of every theme (more translucent surfaces, light edges)
   --------------------------------------------------------------------------------------------- */
:root, html[data-theme] {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-slow: 420ms;
  --blur: 22px;
  --surface: color-mix(in srgb, var(--surface-solid) 56%, transparent);
  --glass-strong: color-mix(in srgb, var(--surface-solid) 66%, transparent);
  --glass-edge: rgba(255, 255, 255, .09);
  --glass-hi: rgba(255, 255, 255, .07);
  --spot: color-mix(in srgb, var(--accent) 13%, transparent);
  --aurora-1: color-mix(in srgb, var(--accent) 30%, transparent);
  --aurora-2: color-mix(in srgb, var(--accent-2) 20%, transparent);
  --aurora-3: var(--bg-glow-1);
}
html[data-theme="aqua"] {
  --glass-edge: rgba(150, 250, 245, .11);
  --glass-hi: rgba(200, 255, 252, .07);
  --spot: color-mix(in srgb, var(--accent) 13%, transparent);
  --aurora-1: color-mix(in srgb, var(--accent) 13%, transparent);
  --aurora-2: color-mix(in srgb, var(--accent-2) 12%, transparent);
  --aurora-3: rgba(24, 226, 222, .28);
}
html[data-theme="light"] {
  --surface: rgba(255, 255, 255, .58);
  --glass-strong: rgba(255, 255, 255, .66);
  --glass-edge: rgba(255, 255, 255, .85);
  --glass-hi: rgba(255, 255, 255, .75);
  --spot: color-mix(in srgb, var(--accent) 9%, transparent);
  --aurora-1: color-mix(in srgb, var(--accent) 22%, transparent);
  --aurora-2: color-mix(in srgb, var(--accent-2) 18%, transparent);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 30px -14px rgba(16, 24, 40, .18);
}

/* ---------------------------------------------------------------------------------------------
   3. BASE
   --------------------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
/* The hidden attribute must always win (the scripts show and hide elements with it). Without this,
   rules such as "label { display:inline-flex }" kept hidden fields on screen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh;
  font: 14px/1.5 var(--font-sans);
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
/* Ambient light behind everything; fixed and non-interactive. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -8%, var(--bg-glow-1), transparent 60%),
    radial-gradient(800px 600px at 105% 10%, var(--bg-glow-2), transparent 60%),
    radial-gradient(1000px 700px at 50% 120%, var(--bg-glow-1), transparent 65%);
}
::selection { background: var(--accent-soft); color: var(--text); }

a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; transition: color var(--t-fast) var(--ease); }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }

h1, h2, h3 { font-family: var(--font-display); color: var(--text); letter-spacing: -.012em; }
h2 { font-size: 22px; font-weight: 650; margin: 2px 0 14px; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 620; margin: 4px 0 10px; line-height: 1.4; }
h2 .chip, h3 .chip { vertical-align: 2px; }
p { margin: 0 0 10px; }
pre { margin: 10px 0; }
ul { padding-left: 20px; }

.muted { color: var(--text-2); }
.small { font-size: 12.5px; }

/* Thin themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* Route icons: one SVG mask per navigation link, matched by the data-route attribute app.js already sets. */
header.top nav a[data-route="overview"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6.5 9 3.5l6 3 6-3v14l-6 3-6-3-6 3z M9 3.5v14 M15 6.5v14'/%3E%3C/svg%3E"); }
header.top nav a[data-route="dashboard"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 20.5h18 M6 17V11 M11 17V5 M16 17v-8 M21 17v-4'/%3E%3C/svg%3E"); }
header.top nav a[data-route="queue"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 6h10 M10 12h10 M10 18h10 M3.5 6l1.3 1.3L7.5 4.6 M3.5 12l1.3 1.3 2.7-2.7 M3.5 18l1.3 1.3 2.7-2.7'/%3E%3C/svg%3E"); }
header.top nav a[data-route="signals"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 12h4l3-8 5 16 3-8h4'/%3E%3C/svg%3E"); }
header.top nav a[data-route="workorders"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 3.5h6v3H9z M7 5H5v16h14V5h-2 M8.5 13.5l2.3 2.3 4.7-4.8'/%3E%3C/svg%3E"); }
header.top nav a[data-route="dq"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 4.8-3.4 8-8 9-4.6-1-8-4.2-8-9V6z M8.8 12l2.2 2.2 4.3-4.4'/%3E%3C/svg%3E"); }
header.top nav a[data-route="ingest"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V3.5 M7.5 8 12 3.5 16.5 8 M4 14.5v4A2.5 2.5 0 0 0 6.5 21h11a2.5 2.5 0 0 0 2.5-2.5v-4'/%3E%3C/svg%3E"); }
header.top nav a[data-route="qa"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l9 4.8-9 4.8-9-4.8z M3 12.4l9 4.8 9-4.8 M3 16.6l9 4.8 9-4.8'/%3E%3C/svg%3E"); }
header.top nav a[data-route="runs"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z M10 8.3v7.4l6-3.7z'/%3E%3C/svg%3E"); }
header.top nav a[data-route="monitoring"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 17.5a8.5 8.5 0 1 1 17 0 M12 17.5l4.2-5.6 M7 17.5h.01 M17 17.5h.01'/%3E%3C/svg%3E"); }
header.top nav a[data-route="ask"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 11.5a8 8 0 0 1-11.8 7L3.5 20l1.6-4.8A8 8 0 1 1 20.5 11.5z M8.5 11.5h.01 M12.5 11.5h.01 M16.5 11.5h.01'/%3E%3C/svg%3E"); }
header.top nav a[data-route="billing"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-3-2-3 2-3-2-3 2z M9 8h6 M9 12h6 M9 16h3'/%3E%3C/svg%3E"); }
header.top nav a[data-route="settings"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h9 M17 6h3 M4 12h3 M11 12h9 M4 18h11 M19 18h1 M15 4v4 M9 10v4 M17 16v4'/%3E%3C/svg%3E"); }
header.top nav a[data-route="security"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 11h13v10h-13z M8 11V7.5a4 4 0 0 1 8 0V11 M12 15v2'/%3E%3C/svg%3E"); }
header.top nav a[data-route="users"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M2.5 21a6.5 6.5 0 0 1 13 0 M16 3.6a4 4 0 0 1 0 7.3 M18.5 14.5A6.5 6.5 0 0 1 21.5 21'/%3E%3C/svg%3E"); }
header.top nav a[data-route="notifications"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5a6 6 0 0 1 12 0c0 6 2.5 7.5 2.5 7.5h-17S6 15.5 6 9.5z M10 20.5a2.2 2.2 0 0 0 4 0'/%3E%3C/svg%3E"); }
header.top nav a[data-route="account"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M4.5 21a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E"); }
:root { --ico-layers: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l9 4.8-9 4.8-9-4.8z M3 12.4l9 4.8 9-4.8 M3 16.6l9 4.8 9-4.8'/%3E%3C/svg%3E"); }
:root { --ico-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M4.5 21a7.5 7.5 0 0 1 15 0'/%3E%3C/svg%3E"); }

/* ---------------------------------------------------------------------------------------------
   4. NAVIGATION - full-width "ribbon command bar"
   Row 1: brand block, a live status line, the signed-in user, theme and sign out.
   Row 2: the ribbon - every page as an icon-over-label command, grouped by task with captions and
          dividers (Monitor / Investigate / Data / Models & tools / Administration).
   Phones: the ribbon becomes a full-width command dock fixed to the bottom edge.
   The links are the same <a> elements app.js creates; only their look changes.
   --------------------------------------------------------------------------------------------- */
main { padding: 24px 28px 48px; margin: 0; max-width: none; }

header.top {
  --hdr-r: 14px; --hdr-gap: 10px;
  position: sticky; top: var(--hdr-gap); z-index: 40;
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
  margin: var(--hdr-gap) var(--hdr-gap) 0;   /* a floating bar: space above, left and right */
  color: var(--text); padding: 0;
  border: 1px solid var(--glass-edge); border-radius: var(--hdr-r) !important;
  box-shadow: none;
}
/* Glass on a pseudo-element (a backdrop-filter on the header itself would trap the fixed phone dock). */
header.top::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: var(--hdr-r) !important;
  background: linear-gradient(180deg, var(--glass-hi), transparent 60%), var(--glass-strong);
  -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%);
}
/* Mouse over the bar: a light in the theme's colours runs round its border (a 1.5px ring cut out with a mask). */
@property --hdr-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
header.top::after {
  content: ""; position: absolute; inset: -1px; padding: 1.5px; pointer-events: none; border-radius: calc(var(--hdr-r) + 1px) !important;
  background: conic-gradient(from var(--hdr-angle), transparent 0 40%, var(--hdr-c1, var(--accent)) 62%, var(--hdr-c2, var(--accent-2)) 78%, transparent 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .35s var(--ease);
  animation: hdr-border 3.2s linear infinite; animation-play-state: paused;
}
header.top:hover::after, header.top:focus-within::after { opacity: 1; animation-play-state: running; }
@keyframes hdr-border { to { --hdr-angle: 360deg; } }

/* Row 1 - brand block */
header.top h1 {
  position: relative; margin: 0; flex: none; display: flex; align-items: center;
  height: 52px; padding: 0 22px 0 64px;
  font-size: 17px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap;
  border-right: 1px solid var(--border);
}
header.top h1::before { /* solid accent block holding the bolt (flat) */
  content: ""; position: absolute; left: 0; top: 0; width: 52px; height: 52px; border-radius: calc(var(--hdr-r) - 1px) 0 0 0 !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
header.top h1::after {
  content: ""; position: absolute; left: 20px; top: 15px; width: 12px; height: 22px; background: var(--on-accent);
  clip-path: polygon(60% 0, 0 58%, 42% 58%, 30% 100%, 100% 38%, 56% 38%);
}

/* Row 1 - user area */
header.top .who {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 16px 0 18px; border-left: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); white-space: nowrap;
}
header.top .who::before { /* user glyph */
  content: ""; width: 30px; height: 30px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-mask: var(--ico-user) center / 18px no-repeat, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: var(--ico-user) center / 18px no-repeat exclude, linear-gradient(#000 0 0);
}
header.top .who button { padding: 6px 14px; font-size: 12.5px; }

/* Row 2 - the ribbon */
header.top nav {
  order: 3; flex: 1 0 100%; display: flex; flex-wrap: nowrap; align-items: stretch;
  min-width: 0; padding: 0 16px; border-top: 1px solid var(--border);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity;
}
header.top nav::-webkit-scrollbar { display: none; }
header.top nav a {
  --grp: 0 0 transparent; --act: 0 0 transparent;
  position: relative; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px;
  min-width: 76px; padding: 24px 10px 9px;
  color: var(--text-2); text-decoration: none; white-space: nowrap; scroll-snap-align: start;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  box-shadow: var(--grp), var(--act);
  transition: color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
header.top nav a::before { /* icon */
  content: ""; width: 22px; height: 22px; flex: none;
  background: currentColor; opacity: .78;
  -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat;
  transition: transform var(--t-med) var(--ease-spring), opacity var(--t-fast) var(--ease), filter var(--t-med) var(--ease);
}
header.top nav a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
header.top nav a:hover::before { opacity: 1; transform: translateY(-3px) scale(1.08); }
header.top nav a.active {
  color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 20%, transparent), transparent 85%);
  --act: inset 0 2px 0 var(--accent), inset 0 -1px 0 color-mix(in srgb, var(--accent) 40%, transparent);
  animation: li-tab-in var(--t-slow) var(--ease-out);
}
header.top nav a.active::before { opacity: 1; background: var(--accent); filter: drop-shadow(0 0 7px var(--accent)); }
header.top nav a:focus-visible { outline-offset: -2px; }

/* Group starters: a divider line on the left and a caption above. Empty alt text keeps screen readers quiet. */
header.top nav a[data-route="queue"], header.top nav a[data-route="dq"],
header.top nav a[data-route="monitoring"], header.top nav a[data-route="security"] { margin-left: 17px; --grp: -9px 0 0 -8px var(--border-strong); }
header.top nav a[data-route="overview"]::after, header.top nav a[data-route="queue"]::after, header.top nav a[data-route="dq"]::after,
header.top nav a[data-route="monitoring"]::after, header.top nav a[data-route="security"]::after {
  position: absolute; left: 10px; top: 7px; pointer-events: none; white-space: nowrap;
  font-size: 9.5px; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
}
header.top nav a[data-route="overview"]::after { content: "Monitor" / ""; }
header.top nav a[data-route="queue"]::after { content: "Investigate" / ""; }
header.top nav a[data-route="dq"]::after { content: "Data" / ""; }
header.top nav a[data-route="monitoring"]::after { content: "Models & tools" / ""; }
header.top nav a[data-route="security"]::after { content: "Administration" / ""; }
header.top nav a.active::after { color: var(--accent); }

/* Desktop and tablet: the ribbon always fills the full width. Each command starts at its one-line width and
   shares the spare room (flex-grow); when space is short, commands shrink and their labels wrap to two
   lines. Icons stay on one level because content is aligned to the top. */
@media (min-width: 721px) {
  header.top nav { padding: 0 10px; }
  header.top nav a {
    flex: 1 1 auto; min-width: 62px; max-width: none; justify-content: flex-start;
    padding: 25px 8px 9px; white-space: normal; text-align: center; line-height: 1.2; font-size: 11.5px;
  }
  header.top nav a::after { left: 8px; }
  header.top nav a[data-route="queue"], header.top nav a[data-route="dq"],
  header.top nav a[data-route="monitoring"], header.top nav a[data-route="security"] { margin-left: 15px; --grp: -8px 0 0 -7px var(--border-strong); }
}
/* Below about 1200px the ribbon scrolls sideways; a soft fade on the right edge hints there is more. */
@media (max-width: 1199px) and (min-width: 721px) {
  header.top nav {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  }
}

/* Phones: full-width command dock at the bottom edge; the top bar keeps brand and user. */
@media (max-width: 720px) {
  header.top h1 { height: 50px; padding: 0 14px 0 60px; border-right: 0; font-size: 16px; }
  header.top h1::before { width: 50px; height: 50px; }
  header.top h1::after { left: 19px; top: 14px; }
  header.top .who { height: 50px; padding: 0 10px; border-left: 0; font-size: 0; gap: 8px; }
  header.top .who > * { font-size: 12.5px; }
  header.top .who::before { display: none; }
  header.top nav {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0;
    padding: 0 0 env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--glass-edge);
    background: linear-gradient(180deg, var(--glass-hi), transparent 60%), var(--glass-strong);
    -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%);
    box-shadow: 0 -18px 40px -26px rgba(0, 0, 0, .8);
  }
  header.top nav a { min-width: 72px; max-width: none; padding: 10px 6px 9px; font-size: 10.5px; white-space: nowrap; }
  header.top nav a[data-route] { margin-left: 0; --grp: 0 0 transparent; }
  header.top nav a[data-route]::after { content: none; }
  header.top nav a.active { --act: inset 0 2px 0 var(--accent); }
  main { padding: 18px 14px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------------------------------------------------------------------------------------
   5. SURFACES: panels, KPI cards, layout grids
   --------------------------------------------------------------------------------------------- */
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--highlight), transparent 120px), var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 18px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  overflow-x: auto; /* wide tables scroll inside their card instead of breaking the page */
  transition: border-color var(--t-med) var(--ease), background-color var(--t-med) var(--ease);
}
.panel > h3:first-child { margin-top: 0; }
.panel.row { overflow: visible; }
.panel.muted { color: var(--text-2); }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 18px; }
.grid2 > .panel { margin-bottom: 0; }
@media (max-width: 960px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--highlight), transparent 70%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 16px 15px; min-width: 0;
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  box-shadow: var(--shadow);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.kpi::before { /* accent stripe */
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .75;
}
.kpi:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.kpi b {
  display: block; margin-top: 6px;
  font-family: var(--font-display); font-size: 26px; font-weight: 680; line-height: 1.15;
  letter-spacing: -.02em; text-transform: none; color: var(--text);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------------------------------
   6. TABLES
   --------------------------------------------------------------------------------------------- */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; vertical-align: top; }
th {
  position: sticky; top: 0; z-index: 1; cursor: default;
  background: var(--th-bg); color: var(--text-3);
  font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
  border-bottom-color: var(--border-strong);
}
th:first-child { border-top-left-radius: var(--r-sm); }
th:last-child { border-top-right-radius: var(--r-sm); }
th.sortable { cursor: pointer; user-select: none; transition: color var(--t-fast) var(--ease); }
th.sortable:hover { color: var(--text); }
th.sortable::after { content: "\2195"; margin-left: 6px; opacity: 0; font-size: 11px; transition: opacity var(--t-fast) var(--ease); }
th.sortable:hover::after { opacity: .7; }
tbody tr { transition: background-color var(--t-fast) var(--ease); }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover, tr.selected { background: var(--accent-soft); }
tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Identifiers (first column: DTC, feeder, period ...) and numbers never break mid-value, e.g. "DTC-/001". */
td:first-child, td.num { white-space: nowrap; }
/* Side-by-side cards are narrower: slightly tighter cells. */
.grid2 th, .grid2 td { padding: 9px 10px; }
.grid2 td:first-child { white-space: normal; min-width: 124px; }
td.muted { text-align: center; padding: 22px 12px; }
td input, td select { padding: 6px 8px; min-height: 34px; }

.scroll { max-height: 440px; overflow: auto; border-radius: var(--r-sm); }

/* ---------------------------------------------------------------------------------------------
   7. CHIPS (status badges): soft tint + coloured text, readable in every theme
   --------------------------------------------------------------------------------------------- */
.chip {
  --c: var(--neutral);
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 8px; margin: 1px 4px 1px 0;
  border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
  letter-spacing: .01em; text-transform: none;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { --c: var(--ok); } .chip.bad { --c: var(--bad); } .chip.warn { --c: var(--warn); } .chip.info { --c: var(--info); }

/* ---------------------------------------------------------------------------------------------
   8. BUTTONS
   --------------------------------------------------------------------------------------------- */
/* Flat glass: a translucent, blurred fill and a hairline edge - no gloss, bevel, emboss or drop shadow. */
button, .btn {
  font: inherit; font-size: 13.5px; font-weight: 600; line-height: 20px;
  padding: 8px 16px; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; display: inline-block;
  color: var(--on-accent);
  background: color-mix(in srgb, var(--accent) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 92%, #fff 8%);
  box-shadow: none; text-shadow: none;
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  transition: filter var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
button:hover, .btn:hover { filter: none; text-decoration: none; background: color-mix(in srgb, var(--accent) 94%, transparent); box-shadow: none; }
button:active, .btn:active { transform: none; filter: brightness(.94); }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
button.secondary, .btn.secondary {
  color: var(--text); background: color-mix(in srgb, var(--surface-solid) 42%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); box-shadow: none;
}
button.secondary:hover, .btn.secondary:hover { filter: none; border-color: color-mix(in srgb, var(--accent) 70%, transparent); color: var(--accent); background: var(--accent-soft); box-shadow: none; }
button.danger {
  color: #fff; background: color-mix(in srgb, var(--bad) 82%, transparent);
  border-color: color-mix(in srgb, var(--bad) 92%, #fff 8%); box-shadow: none;
}
html:not([data-theme="light"]) button.danger { color: #1a0507; }
button:disabled, button:disabled:hover { opacity: .45; cursor: not-allowed; filter: none; transform: none; }

/* ---------------------------------------------------------------------------------------------
   9. FORMS
   --------------------------------------------------------------------------------------------- */
input, select, textarea {
  font: inherit; font-size: 13.5px; color: var(--text);
  padding: 8px 11px; min-height: 38px;
  background: var(--surface-sunken); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a94a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
select option { background: var(--surface-solid); color: var(--text); }
textarea { width: 100%; min-height: 90px; resize: vertical; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
input[type="file"] { padding: 5px; cursor: pointer; }
input[type="file"]::file-selector-button {
  font: inherit; font-size: 12.5px; font-weight: 600; margin-right: 10px; padding: 6px 12px; cursor: pointer;
  color: var(--text); background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--r-xs);
}
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .75; }

label {
  display: inline-flex; flex-direction: column; gap: 6px; margin-right: 12px;
  font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .01em;
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.row > label { margin-right: 0; }
.panel.row { padding: 16px 18px; }

progress {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 8px; border: 0; border-radius: var(--r-pill); overflow: hidden;
  background: var(--surface-sunken); margin: 4px 0 12px;
}
progress::-webkit-progress-bar { background: var(--surface-sunken); border-radius: var(--r-pill); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: var(--r-pill); transition: width var(--t-med) var(--ease); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: var(--r-pill); }

/* ---------------------------------------------------------------------------------------------
   10. MESSAGES: notice, error, toast, log
   --------------------------------------------------------------------------------------------- */
.notice, .error {
  position: relative; padding: 11px 14px 11px 17px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.55;
  border: 1px solid; overflow: hidden;
}
.notice::before, .error::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.notice {
  color: var(--text-2);
  background: color-mix(in srgb, var(--info) 8%, var(--surface-solid));
  border-color: color-mix(in srgb, var(--info) 24%, transparent);
}
.notice::before { background: var(--info); }
main > .notice { margin-bottom: 14px; }
main > .notice + .notice { margin-top: -6px; }
.error {
  color: color-mix(in srgb, var(--bad) 70%, var(--text));
  background: color-mix(in srgb, var(--bad) 11%, var(--surface-solid));
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}
.error::before { background: var(--bad); }

.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 80; max-width: 400px;
  padding: 12px 16px 12px 18px; border-radius: var(--r-md);
  color: var(--text); background: var(--surface-raised);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  animation: li-toast-in var(--t-med) var(--ease);
}
.toast::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: linear-gradient(var(--accent), var(--accent-2)); }

.log {
  font: 12.5px/1.6 var(--font-mono);
  background: var(--log-bg); color: var(--log-text);
  padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
  max-height: 240px; overflow: auto; white-space: pre-wrap;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .35);
}

/* ---------------------------------------------------------------------------------------------
   11. MAP, CHARTS, DOSSIER
   --------------------------------------------------------------------------------------------- */
#map {
  height: 460px; border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden;
  background: radial-gradient(600px 300px at 50% 40%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%), var(--map-bg);
}
#map canvas { filter: var(--canvas-filter); }
#map .notice { max-width: calc(100% - 12px); }
#map .maplibregl-ctrl-group { background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); border-radius: var(--r-sm); overflow: hidden; }
#map .maplibregl-ctrl-group button { min-height: 0; padding: 0; border-radius: 0; box-shadow: none; background: transparent; border: 0; color: var(--text); }
#map .maplibregl-ctrl-group button + button { border-top: 1px solid var(--border); }
#map .maplibregl-ctrl-group button:hover { background: var(--surface-hover); filter: none; }
html:not([data-theme="light"]) #map .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; color: var(--text-2); }
.legend span { margin-right: 0; font-size: 12px; display: inline-flex; align-items: center; }
/* Same filter as the map so each legend dot matches the colour actually drawn on the map. */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; filter: var(--canvas-filter); }

canvas.chart {
  display: block; width: 100%; height: 240px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--canvas-bg); filter: var(--canvas-filter);
}
iframe.dossier { width: 100%; height: 680px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: #fff; box-shadow: var(--shadow-lg); }

/* ---------------------------------------------------------------------------------------------
   12. SIGN-IN
   --------------------------------------------------------------------------------------------- */
.login { max-width: 400px; margin: 0 auto; padding: 14vh 16px 40px; animation: li-fade-up 360ms var(--ease); }
.login::before { /* brand tile above the card */
  content: ""; display: block; width: 46px; height: 46px; margin: 0 auto 20px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 36px -10px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18'%3E%3Cpath d='M6 0 0 10.4h4.2L3 18l7-11.2H5.6z' fill='%230a0f22' fill-opacity='.85'/%3E%3C/svg%3E"), linear-gradient(135deg, var(--accent), var(--accent-2));
  background-repeat: no-repeat; background-position: center, 0 0; background-size: 15px 26px, auto;
}
html[data-theme="light"] .login::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 18'%3E%3Cpath d='M6 0 0 10.4h4.2L3 18l7-11.2H5.6z' fill='%23ffffff'/%3E%3C/svg%3E"), linear-gradient(135deg, var(--accent), var(--accent-2));
}
.login .panel { display: flex; flex-direction: column; gap: 14px; padding: 28px; border-radius: 20px; box-shadow: var(--shadow-lg); overflow: visible; }
.login .panel h2 { font-size: 24px; margin: 0; }
.login label { margin-right: 0; }
.login input { width: 100%; }
.login button[type="submit"] { width: 100%; padding: 10px 16px; margin-top: 4px; }
.login .btn { width: 100%; text-align: center; }

/* ---------------------------------------------------------------------------------------------
   13. THEME PICKER (js/theme.js)
   --------------------------------------------------------------------------------------------- */
.li-theme { position: relative; display: inline-flex; }
.li-theme--floating { position: fixed; top: 16px; right: 16px; z-index: 60; }
.li-theme > button.li-theme-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 8px; font-size: 12.5px; font-weight: 600;
  color: var(--text); background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm);
}
.li-theme > button.li-theme-btn:hover { filter: none; border-color: var(--accent); background: var(--accent-soft); }
.li-swatch {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--sw-a) 0 50%, var(--sw-b) 50% 100%);
  box-shadow: 0 0 0 1px rgba(127, 127, 127, .45);
}
.li-theme-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 70; width: 252px; padding: 6px;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  animation: li-pop var(--t-fast) var(--ease);
}
.li-theme-menu .li-theme-title { padding: 8px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.li-theme-menu button.li-theme-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; box-shadow: none;
  color: var(--text); font-size: 13px; font-weight: 550;
}
.li-theme-menu button.li-theme-opt:hover, .li-theme-menu button.li-theme-opt:focus-visible { background: var(--surface-hover); filter: none; outline: none; }
.li-theme-menu button.li-theme-opt[aria-checked="true"] { background: var(--accent-soft); }
.li-theme-opt .li-swatch { width: 22px; height: 22px; }
.li-theme-opt .li-opt-text { display: flex; flex-direction: column; line-height: 1.3; flex: 1; }
.li-theme-opt .li-opt-sub { font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.li-theme-opt .li-check { width: 16px; color: var(--accent); font-weight: 700; visibility: hidden; }
.li-theme-opt[aria-checked="true"] .li-check { visibility: visible; }

/* ---------------------------------------------------------------------------------------------
   14. GLASS + MOTION LAYER
   --------------------------------------------------------------------------------------------- */

/* Living background: slow-drifting aurora + fine grain, behind everything and never clickable.
   (The body itself is transparent so these layers are not painted over.) */
html { background: var(--bg); }
body { background: transparent; }
body::before {
  content: ""; position: fixed; inset: -25%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(38% 34% at 22% 24%, var(--aurora-1), transparent 70%),
    radial-gradient(32% 30% at 80% 18%, var(--aurora-2), transparent 70%),
    radial-gradient(40% 36% at 62% 82%, var(--aurora-3), transparent 70%),
    radial-gradient(30% 28% at 12% 86%, var(--aurora-2), transparent 70%);
  filter: saturate(120%);
  animation: li-aurora 38s ease-in-out infinite alternate;
  will-change: transform;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Frosted panels with a light edge and a spotlight that follows the pointer (--mx/--my set by theme.js). */
.panel, .kpi {
  --mx: -999px; --my: -999px;
  border-color: var(--glass-edge);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%); backdrop-filter: blur(var(--blur)) saturate(170%);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  transition: border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease), transform var(--t-med) var(--ease-out);
}
.panel {
  background:
    radial-gradient(520px circle at var(--mx) var(--my), var(--spot), transparent 60%),
    linear-gradient(180deg, var(--glass-hi), transparent 140px),
    var(--surface);
}
.panel:hover { border-color: color-mix(in srgb, var(--accent) 26%, var(--glass-edge)); }
.kpi {
  background:
    radial-gradient(260px circle at var(--mx) var(--my), var(--spot), transparent 65%),
    linear-gradient(160deg, var(--glass-hi), transparent 70%),
    var(--surface);
}
.kpi:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 34%, var(--glass-edge)); box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi); }
.kpi::after { /* light sweep across the card on hover */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .10) 50%, transparent 65%);
  transform: translateX(-110%); transition: transform 900ms var(--ease-out);
}
.kpi:hover::after { transform: translateX(110%); }
.kpi b { background: linear-gradient(180deg, var(--text), color-mix(in srgb, var(--text) 72%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
th { background: color-mix(in srgb, var(--surface-solid) 94%, transparent); }

/* Page entrance: each block of a page rises in, one after another. Replays on every navigation. */
main > * { animation: li-rise 560ms var(--ease-out) both; }
main > *:nth-child(2) { animation-delay: 50ms; }
main > *:nth-child(3) { animation-delay: 100ms; }
main > *:nth-child(4) { animation-delay: 150ms; }
main > *:nth-child(5) { animation-delay: 200ms; }
main > *:nth-child(6) { animation-delay: 250ms; }
main > *:nth-child(n+7) { animation-delay: 300ms; }
.kpis > .kpi { animation: li-pop-in 520ms var(--ease-spring) both; }
.kpis > .kpi:nth-child(2) { animation-delay: 60ms; } .kpis > .kpi:nth-child(3) { animation-delay: 120ms; }
.kpis > .kpi:nth-child(4) { animation-delay: 180ms; } .kpis > .kpi:nth-child(5) { animation-delay: 240ms; }
.kpis > .kpi:nth-child(n+6) { animation-delay: 300ms; }
main > h2 { background: linear-gradient(90deg, var(--text) 30%, color-mix(in srgb, var(--accent) 70%, var(--text))); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Table rows cascade in. */
tbody tr { animation: li-row 380ms var(--ease-out) both; }
tbody tr:nth-child(2) { animation-delay: 20ms; } tbody tr:nth-child(3) { animation-delay: 40ms; }
tbody tr:nth-child(4) { animation-delay: 60ms; } tbody tr:nth-child(5) { animation-delay: 80ms; }
tbody tr:nth-child(6) { animation-delay: 100ms; } tbody tr:nth-child(7) { animation-delay: 120ms; }
tbody tr:nth-child(8) { animation-delay: 140ms; } tbody tr:nth-child(n+9) { animation-delay: 160ms; }

/* Primary buttons: a light sweep on hover and a soft press. */
button:not(.secondary):not(.li-theme-opt):not(.li-theme-btn), .btn:not(.secondary) { position: relative; overflow: hidden; isolation: isolate; }
/* (flat finish: no light sweep and no pressed-in scale on buttons) */
#map button::after { display: none; }

/* Status chips: urgent ones breathe. */
.chip.bad::before { animation: li-pulse 2.2s ease-out infinite; }

/* Progress bar: moving stripes while a run is going. */
progress::-webkit-progress-value {
  background-image: linear-gradient(135deg, rgba(255, 255, 255, .22) 25%, transparent 25% 50%, rgba(255, 255, 255, .22) 50% 75%, transparent 75%), linear-gradient(90deg, var(--accent), var(--accent-2));
  background-size: 18px 18px, 100% 100%;
  animation: li-stripes 900ms linear infinite;
}

/* Toast and notices glide in. */
.notice, .error { animation: li-rise 480ms var(--ease-out) both; }
.toast { animation: li-toast-in 480ms var(--ease-spring); }

/* Sign-in: floating brand tile and a light that travels around the card's border. */
@property --li-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.login::before { animation: li-float 6s ease-in-out infinite; }
.login .panel { position: relative; }
.login .panel::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--li-angle), transparent 0 55%, var(--accent) 72%, var(--accent-2) 84%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: li-spin 6s linear infinite;
}

/* Theme change: the new theme spreads out in a circle from the Theme button (View Transitions; browsers
   without it simply switch instantly). */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.li-vt::view-transition-new(root) { animation: li-reveal 700ms var(--ease-out) both; }

/* Theme picker menu */
.li-theme-menu { animation: li-pop 260ms var(--ease-spring); transform-origin: top right; }
.li-theme-menu button.li-theme-opt { transition: background-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.li-theme-menu button.li-theme-opt:hover { transform: translateX(2px); }
.li-theme > button.li-theme-btn .li-swatch { transition: transform var(--t-slow) var(--ease-spring); }
.li-theme > button.li-theme-btn:hover .li-swatch { transform: rotate(180deg); }

/* ---------------------------------------------------------------------------------------------
   15. KEYFRAMES
   --------------------------------------------------------------------------------------------- */
@keyframes li-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes li-rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes li-pop-in { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes li-row { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes li-toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes li-pop { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes li-nav-in { from { background-position: -120px 0; box-shadow: none; } }
@keyframes li-aurora {
  0%   { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate3d(4%, -3%, 0) rotate(8deg) scale(1.06); }
  100% { transform: translate3d(-4%, 3%, 0) rotate(-6deg) scale(1.02); }
}
@keyframes li-brand-glow { 0%, 100% { box-shadow: 0 6px 18px -6px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .4); } 50% { box-shadow: 0 6px 26px -4px var(--accent-2), inset 0 1px 0 rgba(255, 255, 255, .4); } }
@keyframes li-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 70%, transparent); } 80%, 100% { box-shadow: 0 0 0 6px transparent; } }
@keyframes li-stripes { to { background-position: 18px 0, 0 0; } }
@keyframes li-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes li-spin { to { --li-angle: 360deg; } }
@keyframes li-reveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0)); } }

/* People who ask their system for less motion get a calm, static interface. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  body::before { animation: none !important; }
}

/* ---------------------------------------------------------------------------------------------
   16. RESPONSIVE (content; navigation is handled in section 4)
   --------------------------------------------------------------------------------------------- */
@media (max-width: 640px) {
  h2 { font-size: 19px; }
  .panel { padding: 14px; border-radius: var(--r-md); margin-bottom: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi b { font-size: 20px; }
  .row { gap: 10px; }
  .row > label { flex: 1 1 100%; }
  .row > label input, .row > label select { width: 100%; }
  /* Wide tables: give cells room and let the card scroll sideways instead of squeezing text into tall strips. */
  th, td { min-width: 92px; }
  td .small { display: inline-block; min-width: 220px; }
  #map { height: 340px; }
  canvas.chart { height: 200px; }
  iframe.dossier { height: 520px; }
  .toast { left: 12px; right: 12px; max-width: none; }
  .li-theme-label { display: none; }
  .li-theme--floating { top: 12px; right: 12px; }
  .login { padding-top: 12vh; }
}

/* ---------------------------------------------------------------------------------------------
   17. FINISHING TOUCHES
   --------------------------------------------------------------------------------------------- */
/* Dark themes: a faint ring (drawn dark, shown light after the canvas filter) so pale dots stay visible. */
html:not([data-theme="light"]) .dot { box-shadow: 0 0 0 1px #4a5160; }
/* The theme menu floats over content: keep it nearly opaque so text behind never shows through. */
.li-theme-menu { background: color-mix(in srgb, var(--surface-solid) 95%, transparent); }

/* ---------------------------------------------------------------------------------------------
   18. SHARP GEOMETRY + FULL-SCREEN LAYOUT
   Every card, button, field, chip and menu has square corners. Only true dots stay round
   (status dots on chips, the map legend and theme swatches), because their shape carries meaning.
   --------------------------------------------------------------------------------------------- */
*, *::before, *::after { border-radius: 0 !important; }
.dot, .chip::before, input[type="radio"] { border-radius: 50% !important; }

/* Console-style corner bracket on every card (drawn as background layers so it stays put when a
   wide table inside the card scrolls sideways). */
.panel {
  background:
    linear-gradient(var(--accent), var(--accent)) left top / 18px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left top / 2px 18px no-repeat,
    radial-gradient(520px circle at var(--mx) var(--my), var(--spot), transparent 60%),
    linear-gradient(180deg, var(--glass-hi), transparent 140px),
    var(--surface);
}
.panel:hover {
  background:
    linear-gradient(var(--accent-2), var(--accent-2)) left top / 28px 2px no-repeat,
    linear-gradient(var(--accent-2), var(--accent-2)) left top / 2px 28px no-repeat,
    radial-gradient(520px circle at var(--mx) var(--my), var(--spot), transparent 60%),
    linear-gradient(180deg, var(--glass-hi), transparent 140px),
    var(--surface);
}
.login .panel { background: linear-gradient(180deg, var(--glass-hi), transparent 140px), var(--surface); }

/* Full-screen use of space */
.grid2, .kpis { gap: 16px; }
.panel { margin-bottom: 16px; }
#map { height: clamp(420px, calc(100vh - 360px), 760px); }
.scroll { max-height: clamp(420px, calc(100vh - 300px), 900px); }
.li-swatch { box-shadow: 0 0 0 1px rgba(127, 127, 127, .5); }

@keyframes li-scan { from { background-position: -60% 0; } to { background-position: 160% 0; } }
@keyframes li-tab-in { from { filter: brightness(1.7); } to { filter: none; } }
@media (prefers-reduced-motion: reduce) { header.top::after { animation: none; } }

/* ---------------------------------------------------------------------------------------------
   19. UTILITY GIS (js/gis.js): layer switcher on the map, "GIS features here", admin import
   --------------------------------------------------------------------------------------------- */
.gis-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.gis-btn { display: inline-flex; align-items: center; gap: 8px; }
.gis-btn::before { content: ""; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--ico-layers) center / contain no-repeat; mask: var(--ico-layers) center / contain no-repeat; }
.gis-count { min-width: 18px; padding: 0 5px; font-size: 11px; line-height: 18px; text-align: center; color: var(--on-accent); background: var(--accent); }
.gis-state { display: inline-flex; align-items: center; gap: 6px; }
.gis-state::before { content: ""; width: 8px; height: 8px; border-radius: 50% !important; background: var(--neutral); }
.gis-state.gis-ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.gis-menu {
  flex: 1 0 100%; max-height: 360px; overflow: auto; padding: 12px 14px;
  background: var(--surface-sunken); border: 1px solid var(--border-strong);
  animation: li-rise 300ms var(--ease-out) both;
}
.gis-menu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.gis-menu-head button { padding: 4px 10px; font-size: 12px; }
.gis-svc { margin-top: 12px; }
.gis-svc-name { font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); padding-bottom: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.gis-group { margin-top: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
label.gis-layer, .gis-layer > label { display: flex; flex-direction: row; align-items: center; gap: 9px; margin: 0; padding: 5px 0; font-size: 13px; font-weight: 500; color: var(--text); letter-spacing: 0; cursor: pointer; }
.gis-layer-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--border); }
.gis-layer-row button { padding: 3px 10px; font-size: 12px; min-height: 0; }
.gis-geom { font-size: 10.5px; color: var(--text-3); border: 1px solid var(--border); padding: 0 6px; }
.gis-fieldmap { min-height: 300px; font: 12.5px/1.55 var(--font-mono); white-space: pre; }
.gis-columns { margin-top: 14px; }
.gis-hit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.gis-hit-head { margin-bottom: 8px; }
.gis-hit td:first-child { color: var(--text-2); font-weight: 600; }

/* ---------------------------------------------------------------------------------------------
   20. NETWORK MAP SCREEN (js/netmap.js): layers | full-height map | agent (chat + voice)
   --------------------------------------------------------------------------------------------- */
header.top nav a[data-route="netmap"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21.5s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11z M12 13a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z'/%3E%3C/svg%3E"); }
:root { --ico-mic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a3 3 0 0 0-3 3v6a3 3 0 0 0 6 0V6a3 3 0 0 0-3-3z M5.5 11a6.5 6.5 0 0 0 13 0 M12 17.5V21 M8.5 21h7'/%3E%3C/svg%3E"); --ico-send: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12 20 4l-4 16-4-6.5z M12 13.5 20 4'/%3E%3C/svg%3E"); }

main:has(> .nm) { padding: 0; max-width: none; }
main > .nm { animation: none; }
.nm {
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 390px;
  height: calc(100dvh - var(--nm-top, 140px)); min-height: 520px;
}
.nm-side {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, var(--glass-hi), transparent 160px), var(--glass-strong);
  -webkit-backdrop-filter: blur(22px) saturate(170%); backdrop-filter: blur(22px) saturate(170%);
}
.nm-layers { border-right: 1px solid var(--glass-edge); }
.nm-agent { border-left: 1px solid var(--glass-edge); }
.nm-side-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.nm-side-head h2 { margin: 0; font-size: 18px; background: none; -webkit-background-clip: border-box; background-clip: border-box; color: var(--text); }
.nm-side-head .chip { margin-top: 8px; }
.nm-layers-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 18px 18px; }
.nm-group { margin-top: 14px; }
.nm-group .gis-state { margin: 2px 0 6px; }
.nm-svc { font-size: 12px; font-weight: 700; color: var(--text-2); margin-top: 6px; }
.nm-alloff { margin-top: 12px; width: 100%; }
.nm-center { position: relative; min-width: 0; }
.nm-center #map, #map.nm-map { height: 100%; border: 0; }
.nm-info {
  position: absolute; left: 16px; bottom: 16px; z-index: 5; width: 300px; padding: 14px 16px;
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  animation: li-rise 320ms var(--ease-out) both;
}
.nm-info-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.nm-info-head .nm-close { margin-left: auto; padding: 0 9px; min-height: 0; line-height: 24px; font-size: 16px; }
.nm-info-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.nm-info-figs > div { display: flex; flex-direction: column; }
.nm-info-figs b { font-size: 17px; font-variant-numeric: tabular-nums; }

/* Agent */
.nm-agent-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.nm-agent-tools { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.nm-agent-tools select, .nm-agent-tools button { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.nm-voice[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.nm-msgs { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.nm-msg { display: flex; animation: li-rise 300ms var(--ease-out) both; }
.nm-bubble { max-width: 88%; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; border: 1px solid var(--border); }
.nm-from-user { justify-content: flex-end; }
.nm-from-user .nm-bubble { color: var(--on-accent); background: linear-gradient(180deg, var(--accent), var(--accent-strong)); border-color: transparent; }
.nm-from-agent .nm-bubble { background: var(--surface-raised); }
.nm-from-notice .nm-bubble { background: color-mix(in srgb, var(--info) 10%, var(--surface-solid)); color: var(--text-2); font-size: 12.5px; }
.nm-step { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; font-size: 12.5px; border-left: 2px solid var(--accent); background: var(--surface-sunken); animation: li-rise 260ms var(--ease-out) both; }
.nm-step b { font-weight: 650; }
.nm-step-icon { flex: none; width: 14px; height: 14px; margin-top: 2px; border: 2px solid var(--accent); border-radius: 50% !important; }
.nm-step-icon.nm-running { border-right-color: transparent; animation: li-spin-plain 800ms linear infinite; }
.nm-step-icon.nm-done { background: var(--ok); border-color: var(--ok); }
.nm-step-icon.nm-error { background: var(--bad); border-color: var(--bad); }
.nm-confirm { padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--surface-solid)); font-size: 13px; }
.nm-thinking { display: flex; gap: 5px; padding: 6px 2px; }
.nm-thinking i { width: 7px; height: 7px; border-radius: 50% !important; background: var(--accent); animation: li-dots 1s ease-in-out infinite; }
.nm-thinking i:nth-child(2) { animation-delay: .15s; } .nm-thinking i:nth-child(3) { animation-delay: .3s; }
.nm-suggest { display: flex; gap: 6px; overflow-x: auto; padding: 8px 16px; border-top: 1px solid var(--border); scrollbar-width: none; }
.nm-suggest::-webkit-scrollbar { display: none; }
.nm-suggest button { flex: none; padding: 5px 10px; font-size: 12px; min-height: 0; }
.nm-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px 6px; }
.nm-input { flex: 1; min-height: 40px; max-height: 140px; resize: none; }
.nm-mic, .nm-send { flex: none; width: 42px; height: 40px; padding: 0; font-size: 0; display: inline-flex; align-items: center; justify-content: center; }
.nm-mic::before, .nm-send::before { content: ""; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.nm-mic { --ico: var(--ico-mic); } .nm-send { --ico: var(--ico-send); }
.nm-mic.nm-listening { color: #fff; background: var(--bad); border-color: var(--bad); animation: li-pulse 1.4s ease-out infinite; }
.nm-note { padding: 0 16px 12px; font-size: 11px; }
@keyframes li-spin-plain { to { transform: rotate(360deg); } }
@keyframes li-dots { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

@media (max-width: 1280px) { .nm { grid-template-columns: 260px minmax(0, 1fr) 340px; } }
@media (max-width: 1000px) {
  .nm { grid-template-columns: 1fr; grid-template-rows: 58vh auto auto; height: auto; }
  .nm-center { order: 1; height: 58vh; }
  .nm-agent { order: 2; border-left: 0; border-top: 1px solid var(--glass-edge); height: 70vh; }
  .nm-layers { order: 3; border-right: 0; border-top: 1px solid var(--glass-edge); }
  .nm-info { left: 10px; right: 10px; width: auto; bottom: 10px; }
}
@media (max-width: 720px) { main:has(> .nm) { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); } }

/* ---------------------------------------------------------------------------------------------
   21. Brand tile: a little less bright in the dark themes (softer gradient and glow)
   --------------------------------------------------------------------------------------------- */
html:not([data-theme="light"]) header.top h1::before {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 80%, black), color-mix(in srgb, var(--accent-2) 72%, black));
  box-shadow: 0 0 18px -8px var(--accent), inset 0 1px 0 rgba(255, 255, 255, .18);
  animation: none;
}

/* ---------------------------------------------------------------------------------------------
   21. BASE MAP from the utility GIS (gis.js basemapPicker, map.js setBasemap)
   --------------------------------------------------------------------------------------------- */
label.gis-basemap-wrap { display: flex; flex-direction: column; gap: 6px; margin: 0 0 10px; }
.gis-menu label.gis-basemap-wrap { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.gis-basemap { width: 100%; }
/* A real base map has its own colours: show it as it is, without the dark-theme colour flip, and keep the
   legend dots in step with what the map then shows. */
#map.has-basemap canvas { filter: none; }
.panel:has(#map.has-basemap) .dot, .nm:has(#map.has-basemap) .dot { filter: none; }

/* ---------------------------------------------------------------------------------------------
   22. NETWORK MAP: feature-service layers drawn as real features
   --------------------------------------------------------------------------------------------- */
.nm-frow { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nm-frow label.gis-layer { flex: 1; min-width: 0; }
.nm-frow label.gis-layer span:not(.gis-geom) { overflow: hidden; text-overflow: ellipsis; }
.nm-swatch { flex: none; width: 12px; height: 12px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .5), 0 0 8px currentColor; }
.nm-zoomto { flex: none; width: 28px; height: 28px; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.nm-zoomto::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5 M20 9V4h-5 M4 15v5h5 M20 15v5h-5'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5 M20 9V4h-5 M4 15v5h5 M20 15v5h-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.nm-fstatus {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; max-width: calc(100% - 120px);
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--text);
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.nm-fstatus-bad { color: color-mix(in srgb, var(--bad) 75%, var(--text)); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.nm-info-scroll { max-height: 320px; overflow: auto; }
.nm-feat + .nm-feat { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.nm-feat table { font-size: 12.5px; }
.nm-feat td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.nm-feat td:first-child { color: var(--text-2); font-weight: 600; white-space: nowrap; }
.nm-feat .chip { margin-bottom: 6px; }
.nm-info { width: 340px; }
#map .maplibregl-ctrl-attrib { font-size: 10.5px; }

/* ---------------------------------------------------------------------------------------------
   23. AGENTIC MAP (js/agmap.js): ArcGIS map between a collapsible layer tree and the GIS agent
   --------------------------------------------------------------------------------------------- */
header.top nav a[data-route="agmap"] { --ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7l6-3 6 3 6-3v13l-6 3-6-3-6 3z M9 4v13 M15 7v13'/%3E%3C/svg%3E"); }
.ag.nm { grid-template-columns: 320px minmax(0, 1fr); transition: grid-template-columns var(--t-med) var(--ease); }   /* layers | map; the agent is a popup over the map */
.ag.ag-no-left { grid-template-columns: 0 minmax(0, 1fr); }
.ag.ag-no-left .ag-left { overflow: hidden; visibility: hidden; border: 0; }
.ag-center { position: relative; min-width: 0; overflow: hidden; }
.ag-view { position: absolute; inset: 0; background: var(--surface-sunken); }
.ag-empty { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--text-2); }
/* Centred with top: calc() rather than a transform: the shared button:active rule sets transform and would make the
   button jump away under the pointer on mouse-down, so the click never landed. Solid background on hover (no see-through). */
.ag-edge { position: absolute; top: calc(50% - 28px); z-index: 5; width: 22px; height: 56px; min-height: 0; padding: 0; transform: none; font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; background: var(--surface-raised); color: var(--text); opacity: 1; }
button.secondary.ag-edge:hover { background: var(--surface-raised); color: var(--accent); border-color: var(--accent); filter: none; opacity: 1; }
button.secondary.ag-edge:active { transform: none; background: var(--surface-raised); }
.ag-edge-left { left: 0; border-radius: 0 var(--r-sm) var(--r-sm) 0 !important; }
.ag-edge-right { right: 0; border-radius: var(--r-sm) 0 0 var(--r-sm) !important; }
.ag-statusbar { position: absolute; left: 50%; bottom: 10px; z-index: 3; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; padding: 4px 12px;
  font: 11.5px/1.4 var(--font-mono); color: var(--text-2); background: var(--glass-strong); border: 1px solid var(--glass-edge); border-radius: var(--r-pill);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); pointer-events: none; white-space: nowrap; }
.ag-statusbar .ag-busy { color: var(--accent); }
.ag-statusbar .ag-coords:empty, .ag-statusbar .ag-scale:empty { display: none; }

/* layer tree */
.ag-tools { display: flex; flex-direction: column; gap: 8px; padding: 10px 18px 6px; border-bottom: 1px solid var(--border); }
.ag-search { width: 100%; }
.ag-tool-row { display: flex; gap: 6px; }
.ag-tool-row button { flex: 1; min-height: 0; padding: 4px 6px; font-size: 11.5px; }
label.ag-basemap-wrap { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 12px; }
label.ag-basemap-wrap select { flex: 1; min-height: 30px; padding: 3px 8px; font-size: 12px; }
.ag-tree { padding-top: 6px; }
.ag-svc { margin-top: 10px; }
.ag-svc > summary, .ag-group > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; user-select: none; }
.ag-svc > summary::-webkit-details-marker, .ag-group > summary::-webkit-details-marker, .ag-cases > summary::-webkit-details-marker, .ag-legend > summary::-webkit-details-marker { display: none; }
.ag-svc > summary::before, .ag-group > summary::before, .ag-cases > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease); opacity: .7; margin-right: 2px; }
.ag-svc[open] > summary::before, .ag-group[open] > summary::before, .ag-cases[open] > summary::before { transform: rotate(45deg); }
.ag-svc > summary { padding: 7px 0 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; background: var(--glass-strong); }
.ag-svc-name { font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.ag-svc-count { margin-left: auto; }
.ag-group { margin: 4px 0 2px 10px; }
.ag-group > summary { font-size: 12px; font-weight: 650; color: var(--text-2); padding: 4px 0; }
.ag-row { padding: 2px 0 3px; border-bottom: 1px dashed var(--border); }
.ag-row-main { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ag-row-main label.gis-layer { flex: 1; min-width: 0; padding: 4px 0; }
.ag-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ag-row-sub { display: flex; gap: 6px; align-items: center; padding-left: 26px; }
.ag-row-sub:not(:has(.ag-hint:not(:empty), .ag-filter:not([hidden]))) { display: none; }
.ag-hint { font-size: 11px; color: var(--warn); }
.ag-out .ag-name { opacity: .6; }
.ag-filter { cursor: pointer; font-size: 10.5px; padding: 0 7px; min-height: 0; line-height: 18px; }
.ag-swatch { flex: none; width: 16px; height: 16px; object-fit: contain; }
.ag-swatch-empty { border: 1px dashed var(--border); border-radius: 3px !important; }
.ag-legend { padding-left: 26px; font-size: 11.5px; color: var(--text-2); }
.ag-legend > summary { cursor: pointer; list-style: none; color: var(--text-3); }
.ag-legend-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }

/* agent panel additions */
.ag-cases { border-top: 1px solid var(--border); padding: 6px 16px; max-height: 38%; overflow: auto; flex: none; }
.ag-cases > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 650; color: var(--accent); padding: 4px 0; }
.ag-case-group { margin: 6px 0 8px; }
.ag-case-title { font-size: 10.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.ag-case-items { display: flex; flex-wrap: wrap; gap: 5px; }
.ag-case-items button { min-height: 0; padding: 4px 9px; font-size: 11.5px; text-align: left; }
.ag-suggest { margin: 2px 0 8px 30px; }   /* follow-up questions the agent offers under an answer */
.ag-voice-case::before { content: ""; width: 12px; height: 12px; margin-right: 5px; background: currentColor; -webkit-mask: var(--ico-mic) center / contain no-repeat; mask: var(--ico-mic) center / contain no-repeat; }
.ag-results { padding: 8px 10px; border: 1px solid var(--border); background: var(--surface-sunken); font-size: 12.5px; }
.ag-results-head { margin-bottom: 6px; }
.ag-result { display: block; width: 100%; margin-top: 4px; min-height: 0; padding: 4px 8px; font-size: 12px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-bars { display: grid; gap: 3px; margin-top: 6px; }
.ag-bar { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 8px; align-items: center; font-size: 11.5px; }
.ag-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-bar-track { height: 6px; background: var(--border); border-radius: var(--r-pill) !important; overflow: hidden; }
.ag-bar-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: inherit; }
.ag-bar-n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ArcGIS widgets keep their own look: undo the app's global button styling inside the map */
.ag-view button, .ag-view .esri-widget--button { min-height: 0; box-shadow: none; text-transform: none; letter-spacing: 0; }

@media (max-width: 1280px) { .ag.nm { grid-template-columns: 280px minmax(0, 1fr); } .ag.ag-no-left { grid-template-columns: 0 minmax(0, 1fr); } }
@media (max-width: 1000px) {
  .ag.nm, .ag.ag-no-left { grid-template-columns: 1fr; }
  .ag-center { height: 60vh; }
  .ag-edge { display: none; }
  .ag.ag-no-left .ag-left { visibility: visible; }
}
.ag-banner { position: absolute; top: 10px; left: 50%; z-index: 3; transform: translateX(-50%); max-width: min(560px, calc(100% - 120px)); padding: 6px 12px; font-size: 12px; line-height: 1.4;
  color: var(--text-2); background: color-mix(in srgb, var(--warn) 14%, var(--glass-strong)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.ag-note { padding: 2px 12px; font-style: italic; }
.nm-from-agent .nm-bubble { white-space: normal; }
.nm-bubble .ag-p { margin: 0 0 6px; } .nm-bubble .ag-p:last-child { margin-bottom: 0; }
.nm-bubble .ag-list { margin: 2px 0 8px; padding-left: 20px; } .nm-bubble .ag-list li { margin: 2px 0; }

/* ---------------------------------------------------------------------------------------------
   24. LOSS AND THEFT INTELLIGENCE (#losstheft): drill-down from region to consumer
   --------------------------------------------------------------------------------------------- */
.lt-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.lt-head h2 { margin: 0 0 4px; }
.lt-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lt-find { position: relative; }
.lt-search { min-width: 260px; }
.lt-hits { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 320px; overflow: auto;
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-radius: var(--r-sm); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.lt-hit { display: block; width: 100%; text-align: left; padding: 8px 10px; background: none; border: 0; border-bottom: 1px solid var(--border);
  color: var(--text); border-radius: 0; cursor: pointer; }
.lt-hit:hover { background: var(--surface-hover); }
.lt-crumbs { margin: 4px 0 14px; font-size: 14px; }
.lt-crumbs a { color: var(--accent); text-decoration: none; }
.lt-crumbs a:hover { text-decoration: underline; }
.kpi .lt-small { font-size: 15px; }
.kpi.lt-alert b { color: var(--bad); }
.kpi .small { display: block; margin-top: 2px; }
.lt-bars { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; max-height: 420px; overflow: auto; }
.lt-bar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 62px; align-items: center; gap: 8px; width: 100%;
  background: none; border: 0; padding: 3px 4px; border-radius: var(--r-xs); color: var(--text); text-align: left; font-size: 13px; }
button.lt-bar { cursor: pointer; }
button.lt-bar:hover { background: var(--surface-hover); }
.lt-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-bar-track { height: 12px; border-radius: var(--r-pill); background: var(--surface-sunken); overflow: hidden; }
.lt-bar-fill { display: block; height: 100%; border-radius: var(--r-pill); background: var(--ok); }
.lt-bar-fill.bad { background: var(--bad); }
.lt-bar-fill.warn { background: var(--warn); }
.lt-bar-val { text-align: right; font-variant-numeric: tabular-nums; }

/* 25. Agentic Map - loss by zoom info box (on the map, top right) */
.esri-ui .ag-zl { padding: 8px 10px; max-width: 250px; border-radius: var(--r-sm); background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: 0 6px 18px rgba(0,0,0,.3); font-size: 12px; }
.ag-zl-head { display: flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; }
.ag-zl-hint { margin: 4px 0 6px; line-height: 1.35; }
.ag-zl-legend { display: grid; gap: 2px; }
.ag-zl-legend span { display: flex; align-items: center; gap: 6px; }
.ag-zl-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ag-zl-legend summary { cursor: pointer; color: var(--text-2); margin-bottom: 2px; }
.ag-zl-legend:not([open]) { gap: 0; }
@media (max-width: 700px) {
  .esri-ui .ag-zl { max-width: 190px; padding: 6px 8px; font-size: 11px; }
  .ag-zl-hint { margin: 2px 0 4px; }
}
.ag-zl-focus:not(:empty) { margin-top: 4px; padding: 3px 6px; border-left: 3px solid var(--accent, #7c8cff); background: var(--surface, transparent); line-height: 1.35; }
.esri-ui .ag-zl .small, .esri-ui .ag-zl .ag-zl-head, .esri-ui .ag-zl .ag-zl-what { font-size: inherit; }

/* ---------------------------------------------------------------------------------------------
   NAVIGATION HIDE / SHOW (js/app.js setNavHidden). The toggle sits in the top row next to Sign out,
   so it stays reachable when the ribbon (or the phone dock) is hidden.
   --------------------------------------------------------------------------------------------- */
header.top nav[hidden], header.top.nav-hidden nav { display: none; }
header.top .who button.nav-toggle { display: inline-flex; align-items: center; gap: 6px; }
header.top .who button.nav-toggle::before { /* chevron: up = hide, down = show */
  content: ""; width: 10px; height: 10px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 15l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 15l7-7 7 7'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--t-med) var(--ease);
}
header.top .who button.nav-toggle.is-collapsed::before { transform: rotate(180deg); }
@media (max-width: 720px) {
  /* Phones: icon-only toggle so the top row keeps its single line (the label stays as aria-label/title). */
  header.top .who > button.nav-toggle { font-size: 0; gap: 0; padding: 6px 12px; }
  header.top .who > button.nav-toggle::before { width: 12px; height: 12px; }
  header.top.nav-hidden ~ main { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}


/* ---------------------------------------------------------------------------------------------
   ASSISTANT ROBOT (js/robot.js) - floats in a corner of the Agentic AI map and opens the chat
   --------------------------------------------------------------------------------------------- */
.rb { display: inline-block; line-height: 0; }
.rb-svg { width: 100%; height: 100%; overflow: visible; }
.rb-disc-hi { stop-color: color-mix(in srgb, var(--accent) 55%, #2a1440); }
.rb-disc-lo { stop-color: color-mix(in srgb, var(--accent) 25%, #120a1e); }
.rb-visor-hi { stop-color: color-mix(in srgb, var(--accent) 70%, #3a1a55); }
.rb-visor-mid { stop-color: #140c22; }
.rb-crown { fill: none; stroke: rgba(255, 255, 255, .9); stroke-width: 2; stroke-linecap: round; opacity: .55; }
.rb-glint { fill: rgba(255, 255, 255, .55); }
.rb-glint2 { fill: rgba(255, 255, 255, .5); }
.rb-antenna-stem { stroke: #e6e8ef; stroke-width: 2.4; stroke-linecap: round; }
.rb-antenna { fill: #ffffff; }
.rb-boom { fill: none; stroke: #e6e8ef; stroke-width: 2.4; stroke-linecap: round; }
.rb-mic { fill: #ffffff; }
.rb-visor { filter: drop-shadow(0 0 0 transparent); }

/* Bottom-right of the map, above the scale bar and the Esri attribution; never over the zoom buttons or legend. */
button.rb-launch {
  position: absolute; right: 18px; bottom: 54px; z-index: 4; width: 76px; height: 76px; padding: 0; margin: 0;
  background: none; border: 0; box-shadow: none; filter: none; cursor: pointer; color: inherit; border-radius: 50% !important;
}
button.rb-launch:hover, button.rb-launch:active, button.secondary.rb-launch:hover { background: none; border: 0; color: inherit; box-shadow: none; filter: none; transform: none; }
button.rb-launch:focus-visible { outline: 2px solid var(--ring); outline-offset: 4px; }
button.rb-launch[hidden] { display: none; }
.rb-halo { /* a soft glow that turns slowly around the robot */
  position: absolute; inset: -14px; border-radius: 50% !important; pointer-events: none;
  background: conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 70%, transparent), transparent 30%,
              rgba(255, 255, 255, .45) 45%, transparent 60%, color-mix(in srgb, var(--accent-2) 60%, transparent) 78%, transparent 92%);
  filter: blur(12px); opacity: .85; animation: rb-turn 6s linear infinite;
}
.rb-float { position: absolute; inset: 0; display: block; animation: rb-revolve 9s linear infinite; }
.rb-body { position: absolute; inset: 0; display: block; z-index: 1; }
.rb--launch { width: 100%; height: 100%; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, .45)); transition: transform var(--t-med) var(--ease); }
.rb--launch .rb-disc, .rb-svg .rb-disc { border-radius: 50%; }
button.rb-launch:hover .rb--launch { transform: scale(1.07); }
.rb-tip {
  position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  padding: 5px 10px; font-size: 12px; font-weight: 700; color: var(--on-accent); background: var(--accent);
  opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
button.rb-launch:hover .rb-tip, button.rb-launch:focus-visible .rb-tip { opacity: 1; }
/* A small, slow loop: a gentle drift and bob, like floating. */
@keyframes rb-drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-4px, -6px) rotate(-3deg); }
  50% { transform: translate(0, -9px) rotate(0deg); }
  75% { transform: translate(4px, -5px) rotate(3deg); }
}
@keyframes rb-turn { to { transform: rotate(360deg); } }
/* ---- launcher motion: revolve, tilt, head turn, full spin, orbiting lights, pulse ring ---------------------------- */
/* Revolves in a small circle and stays upright (the two rotations cancel; only the offset goes round). */
@keyframes rb-revolve {
  from { transform: rotate(0deg) translateX(9px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(9px) rotate(-360deg); }
}
/* Tilts left and right, bobs, turns its head right round (Y), then does one full spin (Z). Same function list in every
   step so each part moves smoothly; 360deg and 0deg look the same, so the restart is seamless. */
@keyframes rb-look {
  0%   { transform: perspective(260px) translateY(0) rotateY(0deg) rotate(0deg); }
  10%  { transform: perspective(260px) translateY(-5px) rotateY(0deg) rotate(-12deg); }
  20%  { transform: perspective(260px) translateY(0) rotateY(0deg) rotate(10deg); }
  30%  { transform: perspective(260px) translateY(-4px) rotateY(0deg) rotate(0deg); }
  46%  { transform: perspective(260px) translateY(-7px) rotateY(360deg) rotate(0deg); }
  56%  { transform: perspective(260px) translateY(0) rotateY(360deg) rotate(0deg); }
  70%  { transform: perspective(260px) translateY(-4px) rotateY(360deg) rotate(0deg); }
  84%  { transform: perspective(260px) translateY(-8px) rotateY(360deg) rotate(360deg); }
  100% { transform: perspective(260px) translateY(0) rotateY(360deg) rotate(360deg); }
}
.rb--launch .rb-svg { animation: rb-look 10s cubic-bezier(.45, .05, .35, 1) infinite; transform-origin: 50% 55%; }
/* the antenna light blinks in the theme colour */
@keyframes rb-blink { 0%, 60%, 100% { fill: #ffffff; } 70%, 85% { fill: var(--accent); } }
.rb--launch .rb-antenna { animation: rb-blink 2.4s ease-in-out infinite; }

/* orbiting lights: each ring is a flat ellipse (a circle seen at a slant), turned to its own angle (rb-tilt); the light
   runs round it along the same ellipse (offset-path), so it stays a round dot. The rings are 94 px wide, 30 px tall. */
.rb-orbits { position: absolute; inset: 0; pointer-events: none; display: block; }
.rb-orbits--back { z-index: 0; }
.rb-orbits--front { z-index: 2; }
.rb-tilt { position: absolute; inset: -9px; display: block; }
.rb-orbits--back .rb-tilt { clip-path: inset(-40px -40px 50% -40px); }   /* the far half of each ring, behind the robot */
.rb-orbits--front .rb-tilt { clip-path: inset(50% -40px -40px -40px); }  /* the near half, in front of it */
.rb-tilt--a { transform: rotate(0deg); --dur: 3.4s; --sat: var(--accent); }
.rb-tilt--b { transform: rotate(58deg); --dur: 4.8s; --sat: var(--accent-2); }
.rb-tilt--c { transform: rotate(-58deg); --dur: 6.2s; --sat: #ffffff; }
.rb-ring {
  position: absolute; left: 0; right: 0; top: 50%; height: 30px; margin-top: -15px; display: block; border-radius: 50% !important;
  border: 1px solid color-mix(in srgb, var(--sat) 40%, transparent);
}
.rb-orbits--front .rb-ring { border-color: color-mix(in srgb, var(--sat) 26%, transparent); }
.rb-sat {
  position: absolute; top: 0; left: 0; width: 8px; height: 8px; border-radius: 50% !important;
  background: var(--sat); box-shadow: 0 0 6px 2px color-mix(in srgb, var(--sat) 70%, transparent), 0 0 14px 4px color-mix(in srgb, var(--sat) 35%, transparent);
  offset-path: path('M -1 14 A 47 15 0 1 0 93 14 A 47 15 0 1 0 -1 14 Z');   /* the ring's ellipse, in the ring's own box (inside its 1px border) */ offset-rotate: 0deg; offset-distance: 0%;
  animation: rb-run var(--dur) linear infinite;
}
@keyframes rb-run { to { offset-distance: 100%; } }
@supports not (offset-path: path('M 0 0 L 1 1')) { .rb-sat { display: none; } }

/* a soft ring that grows and fades every few seconds */
.rb-ping {
  position: absolute; inset: 2px; border-radius: 50% !important; pointer-events: none;
  border: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); opacity: 0; animation: rb-ping 3.2s ease-out infinite;
}
@keyframes rb-ping { 0% { transform: scale(.85); opacity: .7; } 80%, 100% { transform: scale(1.55); opacity: 0; } }

/* on hover the robot holds still (easy to click) and grows a little; the lights keep going */
button.rb-launch:hover .rb-float, button.rb-launch:hover .rb--launch .rb-svg, button.rb-launch:focus-visible .rb-float { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .rb--launch .rb-svg, .rb--launch .rb-antenna, .rb-sat, .rb-ping { animation: none !important; }
  .rb-orbits--front { display: none; }
  .rb-orbits--back .rb-tilt { clip-path: none; }
}
@media (prefers-reduced-motion: reduce) { .rb-halo, .rb-float, .lc-hero .rb { animation: none !important; } }

/* ---------------------------------------------------------------------------------------------
   ASSISTANT CHAT POPUP (js/robot-chat.js, placed by agmap.js) - a floating chat over the Agentic AI map,
   opened by the robot. The map stays visible behind a light overlay and keeps taking clicks, pans and zooms.
   --------------------------------------------------------------------------------------------- */
.lc-modal { position: absolute; inset: 0; z-index: 8; pointer-events: none; display: flex; justify-content: flex-end; align-items: stretch; padding: 16px 16px 40px; }
.lc-modal[hidden] { display: none; }
.lc-dialog, .lc-scrim { transition: opacity .35s var(--ease), transform .35s var(--ease), filter .35s var(--ease), visibility 0s; }
.lc-modal.lc-run-hidden { pointer-events: none; }
.lc-modal.lc-run-hidden .lc-dialog { opacity: 0; transform: translateX(28px) scale(.97); filter: blur(8px); visibility: hidden; pointer-events: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease), filter .35s var(--ease), visibility 0s linear .35s; }
.lc-modal.lc-run-hidden .lc-scrim { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .lc-dialog, .lc-scrim { transition: none; } }
.lc-scrim { position: absolute; inset: 0; pointer-events: none;   /* a subtle tint only: the map underneath still works */
  background: linear-gradient(270deg, rgba(2, 3, 8, .42), rgba(2, 3, 8, .08) 70%); }
/* The chat popup: glossy glass in the Grid Agent theme's own colours - a top gloss, a diagonal reflection and a faint
   accent glow over the theme's glass surface. Text, buttons and the input box follow the theme as everywhere else. */
.lc-dialog {
  --lc-r: 18px;
  position: relative; isolation: isolate; pointer-events: auto; display: flex; flex-direction: column; min-height: 0;
  width: min(460px, 100%); max-height: min(760px, 100%); height: 100%;
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 150px),
    linear-gradient(125deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, .04) 20%, transparent 38%),
    radial-gradient(130% 55% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    radial-gradient(120% 50% at 0% 100%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 60%),
    var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-edge); border-radius: var(--lc-r) !important;
  box-shadow: var(--shadow-lg), inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px rgba(255, 255, 255, .03);
  animation: lc-pop var(--t-med) var(--ease);
}
.lc-dialog > .lc { overflow: hidden; border-radius: var(--lc-r) !important; }

/* animated border: a coloured light travelling round the edge, with a soft glow that follows it */
@property --lc-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.lc-dialog::before, .lc-dialog::after { content: ""; position: absolute; inset: -1px; border-radius: calc(var(--lc-r) + 1px) !important; pointer-events: none;
  background: conic-gradient(from var(--lc-angle), transparent 0 52%, color-mix(in srgb, var(--accent) 80%, transparent) 70%, var(--accent-2) 82%, #fff 86%, transparent 90%, transparent 100%);
  animation: lc-border 6s linear infinite; }
.lc-dialog::before { padding: 1.5px; z-index: 2;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.lc-dialog::after { z-index: -1; inset: -3px; filter: blur(14px); opacity: .55;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 6px; }
@keyframes lc-border { to { --lc-angle: 360deg; } }

/* little sparkles: one glides along the edge, the others twinkle in turn around the frame */
.lc-sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.lc-spark { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  background: #fff; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  filter: drop-shadow(0 0 3px #fff) drop-shadow(0 0 6px var(--accent)); opacity: 0; transform: scale(0);
  animation: lc-twinkle 3.2s ease-in-out infinite; animation-delay: var(--d); }
@keyframes lc-twinkle { 0%, 62%, 100% { opacity: 0; transform: scale(0) rotate(0deg); } 74% { opacity: 1; transform: scale(1) rotate(45deg); } 86% { opacity: .2; transform: scale(.35) rotate(90deg); } }
.lc-comet { display: none; }
@supports (offset-path: inset(0 round 10px)) {
  .lc-comet { display: block; position: absolute; left: 0; top: 0; width: 10px; height: 10px; offset-path: inset(0 round var(--lc-r)); offset-rotate: 0deg; offset-anchor: center;
    background: #fff; clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    filter: drop-shadow(0 0 4px #fff) drop-shadow(0 0 8px var(--accent-2)); animation: lc-comet 9s linear infinite, lc-comet-pulse 1.4s ease-in-out infinite; }
}
@keyframes lc-comet { from { offset-distance: 0%; } to { offset-distance: 100%; } }
@keyframes lc-comet-pulse { 0%, 100% { scale: .75; opacity: .85; } 50% { scale: 1.15; opacity: 1; } }
.lc-modal.lc-run-hidden .lc-sparkles, .lc-modal.lc-run-hidden .lc-dialog::after { display: none; }
@media (prefers-reduced-motion: reduce) {
  .lc-dialog::before, .lc-dialog::after { animation: none; }
  .lc-spark, .lc-comet { animation: none; display: none; }
}
@keyframes lc-pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.lc-dialog > .lc { flex: 1; }
.lc-icon.lc-min { width: 30px; padding: 0; font-size: 0; display: inline-flex; align-items: center; justify-content: center; }
.lc-icon.lc-min::before { content: ""; width: 12px; height: 2px; background: currentColor; border-radius: 1px; }
/* Minimised: a small bar where the robot was; a dot shows that an answer arrived meanwhile. */
button.lc-minbar {
  position: absolute; right: 18px; bottom: 58px; z-index: 6; display: inline-flex; align-items: center; gap: 8px;
  min-height: 0; padding: 6px 14px 6px 6px; font-size: 13px; font-weight: 600;
  background: var(--surface-raised); border: 1px solid var(--glass-edge); border-radius: 999px !important; box-shadow: var(--shadow-lg);
}
button.lc-minbar[hidden] { display: none; }
button.lc-minbar:active { transform: none; }
.rb--min { width: 30px; height: 30px; flex: none; }
.lc-minbar-dot { width: 8px; height: 8px; border-radius: 50% !important; background: var(--accent); display: none; }
button.lc-minbar.lc-unread .lc-minbar-dot { display: inline-block; animation: li-dots 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .lc-dialog { animation: none; } }
.lc { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.lc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 10px 16px; border-bottom: 1px solid var(--border); }
.lc-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rb--avatar { width: 38px; height: 38px; flex: none; }
.lc-title { margin: 0; font-size: 16px; }
.lc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; display: block; }
.lc-head-btns { display: flex; gap: 6px; flex: none; }
.lc-head-btns button { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.lc-icon.lc-close { width: 30px; padding: 0; font-size: 0; display: inline-flex; align-items: center; justify-content: center; }
.lc-icon.lc-close::before { content: ""; width: 12px; height: 12px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 5l14 14M19 5L5 19'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M5 5l14 14M19 5L5 19'/%3E%3C/svg%3E") center / contain no-repeat; }
.lc-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.lc-tools .chip { margin: 0; }
.lc-tools select, .lc-tools button { min-height: 28px; padding: 3px 9px; font-size: 12px; }

/* Voice-over (speaker) and Hands-free (headset) as icon buttons in the chat popup; the tooltip says what each does.
   Same look as the mic and send buttons: an outline icon in the text colour, the accent colour when switched on. */
:root { --ico-voice-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6.5 9H3.5v6h3l4.5 4V5z M15.5 9a4.5 4.5 0 0 1 0 6 M18.5 6.5a8 8 0 0 1 0 11'/%3E%3C/svg%3E"); --ico-voice-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 5 6.5 9H3.5v6h3l4.5 4V5z M16 9.5l5 5 M21 9.5l-5 5'/%3E%3C/svg%3E"); --ico-hands-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14v-2a8 8 0 0 1 16 0v2 M4 14h3v6H5.5A1.5 1.5 0 0 1 4 18.5z M20 14h-3v6h1.5a1.5 1.5 0 0 0 1.5-1.5z'/%3E%3C/svg%3E"); --ico-hands-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 14v-2a8 8 0 0 1 16 0v2 M4 14h3v6H5.5A1.5 1.5 0 0 1 4 18.5z M20 14h-3v6h1.5a1.5 1.5 0 0 0 1.5-1.5z M3 3l18 18'/%3E%3C/svg%3E"); }
.lc-tools button.lc-ico { width: 32px; height: 28px; padding: 0; font-size: 0; display: inline-flex; align-items: center; justify-content: center; }
.lc-ico::before { content: ""; width: 17px; height: 17px; background: currentColor; -webkit-mask: var(--ico) center / contain no-repeat; mask: var(--ico) center / contain no-repeat; }
.lc-ico-voice { --ico: var(--ico-voice-off); } .lc-ico-voice[aria-pressed="true"] { --ico: var(--ico-voice-on); }
.lc-ico-hands { --ico: var(--ico-hands-off); } .lc-ico-hands[aria-pressed="true"] { --ico: var(--ico-hands-on); }
.lc-tools button.lc-ico:disabled { opacity: .45; }

.lc-scroll { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.lc-msgs.nm-msgs { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px 16px; gap: 14px; }
.lc-hero { flex: none; }
.lc-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 22px 22px 4px; }
.lc-hero[hidden] { display: none; }
.rb--hero { width: 74px; height: 74px; animation: rb-drift 7s ease-in-out infinite; }
.lc-hero h3 { margin: 10px 0 4px; font-size: 20px; }
.lc-hero p { margin: 0; font-size: 13px; }
.lc-msgs .nm-msg { gap: 9px; align-items: flex-start; }
.lc-msgs .nm-from-user { justify-content: flex-end; }
.lc-msgs .nm-from-user .nm-bubble { max-width: 85%; padding: 9px 13px; font-size: 13.5px; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border-strong); }
.lc-msgs .nm-from-agent .nm-bubble { max-width: calc(100% - 36px); padding: 2px 0; font-size: 14px; line-height: 1.62; background: none; border: 0; }
.rb--msg { width: 26px; height: 26px; flex: none; margin-top: 1px; }
.lc-msgs .ag-suggest { margin-left: 35px; }
.lc-msgs .nm-thinking { padding-left: 35px; align-items: center; }
.lc-msgs .nm-thinking::before { content: "Thinking"; margin-right: 6px; font-size: 12.5px; color: var(--text-2); }

.lc-bottom { padding: 6px 14px 10px; border-top: 1px solid var(--border); }
.lc-cases.ag-cases { border-top: 0; padding: 2px 0 6px; max-height: 30vh; }
.lc-composer.nm-composer {
  padding: 6px 6px 6px 12px; align-items: flex-end;
  background: var(--surface-sunken); border: 1px solid var(--border-strong); border-radius: 16px !important;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.lc-composer.nm-composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lc-composer .nm-input { border: 0; background: transparent; box-shadow: none; min-height: 40px; padding: 9px 2px; font-size: 14px; }
.lc-composer .nm-input:focus { box-shadow: none; }
.lc-composer .nm-mic, .lc-composer .nm-send { width: 38px; height: 38px; border-radius: 12px !important; }
.lc-bottom .nm-note { margin-top: 6px; text-align: center; }

/* Tablets: the popup is centred over the map and may use its whole height. */
@media (max-width: 1000px) {
  .lc-modal { justify-content: center; padding: 10px 10px 34px; }
  .lc-scrim { background: color-mix(in srgb, var(--surface-solid) 22%, transparent); }
  .lc-dialog { width: min(560px, 100%); max-height: none; }
  button.rb-launch { right: 12px; bottom: 48px; width: 64px; height: 64px; }
  button.lc-minbar { right: 12px; bottom: 50px; }
}
/* Phones: the popup fills the screen below the header (still over the map); Minimise or Close returns to the map. */
@media (max-width: 720px) {
  .lc-modal { position: fixed; z-index: 46; left: 0; right: 0; top: var(--nm-top, 0px); bottom: calc(72px + env(safe-area-inset-bottom, 0px)); padding: 6px; }
  header.top.nav-hidden ~ main .lc-modal { bottom: 0; }
  .lc-dialog { width: 100%; --lc-r: 14px; }
  .lc-sub { max-width: 16ch; }
  .lc-head-btns .lc-new { padding: 4px 8px; }
}

/* ---------------------------------------------------------------------------------------------
   AGENT PROGRESS OVERLAY (js/agmap-steps.js) - glass cards over the Agentic AI map while the agent works:
   the running stage glows and fills, stages still to come are masked, finished ones get a tick; then the
   veil lifts and the result is revealed on the map. Display only; the map underneath keeps working.
   --------------------------------------------------------------------------------------------- */
@property --as-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.as-overlay { position: absolute; inset: 0 var(--as-right, 0px) 0 0; z-index: 7; pointer-events: none;
  display: flex; align-items: center; justify-content: center; padding: 18px; transition: right var(--t-med) var(--ease); }
.as-overlay[hidden] { display: none; }
.as-veil { position: absolute; inset: 0 calc(-1 * var(--as-right, 0px)) 0 0;
  background: radial-gradient(110% 85% at 45% 45%, rgba(4, 6, 12, .28), rgba(2, 3, 8, .62));
  -webkit-backdrop-filter: blur(4px) saturate(.8) brightness(.9); backdrop-filter: blur(4px) saturate(.8) brightness(.9); opacity: 0; transition: opacity .5s var(--ease); }
.as-overlay.as-entering .as-veil { opacity: 1; }
.as-stack { position: relative; width: min(390px, 100%); display: grid; gap: 10px; }

/* black glass card (in every theme): smoked tint, deep blur, a bright top edge, a light streak and a deep shadow */
.as-overlay { --as-text: #f4f6fb; --as-text-2: rgba(232, 236, 245, .78); --as-text-3: rgba(214, 220, 234, .55); --as-line: rgba(255, 255, 255, .13); }
.as-card { position: relative; border-radius: 20px !important; padding: 14px 16px; isolation: isolate; color: var(--as-text);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 32%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(180deg, rgba(18, 21, 30, .58), rgba(4, 5, 10, .74));
  -webkit-backdrop-filter: blur(30px) saturate(180%) brightness(.82); backdrop-filter: blur(30px) saturate(180%) brightness(.82);
  border: 1px solid var(--as-line);
  box-shadow: 0 28px 60px -22px rgba(0, 0, 0, .85), 0 8px 18px -10px rgba(0, 0, 0, .6),
    inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -1px 0 rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(255, 255, 255, .02);
  transition: opacity .4s var(--ease), filter .4s var(--ease), transform .4s var(--ease), border-color .4s; }
.as-card::after { content: ""; position: absolute; inset: 0; border-radius: 20px !important; pointer-events: none; z-index: -1;
  background: linear-gradient(115deg, transparent 0 18%, rgba(255, 255, 255, .07) 24%, transparent 34%),
    radial-gradient(120% 70% at 0% 0%, rgba(255, 255, 255, .08), transparent 55%); }
.as-head::before { content: ""; position: absolute; z-index: -2; width: 180px; height: 180px; right: -40px; top: -70px; border-radius: 50% !important; pointer-events: none;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent), transparent 65%); filter: blur(10px); opacity: .55; }
.as-head { overflow: hidden; }
.as-overlay.as-ended .as-head::before { background: radial-gradient(circle, color-mix(in srgb, var(--ok) 50%, transparent), transparent 65%); }
.as-overlay.as-entering .as-card { animation: as-in .5s var(--ease) backwards; animation-delay: calc(var(--i, -1) * 70ms + 70ms); }
.as-head { --i: -1; padding: 16px 18px 18px; }
@keyframes as-in { from { opacity: 0; transform: translateY(14px) scale(.97); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

/* header: what is happening + overall progress out of 100 */
.as-head-top { display: flex; align-items: center; gap: 10px; }
.as-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--as-text); }
.as-sub { font-size: 12px; color: var(--as-text-3); margin-top: 1px; }
.as-orb { position: relative; width: 30px; height: 30px; flex: none; border-radius: 50% !important; display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 55%, white), var(--accent) 60%, var(--accent-strong)); box-shadow: 0 0 18px -2px var(--accent); }
.as-orb i { width: 4px; height: 4px; border-radius: 50% !important; background: #fff; animation: li-dots 1s ease-in-out infinite; }
.as-orb i:nth-child(2) { animation-delay: .15s; } .as-orb i:nth-child(3) { animation-delay: .3s; }
.as-score { margin: 10px 0 12px; display: flex; align-items: baseline; gap: 2px; }
.as-pct { font-family: var(--font-display); font-size: 40px; line-height: 1; font-weight: 700; color: var(--as-text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; text-shadow: 0 2px 14px rgba(0, 0, 0, .5); }
.as-of { font-size: 16px; color: var(--as-text-3); }

/* progress bars: a soft track and a gradient fill with a moving sheen */
.as-track { position: relative; height: 6px; margin-top: 11px; border-radius: 999px !important; overflow: hidden;
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .06); }
.as-track-lg { height: 12px; margin-top: 0; padding: 2px; }
.as-fill { position: relative; display: block; height: 100%; width: 0; border-radius: 999px !important; overflow: hidden;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, var(--ok)); box-shadow: 0 0 12px -2px var(--accent); transition: width .25s linear; }
.as-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  background-size: 50% 100%; background-repeat: no-repeat; animation: li-scan 1.4s linear infinite; }

/* stage cards */
.as-stage-row { display: flex; align-items: center; gap: 12px; }
.as-icon-wrap { position: relative; width: 38px; height: 38px; flex: none; border-radius: 12px !important; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .03)); border: 1px solid var(--as-line); color: var(--as-text-2); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12); transition: background .4s, color .4s; }
.as-ico svg, .as-badge svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.as-badge { position: absolute; right: -6px; bottom: -6px; width: 18px; height: 18px; border-radius: 50% !important; display: none; align-items: center; justify-content: center; color: #fff; }
.as-badge svg { width: 12px; height: 12px; stroke-width: 2.6; }
.as-ring { position: absolute; inset: -4px; border-radius: 14px !important; opacity: 0; pointer-events: none;
  background: conic-gradient(from var(--as-angle), transparent 0 70%, var(--accent) 88%, var(--accent-2) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 2px; }
.as-text { flex: 1; min-width: 0; }
.as-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--as-text); }
.as-num { font-size: 11px; font-weight: 700; color: var(--as-text-3); font-variant-numeric: tabular-nums; }
.as-detail { margin-top: 2px; font-size: 12px; color: var(--as-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-state { font-size: 12px; font-weight: 600; color: var(--as-text-3); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.as-stage .as-track { height: 4px; }

/* waiting: masked until its turn */
.as-stage[data-state="wait"] { opacity: .38; filter: blur(1.6px) grayscale(.8) brightness(.8); transform: scale(.965); }
.as-stage[data-state="wait"] .as-fill { width: 0 !important; }
/* running: lifted, glowing edge that travels round the card, spinning ring, live percentage */
.as-stage[data-state="run"] { transform: scale(1.02); border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 30px 64px -22px rgba(0, 0, 0, .9), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent), 0 0 38px -6px color-mix(in srgb, var(--accent) 65%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, .26), inset 0 -1px 0 rgba(0, 0, 0, .55), inset 0 0 40px -18px color-mix(in srgb, var(--accent) 70%, transparent); }
.as-stage[data-state="run"]::before { content: ""; position: absolute; inset: -1px; border-radius: 21px !important; padding: 1px; z-index: -1; pointer-events: none;
  background: conic-gradient(from var(--as-angle), transparent 0 60%, var(--accent) 80%, var(--accent-2) 90%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: as-spin 2.4s linear infinite; }
.as-stage[data-state="run"] .as-icon-wrap { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 6px 18px -6px var(--accent); }
.as-stage[data-state="run"] .as-ring { opacity: 1; animation: as-spin 1.1s linear infinite; }
.as-stage[data-state="run"] .as-ico { animation: as-breathe 1.6s ease-in-out infinite; }
.as-stage[data-state="run"] .as-state { color: var(--accent); }
.as-stage[data-state="run"] .as-detail { color: var(--as-text-2); }
@keyframes as-spin { to { --as-angle: 360deg; } }
@keyframes as-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
/* done: settled, ticked */
.as-stage[data-state="done"] { opacity: .8; }
.as-stage[data-state="done"] .as-icon-wrap { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.as-stage[data-state="done"] .as-badge { display: inline-flex; background: var(--ok); animation: as-tick .45s cubic-bezier(.2, 1.6, .4, 1) both; }
.as-stage[data-state="done"] .as-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--ok) 70%, var(--accent-2)), var(--ok)); box-shadow: none; }
.as-stage[data-state="done"] .as-fill::after, .as-stage[data-state="skip"] .as-fill::after { animation: none; display: none; }
.as-stage[data-state="done"] .as-state { color: var(--ok); }
@keyframes as-tick { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
/* not needed for this question */
.as-stage[data-state="skip"] { opacity: .5; }
.as-stage[data-state="skip"] .as-track { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 6px, transparent 6px 11px); }
.as-stage[data-state="skip"] .as-fill { width: 0 !important; }
/* failed */
.as-stage[data-state="error"] { border-color: color-mix(in srgb, var(--bad) 55%, transparent); box-shadow: 0 0 28px -8px var(--bad); }
.as-stage[data-state="error"] .as-icon-wrap { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.as-stage[data-state="error"] .as-badge { display: inline-flex; background: var(--bad); }
.as-stage[data-state="error"] .as-fill { background: var(--bad); }
.as-stage[data-state="error"] .as-state { color: var(--bad); }

/* finished: the header settles, then everything lifts away to reveal the map */
.as-overlay.as-ended .as-orb { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--ok) 55%, white), var(--ok)); box-shadow: 0 0 18px -2px var(--ok); }
.as-overlay.as-ended .as-orb i, .as-overlay.as-failed .as-orb i { animation: none; opacity: .9; }
.as-overlay.as-ended .as-head { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.as-overlay.as-failed .as-orb { background: var(--bad); box-shadow: 0 0 18px -2px var(--bad); }
.as-overlay.as-leaving .as-veil { opacity: 0; }
.as-overlay.as-leaving .as-stack { opacity: 0; transform: translateY(-10px) scale(.97); filter: blur(6px); transition: opacity .5s var(--ease), transform .5s var(--ease), filter .5s var(--ease); }

@media (max-width: 720px) {   /* phones: the map area is short, so the cards are compact */
  .as-overlay { align-items: flex-start; padding: 10px; }
  .as-stack { gap: 6px; }
  .as-card { padding: 9px 12px; border-radius: 16px !important; }
  .as-card::after { border-radius: 16px !important; }
  .as-head { padding: 10px 12px 12px; }
  .as-orb { width: 24px; height: 24px; }
  .as-title { font-size: 14px; }
  .as-score { margin: 4px 0 8px; }
  .as-pct { font-size: 26px; }
  .as-track-lg { height: 9px; }
  .as-icon-wrap { width: 30px; height: 30px; border-radius: 10px !important; }
  .as-ico svg { width: 16px; height: 16px; }
  .as-stage-row { gap: 10px; }
  .as-name { font-size: 13px; }
  .as-detail { font-size: 11px; }
  .as-track { margin-top: 7px; }
  .as-subs { margin-left: 40px; }
  .as-subs:not(:empty) { margin-top: 5px; }
  .as-stage[data-state="run"]::before { border-radius: 17px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .as-overlay.as-entering .as-card, .as-stage[data-state="run"]::before, .as-stage[data-state="run"] .as-ring, .as-stage[data-state="run"] .as-ico, .as-fill::after, .as-orb i, .as-stage[data-state="done"] .as-badge { animation: none; }
}
/* the agent's real actions inside the "Querying" card */
.as-subs { display: grid; gap: 4px; margin: 0 0 0 50px; }
.as-subs:empty { display: none; }
.as-subs:not(:empty) { margin-top: 8px; }
.as-sub-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--as-text-2); animation: as-in .35s var(--ease) backwards; }
.as-sub-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-sub-dot { width: 10px; height: 10px; flex: none; border-radius: 50% !important; border: 2px solid var(--accent); border-right-color: transparent; animation: li-spin-plain .8s linear infinite; }
.as-sub-done .as-sub-dot { border: 0; background: var(--ok); animation: none; box-shadow: 0 0 8px -1px var(--ok); }
.as-sub-error .as-sub-dot { border: 0; background: var(--bad); animation: none; }
.as-sub-done .as-sub-label { color: var(--as-text-3); }
.as-sub-more { font-size: 11px; color: var(--as-text-3); }
@media (prefers-reduced-motion: reduce) { .as-sub-row, .as-sub-dot { animation: none; } }
/* Light theme: its dark accent colours are hard to read on black glass, so the progress cards
   use brighter versions of the same colours. */
html[data-theme="light"] .as-overlay:not(.af-overlay) {
  --accent: #8197ff; --accent-strong: #6a82f5; --accent-2: #2dd4bf; --accent-soft: rgba(129, 151, 255, .18); --ring: rgba(129, 151, 255, .45);
  --on-accent: #0b0e16; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
}

/* ---------------------------------------------------------------------------------------------
   MAP POP-UP on the Agentic AI map - the information panel that opens when a marker or feature is clicked.
   Glossy glass in the theme's colours: rounded, soft shadow, a thin accent line on top; the details read as
   label / value rows. The ArcGIS pop-up is drawn with Calcite components, which take their colours from the
   --calcite-color-* settings, so those are set to the theme here (the pop-up only; nothing else on the map).
   --------------------------------------------------------------------------------------------- */
.ag-view .esri-popup {
  --calcite-color-foreground-1: transparent; --calcite-color-foreground-2: var(--surface-hover); --calcite-color-foreground-3: color-mix(in srgb, var(--text) 10%, transparent);
  --calcite-color-foreground-current: var(--accent-soft); --calcite-color-background: transparent;
  --calcite-color-text-1: var(--text); --calcite-color-text-2: var(--text-2); --calcite-color-text-3: var(--text-3);
  --calcite-color-border-1: var(--border-strong); --calcite-color-border-2: var(--border); --calcite-color-border-3: var(--border);
  --calcite-color-brand: var(--accent); --calcite-color-brand-hover: var(--accent-strong); --calcite-color-brand-press: var(--accent-strong);
  --calcite-color-focus: var(--accent);
  --calcite-font-family: var(--font-sans);
}
.ag-view .esri-popup__main-container, .ag-view .esri-popup__main-container.esri-widget {
  border-radius: 18px !important; overflow: hidden; border: 1px solid var(--glass-edge) !important; color: var(--text);
  background:
    linear-gradient(90deg, var(--accent), var(--accent-2)) top / 100% 3px no-repeat,
    linear-gradient(180deg, var(--glass-hi), transparent 120px),
    linear-gradient(125deg, rgba(255, 255, 255, .12) 0%, rgba(255, 255, 255, .03) 22%, transparent 40%),
    radial-gradient(120% 60% at 100% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface-solid) 90%, transparent) !important;   /* mostly solid: small text on a busy satellite map must stay readable */
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: 0 24px 54px -20px rgba(0, 0, 0, .65), 0 6px 16px -8px rgba(0, 0, 0, .35), inset 0 1px 0 var(--glass-hi) !important;
  font-family: var(--font-sans);
}
.ag-view .esri-popup__pointer-direction { background: var(--surface-solid) !important; border: 1px solid var(--glass-edge) !important; box-shadow: none !important; }
.ag-view .esri-popup .esri-widget:not(.esri-popup__main-container), .ag-view .esri-popup .esri-features, .ag-view .esri-popup .esri-feature { background: transparent !important; color: var(--text); }
.ag-view .esri-popup .esri-widget__heading, .ag-view .esri-popup .esri-features__heading {
  font-family: var(--font-display); font-size: 15px !important; font-weight: 650; line-height: 1.35; color: var(--text) !important; letter-spacing: -.01em; }
.ag-view .esri-popup .esri-feature__content-element, .ag-view .esri-popup .esri-feature-content { padding: 4px 16px 12px; font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* details: our own tables and the GIS layers' field tables, as label / value rows (the app's grid-table look stays out) */
.ag-view .esri-popup table, .ag-view .esri-popup .esri-widget__table {
  width: 100%; border-collapse: separate !important; border-spacing: 0; margin: 2px 0 0; font-size: 13px; background: transparent;
  border: 1px solid var(--border); border-radius: 12px !important; overflow: hidden; }
.ag-view .esri-popup table tr:nth-child(even) th, .ag-view .esri-popup table tr:nth-child(even) td { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.ag-view .esri-popup table tr:hover th, .ag-view .esri-popup table tr:hover td { background: var(--surface-hover); }
.ag-view .esri-popup th, .ag-view .esri-popup table th {
  width: 44%; padding: 9px 10px 9px 14px !important; text-align: left; vertical-align: top;
  background: transparent; color: var(--text-2); font-size: 12px; font-weight: 500 !important; letter-spacing: .01em; text-transform: none;
  border: 0; border-bottom: 1px solid var(--border); border-radius: 0 !important; position: static; box-shadow: none; }
.ag-view .esri-popup td, .ag-view .esri-popup table td {
  padding: 9px 14px 9px 4px !important; text-align: right; vertical-align: top; color: var(--text); font-weight: 600;
  font-variant-numeric: tabular-nums; word-break: break-word; border: 0; border-bottom: 1px solid var(--border); background: transparent; }
.ag-view .esri-popup tr:last-child th, .ag-view .esri-popup tr:last-child td { border-bottom: 0; }
.ag-view .esri-popup th::after { content: none; }

/* actions (Zoom to, dock, close), the "1 of 2" pager and the scroll bar */
.ag-view .esri-popup calcite-action { --calcite-color-text-3: var(--text-2); --calcite-color-text-1: var(--text); }
.ag-view .esri-popup calcite-action-bar, .ag-view .esri-popup .esri-features__footer, .ag-view .esri-popup .esri-features__pagination-action-bar {
  background: color-mix(in srgb, var(--text) 4%, transparent); border-color: var(--border) !important; }
.ag-view .esri-popup ::-webkit-scrollbar { width: 8px; height: 8px; }
.ag-view .esri-popup ::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 22%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
.ag-view .esri-popup ::-webkit-scrollbar-track { background: transparent; }
.ag-view .esri-popup__main-container { animation: ag-popup-in .28s var(--ease); }
@keyframes ag-popup-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .ag-view .esri-popup__main-container { animation: none; } }

/* ---------------------------------------------------------------------------------------------
   GLOSSY HEADER AND MENU BAR - every theme. Built from each theme's own colours: a glass shine across the top,
   a faint accent tint in the corners, a slow light reflection drifting across, the menu row as its own glossy
   strip and the selected tab as a lit glass pill. The phone dock gets the same finish. Look only.
   --------------------------------------------------------------------------------------------- */
:root, html[data-theme] {
  --gloss-hi: rgba(255, 255, 255, .13);      /* the shine at the top edge */
  --gloss-mid: rgba(255, 255, 255, .035);
  --gloss-line: rgba(255, 255, 255, .16);    /* the bright hairline along the top */
  --gloss-sheen: rgba(255, 255, 255, .075);  /* the drifting reflection */
}
html[data-theme="light"] { --gloss-hi: rgba(255, 255, 255, .9); --gloss-mid: rgba(255, 255, 255, .35); --gloss-line: rgba(255, 255, 255, 1); --gloss-sheen: rgba(255, 255, 255, .55); }
/* FLAT: the top bar and the ribbon are plain glass - a faint accent tint, no shine, sheen, bevel or emboss. */
header.top { box-shadow: none; }
header.top::before {
  background:
    radial-gradient(60% 160% at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(50% 160% at 100% 100%, color-mix(in srgb, var(--accent-2) 7%, transparent), transparent 70%),
    var(--glass-strong);
}
@keyframes li-gloss-sheen {
  0%, 55% { background-position: 160% 0, 0 0, 0 0, 0 0, 0 0; }
  100% { background-position: -60% 0, 0 0, 0 0, 0 0, 0 0; }
}
/* the ribbon: a flat row under the brand row; the selected page is a flat tint with a line under it */
header.top nav { background: none; border-top-color: var(--border); }
header.top nav a.active {
  color: var(--accent); background: var(--accent-soft);
  --act: inset 0 -2px 0 var(--accent);
  text-shadow: none; animation: none;
}
header.top nav a.active::before { filter: none; }
header.top nav a:hover { background: var(--surface-hover); }
header.top h1::before { background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
/* phones: the dock at the bottom has the same gloss */
@media (max-width: 720px) {
  header.top nav {
    background: var(--glass-strong);
    box-shadow: none; animation: none;
  }
}
@media (prefers-reduced-motion: reduce) { header.top::before, header.top nav { animation: none; } }

/* ---------------------------------------------------------------------------------------------
   AQUA NIGHT extras (only this theme): the aqua glow rising from the bottom of the page, panels with a teal
   glass sheen, glowing summary numbers and aqua-to-blue buttons - after the reference design.
   --------------------------------------------------------------------------------------------- */
:where(html[data-theme="aqua"]) body::before {
  background:
    radial-gradient(1px 1px at 18px 26px, rgba(220, 255, 252, .55), transparent 100%),
    radial-gradient(1px 1px at 132px 84px, rgba(200, 240, 255, .4), transparent 100%),
    radial-gradient(1.5px 1.5px at 210px 170px, rgba(220, 255, 252, .5), transparent 100%),
    radial-gradient(1px 1px at 76px 214px, rgba(160, 230, 255, .35), transparent 100%),
    radial-gradient(80% 42% at 50% 114%, rgba(24, 226, 222, .55), transparent 72%),
    radial-gradient(46% 26% at 50% 104%, rgba(74, 157, 255, .22), transparent 70%),
    radial-gradient(38% 34% at 22% 24%, var(--aurora-1), transparent 70%),
    radial-gradient(32% 30% at 82% 16%, var(--aurora-2), transparent 70%),
    radial-gradient(40% 36% at 62% 84%, var(--aurora-3), transparent 70%);
  background-size: 260px 260px, 260px 260px, 260px 260px, 260px 260px, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
}
:where(html[data-theme="aqua"]) .panel {
  background:
    radial-gradient(520px circle at var(--mx) var(--my), var(--spot), transparent 60%),
    linear-gradient(160deg, rgba(34, 230, 220, .07), transparent 34%),
    linear-gradient(180deg, var(--glass-hi), transparent 140px),
    linear-gradient(0deg, rgba(74, 157, 255, .035), transparent 40%),
    var(--surface);
}
:where(html[data-theme="aqua"]) .kpi {
  background:
    radial-gradient(260px circle at var(--mx) var(--my), var(--spot), transparent 65%),
    radial-gradient(120% 90% at 100% 0%, rgba(34, 230, 220, .12), transparent 60%),
    linear-gradient(160deg, var(--glass-hi), transparent 70%),
    var(--surface);
  border-color: rgba(120, 240, 236, .14);
}
:where(html[data-theme="aqua"]) .kpi b {
  background: linear-gradient(180deg, #ffffff, #9ff6f0 70%, #22e6dc); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(34, 230, 220, .35));
}
/* same strength as the base "button, .btn" rule, so buttons with their own look keep it */
:where(html[data-theme="aqua"]) button:where(:not(.secondary):not(.danger)), :where(html[data-theme="aqua"]) .btn:where(:not(.secondary)) {
  background: color-mix(in srgb, #14c7d6 80%, transparent);
  border-color: rgba(120, 245, 240, .55);
  box-shadow: none;
}
:where(html[data-theme="aqua"]) header.top { --hdr-c1: #22e6dc; --hdr-c2: #4a9dff; }
html[data-theme="aqua"] ::selection { background: rgba(34, 230, 220, .3); }
/* Aqua Night: teal-lit panel edges and the glowing ask box, as in the reference */
:where(html[data-theme="aqua"]) .panel, :where(html[data-theme="aqua"]) .kpi { box-shadow: var(--shadow), inset 0 1px 0 rgba(140, 255, 248, .14); }
:where(html[data-theme="aqua"]) .lc-composer {
  border-color: rgba(34, 230, 220, .45);
  background: linear-gradient(180deg, rgba(34, 230, 220, .08), rgba(1, 8, 12, .5));
  box-shadow: 0 0 0 1px rgba(34, 230, 220, .12), 0 16px 44px -14px rgba(34, 230, 220, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
}
:where(html[data-theme="aqua"]) .lc-bottom { background: radial-gradient(90% 120% at 50% 120%, rgba(34, 230, 220, .16), transparent 70%); }
/* the model picker in the chat (AI model / Qwen): green edge when the chosen model is ready, amber when it is not */
.lc-tools select.lc-model-sel { font-weight: 600; padding-left: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a94a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), radial-gradient(circle at 10px 50%, var(--ok) 0 3.5px, transparent 4.5px);
  background-repeat: no-repeat; background-position: right 11px center, 0 0; padding-right: 30px;
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border-strong)); }
.lc-tools select.lc-model-sel[data-state="warn"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a94a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"), radial-gradient(circle at 10px 50%, var(--warn) 0 3.5px, transparent 4.5px);
  border-color: color-mix(in srgb, var(--warn) 50%, var(--border-strong)); }

/* The overall "Agentic AI is working" card is the last card (after the four stages): it slides in last. */
.as-head { --i: 4; }

/* =============================================================================================
   Grid Agent Assistant - glossy finish (presentation only: no layout, behaviour or text changes).
   Everything follows the active theme through its own colours (--accent, --accent-2, --glass-*),
   so all six themes get the same glossy look in their own palette.
   ============================================================================================= */
.lc-dialog { --lc-shine: rgba(255, 255, 255, .16); --lc-shine-soft: rgba(255, 255, 255, .06); }
:where(html[data-theme="light"]) .lc-dialog { --lc-shine: rgba(255, 255, 255, .85); --lc-shine-soft: rgba(255, 255, 255, .45); }

/* header: a glossy band in the theme colour, a bright top edge and a soft light that sweeps across now and then */
.lc-head {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, var(--lc-shine) 0, var(--lc-shine-soft) 46%, transparent 47%),
    linear-gradient(100deg, color-mix(in srgb, var(--accent) 20%, transparent), color-mix(in srgb, var(--accent-2) 10%, transparent) 60%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  box-shadow: inset 0 1px 0 var(--lc-shine);
}
.lc-head::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .22) 48%, rgba(255, 255, 255, .05) 54%, transparent 62%);
  transform: translateX(-120%); animation: lc-sheen 7s ease-in-out 1.2s infinite;
}
@keyframes lc-sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.lc-head > * { position: relative; z-index: 1; }
.lc-head .rb--avatar { border-radius: 50% !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent); }
.lc-title {
  background: linear-gradient(90deg, var(--text) 0%, var(--text) 45%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .2px;
}

/* flat glass buttons in the header and the tools row */
.lc-head-btns button, .lc-tools button, .lc-tools select {
  background-image: none;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--border-strong));
  box-shadow: none;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}
.lc-head-btns button:hover, .lc-tools button:not(:disabled):hover, .lc-tools select:hover {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: none;
}
/* the model picker keeps its arrow and status dot: the gloss is added behind them */
.lc-tools select.lc-model-sel { background-color: transparent; }
.lc-tools { background: linear-gradient(180deg, var(--lc-shine-soft), transparent); }

/* welcome: a soft glow behind the robot */
.lc-hero .rb { filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent)); }
.lc-hero h3 { background: linear-gradient(90deg, var(--text), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* the person's questions: glossy bubbles in the theme colour */
.lc-msgs .nm-from-user .nm-bubble {
  color: var(--on-accent); border: 1px solid color-mix(in srgb, var(--accent) 70%, #fff 10%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .32) 0, rgba(255, 255, 255, .10) 48%, transparent 50%),
    linear-gradient(160deg, var(--accent), var(--accent-strong));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 16px 16px 4px 16px !important;
}
/* the assistant's answers: a light glass card with a glossy top edge */
.lc-msgs .nm-from-agent .nm-bubble {
  padding: 10px 13px; border-radius: 4px 16px 16px 16px !important;
  background:
    linear-gradient(180deg, var(--lc-shine-soft), transparent 60px),
    color-mix(in srgb, var(--surface-raised) 62%, transparent);
  border: 1px solid var(--glass-edge);
  box-shadow: inset 0 1px 0 var(--lc-shine), 0 4px 14px rgba(0, 0, 0, .14);
}
.lc-msgs .nm-from-agent .rb--msg { filter: drop-shadow(0 2px 6px color-mix(in srgb, var(--accent) 40%, transparent)); }
/* follow-up suggestions: flat glass pills */
.lc-msgs .ag-suggest button {
  border-radius: 999px !important; background-image: none;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-strong)); box-shadow: none;
}
.lc-msgs .ag-suggest button:hover { border-color: var(--accent); box-shadow: none; }

/* input box: glossy glass that glows in the theme colour while typing */
.lc-bottom { background: linear-gradient(0deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent); }
.lc-composer.nm-composer {
  background:
    linear-gradient(180deg, var(--lc-shine-soft), transparent 50%),
    color-mix(in srgb, var(--surface-sunken) 82%, transparent);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--border-strong));
  box-shadow: inset 0 1px 0 var(--lc-shine), inset 0 -8px 16px rgba(0, 0, 0, .10), 0 2px 10px rgba(0, 0, 0, .12);
}
.lc-composer.nm-composer:focus-within {
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 var(--lc-shine), 0 0 0 3px var(--accent-soft), 0 0 22px color-mix(in srgb, var(--accent) 28%, transparent);
}
.lc-composer .nm-send {
  color: var(--on-accent); border: 1px solid color-mix(in srgb, var(--accent) 92%, #fff 8%);
  background: color-mix(in srgb, var(--accent) 84%, transparent); box-shadow: none;
}
.lc-composer .nm-send:not(:disabled):hover { filter: none; background: color-mix(in srgb, var(--accent) 96%, transparent); box-shadow: none; }
.lc-composer .nm-mic {
  background-image: none; border-color: color-mix(in srgb, var(--accent) 30%, var(--border-strong)); box-shadow: none;
}

/* step rows ("Moving the map") and notices: the same soft glass instead of flat panels */
.lc-msgs .nm-step {
  border-radius: 10px !important;
  background: linear-gradient(180deg, var(--lc-shine-soft), transparent 70%), color-mix(in srgb, var(--surface-sunken) 70%, transparent);
  box-shadow: inset 0 1px 0 var(--lc-shine-soft);
}
.lc-msgs .nm-from-notice .nm-bubble {
  border-radius: 12px !important;
  background: linear-gradient(180deg, var(--lc-shine-soft), transparent 70%), color-mix(in srgb, var(--info) 10%, transparent);
  border-color: color-mix(in srgb, var(--info) 30%, var(--glass-edge));
}

/* a slim scrollbar in the theme colour */
.lc-msgs.nm-msgs { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 45%, transparent) transparent; }
.lc-msgs.nm-msgs::-webkit-scrollbar { width: 8px; }
.lc-msgs.nm-msgs::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 8px; }

/* the minimised bar gets the same gloss */
button.lc-minbar {
  background-image: linear-gradient(180deg, var(--lc-shine, rgba(255,255,255,.14)) 0, transparent 52%);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, .18), 0 0 18px color-mix(in srgb, var(--accent) 25%, transparent);
}
@media (prefers-reduced-motion: reduce) { .lc-head::after { animation: none; display: none; } }

/* ---- Grid Agent Assistant: the structured JSON record under each answer ("{ } JSON") ---- */
.nm-msg .ag-json { margin: 4px 0 0 2px; max-width: 100%; font-size: 11.5px; }
.nm-msg .ag-json > summary { cursor: pointer; display: inline-block; padding: 2px 9px; border-radius: 999px; color: var(--muted, #667);
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.12)); border: 1px solid rgba(120,130,160,.28); list-style: none; user-select: none; }
.nm-msg .ag-json > summary::-webkit-details-marker { display: none; }
.nm-msg .ag-json > summary:hover { color: var(--accent, #2563eb); border-color: currentColor; }
.nm-msg .ag-json > pre { margin: 6px 0 0; padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre; border-radius: 10px;
  background: rgba(15, 23, 42, .86); color: #d6e2ff; font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
/* the "{ } JSON" button sits under the answer bubble, not beside it */
.nm-msg:has(> .ag-json) { flex-wrap: wrap; }
.nm-msg > .ag-json { flex: 0 0 100%; padding-left: 36px; box-sizing: border-box; }
.nm-msg > .ag-json > summary { font-size: 11px; line-height: 1.5; }

/* ---- the working robot: flies over the map in every direction while the assistant answers (robot.js robotRover) ---- */
.rb-rover { position: absolute; left: 0; top: 0; z-index: 8; width: 64px; height: 64px; pointer-events: none;
  transition: transform var(--rv-ms, 1200ms) cubic-bezier(.45, .05, .35, 1), opacity .45s ease; will-change: transform; opacity: 0; }
.rb-rover[hidden] { display: none; }
.rb-rover.rb-rover-on { opacity: 1; }
.rb-rover.rb-rover-out { opacity: 0; }
.rb-rover-tilt { position: absolute; inset: 0; display: block;
  transform: rotate(var(--rv-lean, 0deg)) scaleX(var(--rv-face, 1)); transition: transform calc(var(--rv-ms, 1200ms) * .5) ease-out; }
.rb-rover-bob { position: absolute; inset: 0; display: block; animation: rb-rover-bob 1.1s ease-in-out infinite; }
.rb--rover { width: 100%; height: 100%; display: block; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .5)) drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 55%, transparent)); }
.rb--rover .rb-head { transform-origin: 60px 62px; animation: rb-rover-look 2.4s ease-in-out infinite; }
/* the scanning glow on the map under the robot */
.rb-rover-scan { position: absolute; left: 50%; top: 100%; width: 74px; height: 22px; margin-left: -37px; margin-top: 2px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 65%, transparent), transparent);
  animation: rb-rover-scan 1.1s ease-in-out infinite; }
/* a short comet tail behind it */
.rb-rover-trail { position: absolute; top: 50%; right: 70%; width: 46px; height: 6px; margin-top: -3px; border-radius: 6px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent));
  transform: scaleX(var(--rv-face, 1)); transform-origin: 100% 50%; opacity: .75; filter: blur(1px); }
.rb-rover[style*="--rv-face: -1"] .rb-rover-trail { right: auto; left: 70%; transform-origin: 0 50%; background: linear-gradient(270deg, transparent, color-mix(in srgb, var(--accent) 70%, transparent)); }
/* landing: stand still over the result, a bigger pulse under it */
.rb-rover-landing .rb-rover-tilt { transform: rotate(0deg) scaleX(1); }
.rb-rover-landing .rb-rover-trail { opacity: 0; transition: opacity .4s; }
.rb-rover-landing .rb-rover-scan { animation: rb-rover-ping 1s ease-out infinite; }
@keyframes rb-rover-bob { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-7px) rotate(4deg); } }
@keyframes rb-rover-look { 0%, 100% { transform: rotate(0deg); } 30% { transform: rotate(-14deg); } 65% { transform: rotate(12deg); } }
@keyframes rb-rover-scan { 0%, 100% { transform: scale(.8); opacity: .55; } 50% { transform: scale(1.15); opacity: .95; } }
@keyframes rb-rover-ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .rb-rover, .rb-rover-tilt { transition: opacity .3s ease; }
  .rb-rover-bob, .rb--rover .rb-head, .rb-rover-scan { animation: none; }
}

/* ---- the model picker (AI model / Qwen): a button that opens its list on hover, focus or tap ---- */
.lc-model-pick { position: relative; display: inline-flex; }
.lc-tools .lc-model-btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding-right: 10px;
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border-strong)); }
.lc-model-pick[data-state="warn"] .lc-model-btn { border-color: color-mix(in srgb, var(--warn) 50%, var(--border-strong)); }
.lc-model-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.lc-model-pick[data-state="warn"] > .lc-model-btn .lc-model-dot, .lc-model-item[data-state="warn"] .lc-model-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.lc-model-caret { width: 7px; height: 7px; margin-left: 2px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; opacity: .6;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s ease; }
.lc-model-menu { position: absolute; left: 0; top: 100%; z-index: 20; min-width: 100%; padding: 10px 0 0; display: grid; gap: 0;
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s; }
/* the 10px padding above is an invisible bridge, so the pointer can travel from the button to the list without it closing */
.lc-model-menu::before { content: ''; position: absolute; inset: 10px 0 0; z-index: -1; border-radius: 12px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-raised, #1b2233) 94%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08); }
.lc-model-pick:hover .lc-model-menu, .lc-model-pick:focus-within .lc-model-menu, .lc-model-pick.lc-open .lc-model-menu {
  opacity: 1; visibility: visible; transform: none; transition: opacity .16s ease, transform .16s ease; }
.lc-model-pick:hover .lc-model-caret, .lc-model-pick.lc-open .lc-model-caret { transform: translateY(1px) rotate(225deg); }
.lc-tools .lc-model-menu .lc-model-item { display: flex; align-items: center; gap: 9px; width: 100%; min-width: 150px; margin: 0; padding: 9px 12px;
  border: 0; border-radius: 0; background: none; box-shadow: none; text-align: left; font-weight: 500; white-space: nowrap; color: inherit; }
.lc-model-menu .lc-model-item:first-child { margin-top: 4px; }
.lc-model-menu .lc-model-item:last-child { margin-bottom: 4px; }
.lc-tools .lc-model-menu .lc-model-item:hover, .lc-tools .lc-model-menu .lc-model-item:focus-visible { background: var(--accent-soft); outline: none; box-shadow: none; }
.lc-model-item[aria-checked="true"] { font-weight: 700; }
.lc-model-name { flex: 1; }
.lc-model-note { font-size: 11px; opacity: .7; }
.lc-model-item[aria-checked="true"] .lc-model-note { color: var(--accent); opacity: 1; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .lc-model-menu, .lc-model-caret { transition: none; } }
.lc-tools { position: relative; z-index: 3; }
.lc-model-dot { border-radius: 50% !important; }   /* a status dot stays round (see 18. sharp geometry) */

/* ---------------------------------------------------------------------------------------------
   HOME BUTTON + HOVER USER AREA (src/app.js)
   The Home button, next to the brand, opens and closes the menu ribbon (closed at start).
   The user name, Theme and Sign out stay hidden; only the user icon shows, and hovering (or
   focusing / tapping) that corner reveals them.
   --------------------------------------------------------------------------------------------- */
header.top > button.nav-home { align-self: center; display: inline-flex; align-items: center; gap: 7px; margin: 0 0 0 10px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; }
header.top > button.nav-home::before { content: none; }
header.top > button.nav-home .nav-home-ico { width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v10h5v-6h4v6h5V10'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 11l9-7 9 7'/%3E%3Cpath d='M5 10v10h5v-6h4v6h5V10'/%3E%3C/svg%3E") center / contain no-repeat; }
header.top > button.nav-home[aria-expanded="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); background: var(--accent-soft); }

header.top .who.who-reveal { cursor: default; outline: none; min-width: 52px; justify-content: flex-end; }
header.top .who.who-reveal:not(:hover):not(:focus-within) > * { display: none; }
header.top .who.who-reveal:not(:hover):not(:focus-within) { padding-left: 11px; padding-right: 11px; }
header.top .who.who-reveal:hover > *, header.top .who.who-reveal:focus-within > * { animation: who-in .18s ease both; }
header.top .who.who-reveal:focus-visible::before { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes who-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { header.top .who.who-reveal > * { animation: none !important; } }
@media (max-width: 720px) {
  header.top > button.nav-home { margin-left: 4px; padding: 6px 10px; }
  header.top > button.nav-home .nav-home-label { display: none; }
  header.top .who.who-reveal::before { display: block; }          /* phones: keep the user icon as the thing to tap */
}


/* =============================================================================================
   AGENTIC AI - "working" overlay drawn as an agentic workflow (src/components/agmap-steps.js).
   Four agents around a central pipeline, live log and completion ring, over an animated grid.
   Every colour is a theme token (--accent, --accent-2, --ok, --warn, --bad, --text, --surface-solid),
   so the whole overlay changes with the colour theme. Rounded corners are kept on purpose
   (they override "18. sharp geometry" inside this overlay only).
   ============================================================================================= */
.af-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.as-overlay.af-overlay { --af-a: var(--accent); --af-b: var(--accent-2); --af-ink: var(--text); --af-mute: var(--text-2);
  --af-panel: color-mix(in srgb, var(--surface-solid) 64%, transparent); --af-edge: color-mix(in srgb, var(--af-a) 26%, var(--border));
  padding: clamp(10px, 1.6vw, 22px); container-type: inline-size; align-items: stretch; justify-content: stretch; color: var(--af-ink); }
.af-overlay .as-veil { background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 90%, transparent));
  -webkit-backdrop-filter: blur(6px) saturate(.85); backdrop-filter: blur(6px) saturate(.85); }
.af-overlay .af-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .6s var(--ease); }
.af-overlay.as-entering .af-bg { opacity: 1; }
.af-overlay.as-leaving .af-bg { opacity: 0; }
.af-grid-canvas, .af-fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.af-fx { z-index: 3; }
.af-aurora { position: absolute; border-radius: 50% !important; filter: blur(90px); opacity: .35; }
.af-a1 { width: 48%; aspect-ratio: 1; left: -10%; top: -20%; background: radial-gradient(circle, var(--af-b), transparent 65%); animation: af-drift1 22s ease-in-out infinite alternate; }
.af-a2 { width: 44%; aspect-ratio: 1; right: -12%; bottom: -20%; background: radial-gradient(circle, var(--af-a), transparent 65%); animation: af-drift2 26s ease-in-out infinite alternate; }
@keyframes af-drift1 { to { transform: translate(10%, 12%) scale(1.15); } }
@keyframes af-drift2 { to { transform: translate(-10%, -8%) scale(.9); } }
.af-scan { position: absolute; left: 0; right: 0; height: 30%; top: -30%; opacity: .5;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--af-b) 8%, transparent) 70%, color-mix(in srgb, var(--af-b) 20%, transparent) 99%, transparent);
  animation: af-scan 9s cubic-bezier(.5, 0, .5, 1) infinite; }
@keyframes af-scan { 0% { top: -30%; } 60%, 100% { top: 110%; } }
.af-surge { position: absolute; inset: 0; z-index: 4; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), color-mix(in srgb, var(--af-b) 30%, transparent), color-mix(in srgb, var(--af-a) 12%, transparent) 30%, transparent 65%); }
.af-surge.wx-go { animation: af-surge 1.1s ease-out; }
@keyframes af-surge { 8% { opacity: 1; } 100% { opacity: 0; } }

/* the board: agents left and right of the centre, the ring under the centre */
.af-board { position: relative; z-index: 2; width: 100%; height: 100%; max-width: 1280px; margin: auto; display: grid; gap: clamp(10px, 1.4vw, 22px);
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto;
  grid-template-areas: "a1 c a2" "a3 c a4" "a3 o a4"; align-content: center; }
.af-pos-1 { grid-area: a1; } .af-pos-2 { grid-area: a2; } .af-pos-3 { grid-area: a3; } .af-pos-4 { grid-area: a4; }
.af-center { grid-area: c; } .af-overview { grid-area: o; }
.af-agent, .af-center, .af-overview { position: relative; min-height: 0; opacity: 0; translate: 0 18px; filter: blur(8px);
  transition: opacity .6s var(--ease-out), translate .6s var(--ease-out), filter .6s var(--ease-out); }
.af-overlay.as-entering .af-agent, .af-overlay.as-entering .af-center, .af-overlay.as-entering .af-overview { opacity: 1; translate: 0 0; filter: none; }
.af-overlay.as-entering .af-pos-1 { transition-delay: .08s; } .af-overlay.as-entering .af-pos-2 { transition-delay: .16s; }
.af-overlay.as-entering .af-pos-3 { transition-delay: .24s; } .af-overlay.as-entering .af-pos-4 { transition-delay: .32s; }
.af-overlay.as-entering .af-overview { transition-delay: .4s; }
.af-overlay.as-leaving .af-board { opacity: 0; scale: .98; filter: blur(6px); transition: opacity .55s var(--ease), scale .55s var(--ease), filter .55s var(--ease); }
/* a soft shadow pool behind each zone keeps text readable over the grid (no box) */
.af-agent::before, .af-center::before, .af-overview::before { content: ""; position: absolute; inset: -8% -5%; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--bg) 78%, transparent) 0%, color-mix(in srgb, var(--bg) 40%, transparent) 48%, transparent 74%); }

/* ---- an agent ---- */
.af-agent { display: flex; align-items: center; gap: clamp(8px, 1vw, 16px); }
.af-agent-body { flex: 1; min-width: 0; }
.af-agent-head { position: relative; display: flex; align-items: center; gap: 9px; padding-bottom: 7px; margin-bottom: 6px; }
.af-agent-head::after { content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: 100%;
  background: linear-gradient(90deg, var(--af-b), color-mix(in srgb, var(--af-a) 60%, transparent), transparent); box-shadow: 0 0 8px var(--af-b); opacity: .7; }
.af-ico { flex: 0 0 28px; height: 28px; border-radius: 50% !important; display: grid; place-items: center; color: var(--af-b);
  border: 1px solid var(--af-edge); background: color-mix(in srgb, var(--af-b) 12%, transparent); box-shadow: inset 0 0 10px color-mix(in srgb, var(--af-b) 25%, transparent); }
.af-ico svg, .af-step-ico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.af-agent h3 { margin: 0; font-size: clamp(11.5px, .9vw, 13.5px); letter-spacing: 1.3px; text-transform: uppercase; font-weight: 650; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; color: var(--af-ink); background: none; -webkit-text-fill-color: currentColor; }
.af-status { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; padding: 3px 10px; border-radius: 999px !important;
  color: var(--af-mute); border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--af-ink) 5%, transparent); white-space: nowrap; transition: all .4s; }
.af-agent[data-state="run"] .af-status { color: var(--af-b); border-color: color-mix(in srgb, var(--af-b) 50%, transparent); background: color-mix(in srgb, var(--af-b) 12%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--af-b) 30%, transparent); }
.af-agent[data-state="run"] .af-status::before { content: ""; width: 6px; height: 6px; border-radius: 50% !important; background: currentColor; animation: af-blink .8s infinite; }
.af-agent[data-state="done"] .af-status { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.af-agent[data-state="done"] .af-status::before { content: "✔"; font-size: 9px; }
.af-agent[data-state="error"] .af-status { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }
@keyframes af-blink { 50% { opacity: .25; } }
.af-role { font-size: 11.5px; color: var(--af-ink); opacity: .9; margin-bottom: 3px; }
.af-detail { font-size: 11.5px; color: var(--af-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; }
.af-agent[data-state="wait"] .af-agent-body { opacity: .55; }
.af-agent[data-state="skip"] .af-agent-body { opacity: .45; }
.af-agent[data-state="run"] h3 { color: var(--af-b); text-shadow: 0 0 16px color-mix(in srgb, var(--af-b) 70%, transparent); }
.af-agent[data-state="run"] .af-ico { border-color: var(--af-b); box-shadow: 0 0 16px color-mix(in srgb, var(--af-b) 65%, transparent), inset 0 0 10px color-mix(in srgb, var(--af-b) 45%, transparent); }
.af-agent[data-state="done"] .af-ico { border-color: color-mix(in srgb, var(--ok) 60%, transparent); color: var(--ok); }
.af-agent[data-state="error"] .af-ico { border-color: var(--bad); color: var(--bad); }

.af-bar { position: relative; height: 5px; margin-top: 8px; border-radius: 5px !important; background: color-mix(in srgb, var(--af-ink) 8%, transparent); overflow: hidden; }
.af-bar-fill, .af-pipe-fill { position: relative; display: block; height: 100%; width: 0; border-radius: 5px !important; transition: width .5s var(--ease-out);
  background: linear-gradient(90deg, var(--af-b), var(--af-a)); box-shadow: 0 0 10px color-mix(in srgb, var(--af-b) 60%, transparent); }
.af-bar-fill::after, .af-pipe-fill::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  background-size: 40% 100%; background-repeat: no-repeat; animation: af-shimmer 2s linear infinite; }
@keyframes af-shimmer { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.af-agent[data-state="done"] .af-bar-fill { background: linear-gradient(90deg, var(--ok), color-mix(in srgb, var(--ok) 60%, var(--af-b))); }
.af-agent[data-state="error"] .af-bar-fill { background: var(--bad); }

/* the GIS agent's real actions */
.af-subs { display: grid; gap: 3px; margin-top: 5px; }
.af-sub { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--af-mute); min-width: 0; animation: af-in .3s var(--ease-out) both; }
.af-sub-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.af-sub-dot { flex: 0 0 8px; height: 8px; border-radius: 50% !important; border: 1.5px solid var(--af-b); }
.af-sub-running .af-sub-dot { border-right-color: transparent; animation: af-spin .8s linear infinite; }
.af-sub-running .af-sub-label { color: var(--af-ink); }
.af-sub-done .af-sub-dot { background: var(--ok); border-color: var(--ok); }
.af-sub-error .af-sub-dot { background: var(--bad); border-color: var(--bad); }
.af-sub-more { font-size: 10.5px; color: var(--af-mute); }
@keyframes af-spin { to { transform: rotate(360deg); } }
@keyframes af-in { from { opacity: 0; translate: 0 4px; } }

/* the robot: neutral body, eyes and glow in the theme's colours */
.af-bot-wrap { position: relative; flex: 0 0 clamp(54px, 5vw, 78px); aspect-ratio: 80 / 110; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.af-bot-holder { position: relative; z-index: 2; width: 100%; margin-bottom: 14%; display: block; }
.af-bot { display: block; width: 100%; aspect-ratio: 80 / 90; animation: af-hover 3.6s ease-in-out infinite; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--af-b) 45%, transparent)); }
@keyframes af-hover { 50% { translate: 0 -6px; } }
#af-robot .af-bot-shadow { fill: color-mix(in srgb, var(--af-b) 35%, transparent); }
#af-robot .af-bot-led { fill: var(--af-b); opacity: .85; }
#af-robot .af-eye ellipse { fill: var(--af-b); }
#af-robot .af-eye-glow { fill: var(--af-b); opacity: .22; }
#af-robot .af-eye { transform-box: fill-box; transform-origin: center; animation: af-blinkEye 4.5s infinite; }
@keyframes af-blinkEye { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
html[data-theme="light"] #af-robot .af-bot-shell { stroke: #b8c3d6; stroke-width: 1; }
.af-pos-2 .af-bot, .af-pos-4 .af-bot { --af-b: var(--af-a); }
.af-bot-wrap::after { content: ""; position: absolute; z-index: 3; left: 6%; right: 6%; top: 0; bottom: 22%; pointer-events: none; border-radius: 40% !important;
  background: repeating-linear-gradient(0deg, color-mix(in srgb, var(--af-b) 14%, transparent) 0 1px, transparent 1px 3px); mix-blend-mode: screen; opacity: .8; }
.af-beam { position: absolute; z-index: 1; bottom: 9%; left: 50%; width: 120%; height: 85%; translate: -50% 0; pointer-events: none; opacity: .45;
  background: linear-gradient(0deg, color-mix(in srgb, var(--af-b) 40%, transparent), color-mix(in srgb, var(--af-b) 6%, transparent) 70%, transparent);
  clip-path: polygon(38% 100%, 62% 100%, 100% 0, 0 0); filter: blur(2px); animation: af-beam 2.8s ease-in-out infinite; }
@keyframes af-beam { 50% { opacity: .8; } }
.af-emitter { position: absolute; bottom: 0; left: 50%; translate: -50% 0; width: 78%; height: 16%; border-radius: 50% !important;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--af-b) 40%, white) 0%, color-mix(in srgb, var(--af-b) 50%, transparent) 30%, transparent 70%);
  box-shadow: 0 0 22px color-mix(in srgb, var(--af-b) 55%, transparent); }
.af-emitter i { position: absolute; inset: 0; border-radius: 50% !important; border: 1px solid color-mix(in srgb, var(--af-b) 70%, transparent); animation: af-wave 2.2s ease-out infinite; }
.af-emitter i:nth-child(2) { animation-delay: 1.1s; }
@keyframes af-wave { from { scale: .5; opacity: 1; } to { scale: 1.8; opacity: 0; } }
.af-pos-2 .af-bot-wrap, .af-pos-4 .af-bot-wrap { --af-b: var(--af-a); }
.af-agent[data-state="run"] .af-beam { opacity: 1; animation-duration: 1.4s; }
.af-agent[data-state="run"] .af-bot { filter: drop-shadow(0 0 18px color-mix(in srgb, var(--af-b) 90%, transparent)); }
.af-agent[data-state="wait"] .af-bot-wrap { opacity: .6; filter: saturate(.6); }

/* ---- the centre ---- */
.af-center { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 6px clamp(4px, 1vw, 14px); }
.af-wf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.af-wf-title { font-size: 12.5px; letter-spacing: 3px; text-transform: uppercase; color: var(--af-ink); text-shadow: 0 0 12px color-mix(in srgb, var(--af-a) 50%, transparent); }
.af-wf-id { font: 11px ui-monospace, "JetBrains Mono", Consolas, monospace; color: var(--af-mute); }
.af-wf-id .af-title { display: inline; color: var(--af-b); }
.af-wf-id .af-sub { display: inline; }
.af-steps { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 4px 24px; }
.af-step { position: relative; flex: 0 0 clamp(42px, 4vw, 62px); aspect-ratio: 1; border-radius: 50% !important; display: grid; place-items: center; color: var(--af-mute);
  border: 1px solid color-mix(in srgb, var(--af-a) 35%, transparent);
  background: radial-gradient(circle, color-mix(in srgb, var(--af-a) 16%, transparent), color-mix(in srgb, var(--bg) 60%, transparent) 70%);
  box-shadow: 0 0 18px color-mix(in srgb, var(--af-a) 22%, transparent), inset 0 0 14px color-mix(in srgb, var(--af-a) 22%, transparent); transition: all .5s var(--ease-out); }
.af-step .af-step-ico svg { width: 20px; height: 20px; }
.af-step label { position: absolute; top: calc(100% + 7px); left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--af-mute); white-space: nowrap; letter-spacing: .4px; }
.af-ring { position: absolute; inset: -7px; border-radius: 50% !important; border: 1px solid transparent; }
.af-step[data-state="run"] { color: var(--af-ink); border-color: var(--af-b); translate: 0 -4px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--af-b) 30%, transparent), color-mix(in srgb, var(--af-a) 8%, transparent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--af-b) 12%, transparent), 0 0 32px color-mix(in srgb, var(--af-b) 65%, transparent); }
.af-step[data-state="run"] label { color: var(--af-ink); }
.af-step[data-state="run"] .af-ring { border-color: color-mix(in srgb, var(--af-b) 60%, transparent); animation: af-ringPulse 1.3s ease-out infinite; }
@keyframes af-ringPulse { from { opacity: .9; transform: scale(.9); } to { opacity: 0; transform: scale(1.35); } }
.af-step[data-state="done"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 60%, transparent);
  background: linear-gradient(145deg, color-mix(in srgb, var(--ok) 18%, transparent), color-mix(in srgb, var(--ok) 3%, transparent)); }
.af-step[data-state="skip"] { opacity: .45; }
.af-step[data-state="error"] { color: var(--bad); border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.af-arrow { flex: 1; height: 2px; border-radius: 2px !important; position: relative; overflow: hidden;
  background: linear-gradient(90deg, color-mix(in srgb, var(--af-a) 10%, transparent), color-mix(in srgb, var(--af-a) 35%, transparent), color-mix(in srgb, var(--af-a) 10%, transparent)); }
.af-arrow::after { content: ""; position: absolute; top: 0; left: -40%; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--af-b), transparent); animation: af-flow 1.5s linear infinite; }
@keyframes af-flow { to { left: 100%; } }
.af-log { min-height: 96px; max-height: 170px; display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; overflow: hidden;
  font: 11.5px/1.45 ui-monospace, "JetBrains Mono", Consolas, monospace; color: var(--af-mute);
  border-left: 1px solid color-mix(in srgb, var(--af-b) 55%, transparent); padding: 6px 14px; box-shadow: -8px 0 16px -12px var(--af-b);
  -webkit-mask-image: linear-gradient(transparent, #000 30%); mask-image: linear-gradient(transparent, #000 30%); }
.af-log p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: af-type .5s steps(30) both; }
.af-log .af-log-ts { opacity: .6; }
.af-log b { color: var(--af-b); font-weight: 600; }
.af-log .af-log-ok { color: var(--af-ink); }
.af-log .af-log-err { color: var(--bad); }
@keyframes af-type { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.af-pipe { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--af-mute); }
.af-pipe .af-bar { flex: 1; margin: 0; height: 7px; }
.af-pct { color: var(--af-ink); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- the completion ring ---- */
.af-overview { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 1.6vw, 24px); }
.af-donut { position: relative; flex: 0 0 clamp(84px, 7.5vw, 116px); aspect-ratio: 1; }
.af-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.af-donut .af-tick { stroke: color-mix(in srgb, var(--af-a) 35%, transparent); stroke-width: 2; stroke-dasharray: 1 6.3; transform-origin: center; animation: af-rot 30s linear infinite; }
.af-donut .af-track { stroke: color-mix(in srgb, var(--af-ink) 8%, transparent); stroke-width: 9; }
.af-donut .af-val { stroke: var(--af-b); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease-out); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--af-b) 80%, transparent)); }
@keyframes af-rot { to { transform: rotate(360deg); } }
.af-donut strong { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(17px, 1.6vw, 24px); font-weight: 700; color: var(--af-ink); font-variant-numeric: tabular-nums; }
.af-donut strong small { font-size: 9px; color: var(--af-mute); letter-spacing: 1.5px; font-weight: 500; }
.af-legend { min-width: 160px; display: grid; gap: 4px; }
.af-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--af-mute); }
.af-row b { margin-left: auto; color: var(--af-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.af-dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50% !important; }
.af-dot-a { background: var(--af-a); box-shadow: 0 0 8px var(--af-a); }
.af-dot-b { background: var(--af-b); box-shadow: 0 0 8px var(--af-b); }
.af-dot-ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* light theme: dark ink on a pale veil; glows are softer */
html[data-theme="light"] .af-overlay .as-veil { background: radial-gradient(120% 90% at 50% 40%, color-mix(in srgb, var(--bg) 72%, transparent), color-mix(in srgb, var(--bg) 94%, transparent)); }
html[data-theme="light"] .af-aurora { opacity: .22; }
html[data-theme="light"] .af-overlay { --af-mute: var(--text-2); }

/* narrow map areas: the centre on top, the agents in two columns under it */
@container (max-width: 860px) {
  .af-board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "c c" "a1 a2" "a3 a4" "o o"; align-content: start; overflow: auto; }
  .af-bot-wrap { flex-basis: 46px; }
}
@container (max-width: 520px) {
  .af-board { grid-template-columns: minmax(0, 1fr); grid-template-areas: "c" "a1" "a2" "a3" "a4" "o"; }
  .af-steps label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .af-overlay *, .af-overlay *::before, .af-overlay *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
.af-agent h3 { flex: 0 1 auto; white-space: normal; overflow: visible; letter-spacing: 1px; line-height: 1.2; }
.af-scan { background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--af-b) 7%, transparent) 75%, transparent); }


/* ===== INVESTIGATION SCENARIOS: icon button in the chat toolbar + floating panel (agmap.js) ===== */
:root { --ico-cases: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='3.5' width='13' height='17' rx='2'/%3E%3Cpath d='M7.5 8h6 M7.5 11.5h6 M7.5 15h3'/%3E%3Ccircle cx='17' cy='16.5' r='3'/%3E%3Cpath d='m19.2 18.7 2.3 2.3'/%3E%3C/svg%3E"); }
.lc-ico-cases { --ico: var(--ico-cases); position: relative; }
.lc-tools button.lc-ico-cases.is-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* the name on hover, at once (the native title tooltip comes late) */
.lc-ico-cases::after { content: attr(data-tip); position: absolute; top: calc(100% + 7px); left: 50%; transform: translate(-50%, -3px); white-space: nowrap; pointer-events: none;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em; color: var(--text); background: var(--surface-solid); border: 1px solid var(--border-strong);
  padding: 4px 9px; border-radius: 7px !important; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); opacity: 0; transition: opacity .12s ease, transform .12s ease; z-index: 30; }
.lc-ico-cases:hover::after, .lc-ico-cases:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.lc-ico-cases.is-on::after { opacity: 0 !important; }
.lc { position: relative; }
.lc-scen { position: absolute; left: 10px; right: 10px; top: 96px; bottom: 76px; z-index: 20; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px 10px;
  background: var(--surface-solid); border: 1px solid var(--border-strong); border-radius: 14px !important; box-shadow: 0 18px 48px rgba(0, 0, 0, .35); animation: lc-scen-in .16s ease-out; }
.lc-scen[hidden] { display: none; }
@keyframes lc-scen-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.lc-scen-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lc-scen-title { margin: 0; font-size: 14px; font-weight: 700; color: var(--text); }
.lc-scen-heading p { margin: 2px 0 0; }
.lc-scen-close { flex: none; }
.lc-scen-filter { width: 100%; min-height: 32px; padding: 5px 10px; font-size: 12.5px; border-radius: 9px !important; }
.lc-scen-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(150px, 34%) minmax(0, 1fr); gap: 10px; }
.lc-scen-nav { display: flex; flex-direction: column; gap: 3px; overflow: auto; padding-right: 4px; border-right: 1px solid var(--border); }
.lc-scen-tab { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 0; padding: 7px 9px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--text-2); background: transparent; border: 1px solid transparent; border-radius: 8px !important; cursor: pointer; }
.lc-scen-tab:hover:not(:disabled) { color: var(--text); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.lc-scen-tab.is-on { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.lc-scen-tab:disabled { opacity: .4; cursor: default; }
.lc-scen-tab-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-scen-count { flex: none; font-size: 10.5px; font-weight: 700; min-width: 20px; text-align: center; padding: 1px 6px; border-radius: 999px !important; color: var(--text-2); background: color-mix(in srgb, var(--text) 8%, transparent); }
.lc-scen-tab.is-on .lc-scen-count { color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.lc-scen-list { display: flex; flex-direction: column; gap: 4px; overflow: auto; padding-right: 2px; }
.lc-scen-note { margin: 0 0 4px; font-size: 11.5px; color: var(--text-2); padding: 6px 9px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.lc-scen-item { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 8px; width: 100%; min-height: 0; padding: 7px 10px; text-align: left; font-size: 12.5px; font-weight: 500; line-height: 1.35;
  color: var(--text); background: color-mix(in srgb, var(--text) 3%, transparent); border: 1px solid var(--border); border-radius: 9px !important; cursor: pointer; transition: border-color .12s, background .12s, transform .12s; }
.lc-scen-item:hover, .lc-scen-item:focus-visible { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); background: color-mix(in srgb, var(--accent) 9%, transparent); transform: translateX(2px); }
.lc-scen-num { font-size: 10.5px; font-weight: 700; color: var(--accent); text-align: center; line-height: 18px; height: 18px; border-radius: 6px !important; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lc-scen-text { min-width: 0; }
.lc-scen-from { grid-column: 2; font-size: 10.5px; color: var(--text-2); }
.lc-scen-empty { margin: 8px 2px; }
@media (max-width: 560px) {
  .lc-scen-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .lc-scen-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 6px; }
  .lc-scen-tab { width: auto; flex: none; }
}
.lc-scen .lc-scen-tab { background-image: none; box-shadow: none; height: auto; }
.lc-scen .lc-scen-tab:not(.is-on):not(:hover) { background: transparent; border-color: transparent; }
.lc-scen-tab-name { white-space: normal; line-height: 1.25; }
.lc-scen-body { grid-template-columns: minmax(170px, 38%) minmax(0, 1fr); }
.lc-scen .lc-scen-item { height: auto; background-image: none; box-shadow: none; overflow: visible; }
.lc-scen .lc-scen-filter { height: auto; }
.lc-scen .lc-scen-tab, .lc-scen .lc-scen-item, .lc-scen-note { flex: none; }

/* =============================================================================================
   TRANSPARENT FLOATING BARS + GLASS CHAT (look only)
   * the top bar is transparent glass (the page or the map shows through) and shows the name only (no bolt block)
   * Agentic AI map, wide screens: the map fills the window; the top bar and the layers panel float over it as
     detached glass cards (agmap.js measures --ag-top, the space under the bar, and pads the map view to match)
   * the chat windows are see-through glass
   Light theme keeps more of its surface so dark text stays readable over the map.
   ============================================================================================= */
:root, html[data-theme] { --float-mix: 30%; --chat-mix: 34%; --float-edge: color-mix(in srgb, var(--text) 13%, transparent); }
html[data-theme="light"] { --float-mix: 58%; --chat-mix: 62%; }

header.top { border-color: var(--float-edge); }
header.top::before {
  background: color-mix(in srgb, var(--surface-solid) var(--float-mix), transparent);
  -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
}
/* brand: the name only */
header.top h1 { padding-left: 20px; }
header.top h1::before, header.top h1::after { content: none; }
@media (max-width: 720px) { header.top h1 { padding-left: 16px; } }

@media (min-width: 1001px) {
  body:has(main > .ag.nm) header.top { position: fixed; top: var(--hdr-gap); left: var(--hdr-gap); right: var(--hdr-gap); margin: 0; }
  main:has(> .ag.nm) { padding: 0; }
  .ag.nm { position: relative; display: block; height: 100dvh; }
  .ag.nm > .ag-center { position: absolute; inset: 0; }
  /* the layers panel: a detached, floating glass card under the top bar */
  .ag.nm > .ag-left {
    position: absolute; z-index: 9; left: 10px; top: var(--ag-top, 80px); bottom: 10px; width: 320px;
    border: 1px solid var(--float-edge); border-radius: 14px !important; overflow: hidden;
    background: color-mix(in srgb, var(--surface-solid) var(--float-mix), transparent);
    -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
    transition: transform .3s var(--ease-out), opacity .3s var(--ease), top .2s var(--ease), visibility 0s;
  }
  .ag.nm > .ag-left .nm-side-head, .ag.nm > .ag-left .ag-svc > summary { background: transparent; }
  .ag.ag-no-left > .ag-left { visibility: hidden; opacity: 0; transform: translateX(calc(-100% - 20px)); border: 1px solid var(--float-edge);
    transition: transform .3s var(--ease-out), opacity .3s var(--ease), visibility 0s linear .3s; }
  /* the open / close tab sits on the panel's edge, and moves with it */
  .ag .ag-edge-left { left: 338px; top: calc(var(--ag-top, 80px) + (100dvh - var(--ag-top, 80px)) / 2 - 28px); border-radius: var(--r-sm) !important;
    background: color-mix(in srgb, var(--surface-solid) var(--float-mix), transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border: 1px solid var(--float-edge); transition: left .3s var(--ease-out); }
  .ag.ag-no-left .ag-edge-left { left: 10px; }
  /* everything else that sits over the map starts under the floating top bar */
  .ag .lc-modal { padding-top: var(--ag-top, 80px); }
  .ag .as-overlay { padding-top: calc(var(--ag-top, 80px) + 4px); }
  .ag .ag-banner { top: var(--ag-top, 80px); }
}
@media (min-width: 1001px) and (max-width: 1280px) {
  .ag.nm > .ag-left { width: 280px; }
  .ag .ag-edge-left { left: 298px; }
}

/* the chat windows: see-through glass */
.lc-dialog {
  background:
    linear-gradient(125deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, .02) 22%, transparent 40%),
    radial-gradient(130% 55% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
    radial-gradient(120% 50% at 0% 100%, color-mix(in srgb, var(--accent-2) 8%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface-solid) var(--chat-mix), transparent);
  -webkit-backdrop-filter: blur(28px) saturate(190%); backdrop-filter: blur(28px) saturate(190%);
  border-color: var(--float-edge);
}
.lc-composer.nm-composer { background: color-mix(in srgb, var(--surface-sunken) 45%, transparent); }
.lc-msgs .nm-from-agent .nm-bubble { background: color-mix(in srgb, var(--surface-raised) 38%, transparent); }
.lc-scen { background: color-mix(in srgb, var(--surface-solid) calc(var(--chat-mix) + 22%), transparent);
  -webkit-backdrop-filter: blur(26px) saturate(180%); backdrop-filter: blur(26px) saturate(180%); border-color: var(--float-edge); }
button.lc-minbar { background: color-mix(in srgb, var(--surface-solid) var(--chat-mix), transparent); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); }

/* =============================================================================================
   AGENTIC AI - the theft trail strip over the map (src/pages/agmap.js showTrail): Region > Zone > Circle > Division > Feeder > DTC.
   ============================================================================================= */
.ag-trail { position: absolute; left: 50%; top: var(--ag-top, 12px); z-index: 4; transform: translateX(-50%); max-width: min(680px, calc(100% - 32px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 6px 8px 6px 12px; border-radius: var(--r-md);
  background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: var(--shadow); backdrop-filter: blur(var(--blur)); font-size: 12px; color: var(--text); }
.ag-trail[hidden] { display: none; }
.ag-trail-head { font-weight: 600; margin-right: 4px; white-space: nowrap; }
.ag-trail-sep { opacity: .55; }
.ag-trail-step { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0; padding: 3px 8px; min-height: 0; line-height: 1.25;
  border-radius: var(--r-sm); border: 1px solid var(--border); border-left: 4px solid var(--c); background: transparent; color: var(--text); cursor: pointer; font: inherit; }
.ag-trail-step:hover:not(:disabled) { background: var(--surface-hover); }
.ag-trail-step:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ag-trail-step:disabled { cursor: default; opacity: .8; }
.ag-trail-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--c); font-weight: 700; }
.ag-trail-name { font-weight: 600; white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.ag-trail-close { margin-left: 2px; padding: 0 6px; min-height: 0; border: 0; background: transparent; color: var(--text); font-size: 16px; line-height: 1; cursor: pointer; opacity: .7; }
.ag-trail-close:hover { opacity: 1; }
@media (max-width: 700px) { .ag-trail { top: 8px; font-size: 11px; } .ag-trail-name { max-width: 110px; } }

/* =============================================================================================
   AGENTIC AI - the one pop-up format of every map marker (src/components/agmap-popup.js):
   Where / Consumers / What is happening / Energy, "N/A" where a part does not apply, then "More details".
   ============================================================================================= */
.lp { display: grid; gap: 10px; font-size: 13px; line-height: 1.45; color: inherit; min-width: 260px; }
.lp-sec { display: grid; gap: 4px; padding-top: 8px; border-top: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.lp-sec:first-child { border-top: 0; padding-top: 0; }
.lp-h { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent, #6b7cf2); }
.lp-dl { display: grid; grid-template-columns: minmax(110px, 42%) 1fr; gap: 3px 12px; margin: 0; }
.lp-dl dt { margin: 0; opacity: .72; }
.lp-dl dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lp-dl dd.is-na { font-weight: 400; opacity: .5; }
.lp-dl dd.is-bad { color: var(--bad, #e5484d); }
.lp-p { margin: 0; }
.lp-muted { opacity: .7; font-size: 12px; }
.lp-more summary { cursor: pointer; font-size: 12px; font-weight: 600; opacity: .8; }
.lp-more .lp-dl { margin-top: 6px; font-size: 12px; }

/* ---- ranked result cards in the assistant chat: captions, help line, rows that show the item on the map (agmap.js miniTable) ---- */
.ag-bar-head { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 0 6px; }
.ag-bar-head .ag-bar-n { font-family: inherit; text-align: right; white-space: normal; }
.ag-bar-help { margin: 0 0 4px; padding: 0 6px; font-size: 11.5px; line-height: 1.4; color: var(--text-2); }
.nm-msgs button.ag-bar-go, button.ag-bar-go { width: 100%; min-height: 0; margin: 0; padding: 4px 6px; text-align: left; font: inherit; font-size: 11.5px; color: inherit; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: 8px !important; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; transition: background .15s, border-color .15s; }
.nm-msgs button.ag-bar-go:hover, button.ag-bar-go:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.nm-msgs button.ag-bar-go:hover .ag-bar-label, button.ag-bar-go:hover .ag-bar-label { color: var(--accent); text-decoration: underline; }
button.ag-bar-go:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.ag-bar-go .ag-bar-n { text-align: right; }
/* a bold ID or name in an answer: shows it on the map */
.nm-msgs button.ag-goto, button.ag-goto { display: inline; min-height: 0; margin: 0; padding: 0 2px; font: inherit; font-weight: 700; color: var(--accent); cursor: pointer;
  background: none; border: 0; border-bottom: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 0 !important; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.nm-msgs button.ag-goto:hover, button.ag-goto:hover { border-bottom-style: solid; background: var(--accent-soft); }

/* pop-up "Reason for loss" (agmap-popup.js reasonSection) */
.lp-likely { padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent, #6b7cf2) 14%, transparent); }
.lp-likely b { color: var(--accent, #6b7cf2); }
.lp-reasons { margin: 2px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 12.5px; }
.lp-reasons b { font-weight: 650; }
.lp-reasons li.is-muted { opacity: .7; }

/* ---- the robot at work (robot.js): eyes, a waving arm, a magnifying glass, antenna signal and a caption ---------------
   Parts are drawn in the robot's 120 x 120 box; each turns round its own shoulder (transform-box: view-box). */
.rb-eye { fill: color-mix(in srgb, var(--accent) 80%, #ffffff); filter: drop-shadow(0 0 2px var(--accent)); transform-box: fill-box; transform-origin: center; }
.rb-eyes { transform-box: view-box; }
.rb-limb { fill: none; stroke: #e6e8ef; stroke-width: 4.2; stroke-linecap: round; }
.rb-hand { fill: #ffffff; stroke: #cfd3df; stroke-width: 1; }
.rb-lens { fill: color-mix(in srgb, var(--accent) 22%, rgba(255, 255, 255, .18)); stroke: #ffffff; stroke-width: 2.6; }
.rb-lens-handle { stroke: #e6e8ef; stroke-width: 3.4; stroke-linecap: round; }
.rb-lens-glint { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 1.4; stroke-linecap: round; }
.rb-wave { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; opacity: 0; }
.rb-arm { transform-box: view-box; }
.rb-arm--wave { transform-origin: 25px 68px; transform: rotate(-75deg); }
.rb-arm--lens { transform-origin: 95px 70px; }
/* small copies (chat messages, header, minimised bar): face only */
.rb--msg .rb-arm, .rb--avatar .rb-arm, .rb--min .rb-arm, .rb--msg .rb-signal, .rb--avatar .rb-signal, .rb--min .rb-signal { display: none; }

/* blink every few seconds (all copies) */
@keyframes rb-eye-blink { 0%, 44%, 50%, 100% { transform: scaleY(1); } 47% { transform: scaleY(.12); } }
.rb-eye { animation: rb-eye-blink 4.2s ease-in-out infinite; }
.rb-eye:nth-child(2) { animation-delay: .04s; }

/* The corner robot keeps busy on a 12-second loop: waves (0-20%), inspects through the glass (22-52%),
   looks around (54-74%), then sends what it found (antenna waves, 76-96%). */
@keyframes rb-act-wave { 0% { transform: rotate(-75deg); } 4% { transform: rotate(0deg); } 7% { transform: rotate(28deg); } 10% { transform: rotate(0deg); }
  13% { transform: rotate(28deg); } 16% { transform: rotate(0deg); } 20%, 100% { transform: rotate(-75deg); } }
@keyframes rb-act-lens { 0%, 22% { transform: rotate(0deg); } 28% { transform: rotate(110deg); } 34% { transform: rotate(98deg); } 40% { transform: rotate(116deg); }
  46% { transform: rotate(104deg); } 52%, 100% { transform: rotate(0deg); } }
@keyframes rb-act-eyes { 0%, 24% { transform: translate(0, 0); } 28%, 46% { transform: translate(4px, 1px); } 52% { transform: translate(0, 0); }
  58% { transform: translate(-5px, 0); } 64% { transform: translate(5px, -1px); } 70% { transform: translate(-3px, 1px); } 74%, 100% { transform: translate(0, 0); } }
@keyframes rb-act-signal { 0%, 76% { opacity: 0; } 79% { opacity: 1; } 84% { opacity: .2; } 87% { opacity: 1; } 92% { opacity: .2; } 96%, 100% { opacity: 0; } }
@keyframes rb-sway { 0%, 100% { transform: translateY(0) rotate(0deg); } 25% { transform: translateY(-4px) rotate(-5deg); } 50% { transform: translateY(-7px) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(5deg); } }
.rb--launch .rb-svg { animation: rb-sway 6s ease-in-out infinite; transform-origin: 50% 55%; }
.rb--launch .rb-arm--wave, .rb--hero .rb-arm--wave { animation: rb-act-wave 12s ease-in-out infinite; }
.rb--launch .rb-arm--lens { animation: rb-act-lens 12s ease-in-out infinite; }
.rb--launch .rb-eyes { animation: rb-act-eyes 12s ease-in-out infinite; }
.rb--launch .rb-wave--1 { animation: rb-act-signal 12s ease-out infinite; }
.rb--launch .rb-wave--2 { animation: rb-act-signal 12s ease-out infinite .25s; }

/* the caption of what it is doing, left of the robot; the "Ask me" tip takes its place on hover */
.rb-task {
  position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); white-space: nowrap; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; font-size: 11.5px; font-weight: 600; color: var(--text, #e8eef6);
  background: color-mix(in srgb, var(--panel, #101826) 82%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 999px !important; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); backdrop-filter: blur(6px);
  transition: opacity .26s ease, transform .26s ease;
}
.rb-task::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: rb-task-dot 1s ease-in-out infinite; }
.rb-task::after { content: '...'; display: inline-block; width: 1.2em; overflow: hidden; vertical-align: bottom; animation: rb-task-dots 1.4s steps(4, end) infinite; }
.rb-task--out { opacity: 0; transform: translateY(-50%) translateX(6px); }
button.rb-launch:hover .rb-task, button.rb-launch:focus-visible .rb-task { opacity: 0; }
@keyframes rb-task-dot { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes rb-task-dots { from { width: 0; } to { width: 1.2em; } }

/* the flying robot (while answering): glass pointed down, a scanning beam on the map, eyes down, sending data */
.rb--rover .rb-arm--lens { animation: rb-rover-lens 1.6s ease-in-out infinite; }
.rb--rover .rb-eyes { transform: translate(1px, 3px); }
.rb--rover .rb-wave--1 { animation: rb-rover-signal 1.2s ease-out infinite; }
.rb--rover .rb-wave--2 { animation: rb-rover-signal 1.2s ease-out infinite .3s; }
@keyframes rb-rover-lens { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(10deg); } }
@keyframes rb-rover-signal { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.rb-rover-beam {
  position: absolute; left: 50%; top: 72%; width: 60px; height: 40px; margin-left: -30px; pointer-events: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  clip-path: polygon(40% 0, 60% 0, 100% 100%, 0 100%); opacity: .55; transform-origin: 50% 0;
  animation: rb-rover-beam 1.6s ease-in-out infinite;
}
@keyframes rb-rover-beam { 0%, 100% { transform: rotate(-14deg); opacity: .4; } 50% { transform: rotate(14deg); opacity: .75; } }

@media (prefers-reduced-motion: reduce) {
  .rb-eye, .rb--launch .rb-svg, .rb--launch .rb-arm, .rb--hero .rb-arm, .rb--launch .rb-eyes, .rb--launch .rb-wave,
  .rb--rover .rb-arm--lens, .rb--rover .rb-wave, .rb-rover-beam, .rb-task::before, .rb-task::after { animation: none !important; }
}
@media (max-width: 600px) { .rb-task { display: none; } }

/* ---- notify(): pop-up for a finished file load or analysis run (utils/dom.js) ---- */
.notify-stack { position: fixed; top: 84px; right: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.notify {
  pointer-events: auto; display: grid; grid-template-columns: 30px 1fr 24px; gap: 12px; align-items: start;
  padding: 14px 14px 14px 16px; border-radius: var(--r-md); color: var(--text);
  background: var(--surface-raised); border: 1px solid var(--border-strong); border-left: 4px solid var(--ok);
  box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur));
  animation: li-toast-in var(--t-med) var(--ease);
  transition: opacity .2s ease, transform .2s ease;
}
.notify--warn { border-left-color: var(--warn); }
.notify--bad { border-left-color: var(--bad); }
.notify--out { opacity: 0; transform: translateX(16px); }
.notify__icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #06140f; background: var(--ok); }
.notify--warn .notify__icon { background: var(--warn); }
.notify--bad .notify__icon { background: var(--bad); }
.notify__title { display: block; margin-bottom: 2px; }
.notify__line { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.notify__close { background: none; border: 0; color: var(--text); font-size: 20px; line-height: 1; padding: 0; cursor: pointer; opacity: .7; min-height: 0; box-shadow: none; }
.notify__close:hover, .notify__close:focus-visible { opacity: 1; }
@media (max-width: 600px) { .notify-stack { top: auto; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); right: 16px; left: 16px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .notify { animation: none; transition: none; } }

/* Data loads: the result shown inside the step's own card */
.ingest-inline { margin-top: 10px; padding: 8px 12px; border-radius: var(--r-sm, 8px); font-size: 13px; border: 1px solid var(--border-strong); }
.ingest-inline--ok { border-left: 3px solid var(--ok); }
.ingest-inline--warn { border-left: 3px solid var(--warn); }
.ingest-inline--bad { border-left: 3px solid var(--bad); }

/* Review queue: the case summary stays two lines in a wide column (full text on hover) */
.q-summary { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-width: 360px; max-width: 560px; white-space: normal; }
