/* ==========================================================================
   Argus design system: Ocellus
   --------------------------------------------------------------------------
   When Argus fell, Hera set his hundred eyes in the peacock's tail. The mark
   is one of those eye-spots; peacock teal is the one data hue.

   The move (framed sheet): one teal-tinted L-frame holds the sidebar and the
   48px top bar; the work sits on a white sheet inset 8px from the window's
   right and bottom edges, 16px corners, a 1px edge and no shadow.

   Rules this file enforces for every screen:
   - Colour is data and status. The accent marks the main data element, links
     and the active tab; buttons are ink, severity keeps its own hues, and no
     severity hue is within 140 degrees of the teal.
   - Surfaces are flat: a 1px border or one tone step, never a shadow at rest,
     never a gradient, a glow or a blur. Shadows are for what floats.
   - Sentence case everywhere. No tracked uppercase labels.
   - Figures are tabular and right-aligned in columns; IDs and CVEs do not wrap.
   - Layout uses logical properties (inline/block) so Arabic can flip it.

   Grid at 1440: sidebar 228; sheet 1204 (1440 - 228 - 8); 24px padding gives
   1156 = 12 x 74.33 + 11 x 24.

   Old token names (--bg-surface, --text-primary, --accent-primary, ...) are
   kept as aliases at the bottom of the token block, so page styles written
   against them take the new look without edits.
   ========================================================================== */

/* ── Faces: IBM Plex, self-hosted (static/fonts/ibm-plex, SIL OFL 1.1) ───── */
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex/IBMPlexSans-VF.woff2") format("woff2"); font-weight: 100 700; font-stretch: 85% 100%; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex/IBMPlexMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/static/fonts/ibm-plex/IBMPlexMono-Medium.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/static/fonts/ibm-plex/IBMPlexSansArabic-Regular.woff2") format("woff2"); font-weight: 100 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/static/fonts/ibm-plex/IBMPlexSansArabic-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("/static/fonts/ibm-plex/IBMPlexSansArabic-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF; }


/* ==========================================================================
   1. TOKENS
   ========================================================================== */

/* Light is the default (no saved choice means light). */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --ground: #edf3f3;       /* the frame: sidebar and top bar */
  --surface: #ffffff;      /* the sheet and its cards */
  --raised: #f3f7f7;       /* a well, a selected row, a hover */
  --active: #e2ecec;       /* the active nav pill, tracks */
  --border: #e1e8e8;       /* card edges */
  --rule: #edf1f1;         /* row rules */
  --control: #c8d0d1;      /* control borders */
  --text: #131416;
  --muted: #56595b;        /* secondary text, 7.0:1 on white */
  --faint: #5d6163;        /* meta and placeholders, 6.1:1 on white */
  --disabled: #8a9192;
  --accent: #1b6c80;       /* peacock teal: data, links, the active tab */
  --accent-text: #1b6c80;  /* 5.99:1 on white */
  --accent-hover-tone: #145565;
  --accent-tint: rgba(27, 108, 128, 0.10);
  --accent-tint-2: rgba(27, 108, 128, 0.05);
  --primary: #131416;      /* the one filled button: ink */
  --primary-hover: #2a2c2f;
  --primary-ink: #ffffff;
  --positive: #1e7b4f;
  --negative: #c4242a;
  --warning: #92400e;
  --sev-critical: #c4242a;
  --sev-high: #c2410c;
  --sev-medium: #a86f0c;
  --sev-low: #6a6e72;
  --sev-info: #56707a;
  --pill-critical-bg: #ffedea; --pill-critical-ink: #831c1e;
  --pill-high-bg: #fff0e5;     --pill-high-ink: #7c2d0b;
  --pill-medium-bg: #fbf3df;   --pill-medium-ink: #6b4a06;
  --pill-low-bg: #edf1f4;      --pill-low-ink: #36424e;
  --pill-info-bg: #eef2f2;     --pill-info-ink: #3c4b50;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e; --pill-warning-edge: #fde68a;
  --pill-accent-bg: #e3f1f4;   --pill-accent-ink: #0f4654;
  --grid: #e6ecec;
  --chart-1: #1b6c80;
  --chart-muted: #b9c6c8;
  --scrim: rgba(19, 20, 22, 0.42);
  --float-shadow: 0 10px 30px -8px rgba(19, 32, 36, 0.20), 0 2px 6px rgba(19, 32, 36, 0.08);
  --avatar-bg: #d6ebe9; --avatar-ink: #0c3f3b;
  --mark-o: #1b6c80; --mark-c: #0c2f38;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground: #0f1414;
  --surface: #161c1d;
  --raised: #1d2526;
  --active: #26302f;
  --border: #253031;
  --rule: #1f2829;
  --control: #3d4a4b;
  --text: #eef2f2;
  --muted: #a5b3b4;
  --faint: #93a2a3;
  --disabled: #6a7879;
  --accent: #4fb3c7;
  --accent-text: #5fc0d3;
  --accent-hover-tone: #7ccfdf;
  --accent-tint: rgba(79, 179, 199, 0.14);
  --accent-tint-2: rgba(79, 179, 199, 0.07);
  --primary: #eef2f2;
  --primary-hover: #ffffff;
  --primary-ink: #0f1414;
  --positive: #4cc38a;
  --negative: #f0707a;
  --warning: #e5a93b;
  --sev-critical: #f0707a;
  --sev-high: #f2924e;
  --sev-medium: #d9b44a;
  --sev-low: #9a9fa3;
  --sev-info: #8fa9b2;
  --pill-critical-bg: #3a1d21; --pill-critical-ink: #ff9aa2;
  --pill-high-bg: #3a2516;     --pill-high-ink: #ffb27a;
  --pill-medium-bg: #332b16;   --pill-medium-ink: #ecc865;
  --pill-low-bg: #232c30;      --pill-low-ink: #b8c6cf;
  --pill-info-bg: #1f2a2c;     --pill-info-ink: #b4c6cb;
  --pill-positive-bg: #15291f; --pill-positive-ink: #6fd6a2;
  --pill-warning-bg: #2d2412;  --pill-warning-ink: #f0c46a; --pill-warning-edge: #5c4716;
  --pill-accent-bg: #173238;   --pill-accent-ink: #8fd6e4;
  --grid: #253031;
  --chart-1: #4fb3c7;
  --chart-muted: #46595b;
  --scrim: rgba(0, 0, 0, 0.6);
  --float-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.4);
  --avatar-bg: #1d3b3d; --avatar-ink: #bfe6e2;
  --mark-o: #4fb3c7; --mark-c: #e8f4f6;
}

:root {
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-id: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Type scale: 12 / 14 / 16 / 22 does the visible work. */
  --text-2xs: 0.6875rem;  /* 11px: the floor */
  --text-xs: 0.75rem;     /* 12px: meta, labels, table headers */
  --text-sm: 0.875rem;    /* 14px: body */
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --text-4xl: 2rem;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  --radius-sm: 4px;
  --radius-md: 6px;     /* controls */
  --radius-lg: 8px;     /* cards */
  --radius-xl: 8px;
  --radius-sheet: 16px; /* the sheet */
  --radius-full: 999px;

  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: var(--ease-standard);
  --transition-fast: 140ms var(--ease-standard);
  --transition-modal: 180ms var(--ease-standard);
  --transition-smooth: 200ms var(--ease-standard);

  --sidebar-expanded: 228px;
  --sidebar-collapsed: 60px;
  --topbar-height: 48px;
  --sheet-inset: 8px;
  --pad: 24px;
  --gap: 24px;
  --card-pad: 20px;
  --control-h: 34px;
  --row-h: 44px;

  /* ── Aliases: the names page styles were written against ─────────────── */
  --font-sans: var(--font);
  --font-display: var(--font);
  --font-hero: var(--font);
  --font-mono: var(--font-id);

  --bg-base: var(--surface);
  --bg-surface: var(--surface);
  --bg-elevated: var(--raised);
  --bg-interactive: var(--active);
  --bg-card: var(--surface);
  --bg-card-hover: var(--raised);
  --bg-hover: var(--raised);
  --bg-subtle: var(--raised);
  --bg-tertiary: var(--raised);
  --bg-dark: var(--raised);
  --card: var(--surface);
  --card-bg: var(--surface);
  --panel: var(--surface);
  --sidebar-bg: var(--ground);
  --log-bg: var(--raised);

  --border-default: var(--border);
  --border-subtle: var(--rule);
  --border-strong: var(--control);
  --border-hover: var(--control);
  --border-light: var(--rule);

  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --text-tertiary: var(--faint);
  --text-disabled: var(--disabled);
  --text-1: var(--text);
  --text-2: var(--muted);
  --text-3: var(--faint);
  --bright: var(--text);
  --dark: var(--text);

  --accent-primary: var(--accent);
  --accent-primary-strong: var(--accent);
  --accent-hover: var(--accent-hover-tone);
  --accent-muted: var(--accent-tint);
  --accent-subtle: var(--accent-tint-2);
  --accent-interactive: var(--accent-text);
  --accent-interactive-muted: var(--accent-tint);
  --accent-signature: var(--accent);
  --accent-signature-muted: var(--accent-tint);
  --accent-light: var(--accent-text);
  --accent-danger: var(--negative);
  --auth-accent: var(--accent);
  --auth-accent-hover: var(--accent-hover-tone);

  --severity-critical: var(--sev-critical);
  --severity-high: var(--sev-high);
  --severity-medium: var(--sev-medium);
  --severity-low: var(--sev-low);
  --severity-info: var(--sev-info);
  --severity-critical-light: var(--pill-critical-ink);
  --severity-high-light: var(--pill-high-ink);
  --status-success: var(--positive);
  --status-success-light: var(--pill-positive-ink);
  --status-active: var(--accent-text);
  --status-inactive: var(--faint);
  --success: var(--positive);
  --danger: var(--negative);
  --info: var(--accent-text);

  /* Named hues from older pages fold into the system: one data hue, the
     severity ramp, and ink. No violet, no pink, no second accent. */
  --blue: var(--accent-text);
  --cyan: var(--accent-text);
  --purple: var(--accent-text);
  --pink: var(--accent-text);
  --green: var(--positive);
  --red: var(--negative);
  --orange: var(--sev-high);
  --yellow: var(--sev-medium);

  --code-color: var(--accent-text);
  --log-stdout: var(--positive);
  --log-stderr: var(--negative);

  --tracking-display: -0.01em;
  --tracking-tight: 0;
  --tracking-label: 0;

  /* Flat by rule: resting surfaces have no shadow, and nothing glows. */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: var(--float-shadow);
  --shadow-xl: var(--float-shadow);
  --ring-focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --glow-blue: 0 0 0 0 transparent;
  --glow-accent: 0 0 0 0 transparent;
  --glow-critical: 0 0 0 0 transparent;
  --gradient-accent: var(--accent);
  --gradient-critical: var(--negative);
  --glass-bg: var(--surface);
  --glass-border: var(--border);
  --glass-blur: 0px;

  /* Charts: one hue on data, neutrals for the rest, severity for severity. */
  --chart-2: var(--chart-muted);
  --chart-3: var(--chart-muted);
  --chart-4: var(--chart-muted);
  --chart-5: var(--chart-muted);
  --chart-6: var(--chart-muted);
  --chart-7: var(--chart-muted);
  --chart-8: var(--chart-muted);
  --chart-grid: var(--grid);
  --chart-axis: var(--control);
  --chart-track: var(--active);
  --chart-critical: var(--sev-critical);
  --chart-high: var(--sev-high);
  --chart-medium: var(--sev-medium);
  --chart-low: var(--sev-low);
  --chart-success: var(--positive);

  /* Attack-map node kinds: ink and greys, teal for the hosts, severity for
     what is vulnerable. */
  --color-entity: var(--text);
  --color-subdomain: var(--accent);
  --color-ip: var(--muted);
  --color-tech: var(--faint);
  --color-login: var(--sev-medium);
}


/* ==========================================================================
   2. BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--text-sm)/1.43 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text); font-weight: 600; letter-spacing: 0; }
h1 { font-size: var(--fs-title); line-height: 28px; }
h2 { font-size: var(--fs-section); line-height: 22px; }
h3 { font-size: var(--text-sm); line-height: 20px; }
h4, h5, h6 { font-size: var(--text-sm); }
p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
/* A link inside running text is underlined, not told apart by colour alone. */
p a, li > a:not([class]), .page-sub a, .empty-state__body a { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
img, svg { max-inline-size: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
/* Pages write bare <button>s for icon actions: they start unstyled. */
button { cursor: pointer; border: 0; background: none; }
ul { list-style: none; }
table { border-collapse: collapse; inline-size: 100%; }
code, kbd, samp, pre, .mono, .cell-mono { font-family: var(--font-id); font-size: 0.92em; }
code { padding: 1px 5px; border-radius: var(--radius-sm); background: var(--raised); overflow-wrap: anywhere; }
td code, .mono code, code.mono { padding: 0; background: none; white-space: nowrap; }
pre {
  margin: 0; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--raised); border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-size: 12.5px; line-height: 1.6; tab-size: 2;
}
pre code { padding: 0; background: none; }
hr { border: 0; border-block-start: 1px solid var(--border); margin: var(--sp-5) 0; }
::selection { background: var(--accent); color: #fff; }
.num, table, .kpi-value, .kpi-num, .surf-n { font-variant-numeric: tabular-nums; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; inset-inline-start: 12px; inset-block-start: -48px; z-index: 1000;
  padding: 8px 12px; border-radius: var(--radius-md);
  background: var(--primary); color: var(--primary-ink); font-weight: 500;
}
.skip-link:focus { inset-block-start: 12px; text-decoration: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

* { scrollbar-width: thin; scrollbar-color: var(--control) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--control); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.theme-transitioning, .theme-transitioning * { transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease !important; }


/* ==========================================================================
   3. SHELL: tinted L-frame, white sheet
   ========================================================================== */

/* --- Sidebar (on the frame's ground) --- */
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40;
  inline-size: var(--sidebar-expanded);
  display: flex; flex-direction: column;
  background: var(--ground);
  transition: inline-size var(--transition-smooth), transform var(--transition-smooth);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  block-size: var(--topbar-height); padding-inline: 18px 12px; flex: none;
}
.sidebar-brand-link { display: flex; align-items: center; gap: 10px; min-inline-size: 0; color: var(--text); text-decoration: none; }
.sidebar-brand-link:hover { text-decoration: none; }
.sidebar-brand-icon { display: grid; place-items: center; inline-size: 26px; block-size: 26px; flex: none; }
.sidebar-brand-icon svg, .sidebar-brand-icon img { display: block; inline-size: 26px; block-size: 26px; object-fit: contain; }
.sidebar-brand-text { display: flex; flex-direction: column; min-inline-size: 0; line-height: 1.15; }
.sidebar-brand-name { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand-sub { font-size: var(--text-2xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-scope {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 6px 12px 4px; padding: 7px 10px; min-block-size: 36px;
  border-radius: var(--radius-lg); color: var(--text); font-weight: 500;
}
.sidebar-scope[hidden] { display: none; }
.sidebar-scope__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-scope__meta { color: var(--muted); font-size: var(--text-xs); font-weight: 400; white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.nav-section { margin-block-start: 14px; }
.nav-section:first-child { margin-block-start: 6px; }
.nav-section-label {
  display: block; margin: 0 10px 4px;
  font-size: 13px; font-weight: 400; color: var(--muted);
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  block-size: 32px; margin-block-end: 2px; padding-inline: 10px;
  border-radius: var(--radius-lg);
  color: var(--muted); font-size: var(--text-sm); text-decoration: none; white-space: nowrap;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover { background: var(--active); color: var(--text); text-decoration: none; }
.nav-item.active, .nav-item[aria-current="page"] { background: var(--active); color: var(--text); font-weight: 500; }
.nav-item i, .nav-item svg { inline-size: 16px; block-size: 16px; flex: none; stroke-width: 1.6; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-count { margin-inline-start: auto; font-size: var(--text-xs); font-weight: 500; color: var(--text); }

.sidebar-footer {
  flex: none; display: flex; flex-direction: column; gap: 4px; padding: 8px 12px 14px;
}
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px; block-size: 32px; padding-inline: 10px;
  border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--muted);
}
.sidebar-collapse-btn:hover { background: var(--active); color: var(--text); }
.sidebar-collapse-btn svg { inline-size: 16px; block-size: 16px; flex: none; }
.sidebar-footer-text { padding-inline: 10px; font-size: var(--text-xs); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collapsed: a 60px icon rail (the mark stays, labels go to tooltips). */
.sidebar.collapsed { inline-size: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand { padding-inline: 17px; }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-scope,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .sidebar-collapse-label,
.sidebar.collapsed .sidebar-footer-text { display: none; }
.sidebar.collapsed .sidebar-nav, .sidebar.collapsed .sidebar-footer { padding-inline: 8px; }
.sidebar.collapsed .nav-item, .sidebar.collapsed .sidebar-collapse-btn { justify-content: center; padding-inline: 0; }
.sidebar.collapsed .nav-section { margin-block-start: 10px; padding-block-start: 10px; border-block-start: 1px solid var(--border); }
.sidebar.collapsed .nav-section:first-child { border-block-start: 0; padding-block-start: 0; }

/* The mark keeps the brand teal even when a white-label accent is set. */
.argus-mark { display: block; flex: none; }
.argus-mark__o { fill: var(--mark-o); }
.argus-mark__c { fill: var(--mark-c); }

/* --- Main column --- */
.main {
  margin-inline-start: var(--sidebar-expanded);
  min-block-size: 100vh; min-block-size: 100svh;
  display: flex; flex-direction: column;
  transition: margin-inline-start var(--transition-smooth);
}
.sidebar.collapsed ~ .main { margin-inline-start: var(--sidebar-collapsed); }

/* --- Top bar (on the frame's ground, no rule) --- */
.topbar {
  position: sticky; inset-block-start: 0; z-index: 30;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 548px) minmax(0, 1fr);
  align-items: center; gap: 12px;
  block-size: var(--topbar-height); padding-inline: 8px 24px;
  background: var(--ground);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.topbar-mark { display: none; }
.topbar-hamburger {
  display: none; place-items: center; inline-size: 36px; block-size: 36px;
  border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--muted);
}
.topbar-hamburger:hover { background: var(--active); color: var(--text); }
.topbar-hamburger svg { inline-size: 20px; block-size: 20px; }

.topbar-search-btn {
  grid-column: 2;
  display: flex; align-items: center; gap: 8px; inline-size: 100%;
  block-size: 32px; padding-inline: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--faint); text-align: start;
  transition: border-color var(--transition-fast);
}
.topbar-search-btn:hover { border-color: var(--control); color: var(--muted); }
.topbar-search-btn svg { inline-size: 15px; block-size: 15px; flex: none; }
.topbar-search-btn span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.topbar-search-btn kbd, .cmd-palette kbd {
  font: 500 var(--text-2xs)/1 var(--font); color: var(--faint);
  padding: 3px 5px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--raised);
}

.topbar-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 4px; }
.topbar-icon-btn, .topbar-bell, #themeToggle {
  position: relative; display: grid; place-items: center;
  inline-size: 32px; block-size: 32px; padding: 0;
  border: 0; border-radius: var(--radius-lg); background: transparent; color: var(--muted);
  transition: background-color var(--transition-fast), color var(--transition-fast);
}
.topbar-icon-btn:hover, .topbar-bell:hover, #themeToggle:hover { background: var(--active); color: var(--text); }
.topbar-icon-btn svg, .topbar-bell svg, #themeToggle svg { inline-size: 17px; block-size: 17px; }
.topbar-bell-dot {
  position: absolute; inset-block-start: 7px; inset-inline-end: 7px;
  inline-size: 7px; block-size: 7px; border-radius: 50%;
  background: var(--negative); border: 2px solid var(--ground); box-sizing: content-box; inset-block-start: 5px; inset-inline-end: 5px;
}
.topbar-avatar {
  display: grid; place-items: center; inline-size: 28px; block-size: 28px; margin-inline-start: 6px;
  border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-ink);
  font-size: var(--text-xs); font-weight: 600; cursor: pointer; user-select: none; border: 0;
}

/* Running / queued work: words, with one dot that only lights when work runs. */
.status-badge {
  display: inline-flex; align-items: center; gap: 6px; block-size: 28px; padding-inline: 8px;
  color: var(--muted); font-size: var(--text-xs); white-space: nowrap;
}
.status-badge [id] { color: var(--text); font-weight: 500; }
.status-dot { inline-size: 7px; block-size: 7px; border-radius: 50%; background: var(--control); flex: none; }
.status-badge--running.is-live .status-dot, .status-dot--running.is-live { background: var(--accent); }
.status-badge--queued.is-live .status-dot { background: var(--faint); }

/* --- The sheet --- */
.content {
  flex: 1; min-inline-size: 0;
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  margin-inline: 0 var(--sheet-inset);
  padding: 20px var(--pad) 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
}
.content:focus { outline: none; }

/* --- Page head: breadcrumb, the one h1, actions, one grey line --- */
.page-head { margin-block-end: 20px; }
.page-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-head__actions:empty { display: none; }
.page-title, .topbar-title {
  font-size: var(--fs-title); line-height: 28px; font-weight: 600; color: var(--text);
  letter-spacing: -0.005em; margin: 0; overflow-wrap: anywhere;
}
.page-sub { margin-block-start: 6px; color: var(--muted); max-inline-size: 80ch; }
.page-sub:empty { display: none; }

.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  margin-block-end: 6px; font-size: 13px; color: var(--muted);
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb [aria-current] { color: var(--muted); }
.breadcrumb__sep { inline-size: 13px !important; block-size: 13px !important; color: var(--faint); }
[dir="rtl"] .breadcrumb__sep { transform: scaleX(-1); }

/* --- Sidebar overlay (phone) --- */
.sidebar-overlay {
  position: fixed; inset: 0; z-index: 35; background: var(--scrim);
  opacity: 0; visibility: hidden; transition: opacity var(--transition-fast), visibility var(--transition-fast);
}
.sidebar-overlay--visible { opacity: 1; visibility: visible; }

/* --- Embedded (chrome-less) mode: /page?embed=1 inside a tab panel --- */
body.embed { background: var(--surface); }
body.embed .sidebar, body.embed .topbar, body.embed .sidebar-overlay, body.embed .page-head { display: none !important; }
body.embed .main { margin: 0; }
body.embed .content { margin: 0; border: 0; border-radius: 0; padding: 4px 2px 16px; }

.merge-frame {
  display: block; inline-size: 100%; border: 0; border-radius: 0;
  background: transparent;
  block-size: calc(100vh - var(--topbar-height) - 190px); min-block-size: 480px;
}
.ds-tabpanel .chat-page { block-size: calc(100vh - var(--topbar-height) - 200px); }

/* --- Tablet and phone: the frame folds away, the sheet is the screen --- */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); inline-size: 280px; box-shadow: none; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  .sidebar.collapsed { inline-size: 280px; }
  .sidebar.collapsed .sidebar-brand-text, .sidebar.collapsed .nav-section-label,
  .sidebar.collapsed .nav-item span, .sidebar.collapsed .sidebar-scope { display: revert; }
  .sidebar--open { transform: none !important; box-shadow: var(--float-shadow); background: var(--surface); }
  .sidebar-collapse-btn { display: none; }
  .main, .sidebar.collapsed ~ .main { margin-inline-start: 0; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; padding-inline: 8px 12px; }
  .topbar-hamburger { display: grid; }
  .topbar-mark { display: grid; place-items: center; }
  .topbar-mark svg, .topbar-mark img { inline-size: 24px; block-size: 24px; }
  .topbar-search-btn { grid-column: 2; max-inline-size: 420px; justify-self: center; }
  .content { margin: 0; border-radius: 0; border-inline: 0; border-block-end: 0; padding: 18px 20px 32px; }
}
@media (max-width: 640px) {
  .topbar-search-btn { inline-size: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; justify-self: end; }
  .topbar-search-btn span, .topbar-search-btn kbd { display: none; }
  .status-badge { display: none; }
  .page-title, .topbar-title { font-size: 20px; line-height: 26px; }
  .page-head__actions { inline-size: 100%; }
  .content { padding: 16px 16px 28px; }
}


/* ==========================================================================
   4. FLOATING: menus, palette, popovers, toasts, dialogs (shadows live here)
   ========================================================================== */

.user-menu {
  display: none; position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0; z-index: 60;
  inline-size: 248px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--float-shadow);
}
.user-menu.open { display: block; }
.user-menu-header { padding: 14px 16px 12px; }
.user-menu-name { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.user-menu-email { margin-block-start: 2px; font-size: var(--text-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-role {
  display: inline-flex; margin-block-start: 8px; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--raised); color: var(--muted); font-size: var(--text-xs); font-weight: 500;
}
.user-menu-role::first-letter { text-transform: uppercase; }
.user-menu-divider { block-size: 1px; background: var(--border); margin: 4px 0; }
.user-menu-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  color: var(--text); font-size: var(--text-sm); text-decoration: none; cursor: pointer;
}
.user-menu-item svg { inline-size: 15px; block-size: 15px; color: var(--muted); }
.user-menu-item:hover { background: var(--raised); text-decoration: none; }
.user-menu-danger, .user-menu-danger svg { color: var(--negative); }

.notif-dropdown {
  display: none; position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: -8px; z-index: 60;
  inline-size: min(360px, calc(100vw - 24px)); max-block-size: 460px; overflow: hidden;
  flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--float-shadow);
}
.notif-dropdown.open { display: flex; }
.notif-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-block-end: 1px solid var(--border); }
.notif-header-title { font-weight: 600; }
.notif-header-action { border: 0; background: none; padding: 0; color: var(--accent-text); font-size: var(--text-xs); font-weight: 500; }
.notif-header-action:hover { text-decoration: underline; }
.notif-list { overflow-y: auto; }
.notif-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 12px; padding: 12px 16px;
  border-block-end: 1px solid var(--rule); cursor: pointer;
}
.notif-item:hover { background: var(--raised); }
.notif-item:last-child { border-block-end: 0; }
.notif-item-icon { display: grid; place-items: center; padding-block-start: 2px; color: var(--muted); background: none !important; }
.notif-item-icon svg { inline-size: 15px; block-size: 15px; }
.notif-item--unread .notif-item-text { font-weight: 500; }
.notif-item--unread { box-shadow: inset 2px 0 0 var(--accent); }
.notif-item-text { color: var(--text); font-size: var(--text-sm); line-height: 1.4; overflow-wrap: anywhere; }
.notif-item-time { margin-block-start: 2px; font-size: var(--text-xs); color: var(--faint); }
.notif-empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: var(--text-sm); }

.cmd-palette-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; align-items: flex-start;
  padding-block-start: 12vh; padding-inline: 16px; background: var(--scrim);
  opacity: 0; visibility: hidden; transition: opacity var(--transition-fast), visibility var(--transition-fast);
}
.cmd-palette-overlay.open { opacity: 1; visibility: visible; }
.cmd-palette {
  inline-size: min(600px, 100%); max-block-size: 70vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--float-shadow);
}
.cmd-palette-input-wrap { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-block-end: 1px solid var(--border); }
.cmd-palette-input-wrap svg { inline-size: 17px; block-size: 17px; color: var(--muted); flex: none; }
.cmd-palette-input { flex: 1; block-size: 50px; border: 0; background: transparent; color: var(--text); font-size: 15px; }
.cmd-palette-input:focus { outline: none; }
.cmd-palette-input::placeholder { color: var(--faint); }
.cmd-palette-results { overflow-y: auto; padding: 6px; }
.cmd-palette-group-label { padding: 10px 10px 4px; font-size: var(--text-xs); color: var(--muted); }
.cmd-palette-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md);
  color: var(--text); text-decoration: none;
}
.cmd-palette-item svg { inline-size: 16px; block-size: 16px; color: var(--muted); flex: none; }
.cmd-palette-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-palette-item:hover, .cmd-palette-item.active { background: var(--active); text-decoration: none; }
.cmd-palette-empty { padding: 28px; text-align: center; color: var(--muted); }
.cmd-palette-footer { display: flex; gap: 16px; padding: 8px 16px; border-block-start: 1px solid var(--border); color: var(--faint); font-size: var(--text-xs); }

.help-pop {
  display: inline-grid; place-items: center; inline-size: 16px; block-size: 16px; padding: 0; margin-inline-start: 4px;
  border: 1px solid var(--control); border-radius: 50%; background: transparent;
  color: var(--muted); font-size: 10.5px; font-weight: 600; line-height: 1; vertical-align: middle; cursor: help;
}
.help-pop:hover { border-color: var(--muted); color: var(--text); }
.help-pop-tip {
  position: absolute; z-index: 95; display: none; max-inline-size: 280px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  color: var(--text); font-size: var(--text-xs); line-height: 1.5; box-shadow: var(--float-shadow);
}
.help-pop-tip.open { display: block; }

.toast-container {
  position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 100;
  display: flex; flex-direction: column; gap: 8px; max-inline-size: min(400px, calc(100vw - 32px));
}
.toast, .ui-toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--float-shadow); font-size: var(--text-sm); line-height: 1.45;
  animation: ds-rise 180ms var(--ease-standard);
}
.toast.removing, .ui-toast.removing { opacity: 0; transform: translateY(6px); transition: opacity 180ms, transform 180ms; }
.toast-icon, .ui-toast__icon { inline-size: 17px !important; block-size: 17px !important; flex: none; margin-block-start: 1px; color: var(--muted); }
.toast span, .ui-toast__body { flex: 1; overflow-wrap: anywhere; }
.toast-close, .ui-toast__close { inline-size: 16px !important; block-size: 16px !important; flex: none; color: var(--faint); cursor: pointer; border: 0; background: none; padding: 0; }
.toast-success .toast-icon, .ui-toast--ok .ui-toast__icon { color: var(--positive); }
.toast-error .toast-icon, .ui-toast--err .ui-toast__icon { color: var(--negative); }
.toast-warning .toast-icon, .ui-toast--warn .ui-toast__icon { color: var(--warning); }
.toast-info .toast-icon, .ui-toast--info .ui-toast__icon { color: var(--accent-text); }

.modal-overlay, .modal-backdrop, .ui-modal-back {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: var(--scrim);
  opacity: 0; visibility: hidden; transition: opacity var(--transition-modal), visibility var(--transition-modal);
}
.modal-overlay.open, .modal-backdrop--active, .ui-modal-back { opacity: 1; visibility: visible; }
.modal-box, .modal-overlay .modal, .ui-modal {
  inline-size: min(560px, 100%); max-block-size: calc(100vh - 32px); overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--float-shadow);
  transform: translateY(6px); transition: transform var(--transition-modal);
}
.modal-overlay.open .modal-box, .modal-overlay.open .modal, .ui-modal { transform: none; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-header h2, .modal-header h3, .modal-title { font-size: var(--fs-section); font-weight: 600; margin: 0; }
.modal-body { padding: 16px 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }
.ui-modal { padding: 22px 24px; max-inline-size: 480px; }
.ui-modal h3 { font-size: var(--fs-section); margin: 0 0 10px; }
.ui-modal__body { color: var(--muted); margin-block-end: 18px; line-height: 1.5; }
.ui-modal__actions { display: flex; justify-content: flex-end; gap: 8px; }
.ui-field { margin-block-end: 14px; }
.ui-field > label { display: block; margin-block-end: 6px; font-weight: 500; color: var(--text); }
.ui-field__help { margin-block-start: 4px; font-size: var(--text-xs); color: var(--muted); }
.ui-field__err { display: none; margin-block-end: 12px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--pill-critical-bg); color: var(--pill-critical-ink); font-size: var(--text-sm); }


/* ==========================================================================
   5. CONTROLS
   ========================================================================== */

/* One filled primary per screen, in ink. Secondary is white with a border;
   ghost is text. One height per row. */
.btn, .btn-primary, .btn-p, .btn-o, .btn-secondary, .btn-ghost, .btn-danger,
.btn-danger-o, .btn-success-o, .btn-info-o, .btn-success, .btn-info {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-block-size: var(--control-h); padding: 0 14px;
  border: 1px solid var(--control); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text);
  font-size: var(--text-sm); font-weight: 500; line-height: 1.2; white-space: nowrap;
  text-decoration: none; cursor: pointer; user-select: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform 100ms var(--ease-standard);
}
.btn:hover, .btn-o:hover, .btn-secondary:hover, .btn-danger-o:hover, .btn-success-o:hover, .btn-info-o:hover {
  background: var(--raised); text-decoration: none;
}
.btn:active, .btn-primary:active, .btn-p:active, .btn-o:active, .btn-secondary:active, .btn-ghost:active, .btn-danger:active { transform: translateY(1px); }
.btn svg, .btn-primary svg, .btn-p svg, .btn-o svg, .btn-secondary svg, .btn-ghost svg, .btn-danger svg,
.btn-danger-o svg, .btn-success-o svg, .btn-info-o svg { inline-size: 15px; block-size: 15px; flex: none; }

.btn-primary, .btn.btn-primary, .btn-p, .btn-success, .btn-info {
  background: var(--primary); color: var(--primary-ink); border-color: transparent;
}
.btn-primary:hover, .btn.btn-primary:hover, .btn-p:hover, .btn-success:hover, .btn-info:hover {
  background: var(--primary-hover); color: var(--primary-ink); text-decoration: none;
}
.btn-ghost, .btn.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover, .btn.btn-ghost:hover { background: var(--active); color: var(--text); text-decoration: none; }
.btn-danger, .btn.btn-danger { background: var(--negative); color: #fff; border-color: transparent; }
.btn-danger:hover, .btn.btn-danger:hover { filter: brightness(0.92); color: #fff; text-decoration: none; }
.btn-danger-o { color: var(--negative); }
.btn-success-o { color: var(--positive); }
.btn-info-o { color: var(--accent-text); }
.btn-sm, .btn.btn-sm, .btn-o.btn-sm { min-block-size: 28px; padding: 0 10px; font-size: var(--text-xs); }
.btn-icon { inline-size: var(--control-h); padding: 0; }
.btn-icon.btn-sm { inline-size: 28px; }
.btn[disabled], .btn-primary[disabled], .btn-p[disabled], .btn-o[disabled], .btn-secondary[disabled], .btn-ghost[disabled],
.btn-danger[disabled], .btn:disabled, .btn-primary:disabled, .btn-p:disabled, .btn-o:disabled, .btn-ghost:disabled,
.btn-secondary:disabled, .btn-danger:disabled, .btn-danger-o:disabled {
  cursor: not-allowed; opacity: 0.55; transform: none;
}

/* --- Fields: label above, white, one border, 38px in forms --- */
.form-group { margin-block-end: 16px; }
.form-label, label.form-label {
  display: block; margin-block-end: 6px; font-size: var(--text-sm); font-weight: 500; color: var(--text);
}
.form-help, .form-hint { margin-block-start: 4px; font-size: var(--text-xs); color: var(--muted); }
.form-input, .form-ctrl, .form-select, .form-textarea, .search-input,
input.form-control, select.form-control, textarea.form-control {
  display: block; inline-size: 100%; min-block-size: 36px; padding: 7px 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--control); border-radius: var(--radius-md);
  font-size: var(--text-sm); line-height: 1.4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.form-input::placeholder, .form-ctrl::placeholder, .form-textarea::placeholder, .search-input::placeholder { color: var(--faint); opacity: 1; }
.form-input:hover, .form-ctrl:hover, .form-select:hover, .form-textarea:hover { border-color: var(--muted); }
.form-input:focus, .form-ctrl:focus, .form-select:focus, .form-textarea:focus, .search-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint);
}
.form-input:disabled, .form-ctrl:disabled, .form-select:disabled, .form-textarea:disabled { background: var(--raised); color: var(--muted); cursor: not-allowed; }
.form-textarea, textarea.form-ctrl { min-block-size: 88px; resize: vertical; }
select.form-ctrl {
  appearance: none; -webkit-appearance: none; padding-inline-end: 32px;
}
select.form-ctrl, .form-select, select.form-input {
  appearance: none; -webkit-appearance: none; padding-inline-end: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2393a2a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
[dir="rtl"] select.form-ctrl, [dir="rtl"] .form-select { background-position: left 10px center; }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { inline-size: 16px; block-size: 16px; margin: 0; vertical-align: middle; }

/* Toolbars and filter rows: one row, one height. */
.filter-bar, .toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-end: 16px;
}
.filter-bar .form-input, .filter-bar .form-ctrl, .filter-bar .form-select,
.toolbar .form-input, .toolbar .form-ctrl, .toolbar .form-select { inline-size: auto; min-block-size: var(--control-h); }

/* Switch */
.switch { position: relative; display: inline-block; inline-size: 32px; block-size: 18px; flex: none; }
.switch input { opacity: 0; inline-size: 0; block-size: 0; }
.switch .slider, .switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--control); transition: background-color var(--transition-fast); cursor: pointer; }
.switch .slider::before, .switch .track::before { content: ""; position: absolute; inset-block-start: 2px; inset-inline-start: 2px; inline-size: 14px; block-size: 14px; border-radius: 50%; background: #fff; transition: transform var(--transition-fast); }
.switch input:checked + .slider, .switch input:checked + .track { background: var(--positive); }
.switch input:checked + .slider::before, .switch input:checked + .track::before { transform: translateX(14px); }


/* ==========================================================================
   6. SURFACES: cards, panels, KPI strips, chart cards
   ========================================================================== */

.card, .card-d, .panel, .chart-card, .stat-card, .kpi-hero {
  position: relative; min-inline-size: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: none;
}
.card-d, .chart-card, .panel { padding: var(--card-pad); }
.card.p-0, .card-d.p-0 { padding: 0; }
.card-glow, .card-glow:hover { box-shadow: none; }
.card-header, .panel-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-end: 14px;
}
.card-title, .panel-title { font-size: var(--fs-section); line-height: 22px; font-weight: 600; margin: 0; }
.card-sub, .panel-sub, .card-meta { color: var(--muted); font-size: var(--text-xs); }
.card.is-link, .card-d.is-link, .card-d[onclick], .card[onclick] { cursor: pointer; }
.card.is-link:hover, .card-d.is-link:hover, .card-d[onclick]:hover, .card[onclick]:hover { border-color: var(--control); }

/* A section label is a heading: sentence case, ink, 14px. */
.section-label {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  font-size: var(--text-sm); font-weight: 600; color: var(--text);
}
.section-label i, .section-label svg { inline-size: 15px; block-size: 15px; color: var(--muted); flex: none; }

/* KPIs are type: label above value (column-reverse, since pages write the
   value first), values in ink at regular weight, no tile colour. */
.kpi-compact {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; min-inline-size: 0;
  padding: 14px var(--card-pad) 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.kpi-label, .kpi-lbl, .surf-l {
  font-size: var(--text-sm); font-weight: 500; color: var(--muted); letter-spacing: 0; text-transform: none;
  overflow-wrap: anywhere;
}
.kpi-value, .kpi-num, .kpi-val, .surf-n {
  font-size: var(--fs-kpi) !important; line-height: 34px; font-weight: 400; letter-spacing: -0.01em;
  color: var(--text) !important; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi-note, .kpi-trend, .kpi-sub { font-size: 13px; color: var(--muted); }
.kpi--danger, .kpi--warn, .kpi--safe, .kpi--info { background: var(--surface) !important; }
.kpi--danger::after, .kpi--warn::after, .kpi--safe::after, .kpi--info::after { content: none !important; }

/* A divided KPI strip: one container, equal columns, 1px dividers. */
.kpi-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface);
}
.kpi-strip > .kpi { display: flex; flex-direction: column; gap: 4px; padding: 14px var(--card-pad) 16px; min-inline-size: 0; }
.kpi-strip > .kpi + .kpi { border-inline-start: 1px solid var(--border); }
.kpi-strip .kpi-label { order: 0; }
.kpi-strip .kpi-value { order: 1; }
.kpi-strip .kpi-note { order: 2; }
.kpi-strip .severity-bar, .kpi-strip .sev-legend { order: 3; }
.kpi-label { display: inline-flex; align-items: center; gap: 2px; }
.kpi-strip > .kpi.is-lead .kpi-value { font-size: 34px !important; line-height: 40px; }
@media (max-width: 860px) {
  .kpi-strip { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .kpi-strip > .kpi + .kpi { border-inline-start: 0; }
  .kpi-strip > .kpi:nth-child(n + 3) { border-block-start: 1px solid var(--border); }
  .kpi-strip > .kpi:nth-child(2n) { border-inline-start: 1px solid var(--border); }
  .kpi-strip > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* KPI cells may be buttons (they open a drill-down). */
.kpi-strip > button.kpi { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 14px var(--card-pad) 16px; min-inline-size: 0; cursor: pointer; }
.kpi-strip > button.kpi:hover .kpi-label { color: var(--text); }
.kpi-strip > button.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius-lg); }
.kpi-strip > .kpi.is-lead { grid-column: span 2; }
.kpi-strip .severity-bar { margin-block-start: 8px; }
.sev-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-block-start: 8px; font-size: 13px; color: var(--muted); }
.sev-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sev-legend b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.sev-legend i { inline-size: 8px; block-size: 8px; border-radius: 2px; }

/* Segmented control: as wide as its options. */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--radius-lg); background: var(--active); }
.seg button, .seg a {
  display: inline-flex; align-items: center; gap: 6px; min-block-size: 30px; padding: 0 12px;
  border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--muted);
  font-size: var(--text-sm); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.seg button:hover, .seg a:hover { color: var(--text); text-decoration: none; }
.seg [aria-selected="true"], .seg .active { background: var(--surface); color: var(--text); border-color: var(--border); }

/* The lead panel: one finding stated, its facts in divided cells. */
.lead-panel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: stretch; }
.lead-panel__what h2 { font-size: var(--fs-section); line-height: 22px; margin: 8px 0 6px; overflow-wrap: anywhere; }
.lead-panel__what p { color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.lead-panel__what code.mono { white-space: normal; overflow-wrap: anywhere; }
.lead-panel__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cellset { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(110px, auto); border-inline-start: 1px solid var(--border); margin: 0; }
.cellset > div { padding: 2px 20px; display: grid; align-content: center; gap: 4px; }
.cellset > div + div { border-inline-start: 1px solid var(--border); }
.cellset dt { color: var(--muted); font-size: var(--text-xs); }
.cellset dd { margin: 0; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 1100px) {
  .lead-panel { grid-template-columns: minmax(0, 1fr); }
  .cellset { grid-auto-flow: row; grid-template-columns: 1fr 1fr; border-inline-start: 0; border-block-start: 1px solid var(--border); padding-block-start: 8px; }
  .cellset > div { padding: 8px 0; }
  .cellset > div + div { border-inline-start: 0; }
}

/* A change list: when, what, how much. */
.change-list { margin: 0; padding: 0; list-style: none; }
.change-list > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-block-end: 1px solid var(--rule); }
.change-list > li:last-child { border-block-end: 0; }
.change-list .ch-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.change-list .ch-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.change-list .ch-detail { grid-column: 1 / -1; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.change-list .ch-detail b { color: var(--text); font-weight: 500; }

/* Panels on the sheet share one 12-column grid and one gutter. */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); margin-block-end: var(--gap); align-items: start; }
.dash-grid > * { min-inline-size: 0; }
.span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-12 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .dash-grid > .span-3, .dash-grid > .span-4, .dash-grid > .span-5 { grid-column: span 6; } .dash-grid > .span-7, .dash-grid > .span-8 { grid-column: 1 / -1; } }
@media (max-width: 760px) { .dash-grid > * { grid-column: 1 / -1 !important; } }
.panel > header, .card-d > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-end: 12px; flex-wrap: wrap; }
.panel > header h2, .card-d > header h2 { font-size: var(--fs-section); line-height: 22px; font-weight: 600; margin: 0; display: inline-flex; align-items: center; gap: 4px; }
.panel .meta, .card-d .meta { color: var(--muted); font-size: var(--text-xs); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 0 12px; }
.section-head h2 { font-size: var(--fs-section); font-weight: 600; margin: 0; }
.link-action { color: var(--accent-text); font-weight: 500; font-size: var(--text-sm); white-space: nowrap; }

/* stat-row: a row of compact figures (assets, code leaks, WAF live stats) */
.stat-row { display: flex; flex-wrap: wrap; gap: 0; margin-block-end: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.stat-row:empty { display: none; }
.stat-row > * { flex: 1 1 140px; min-inline-size: 0; padding: 12px 16px; border: 0 !important; border-radius: 0 !important; background: none !important; }
.stat-row > * + * { border-inline-start: 1px solid var(--border) !important; }
.stat-row .kpi-compact { padding: 12px 16px; }

/* The old .gs figure block (scoreboard, misc) */
.gs { text-align: start; }
.gs .n { font-size: var(--text-xl); font-weight: 500; color: var(--text); }
.gs .l { font-size: var(--text-xs); color: var(--muted); }

/* Chart card */
.chart-card { display: flex; flex-direction: column; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-end: 12px; }
.chart-head .section-label { margin: 0; }
.chart-unit { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.chart-frame { position: relative; flex: 1 1 auto; min-block-size: 0; }
.chart-frame canvas { inline-size: 100% !important; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-block-start: 12px; font-size: var(--text-xs); color: var(--muted); }
.chart-legend__item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chart-legend__swatch { inline-size: 8px; block-size: 8px; border-radius: 2px; flex: none; }
.chart-legend__value { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

/* Divider */
.divider { block-size: 0; border-block-start: 1px solid var(--border); margin: var(--sp-5) 0; }


/* ==========================================================================
   7. TABLES: rules and alignment
   ========================================================================== */

.table-wrap, .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; } /* contains .sr-only header labels */
.table, .tbl, .data-table {
  inline-size: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums;
}
.table th, .tbl th, .data-table th {
  block-size: 36px; padding: 0 12px; text-align: start; vertical-align: middle;
  font-size: var(--text-xs); font-weight: 400; color: var(--muted); letter-spacing: 0; text-transform: none;
  white-space: nowrap; border-block-end: 1px solid var(--border); background: none;
}
.table td, .tbl td, .data-table td {
  block-size: var(--row-h); padding: 8px 12px; vertical-align: middle;
  border-block-end: 1px solid var(--rule); color: var(--text);
}
.table tbody tr:last-child td, .tbl tbody tr:last-child td, .data-table tbody tr:last-child td { border-block-end: 0; }
.table th:first-child, .table td:first-child, .tbl th:first-child, .tbl td:first-child { padding-inline-start: 0; }
.table th:last-child, .table td:last-child, .tbl th:last-child, .tbl td:last-child { padding-inline-end: 0; }
.card-d .table th:first-child, .card-d .table td:first-child, .card .table th:first-child, .card .table td:first-child,
.card-d .tbl th:first-child, .card-d .tbl td:first-child { padding-inline-start: 0; }
.table tbody tr, .tbl tbody tr { transition: background-color var(--transition-fast); }
.table tbody tr:hover td, .tbl tbody tr:hover td { background: var(--raised); }
.table th.n, .table td.n, .tbl th.n, .tbl td.n, th.num, td.num, .table .text-end, .col-num { text-align: end; white-space: nowrap; }
.table .sortable, .tbl .sortable, th[data-sort] { cursor: pointer; user-select: none; }
.table .sortable:hover, th[data-sort]:hover { color: var(--text); }
td.mono, td .mono, td code, .cve-id, .cell-mono { white-space: nowrap; }
td .ellip, .ellip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty, td.empty { padding: 32px 0 !important; text-align: center; color: var(--muted); }


/* ==========================================================================
   8. STATUS: pills, severity, progress
   ========================================================================== */

/* Pills: a pale tint with dark ink of the same hue. Never squeezed. */
.badge, .sbadge, .pill, .st-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  block-size: 22px; padding: 0 8px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 500; line-height: 1; white-space: nowrap; letter-spacing: 0; text-transform: none;
  background: var(--raised); color: var(--muted); border: 0;
}
.badge::first-letter, .sbadge::first-letter, .st-badge::first-letter { text-transform: uppercase; }
.badge-critical, .sbadge-critical, .pill--critical, .pill.critical, .sev-badge-critical, .badge-sev-critical { background: var(--pill-critical-bg); color: var(--pill-critical-ink); }
.badge-high, .sbadge-high, .pill--high, .pill.high, .sev-badge-high, .badge-sev-high { background: var(--pill-high-bg); color: var(--pill-high-ink); }
.badge-medium, .sbadge-medium, .pill--medium, .pill.medium, .sev-badge-medium, .badge-sev-medium { background: var(--pill-medium-bg); color: var(--pill-medium-ink); }
.badge-low, .sbadge-low, .pill--low, .pill.low, .sev-badge-low, .badge-sev-low { background: var(--pill-low-bg); color: var(--pill-low-ink); }
.badge-info, .sbadge-info, .pill--info, .pill.info { background: var(--pill-info-bg); color: var(--pill-info-ink); }
.pill--kev, .pill.kev, .badge-kev { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--control); }

/* Run and record states: one hue at three intensities. */
.badge-succeeded, .sbadge-succeeded, .badge-active, .badge-complete, .badge-completed, .badge-verified, .badge-success,
.st-fixed, .st-resolved { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.badge-running, .sbadge-running, .badge-in_progress, .st-triaged, .badge-retest { background: var(--pill-accent-bg); color: var(--pill-accent-ink); }
.badge-failed, .sbadge-failed, .badge-error, .badge-revoked, .badge-expired { background: var(--pill-critical-bg); color: var(--pill-critical-ink); }
.badge-queued, .sbadge-queued, .badge-pending, .sbadge-pending, .badge-idle, .badge-inactive, .badge-stopped,
.badge-unused, .badge-cancelled, .sbadge-cancelled, .st-accepted_risk, .st-false_positive { background: var(--raised); color: var(--muted); }
.st-open { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--control); }
.badge-warning, .sbadge-warning { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.badge-dot::before { content: ""; inline-size: 6px; block-size: 6px; border-radius: 50%; background: currentColor; }

/* Severity as a dot with a word (tables, lists). */
.sev, .severity-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-sm); font-weight: 400; color: var(--text); white-space: nowrap; }
.sev-dot, .severity-dot, .dot { display: inline-block; inline-size: 8px; block-size: 8px; border-radius: 2px; flex: none; background: var(--sev-low); }
.dot { border-radius: 50%; }
.sev-CRITICAL .sev-dot, .sev-critical .sev-dot, .severity-dot.critical, .sev-dot.critical, .sev-dot--critical { background: var(--sev-critical); }
.sev-HIGH .sev-dot, .sev-high .sev-dot, .severity-dot.high, .sev-dot.high, .sev-dot--high { background: var(--sev-high); }
.sev-MEDIUM .sev-dot, .sev-medium .sev-dot, .severity-dot.medium, .sev-dot.medium, .sev-dot--medium { background: var(--sev-medium); }
.sev-LOW .sev-dot, .sev-low .sev-dot, .severity-dot.low, .sev-dot.low, .sev-dot--low { background: var(--sev-low); }
.sev-INFO .sev-dot, .sev-info .sev-dot, .sev-informational .sev-dot, .severity-dot.info, .sev-dot.info { background: var(--sev-info); }
.text-critical, .sev-text-critical { color: var(--sev-critical); }
.text-high, .sev-text-high { color: var(--sev-high); }
.text-medium, .sev-text-medium { color: var(--sev-medium); }
.text-low, .sev-text-low { color: var(--sev-low); }

/* Severity meter (Register): four steps, filled to the level. Survives a
   black-and-white printer because the step count carries the level. */
.sev-meter { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sev-meter__bars { display: inline-grid; grid-template-columns: repeat(4, 4px); gap: 2px; align-items: end; block-size: 12px; }
.sev-meter__bars i { display: block; inline-size: 4px; background: var(--rule); border-radius: 1px; }
.sev-meter__bars i:nth-child(1) { block-size: 6px; }
.sev-meter__bars i:nth-child(2) { block-size: 8px; }
.sev-meter__bars i:nth-child(3) { block-size: 10px; }
.sev-meter__bars i:nth-child(4) { block-size: 12px; }
.sev-meter[data-level="1"] .sev-meter__bars i:nth-child(-n + 1),
.sev-meter[data-level="2"] .sev-meter__bars i:nth-child(-n + 2),
.sev-meter[data-level="3"] .sev-meter__bars i:nth-child(-n + 3),
.sev-meter[data-level="4"] .sev-meter__bars i:nth-child(-n + 4) { background: var(--c, var(--text)); }
.sev-meter[data-level="4"] { --c: var(--sev-critical); }
.sev-meter[data-level="3"] { --c: var(--sev-high); }
.sev-meter[data-level="2"] { --c: var(--sev-medium); }
.sev-meter[data-level="1"] { --c: var(--sev-low); }

/* A 100% stacked severity bar with 2px seams. */
.severity-bar { display: flex; gap: 2px; block-size: 8px; border-radius: 2px; overflow: hidden; background: var(--rule); }
.severity-bar__segment { block-size: 100%; min-inline-size: 2px; }

/* Progress: both ends labelled by the page, the fill the true ratio. */
.prog-bar, .progress { block-size: 6px; border-radius: var(--radius-full); background: var(--active); overflow: hidden; }
.prog-bar-inner, .progress__fill { block-size: 100%; border-radius: var(--radius-full); background: var(--accent); transition: inline-size 400ms var(--ease-standard), width 400ms var(--ease-standard); }


/* ==========================================================================
   9. TABS: underline on a full-width rule
   ========================================================================== */

.ds-tabs, .tabs-bar {
  display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none;
  margin-block-end: 20px; border-block-end: 1px solid var(--border);
}
.ds-tabs::-webkit-scrollbar { display: none; }
.ds-tab, .tab-btn {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 0; margin-block-end: -1px;
  border: 0; border-block-end: 2px solid transparent; background: none;
  color: var(--muted); font-size: var(--text-sm); font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.ds-tab svg, .tab-btn svg { inline-size: 15px; block-size: 15px; }
.ds-tab:hover, .tab-btn:hover { color: var(--text); }
.ds-tab[aria-selected="true"], .ds-tab.active, .tab-btn.active, .tab-btn[aria-selected="true"] { color: var(--text); font-weight: 600; border-block-end-color: var(--accent); }
.ds-tabpanel[hidden] { display: none !important; }


/* ==========================================================================
   10. STATES: empty, loading, error, logs
   ========================================================================== */

/* An empty block keeps its frame and states the next step in one sentence. */
.empty-state, .empty-state-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 28px 16px; text-align: center; color: var(--muted);
  border: 1px dashed var(--control); border-radius: var(--radius-lg);
}
td .empty-state, .table .empty-state { border: 0; }
.empty-state__icon, .empty-state-block .es-icon, .es-icon { color: var(--faint); margin-block-end: 2px; }
.empty-state__icon svg, .empty-state__icon i, .es-icon svg { inline-size: 20px; block-size: 20px; }
.empty-state__title, .es-title { font-weight: 600; color: var(--text); font-size: var(--text-sm); }
.empty-state__body, .es-body { max-inline-size: 440px; font-size: var(--text-sm); color: var(--muted); }
.empty-state .btn, .empty-state .btn-o, .empty-state .btn-primary { margin-block-start: 8px; }

/* Loading: a flat grey bar at the value's real size. No shimmer. */
.skeleton { background: var(--raised); border-radius: var(--radius-sm); color: transparent !important; min-block-size: 1em; }

.spin { animation: ds-spin 1s linear infinite; }
@keyframes ds-spin { to { transform: rotate(360deg); } }
@keyframes ds-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.num-tick { display: inline-block; transition: transform 150ms var(--ease-standard), opacity 150ms var(--ease-standard); }
.num-tick.out { transform: translateY(-4px); opacity: 0; }

.notice, .alert-box, .banner-note {
  padding: 10px 12px; border-radius: var(--radius-md); font-size: var(--text-sm);
  background: var(--pill-warning-bg); color: var(--pill-warning-ink); border: 1px solid var(--pill-warning-edge);
}
.notice--error, .error-box { background: var(--pill-critical-bg); color: var(--pill-critical-ink); border: 1px solid transparent; padding: 10px 12px; border-radius: var(--radius-md); }
.notice--info { background: var(--raised); color: var(--muted); border-color: var(--border); }

.log-box {
  padding: 14px 16px; background: var(--raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  font-family: var(--font-id); font-size: 12.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; overflow: auto; max-block-size: 420px;
}
.log-box .stderr { color: var(--negative); }
.log-box .stdout { color: var(--text); }

.mini-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-block-size: 40px; padding-block: 8px; border-block-end: 1px solid var(--rule);
}
.mini-row:last-child { border-block-end: 0; }
.mini-row__main { display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.mini-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-row__meta { flex: none; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }


/* ==========================================================================
   11. LAYOUT UTILITIES (a 12-column grid and the Bootstrap-style aliases
       existing pages use)
   ========================================================================== */

.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.row > * { grid-column: 1 / -1; min-inline-size: 0; }
.row.g-2 { gap: 8px; } .row.g-3 { gap: 16px; } .row.g-4 { gap: 24px; }
.col-12 { grid-column: span 12; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
@media (min-width: 768px) {
  .col-md-3 { grid-column: span 3; } .col-md-4 { grid-column: span 4; } .col-md-5 { grid-column: span 5; }
  .col-md-6 { grid-column: span 6; } .col-md-7 { grid-column: span 7; } .col-md-8 { grid-column: span 8; } .col-md-12 { grid-column: span 12; }
}
@media (min-width: 992px) {
  .col-lg-3 { grid-column: span 3; } .col-lg-4 { grid-column: span 4; } .col-lg-6 { grid-column: span 6; } .col-lg-8 { grid-column: span 8; }
}
@media (min-width: 1200px) {
  .col-xl-5 { grid-column: span 5; } .col-xl-7 { grid-column: span 7; }
}
.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.d-flex { display: flex; } .d-grid { display: grid; } .d-none { display: none !important; } .d-block { display: block; }
.flex-wrap { flex-wrap: wrap; } .flex-column { flex-direction: column; } .flex-1 { flex: 1; min-inline-size: 0; }
.align-items-center { align-items: center; } .align-items-start { align-items: flex-start; } .align-items-end { align-items: flex-end; }
.justify-content-between { justify-content: space-between; } .justify-content-end { justify-content: flex-end; } .justify-content-center { justify-content: center; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.w-100 { inline-size: 100%; } .h-100 { block-size: 100%; }
.text-center { text-align: center; } .text-end, .text-right { text-align: end; } .text-start { text-align: start; }
.text-muted, .muted { color: var(--muted); } .text-faint { color: var(--faint); }
.text-xs { font-size: var(--text-xs); } .text-sm { font-size: var(--text-sm); }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }
.m-0 { margin: 0; } .mb-0 { margin-block-end: 0; } .mb-1 { margin-block-end: 4px; } .mb-2 { margin-block-end: 8px; }
.mb-3 { margin-block-end: 16px; } .mb-4 { margin-block-end: 24px; } .mb-5 { margin-block-end: 32px; }
.mt-0 { margin-block-start: 0; } .mt-1 { margin-block-start: 4px; } .mt-2 { margin-block-start: 8px; } .mt-3 { margin-block-start: 16px; } .mt-4 { margin-block-start: 24px; }
.ms-auto { margin-inline-start: auto; } .me-2 { margin-inline-end: 8px; }
.p-0 { padding: 0; } .p-2 { padding: 8px; } .p-3 { padding: 16px; } .p-4 { padding: 20px; } .p-5 { padding: 28px; }
.py-2 { padding-block: 8px; } .py-3 { padding-block: 16px; } .py-4 { padding-block: 24px; }
.px-3 { padding-inline: 16px; }
.hide-phone { }
@media (max-width: 640px) { .hide-phone { display: none !important; } }


/* ==========================================================================
   12. MOTION AND PRINT
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media print {
  :root { --ground: #fff; }
  .sidebar, .topbar, .sidebar-overlay, .toast-container, .cmd-palette-overlay, .page-head__actions { display: none !important; }
  .main { margin: 0 !important; }
  .content { margin: 0; border: 0; padding: 0; }
  .card, .card-d, .chart-card, .kpi-compact { break-inside: avoid; }
}

/* ── Query panel (pass 2): the "choose what to look at, then run" surface
   used by the tool pages. Labelled fields on one row, the run action at
   the end of the row, an optional note underneath. ── */
.qp{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-lg);margin-bottom:var(--gap);}
.qp-body{display:flex;flex-wrap:wrap;gap:16px 20px;align-items:flex-end;padding:20px 24px;}
.qp-field{display:flex;flex-direction:column;gap:6px;min-width:0;flex:1 1 240px;max-width:420px;}
.qp-field > label{font-size:14px;font-weight:500;color:var(--text);}
.qp-field > label span{color:var(--muted);font-weight:400;}
.qp-field .form-select,.qp-field .form-input{width:100%;min-width:0 !important;}
.qp-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.qp-foot{display:flex;align-items:center;gap:8px;padding:12px 24px;border-top:1px solid var(--border);font-size:13px;color:var(--muted);}
.qp-foot svg{width:14px;height:14px;flex:none;}
.qp-group{display:flex;flex-direction:column;gap:6px;min-width:0;}
.qp-group > .qp-lbl{font-size:14px;font-weight:500;color:var(--text);}
.toggle-chips{display:flex;flex-wrap:wrap;gap:6px;}
.toggle-chips .chip{min-height:36px;padding:0 12px;border-radius:999px;border:1px solid var(--control);background:var(--surface);color:var(--muted);font:500 13px/1 var(--font);cursor:pointer;display:inline-flex;align-items:center;}
.toggle-chips .chip:hover{border-color:var(--text);color:var(--text);}
.toggle-chips .chip.on{background:var(--text);border-color:var(--text);color:var(--surface);font-weight:500;}
.toggle-chips .chip svg{display:none;}
.kpi-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--surface);margin-bottom:var(--gap);overflow:hidden;}
@media (max-width:640px){.qp-body{padding:16px;} .qp-foot{padding:12px 16px;} .qp-field{max-width:none;flex-basis:100%;} .qp-actions{width:100%;} .qp-actions > .btn-primary{flex:1;justify-content:center;}}
