/*
 * Monarail Console (staff). The shared Monarail foundation (packages/design-system/design-system-v2.css: tokens, the licensed faces,
 * buttons, inputs, tables, notices, dialogs, loading and empty states) is spliced in at the marker below by scripts/build.mjs.
 * This file only lays out the staff frame (Paper 3b) and the review surfaces on the shared tokens; it defines no colour, size or
 * radius of its own.
 */
/* ============================================================================
   Monarail design system — shared foundation
   (class and token prefix still `aex-v2`; the rename to `monarail` is a
   separate mechanical sweep)

   One file, two surfaces. The site loads it directly. The console build
   (backend/public/agent-exchange-control-plane/build.mjs) splices it into the
   console stylesheet at the @@shared-design-system@@ marker and rewrites the
   font URLs. The decisions live in the Paper file "Design System", page
   "0 · Decided"; this file is their code form. Never patch a surface around
   it — change the rule here, then look at both surfaces.

   Decided 2026-09-09/10:
     colour  — grey backgrounds always; colour only by role (lake, lake-green,
               credit gold as a mark); status green/amber/red inside badges.
     type    — ABC Diatype for every word; Geist Mono for figures inside data
               components (plain zero, ss09) and for code; weights 400/500 only.
     scale   — site: five sizes 46/32/20/14/11; product: measured 17/13/12/11/10.
     buttons — one step away from the surface they sit on; hover lifts 1px,
               press settles; quiet buttons only change fill; focus never lifts.
   ========================================================================== */

/* Monarail Console reconciliation to Paper "0 · Decided" (T9, 2026-10-08;
   source: snips-v2 0c3e7192 site/assets/design-system-v2.css). Where this
   code form and the Decided page differ, the Decided page wins, here, for
   every surface:
     product line heights — §2: body 13/18, dense 12/16, label 11/14,
                            caption 10/14, component title 15/20;
     focus                — §10: a 1px lake-500 ring with a 3px lake-100 halo
                            on every control (buttons and selects included);
     notice radius        — 9b: notices sit on a 6px radius.
   Focus is declared after the quiet and disabled button states, so a
   focused quiet button keeps its halo under the pointer and while pressed.
   Two containment corrections, no new token: the focus ring appears at
   once (it is not eased in with the hover shadow), and a table wrapper is
   the containing block of its visually hidden labels, so they cannot widen
   the page outside the wrapper's own scroll.
   The 3b page anatomy and the 9b operator wordmark are application shell
   rules and live with each console's shell. */

@font-face {
  font-family: 'ABCDiatype';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/ABCDiatype-Regular.a673720520b4f039.woff2') format('woff2');
}

@font-face {
  font-family: 'ABCDiatype';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/ABCDiatype-Medium.bdcca7f0c53eb392.woff2') format('woff2');
}

@font-face {
  font-family: 'GeistMono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/GeistMono-Regular.a8eb1f882a9c87d4.woff2') format('woff2');
}

@font-face {
  font-family: 'GeistMono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/GeistMono-Medium.0850781900f50dd8.woff2') format('woff2');
}

:root {
  /* Families — two, one job each */
  --aex-v2-font-ui: 'ABCDiatype', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --aex-v2-font-marketing: var(--aex-v2-font-ui);
  --aex-v2-font-display: var(--aex-v2-font-ui);
  --aex-v2-font-numeric: 'GeistMono', 'SF Mono', SFMono-Regular, Menlo, monospace;
  --aex-v2-font-code: var(--aex-v2-font-numeric);
  --aex-v2-font-mono: var(--aex-v2-font-numeric);

  /* Weights — two working weights; nothing asks for more */
  --aex-v2-weight-regular: 400;
  --aex-v2-weight-medium: 500;

  /* Site type scale (five steps); line heights follow the role inside a step */
  --aex-v2-size-1: 46px; --aex-v2-lh-1: 50px;
  --aex-v2-size-2: 32px; --aex-v2-lh-2: 36px;
  --aex-v2-size-3: 20px; --aex-v2-lh-3: 26px; --aex-v2-lh-3-lead: 32px;
  --aex-v2-size-4: 14px; --aex-v2-lh-4: 21px;
  --aex-v2-size-5: 11px; --aex-v2-lh-5: 14px;

  /* Product type scale — measured from the console; confirmation is an open decision */
  --aex-v2-text-product-title: 17px;  --aex-v2-lh-product-title: 22px;
  --aex-v2-text-product-component-title: 15px; --aex-v2-lh-product-component-title: 20px;
  --aex-v2-text-product-body: 13px;   --aex-v2-lh-product-body: 18px;
  --aex-v2-text-product-note: 12px;   --aex-v2-lh-product-note: 16px;
  --aex-v2-text-product-label: 11px;  --aex-v2-lh-product-label: 14px;
  --aex-v2-text-product-tag: 10px;    --aex-v2-lh-product-tag: 14px;
  --aex-v2-text-product-metric: 25px; --aex-v2-lh-product-metric: 32px;

  /* Grey scale — every background lives here (node grey = 400) */
  --aex-v2-grey-50: #FAFAFA;
  --aex-v2-grey-100: #F5F5F5;
  --aex-v2-grey-200: #EBEBEB;
  --aex-v2-grey-300: #D9D9D9;
  --aex-v2-grey-400: #C4C4C4;
  --aex-v2-grey-500: #9B9B9B;
  --aex-v2-grey-600: #767676;
  --aex-v2-grey-700: #575757;
  --aex-v2-grey-800: #333333;
  --aex-v2-grey-900: #1A1A1A;
  --aex-v2-grey-950: #111111;

  /* Lake scale — the blue accent, anchored on 200 */
  --aex-v2-lake-50: #EDF4F8;
  --aex-v2-lake-100: #DAEAF1;
  --aex-v2-lake-200: #B1D5E6;
  --aex-v2-lake-300: #8CC0D9;
  --aex-v2-lake-400: #60A6C7;
  --aex-v2-lake-500: #3A84A6;
  --aex-v2-lake-600: #2E6C8A;
  --aex-v2-lake-700: #24546B;
  --aex-v2-lake-800: #1C3B4A;

  /* Lake-green scale — the green end of the lake, for cash */
  --aex-v2-lake-green-100: #DBF0EF;
  --aex-v2-lake-green-200: #B7E1E0;
  --aex-v2-lake-green-300: #92D3D0;
  --aex-v2-lake-green-400: #60BEBB;
  --aex-v2-lake-green-500: #3EA39F;
  --aex-v2-lake-green-600: #308885;
  --aex-v2-lake-green-700: #256A67;

  /* Roles — colour is assigned by what a thing means, never by where it sits */
  --aex-v2-role-node: var(--aex-v2-lake-200);
  --aex-v2-role-link: var(--aex-v2-lake-600);
  --aex-v2-role-link-underline: var(--aex-v2-lake-300);
  --aex-v2-role-activity: var(--aex-v2-lake-500);
  --aex-v2-role-activity-text: var(--aex-v2-lake-600);
  --aex-v2-role-chart-area: var(--aex-v2-lake-100);
  --aex-v2-role-focus: var(--aex-v2-lake-500);
  --aex-v2-role-focus-halo: var(--aex-v2-lake-100);
  --aex-v2-role-selection-edge: var(--aex-v2-lake-500);
  --aex-v2-role-money: var(--aex-v2-lake-green-500);
  --aex-v2-role-money-text: var(--aex-v2-lake-green-700);
  --aex-v2-role-credit: #C9940E; /* marks only: bars, coin mark. Never text, never a badge. */

  /* Status — inside badges only */
  --aex-v2-success: #247451;
  --aex-v2-success-fill: #E8F5EE;
  --aex-v2-warning: #8A5A00;
  --aex-v2-warning-fill: #FDF3E0;
  --aex-v2-danger: #B42318;
  --aex-v2-danger-fill: #FEE8E8;
  --aex-v2-danger-strong: #9E1F15;
  --aex-v2-live: var(--aex-v2-success);
  --aex-v2-live-fill: var(--aex-v2-success-fill);

  /* Legacy names, mapped onto the roles so older rules land on the system */
  --aex-v2-brand-black: var(--aex-v2-grey-950);
  --aex-v2-brand-blue: var(--aex-v2-role-activity);
  --aex-v2-action: var(--aex-v2-role-link);
  --aex-v2-action-strong: var(--aex-v2-lake-700);
  --aex-v2-action-soft: var(--aex-v2-lake-50);
  --aex-v2-focus: var(--aex-v2-role-focus);

  /* Light materials */
  --aex-v2-surface: #FFFFFF;
  --aex-v2-surface-raised: var(--aex-v2-grey-50);
  --aex-v2-surface-recessed: var(--aex-v2-grey-100);
  --aex-v2-surface-inverse: var(--aex-v2-grey-950);
  --aex-v2-text: var(--aex-v2-grey-900);
  --aex-v2-text-secondary: var(--aex-v2-grey-700);
  --aex-v2-text-tertiary: var(--aex-v2-grey-600);
  --aex-v2-text-disabled: rgba(0, 0, 0, 0.38);
  --aex-v2-on-inverse: #FFFFFF;
  --aex-v2-fill: rgba(0, 0, 0, 0.04);
  --aex-v2-fill-strong: rgba(0, 0, 0, 0.08);
  --aex-v2-border: rgba(0, 0, 0, 0.10);
  --aex-v2-border-strong: rgba(0, 0, 0, 0.16);
  --aex-v2-scrim: rgba(0, 0, 0, 0.40);
  --aex-v2-selection: var(--aex-v2-lake-200);

  /* 4px spatial scale */
  --aex-v2-space-1: 4px;
  --aex-v2-space-2: 8px;
  --aex-v2-space-3: 12px;
  --aex-v2-space-4: 16px;
  --aex-v2-space-5: 20px;
  --aex-v2-space-6: 24px;
  --aex-v2-space-8: 32px;
  --aex-v2-space-10: 40px;
  --aex-v2-space-12: 48px;
  --aex-v2-space-16: 64px;
  --aex-v2-space-20: 80px;
  --aex-v2-space-24: 96px;
  --aex-v2-space-32: 128px;

  /* Geometry */
  --aex-v2-control-dense: 26px;
  --aex-v2-control: 32px;
  --aex-v2-control-touch: 44px;
  /* Radius is a containment ladder, +2 per level: a surface is one step
     softer than the controls it holds, never the same and never sharper. A
     card at the button's own radius makes the button look rounder than the
     box around it. The textbook rule is outer = inner + padding, which at
     16-20px padding would give 24-28px — far too soft for this system's
     character — so the ladder steps once per level instead. Marks, bars and
     meters under 8px tall stay at 2-3px; at 8px they read as lozenges. */
  --aex-v2-radius-control-sm: 6px;
  --aex-v2-radius-control: 8px;
  --aex-v2-radius-card: 10px;
  --aex-v2-radius-menu: 12px;
  --aex-v2-radius-dialog: 14px;
  --aex-v2-radius-pill: 9999px;

  /* Elevation */
  --aex-v2-shadow-button: 0 1px 2px rgba(0, 0, 0, 0.06);
  --aex-v2-shadow-button-hover: 0 3px 8px rgba(0, 0, 0, 0.08);
  --aex-v2-shadow-low: 0 1px 1px rgba(0, 0, 0, 0.06), 0 2px 2px rgba(0, 0, 0, 0.04);
  --aex-v2-shadow-middle: 0 2px 4px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.05);
  --aex-v2-shadow-high: 0 4px 8px rgba(0, 0, 0, 0.08), 0 24px 48px rgba(0, 0, 0, 0.10);

  /* Motion */
  --aex-v2-duration-instant: 100ms;
  --aex-v2-duration-fast: 150ms;
  --aex-v2-duration-medium: 250ms;
  --aex-v2-duration-slow: 400ms;
  --aex-v2-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --aex-v2-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);

  /* Layout */
  --aex-v2-container: 1000px;
  --aex-v2-sidebar: 240px;
  --aex-v2-inspector: 320px;
  --aex-v2-header: 56px;
}

@media (max-width: 640px) {
  :root {
    --aex-v2-size-1: 34px; --aex-v2-lh-1: 38px;
    --aex-v2-size-2: 26px; --aex-v2-lh-2: 30px;
    --aex-v2-size-3: 18px; --aex-v2-lh-3: 24px; --aex-v2-lh-3-lead: 28px;
  }
}

[data-aex-v2-theme='dark'] {
  --aex-v2-surface: #1C1C1E;
  --aex-v2-surface-raised: #2C2C2E;
  --aex-v2-surface-recessed: #0A0A0A;
  --aex-v2-surface-inverse: #F5F5F5;
  --aex-v2-text: #F5F5F5;
  --aex-v2-text-secondary: rgba(255, 255, 255, 0.68);
  --aex-v2-text-tertiary: rgba(255, 255, 255, 0.52);
  --aex-v2-text-disabled: rgba(255, 255, 255, 0.30);
  --aex-v2-on-inverse: #1A1A1A;
  --aex-v2-fill: rgba(255, 255, 255, 0.06);
  --aex-v2-fill-strong: rgba(255, 255, 255, 0.12);
  --aex-v2-border: rgba(255, 255, 255, 0.10);
  --aex-v2-border-strong: rgba(255, 255, 255, 0.18);
  --aex-v2-scrim: rgba(0, 0, 0, 0.62);
}
.aex-v2,
.aex-v2 *,
.aex-v2 *::before,
.aex-v2 *::after {
  box-sizing: border-box;
}

.aex-v2 {
  margin: 0;
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface);
  font-family: var(--aex-v2-font-ui);
  font-size: var(--aex-v2-size-4);
  line-height: var(--aex-v2-lh-4);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.aex-v2 button,
.aex-v2 input {
  font: inherit;
}

.aex-v2 button,
.aex-v2 a {
  -webkit-tap-highlight-color: transparent;
}

.aex-v2 a {
  color: inherit;
  text-decoration: none;
}

.aex-v2 button {
  color: inherit;
}

/* Two weights: emphasis is Medium, never Bold (no 700 face ships). */
.aex-v2 strong,
.aex-v2 b {
  font-weight: 500;
}

/* Code and identifiers take the code face, not the browser's monospace. */
.aex-v2 code,
.aex-v2 pre,
.aex-v2 kbd,
.aex-v2 samp {
  font-family: var(--aex-v2-font-code);
}

.aex-v2 ::selection {
  color: var(--aex-v2-text);
  background: var(--aex-v2-selection);
}

/* §10: a 1px lake-500 ring with a 3px lake-100 halo on every control. */
.aex-v2 :focus-visible {
  outline: 1px solid var(--aex-v2-role-focus);
  outline-offset: 0;
  box-shadow: 0 0 0 4px var(--aex-v2-role-focus-halo);
}

/* Links inside prose take the link role; navigation and cards stay inherit. */
.aex-v2-link {
  color: var(--aex-v2-role-link);
  text-decoration: underline;
  text-decoration-color: var(--aex-v2-role-link-underline);
  text-underline-offset: 2px;
}

.aex-v2-link:hover {
  text-decoration-color: currentColor;
}

/* A field whose label is the wrapping <label>: label text above the control. */
label.aex-v2-field > span:first-child,
.aex-v2-field > span:first-child {
  color: var(--aex-v2-text-secondary);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
}

.aex-v2-nowrap {
  white-space: nowrap;
}

/* A value that will not fit takes one line and an ellipsis, with the full
   string on the element's title. Wrapping a name to three lines to save a
   character sets the row height for the whole table. */
.aex-v2-truncate {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Empty state: a quiet grey tile with one line of guidance. */
.aex-v2-empty {
  padding: var(--aex-v2-space-5);
  background: var(--aex-v2-grey-100);
  border-radius: var(--aex-v2-radius-card);
}

.aex-v2-empty strong {
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.aex-v2-empty p {
  max-width: 60ch;
  margin: 4px 0 0;
  color: var(--aex-v2-text-secondary);
  font-size: 12px;
  line-height: 16px;
}

/* Numeric role: figures inside data components, plain zero, tabular. Never a sentence. */
.aex-v2-numeric {
  font-family: var(--aex-v2-font-numeric);
  font-feature-settings: "ss09";
  font-variant-numeric: tabular-nums;
}

.aex-v2-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.aex-v2-skip {
  position: fixed;
  top: var(--aex-v2-space-3);
  left: var(--aex-v2-space-3);
  z-index: 200;
  transform: translateY(-80px);
  padding: var(--aex-v2-space-2) var(--aex-v2-space-3);
  color: #fff;
  background: var(--aex-v2-action-strong);
  border-radius: var(--aex-v2-radius-control-sm);
  transition: transform var(--aex-v2-duration-fast) var(--aex-v2-ease-standard);
}

.aex-v2-skip:focus {
  transform: translateY(0);
}

.aex-v2-container {
  width: min(calc(100% - 40px), var(--aex-v2-container));
  margin-inline: auto;
}

.aex-v2-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-ui);
  font-size: var(--aex-v2-size-4);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  white-space: nowrap;
}

.aex-v2-mark {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--aex-v2-brand-blue);
  background: var(--aex-v2-brand-black);
  border-radius: 5px;
  font-family: var(--aex-v2-font-mono);
  font-size: 9px;
  letter-spacing: -0.04em;
}

.aex-v2-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--aex-v2-header);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.aex-v2-topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(calc(100% - 32px), 1400px);
  height: 100%;
  margin-inline: auto;
}

.aex-v2-topnav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: var(--aex-v2-size-4);
  color: var(--aex-v2-text-secondary);
}

.aex-v2-topnav a {
  transition: color var(--aex-v2-duration-fast) var(--aex-v2-ease-standard);
}

.aex-v2-topnav a:hover {
  color: var(--aex-v2-text);
}

.aex-v2-status {
  justify-self: end;
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-hero {
  display: flex;
  min-height: calc(100svh - var(--aex-v2-header));
  align-items: center;
  padding: var(--aex-v2-space-16) 0 var(--aex-v2-space-24);
}

.aex-v2-hero-inner {
  width: 100%;
}

.aex-v2-hero-copy {
  max-width: 850px;
  margin: 0 auto var(--aex-v2-space-12);
  text-align: center;
}

.aex-v2-eyebrow {
  margin: 0 0 var(--aex-v2-space-4);
  color: var(--aex-v2-text-secondary);
  font-size: var(--aex-v2-size-5);
  font-weight: 500;
  line-height: var(--aex-v2-lh-5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aex-v2-hero h1 {
  margin: 0;
  font-family: var(--aex-v2-font-display);
  font-size: var(--aex-v2-size-1);
  font-weight: 500;
  line-height: var(--aex-v2-lh-1);
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.aex-v2-hero-lead {
  max-width: 620px;
  margin: var(--aex-v2-space-5) auto 0;
  color: var(--aex-v2-text-secondary);
  font-size: 18px;
  line-height: 28px;
  text-wrap: balance;
}

.aex-v2-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--aex-v2-space-3);
  margin-top: var(--aex-v2-space-6);
}

.aex-v2-btn {
  display: inline-flex;
  min-height: var(--aex-v2-control);
  align-items: center;
  justify-content: center;
  gap: var(--aex-v2-space-2);
  padding: 0 14px;
  color: var(--aex-v2-text);
  border: 1px solid transparent;
  border-radius: var(--aex-v2-radius-control);
  cursor: pointer;
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  transition:
    color var(--aex-v2-duration-fast) var(--aex-v2-ease-standard),
    background var(--aex-v2-duration-fast) var(--aex-v2-ease-standard),
    border-color var(--aex-v2-duration-fast) var(--aex-v2-ease-standard),
    box-shadow var(--aex-v2-duration-fast) var(--aex-v2-ease-standard),
    transform var(--aex-v2-duration-fast) var(--aex-v2-ease-standard);
}

/* Motion: filled and bordered buttons lift on hover and settle on press;
   quiet buttons only change fill; focus never lifts. */
.aex-v2-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--aex-v2-shadow-button-hover);
}

.aex-v2-btn:active {
  transform: translateY(1px);
  box-shadow: var(--aex-v2-shadow-button);
}

.aex-v2-btn:disabled,
.aex-v2-btn-quiet:hover,
.aex-v2-btn-quiet:active {
  transform: none;
  box-shadow: none;
}

/* Focus never lifts; it keeps the §10 halo (the ring is the outline above),
   shown at once rather than eased in. */
.aex-v2-btn:focus-visible {
  transform: none;
  transition: none;
  box-shadow: 0 0 0 4px var(--aex-v2-role-focus-halo);
}

@media (prefers-reduced-motion: reduce) {
  .aex-v2-btn:hover,
  .aex-v2-btn:active {
    transform: none;
  }
}

/* Primary: one step down from white. On a grey surface (.aex-v2-on-grey) it
   flips to white with a hairline and a soft shadow. `-console` is the same
   button under the console's older name. */
.aex-v2 .aex-v2-btn-primary,
.aex-v2 .aex-v2-btn-console {
  color: var(--aex-v2-text);
  background: var(--aex-v2-grey-200);
}

.aex-v2 .aex-v2-btn-primary:hover,
.aex-v2 .aex-v2-btn-console:hover {
  color: var(--aex-v2-text);
  background: var(--aex-v2-grey-300);
}

.aex-v2 .aex-v2-on-grey .aex-v2-btn-primary,
.aex-v2 .aex-v2-on-grey .aex-v2-btn-console {
  background: var(--aex-v2-surface);
  border-color: var(--aex-v2-border);
  box-shadow: var(--aex-v2-shadow-button);
}

.aex-v2 .aex-v2-on-grey .aex-v2-btn-primary:hover,
.aex-v2 .aex-v2-on-grey .aex-v2-btn-console:hover {
  background: var(--aex-v2-grey-50);
  box-shadow: var(--aex-v2-shadow-button-hover);
}

.aex-v2-btn-secondary {
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface);
  border-color: var(--aex-v2-border-strong);
}

.aex-v2-btn-secondary:hover {
  background: var(--aex-v2-grey-50);
}

.aex-v2-on-grey .aex-v2-btn-secondary {
  background: transparent;
}

.aex-v2-on-grey .aex-v2-btn-secondary:hover {
  background: var(--aex-v2-surface);
}

.aex-v2-btn-quiet {
  color: var(--aex-v2-text-secondary);
  background: transparent;
}

.aex-v2-btn-quiet:hover {
  color: var(--aex-v2-text);
  background: var(--aex-v2-grey-100);
}

.aex-v2-btn-danger {
  color: #fff;
  background: var(--aex-v2-danger);
}

.aex-v2-btn-danger:hover {
  color: #fff;
  background: var(--aex-v2-danger-strong);
}

.aex-v2-btn-pill {
  border-radius: var(--aex-v2-radius-pill);
}

.aex-v2-icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.aex-v2-demo {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  max-width: 860px;
  margin-inline: auto;
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border-strong);
  border-radius: var(--aex-v2-radius-card);
  box-shadow: var(--aex-v2-shadow-middle);
}

.aex-v2-demo-bar {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--aex-v2-space-4);
  border-bottom: 1px solid var(--aex-v2-border);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  line-height: 15px;
}

.aex-v2-demo-title,
.aex-v2-live-label {
  display: inline-flex;
  align-items: center;
  gap: var(--aex-v2-space-2);
}

.aex-v2-live-label {
  color: var(--aex-v2-live);
}

.aex-v2-live-dot {
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--aex-v2-live-fill);
}

.aex-v2-query {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--aex-v2-space-3);
  padding: var(--aex-v2-space-4);
  border-bottom: 1px solid var(--aex-v2-border);
}

.aex-v2-query label {
  min-width: 0;
}

.aex-v2-input {
  width: 100%;
  min-height: var(--aex-v2-control);
  padding: 0 var(--aex-v2-space-3);
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border-strong);
  border-radius: var(--aex-v2-radius-control);
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  line-height: 16px;
}

.aex-v2-input::placeholder {
  color: var(--aex-v2-text-tertiary);
}

.aex-v2-input:focus-visible {
  outline: 0;
  border-color: var(--aex-v2-role-focus);
  box-shadow: 0 0 0 3px var(--aex-v2-role-focus-halo);
}

/* Toolbar above a list: tabs and filters start-aligned, search and the view's
   one action end-aligned. The filled primary is what makes the search read as
   part of the group. */
.aex-v2-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--aex-v2-space-3);
  min-height: var(--aex-v2-control);
  margin-bottom: var(--aex-v2-space-3);
}

.aex-v2-toolbar-start,
.aex-v2-toolbar-end {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--aex-v2-space-2);
}

.aex-v2-toolbar-end {
  margin-left: auto;
}

.aex-v2-toolbar-end > .aex-v2-btn,
.aex-v2-toolbar-end > .aex-v2-select {
  flex: none;
}

/* Search: a white hairline input with a leading magnifier. */
.aex-v2-input-search {
  width: min(240px, 100%);
  min-height: var(--aex-v2-control);
  padding: 0 10px 0 30px;
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23767676' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center;
  border: 1px solid var(--aex-v2-border-strong);
  border-radius: var(--aex-v2-radius-control);
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  line-height: 16px;
}

.aex-v2-input-search-wide {
  width: 100%;
}

.aex-v2-input-search::placeholder {
  color: var(--aex-v2-text-tertiary);
}

.aex-v2-input-search:focus-visible {
  outline: 0;
  border-color: var(--aex-v2-role-focus);
  box-shadow: 0 0 0 3px var(--aex-v2-role-focus-halo);
}

.aex-v2-input-search::-webkit-search-decoration,
.aex-v2-input-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Filter select: reads as a secondary button with a chevron. The list itself is native. */
.aex-v2-select {
  appearance: none;
  -webkit-appearance: none;
  min-height: var(--aex-v2-control);
  padding: 0 28px 0 12px;
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface) 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='%23575757' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--aex-v2-border-strong);
  border-radius: var(--aex-v2-radius-control);
  cursor: pointer;
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}

.aex-v2-select:hover {
  background-color: var(--aex-v2-grey-50);
}

.aex-v2-select:focus-visible {
  outline: 1px solid var(--aex-v2-role-focus);
  outline-offset: 0;
  box-shadow: 0 0 0 4px var(--aex-v2-role-focus-halo);
}

/* Select box: the native <select> stays for forms and assistive tech, hidden;
   the trigger and the option list are the anchored menu, the same one the
   row actions use. Inline (toolbar filter) or block (a form field). */
/* Dense: a select that lives inside a card's head, beside an 11px label.
   The full 32px control out-weighs the label it sits next to. */
.aex-v2-select-dense,
.aex-v2-selectbox.is-dense .aex-v2-selectbox-trigger {
  min-height: 26px;
  height: 26px;
  /* The right inset keeps the chevron's lane — .aex-v2-select draws it as a
     background image at `right 10px`, so a symmetric padding would put the
     value underneath it. */
  padding: 0 24px 0 10px;
  font-size: 12px;
}

.aex-v2-select-dense,
.aex-v2-selectbox.is-dense .aex-v2-selectbox-trigger {
  background-position: right 8px center;
}

.aex-v2-selectbox {
  position: relative;
  display: block;
  min-width: 0;
}

.aex-v2-selectbox.is-inline {
  display: inline-block;
  flex: none; /* never shrink below the trigger inside a toolbar */
  min-width: max-content;
}

.aex-v2-selectbox-native {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.aex-v2-selectbox-trigger {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.aex-v2-selectbox:not(.is-inline) .aex-v2-selectbox-trigger {
  font-weight: 400;
}

.aex-v2-selectbox.is-inline .aex-v2-selectbox-trigger {
  width: auto;
}

.aex-v2-selectbox-trigger[aria-expanded="true"] {
  border-color: var(--aex-v2-role-focus);
  box-shadow: 0 0 0 3px var(--aex-v2-role-focus-halo);
}

.aex-v2-selectbox-trigger:disabled {
  color: var(--aex-v2-text-disabled);
  background-color: var(--aex-v2-surface-recessed);
  cursor: not-allowed;
}

.aex-v2-selectbox-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aex-v2-select-menu {
  position: fixed;
  z-index: 1000; /* above dialogs: a select inside a modal opens over it */
  max-height: 320px;
  overflow: auto;
}

.aex-v2-select-menu .aex-v2-menu-item {
  justify-content: space-between;
}

.aex-v2-select-menu .aex-v2-menu-item.is-selected {
  color: var(--aex-v2-text);
}

.aex-v2-selectbox-check {
  width: 14px;
  height: 14px;
  flex: none;
  visibility: hidden;
}

.aex-v2-menu-item.is-selected .aex-v2-selectbox-check {
  visibility: visible;
}

.aex-v2-demo-meta {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: var(--aex-v2-space-3);
  padding: 0 var(--aex-v2-space-4);
  color: var(--aex-v2-text-secondary);
  background: var(--aex-v2-surface-raised);
  border-bottom: 1px solid var(--aex-v2-border);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-demo-tabs {
  display: flex;
  align-items: center;
  gap: var(--aex-v2-space-1);
}

.aex-v2-demo-tab {
  padding: 4px 8px;
  color: var(--aex-v2-text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--aex-v2-radius-control-sm);
  font-size: 11px;
}

.aex-v2-demo-tab[aria-selected='true'] {
  color: var(--aex-v2-text);
  background: var(--aex-v2-fill-strong);
}

.aex-v2-table-wrap {
  position: relative;
  overflow-x: auto;
}

.aex-v2-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  line-height: 16px;
}

.aex-v2-table th {
  height: 34px;
  padding: 0 var(--aex-v2-space-4);
  color: var(--aex-v2-text-tertiary);
  border-bottom: 1px solid var(--aex-v2-border);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  text-align: left;
  white-space: nowrap;
}

.aex-v2-table td {
  height: 48px;
  padding: var(--aex-v2-space-2) var(--aex-v2-space-4);
  border-bottom: 1px solid var(--aex-v2-border);
  vertical-align: middle;
}

.aex-v2-table-dense td {
  height: 40px;
}

.aex-v2-table tr:last-child td {
  border-bottom: 0;
}

.aex-v2-table tbody tr {
  transition: background var(--aex-v2-duration-fast) var(--aex-v2-ease-standard);
}

.aex-v2-table tbody tr:hover {
  background: var(--aex-v2-fill);
}

/* Figures: right-aligned; the cells take the numeric role. Only cells, never
   the whole table — Diatype's tabular setting also widens word spaces. */
.aex-v2-table-number {
  text-align: right !important;
}

/* The trailing action column: a fixed 56px slot with its control centred, so
   the ⋯ reads as its own column instead of hanging off the table's edge. */
.aex-v2-table-actions {
  width: 56px;
  text-align: center !important;
  white-space: nowrap;
}

td.aex-v2-table-number {
  font-family: var(--aex-v2-font-numeric);
  font-feature-settings: "ss09";
  font-variant-numeric: tabular-nums;
}

.aex-v2-record {
  display: grid;
  gap: 2px;
}

.aex-v2-record strong {
  font-weight: 500;
}

.aex-v2-record small {
  color: var(--aex-v2-text-secondary);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-record small.record-connected {
  color: var(--aex-v2-live);
}

.aex-v2-tag {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: var(--aex-v2-text-secondary);
  background: var(--aex-v2-fill);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-pill);
  font-family: var(--aex-v2-font-ui);
  font-size: 10px;
  font-weight: 500;
  line-height: 13px;
  white-space: nowrap;
}

.aex-v2-tag-live {
  color: var(--aex-v2-live);
  background: var(--aex-v2-live-fill);
  border-color: transparent;
}

.aex-v2-tag-warning {
  color: var(--aex-v2-warning);
  background: var(--aex-v2-warning-fill);
  border-color: transparent;
}

.aex-v2-tag-danger {
  color: var(--aex-v2-danger);
  background: var(--aex-v2-danger-fill);
  border-color: transparent;
}

.aex-v2-reward {
  font-weight: 500;
  white-space: nowrap;
}

.aex-v2-section {
  padding: var(--aex-v2-space-32) 0 0;
}

.aex-v2-section:last-of-type {
  padding-bottom: var(--aex-v2-space-32);
}

.aex-v2-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: var(--aex-v2-space-8);
  align-items: end;
  margin-bottom: var(--aex-v2-space-10);
}

.aex-v2-section-kicker {
  margin: 0 0 var(--aex-v2-space-3);
  color: var(--aex-v2-text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.aex-v2-section h2 {
  margin: 0;
  font-family: var(--aex-v2-font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.aex-v2-section-intro {
  margin: 0;
  color: var(--aex-v2-text-secondary);
  font-size: 16px;
  line-height: 26px;
}

.aex-v2-console-frame {
  overflow: hidden;
  min-height: 680px;
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border-strong);
  border-radius: var(--aex-v2-radius-card);
  box-shadow: var(--aex-v2-shadow-low);
  font-family: var(--aex-v2-font-ui);
}

.aex-v2-console-grid {
  display: grid;
  grid-template-columns: var(--aex-v2-sidebar) minmax(0, 1fr);
  min-height: 680px;
}

.aex-v2-sidebar {
  display: flex;
  flex-direction: column;
  padding: var(--aex-v2-space-2);
  border-right: 1px solid var(--aex-v2-border);
}

.aex-v2-sidebar-brand {
  display: flex;
  height: 42px;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--aex-v2-space-2);
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
}

.aex-v2-sidebar-groups {
  display: grid;
  gap: var(--aex-v2-space-5);
  margin-top: var(--aex-v2-space-2);
}

.aex-v2-sidebar-group-label {
  margin: 0 0 var(--aex-v2-space-2);
  padding: 0 var(--aex-v2-space-2);
  color: var(--aex-v2-text-secondary);
  font-size: 12px;
  line-height: 15px;
}

.aex-v2-sidebar-nav {
  display: grid;
  gap: 2px;
}

.aex-v2-sidebar-link {
  display: flex;
  height: var(--aex-v2-control);
  align-items: center;
  gap: var(--aex-v2-space-2);
  padding: 0 var(--aex-v2-space-2);
  color: var(--aex-v2-text-secondary);
  border-radius: var(--aex-v2-radius-control-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 19px;
}

.aex-v2-sidebar-link .aex-v2-icon {
  width: 14px;
  height: 14px;
}

.aex-v2-sidebar-link:hover,
.aex-v2-sidebar-link[aria-current='page'] {
  color: var(--aex-v2-text);
  background: var(--aex-v2-fill);
}

.aex-v2-account {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: var(--aex-v2-space-2);
  margin-top: auto;
  padding: var(--aex-v2-space-2);
  border-radius: var(--aex-v2-radius-control);
}

.aex-v2-account:hover {
  background: var(--aex-v2-fill);
}

.aex-v2-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  flex: none;
  place-items: center;
  background: var(--aex-v2-fill-strong);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 500;
}

.aex-v2-account-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-account-copy span:last-child {
  overflow: hidden;
  color: var(--aex-v2-text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.aex-v2-console-main {
  min-width: 0;
}

.aex-v2-console-header {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--aex-v2-space-4);
}

.aex-v2-console-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
}

.aex-v2-console-content {
  padding: var(--aex-v2-space-4);
}

.aex-v2-card {
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-card);
}

/* Metric card — label / figure / note, with an optional trend, sparkline and
   bar. Colour follows the role of the number: .is-money (lake-green),
   .is-activity (lake, the default), .is-credit (gold, marks only). The same
   pattern as the landing page's audience dashboards. */
.aex-v2-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--aex-v2-space-3);
  margin-bottom: var(--aex-v2-space-6);
}

.aex-v2-metric {
  --aex-v2-metric-accent: var(--aex-v2-role-activity);
  --aex-v2-metric-accent-text: var(--aex-v2-role-activity-text);
  display: block;
  min-height: 0;
  padding: var(--aex-v2-space-4);
}

.aex-v2-metric.is-money {
  --aex-v2-metric-accent: var(--aex-v2-role-money);
  --aex-v2-metric-accent-text: var(--aex-v2-role-money-text);
}

.aex-v2-metric.is-credit {
  --aex-v2-metric-accent: var(--aex-v2-role-credit);
  --aex-v2-metric-accent-text: var(--aex-v2-text-secondary);
}

.aex-v2-metric-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--aex-v2-space-2);
}

.aex-v2-metric-label {
  display: block;
  margin: 0;
  color: var(--aex-v2-text-secondary);
  font-size: 11px;
  font-weight: 500;
  line-height: 14px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.aex-v2-metric-value {
  display: block;
  margin: var(--aex-v2-space-2) 0 0;
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-numeric);
  font-size: var(--aex-v2-text-product-metric);
  font-weight: 400;
  line-height: var(--aex-v2-lh-product-metric);
  letter-spacing: -0.02em;
  font-feature-settings: "ss09";
  font-variant-numeric: tabular-nums;
}

.aex-v2-metric-value small {
  margin-left: 4px;
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  letter-spacing: 0;
}

/* A metric slot that holds words, not a figure (a state, a timestamp with prose). */
.aex-v2-metric-value.is-text {
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  line-height: 18px;
  letter-spacing: 0;
}

.aex-v2-metric-trend {
  flex: none;
  margin-top: 2px;
  color: var(--aex-v2-metric-accent-text);
  font-family: var(--aex-v2-font-numeric);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  font-feature-settings: "ss09";
  white-space: nowrap;
}

.aex-v2-metric-note {
  display: block;
  margin: var(--aex-v2-space-2) 0 0;
  color: var(--aex-v2-text-secondary);
  font-size: 12px;
  line-height: 15px;
}

.aex-v2-metric-spark {
  display: block;
  width: 100%;
  height: 40px;
  margin-top: var(--aex-v2-space-2);
  overflow: visible;
}

.aex-v2-metric-spark-grid {
  fill: none;
  stroke: var(--aex-v2-border);
  stroke-width: 0.75;
}

.aex-v2-metric-spark-line {
  fill: none;
  stroke: var(--aex-v2-metric-accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.aex-v2-metric-spark-point {
  fill: var(--aex-v2-metric-accent);
}

.aex-v2-metric-bar {
  display: block;
  height: 4px;
  margin-top: var(--aex-v2-space-2);
  overflow: hidden;
  background: var(--aex-v2-grey-100);
  border-radius: 2px;
}

.aex-v2-metric-bar > em,
.aex-v2-metric-bar > span {
  display: block;
  height: 100%;
  background: var(--aex-v2-metric-accent);
  border-radius: inherit;
}

/* ---- Chart ----
   Shaped after the shadcn line chart (ui.shadcn.com/charts/line): horizontal
   dashed grid only, no axis line and no tick marks, a monotone curve at 2px
   with no dots, and a hover tooltip. The parts stay ours — this is the house
   line chart with that chart's manners, not a second charting vocabulary.

   The accent still comes from the role, so a revenue chart is money-green
   without being told. */
.aex-v2-chart {
  --aex-v2-chart-accent: var(--aex-v2-role-activity);
  position: relative;
  display: block;
  margin: 0;
}

.aex-v2-chart.is-money {
  --aex-v2-chart-accent: var(--aex-v2-role-money);
}

.aex-v2-chart-plot {
  display: block;
  width: 100%;
  height: 220px;
  overflow: visible;
}

/* CartesianGrid vertical={false}: horizontals only, dashed, hairline. */
.aex-v2-chart-grid {
  fill: none;
  stroke: var(--aex-v2-border);
  stroke-width: 1;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
}

/* Line type="monotone" strokeWidth={2} dot={false}. */
.aex-v2-chart-line {
  fill: none;
  stroke: var(--aex-v2-chart-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* Two streams, stacked: their sum is the number the balance card shows, so the
   upper edge means something and the bands read as parts of one total. Roles
   are the system's own — money for commission, credit gold for credit sales —
   so the chart needs no legend to be guessable. */
.aex-v2-chart-line.is-commission {
  stroke: var(--aex-v2-role-money);
}

.aex-v2-chart-line.is-credit {
  stroke: var(--aex-v2-role-credit);
}

/* Reporting's two series use the roles they already mean elsewhere in the
   system: activity for traffic arriving, money for the part of it that was
   filled and can earn. The gap between the two lines IS the unfilled
   inventory, which is the thing a supply report exists to show. */
.aex-v2-chart-line.is-requests {
  stroke: var(--aex-v2-role-activity);
}

.aex-v2-chart-line.is-served {
  stroke: var(--aex-v2-role-money);
}

/* fillOpacity={0.4} in the shadcn reference; kept low so the grid stays
   readable through the band. */
.aex-v2-chart-area {
  stroke: none;
}

.aex-v2-chart-area.is-commission {
  fill: var(--aex-v2-role-money);
  opacity: 0.18;
}

.aex-v2-chart-area.is-credit {
  fill: var(--aex-v2-role-credit);
  opacity: 0.18;
}

.aex-v2-chart-area.is-requests {
  fill: var(--aex-v2-role-activity);
  opacity: 0.18;
}

/* A band axis. The ticks are already equal centred cells; the only thing to
   undo is the end alignment below, which pushes the first tick left and the
   last right so a LINE's end points — which sit ON the plot edges — get a
   label flush with them. A bar sits inside its slot, so its end ticks centre
   like every other one, and flush ones drift off the group they name. */
.aex-v2-chart-axis.is-band span:first-child,
.aex-v2-chart-axis.is-band span:last-child {
  text-align: center;
}

/* Bars sit on the baseline, so only their tops round — a rounded foot would
   lift a bar off the axis it is measured against. shadcn's radius={4}. */
.aex-v2-chart-bar {
  stroke: none;
}

.aex-v2-chart-bar.is-commission {
  fill: var(--aex-v2-role-money);
}

.aex-v2-chart-bar.is-credit {
  fill: var(--aex-v2-role-credit);
}

.aex-v2-chart-area.is-served {
  fill: var(--aex-v2-role-money);
  opacity: 0.18;
}

.aex-v2-chart-legend {
  display: flex;
  gap: var(--aex-v2-space-4);
  margin-top: var(--aex-v2-space-3);
}

.aex-v2-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  line-height: 16px;
}

/* A dot per line, and only under the cursor — the resting chart has none.
   HTML rather than an SVG <circle>: the plot is preserveAspectRatio="none", so
   a circle inside its viewBox is scaled unevenly and draws as an ellipse.
   Filled in the series colour with a surface ring, the shape Recharts' activeDot
   uses — the ring is what separates the dot from the line running under it. */
.aex-v2-chart-dot {
  position: absolute;
  box-sizing: border-box;
  width: 10px;
  height: 10px;
  border: 2px solid var(--aex-v2-surface);
  border-radius: 50%;
  background: var(--aex-v2-chart-accent);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.aex-v2-chart-dot.is-visible {
  opacity: 1;
}

.aex-v2-chart-dot.is-commission {
  background: var(--aex-v2-role-money);
}

.aex-v2-chart-dot.is-credit {
  background: var(--aex-v2-role-credit);
}

.aex-v2-chart-dot.is-requests {
  background: var(--aex-v2-role-activity);
}

.aex-v2-chart-dot.is-served {
  background: var(--aex-v2-role-money);
}

/* XAxis tickLine={false} axisLine={false} tickMargin={8}. */
.aex-v2-chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-chart-axis span {
  flex: 1 1 0;
  text-align: center;
}

.aex-v2-chart-axis span:first-child {
  text-align: left;
}

.aex-v2-chart-axis span:last-child {
  text-align: right;
}

/* ChartTooltipContent: a small raised card with the role swatch, the bucket
   label and the value. Follows the cursor, never covers the point. */
.aex-v2-chart-tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  min-width: 140px;
  padding: 8px 10px;
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-control);
  box-shadow: var(--aex-v2-shadow-high);
  pointer-events: none;
}

.aex-v2-chart-tooltip.is-visible {
  display: block;
}

.aex-v2-chart-tooltip-label {
  display: block;
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-numeric);
  font-size: 12px;
  line-height: 16px;
}

/* ---- Calendar ----
   A range picker on the menu surface, so a popover is a popover whatever it
   holds. Monday-first, one month at a time; the edges of the range are filled
   and the days between take the quiet tint. */
.aex-v2-calendar {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  right: 0;
  width: 260px;
}

.aex-v2-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--aex-v2-space-2);
  padding-bottom: var(--aex-v2-space-2);
}

.aex-v2-calendar-title {
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}

.aex-v2-calendar-head svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.aex-v2-calendar-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.aex-v2-calendar-grid th {
  padding-bottom: 4px;
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-ui);
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  text-align: center;
}

.aex-v2-calendar-grid td {
  padding: 1px;
  text-align: center;
}

.aex-v2-calendar-day {
  width: 100%;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--aex-v2-radius-control-sm);
  color: var(--aex-v2-text);
  cursor: pointer;
  font-family: var(--aex-v2-font-numeric);
  font-size: 12px;
  line-height: 16px;
}

.aex-v2-calendar-day:hover:not(:disabled) {
  background: var(--aex-v2-grey-100);
}

/* Outside the loaded series: shown, not hidden, so the edge of what the page
   knows is visible rather than a place the calendar silently will not go. */
.aex-v2-calendar-day:disabled {
  color: var(--aex-v2-text-disabled);
  cursor: default;
}

.aex-v2-calendar-day.is-within {
  background: var(--aex-v2-grey-100);
  border-radius: 0;
}

.aex-v2-calendar-day.is-edge {
  color: var(--aex-v2-surface);
  background: var(--aex-v2-role-money);
}

.aex-v2-calendar-hint {
  margin: var(--aex-v2-space-2) 0 0;
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-chart-tooltip-swatch {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
  background: var(--aex-v2-chart-accent);
}

.aex-v2-chart-tooltip-swatch.is-commission {
  background: var(--aex-v2-role-money);
}

.aex-v2-chart-tooltip-swatch.is-credit {
  background: var(--aex-v2-role-credit);
}

/* A named gap, not a third category: grey because it is the absence of a
   reading rather than a lane of its own. */
.aex-v2-chart-tooltip-swatch.is-unknown {
  background: var(--aex-v2-border-strong);
}

.aex-v2-chart-tooltip-swatch.is-requests {
  background: var(--aex-v2-role-activity);
}

.aex-v2-chart-tooltip-swatch.is-served {
  background: var(--aex-v2-role-money);
}

/* The tooltip's rows put the label left and the figure right, so the two
   streams and their sum line up as a column of numbers. */
.aex-v2-chart-tooltip-row {
  justify-content: space-between;
}

.aex-v2-chart-tooltip-row > [data-series-tooltip-value] {
  margin-left: auto;
}

.aex-v2-chart-tooltip-row.is-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--aex-v2-border);
  font-weight: 500;
}

/* The two streams under a metric card's figure. */
.aex-v2-metric-split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--aex-v2-space-3);
  margin-top: var(--aex-v2-space-2);
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-metric-split > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Plain: a metric inside another surface (a window, a panel) — no frame, no padding. */
.aex-v2-metric.is-plain {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* Dense: a KPI row inside another card — no frame, smaller figure. */
.aex-v2-metrics-dense {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--aex-v2-space-4);
  margin-bottom: 0;
}

.aex-v2-metrics-dense .aex-v2-metric {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.aex-v2-metrics-dense .aex-v2-metric-value {
  margin-top: 4px;
  font-size: var(--aex-v2-text-product-title);
  line-height: var(--aex-v2-lh-product-title);
}

.aex-v2-console-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--aex-v2-space-2);
}

.aex-v2-console-table-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
}

.aex-v2-components-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--aex-v2-space-4);
}

.aex-v2-spec-card {
  min-height: 310px;
  padding: var(--aex-v2-space-6);
}

.aex-v2-spec-title {
  margin: 0 0 var(--aex-v2-space-6);
  font-family: var(--aex-v2-font-ui);
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
}

.aex-v2-control-stack {
  display: grid;
  gap: var(--aex-v2-space-6);
}

.aex-v2-control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--aex-v2-space-2);
}

.aex-v2-field {
  display: grid;
  align-content: start; /* never stretch the control to a taller sibling */
  gap: var(--aex-v2-space-2);
}

.aex-v2-field label {
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

/* Menu / popover */
.aex-v2-menu {
  padding: var(--aex-v2-space-2);
  background: var(--aex-v2-surface-raised);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-menu);
  box-shadow: var(--aex-v2-shadow-high);
}

.aex-v2-menu-item {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  font-family: inherit;
  gap: 10px;
  padding: 0 var(--aex-v2-space-2);
  background: transparent;
  border: 0;
  border-radius: var(--aex-v2-radius-control-sm);
  color: var(--aex-v2-text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  line-height: 19px;
  text-align: left;
}

.aex-v2-menu-item:hover {
  color: var(--aex-v2-text);
  background: var(--aex-v2-fill);
}

.aex-v2-menu {
  min-width: 208px;
  font-family: var(--aex-v2-font-ui);
}

.aex-v2-menu-item > span {
  display: block;
  min-width: 0;
}

.aex-v2-menu-item small {
  display: block;
  color: var(--aex-v2-text-tertiary);
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  white-space: normal;
}

.aex-v2-menu-item:disabled {
  color: var(--aex-v2-text-disabled);
  background: transparent;
  cursor: not-allowed;
}

.aex-v2-menu-item.is-danger {
  color: var(--aex-v2-danger);
}

.aex-v2-menu-item.is-danger:hover {
  color: var(--aex-v2-danger);
  background: var(--aex-v2-danger-fill);
}

.aex-v2-menu-item.is-danger:disabled {
  color: var(--aex-v2-text-disabled);
  background: transparent;
}

.aex-v2-menu-item:has(small) {
  padding-top: 6px;
  padding-bottom: 6px;
  align-items: flex-start;
}

.aex-v2-dialog-stage {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: var(--aex-v2-space-6);
  background:
    linear-gradient(var(--aex-v2-scrim), var(--aex-v2-scrim)),
    var(--aex-v2-surface-recessed);
  border-radius: var(--aex-v2-radius-control);
}

.aex-v2-dialog {
  width: min(100%, 420px);
  padding: var(--aex-v2-space-6);
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-dialog);
  box-shadow: var(--aex-v2-shadow-high);
  font-family: var(--aex-v2-font-ui);
}

.aex-v2-dialog h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
}

.aex-v2-dialog p {
  margin: var(--aex-v2-space-3) 0 var(--aex-v2-space-5);
  color: var(--aex-v2-text-secondary);
  font-size: 13px;
  line-height: 18px;
}

.aex-v2-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--aex-v2-space-2);
}

/* ---- Feedback: notice ----
   One banner for a failed load, a caution, or a result that needs a sentence.
   The panel stays grey like every other panel; the role speaks through a 2px
   edge and the mark, which is the accent rule the system already follows. A
   fully tinted panel competes with the data it sits above, and a page can
   carry several of these at once. Anything short enough to be a sentence and
   transient enough to dismiss itself is a toast, not a notice. */
.aex-v2-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--aex-v2-space-3);
  padding: var(--aex-v2-space-3) var(--aex-v2-space-4);
  background: var(--aex-v2-grey-100);
  border-left: 2px solid var(--aex-v2-grey-400);
  border-radius: var(--aex-v2-radius-control-sm);
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  line-height: 16px;
}

/* The mark is a fixed slot so the text lane holds across stacked notices. */
.aex-v2-notice-mark {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--aex-v2-text-tertiary);
}

.aex-v2-notice-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.aex-v2-notice-body p {
  margin: 0;
}

.aex-v2-notice-body p + p {
  margin-top: 2px;
}

.aex-v2-notice-body strong {
  display: block;
  font-weight: 500;
}

/* A request id or trace handle: the code face, one tier down, never the lead. */
.aex-v2-notice-ref {
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-mono);
  font-size: 11px;
  line-height: 14px;
}

/* Retry, Dismiss, View — the notice's one action, pinned to the far end. */
.aex-v2-notice-action {
  flex: none;
  margin-left: auto;
  align-self: center;
}

.aex-v2-notice-danger {
  border-left-color: var(--aex-v2-danger);
}

.aex-v2-notice-danger .aex-v2-notice-mark,
.aex-v2-notice-danger .aex-v2-notice-body strong {
  color: var(--aex-v2-danger);
}

.aex-v2-notice-warning {
  border-left-color: var(--aex-v2-warning);
}

.aex-v2-notice-warning .aex-v2-notice-mark,
.aex-v2-notice-warning .aex-v2-notice-body strong {
  color: var(--aex-v2-warning);
}

.aex-v2-notice-success {
  border-left-color: var(--aex-v2-success);
}

/* ---- Feedback: loading ----
   Two shapes, no spinner. A table waits as its own shape, so the page does
   not jump when the rows land; anything that is not a table waits as one
   quiet line. The console's reads are sub-second, and a spinner at that
   length is a flash, not information. */
.aex-v2-skeleton {
  display: block;
  height: 10px;
  border-radius: 3px;
  background: var(--aex-v2-grey-200);
  animation: aex-v2-skeleton-pulse 1.4s var(--aex-v2-ease-standard) infinite;
}

@keyframes aex-v2-skeleton-pulse {
  50% {
    opacity: 0.45;
  }
}

.aex-v2-loading {
  color: var(--aex-v2-text-tertiary);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  line-height: 16px;
  animation: aex-v2-skeleton-pulse 1.4s var(--aex-v2-ease-standard) infinite;
}

/* ---- Feedback: toast ----
   The confirmation for a write the operator just made and does not need to
   read twice: invited, rotated, paused, granted. It says what happened in the
   past tense and leaves. Anything that stays true until the underlying
   condition changes is a notice; anything that needs a decision is a dialog.

   Same accent language as the notice, one elevation up: white surface, 2px
   role edge, role mark. Bottom-right, newest nearest the corner, above the
   dialog scrim — a write can fail from inside a modal. */
.aex-v2-toast-stack {
  position: fixed;
  right: var(--aex-v2-space-5);
  bottom: var(--aex-v2-space-5);
  z-index: 1100;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--aex-v2-space-2);
  pointer-events: none;
}

.aex-v2-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--aex-v2-space-3);
  width: 360px;
  max-width: calc(100vw - var(--aex-v2-space-10));
  padding: var(--aex-v2-space-3) var(--aex-v2-space-4);
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border);
  border-left: 2px solid var(--aex-v2-grey-400);
  border-radius: var(--aex-v2-radius-card);
  box-shadow: var(--aex-v2-shadow-high);
  color: var(--aex-v2-text);
  font-family: var(--aex-v2-font-ui);
  font-size: 12px;
  line-height: 16px;
  pointer-events: auto;
  animation: aex-v2-toast-in var(--aex-v2-duration-medium) var(--aex-v2-ease-standard) both;
}

@keyframes aex-v2-toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Leaving is a fade only: sliding out reads as a second arrival. */
.aex-v2-toast.is-leaving {
  opacity: 0;
  transition: opacity var(--aex-v2-duration-fast) var(--aex-v2-ease-standard);
}

.aex-v2-toast-mark {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--aex-v2-text-tertiary);
}

.aex-v2-toast-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.aex-v2-toast-dismiss {
  flex: none;
  width: 20px;
  height: 20px;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--aex-v2-radius-control-sm);
  color: var(--aex-v2-text-tertiary);
  cursor: pointer;
}

.aex-v2-toast-dismiss:hover {
  color: var(--aex-v2-text);
  background: var(--aex-v2-grey-100);
}

.aex-v2-toast-danger {
  border-left-color: var(--aex-v2-danger);
}

.aex-v2-toast-danger .aex-v2-toast-mark {
  color: var(--aex-v2-danger);
}

.aex-v2-toast-warning {
  border-left-color: var(--aex-v2-warning);
}

.aex-v2-toast-warning .aex-v2-toast-mark {
  color: var(--aex-v2-warning);
}

.aex-v2-toast-success {
  border-left-color: var(--aex-v2-success);
}

.aex-v2-toast-success .aex-v2-toast-mark {
  color: var(--aex-v2-success);
}

.aex-v2-notice-success .aex-v2-notice-mark,
.aex-v2-notice-success .aex-v2-notice-body strong {
  color: var(--aex-v2-success);
}

.aex-v2-foundations {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: var(--aex-v2-space-4);
}

.aex-v2-type-specimen,
.aex-v2-color-specimen {
  padding: var(--aex-v2-space-6);
}

.aex-v2-type-list {
  display: grid;
  gap: var(--aex-v2-space-6);
}

.aex-v2-type-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: var(--aex-v2-space-5);
  align-items: baseline;
}

.aex-v2-type-label {
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-mono);
  font-size: 10px;
  line-height: 13px;
}

.aex-v2-type-display {
  font-family: var(--aex-v2-font-display);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.08;
}

.aex-v2-type-marketing {
  font-family: var(--aex-v2-font-marketing);
  font-size: 18px;
  line-height: 28px;
}

.aex-v2-type-ui {
  font-family: var(--aex-v2-font-ui);
  font-size: 13px;
  line-height: 16px;
}

.aex-v2-type-mono {
  font-family: var(--aex-v2-font-mono);
  font-size: 12px;
  line-height: 18px;
}

.aex-v2-swatches {
  display: grid;
  gap: var(--aex-v2-space-3);
}

.aex-v2-swatch {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: var(--aex-v2-space-3);
  align-items: center;
  color: var(--aex-v2-text-secondary);
  font-family: var(--aex-v2-font-ui);
  font-size: 11px;
  line-height: 14px;
}

.aex-v2-swatch-color {
  width: 48px;
  height: 32px;
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-control-sm);
}

.aex-v2-swatch-brand-black { background: var(--aex-v2-brand-black); }
.aex-v2-swatch-brand-blue { background: var(--aex-v2-brand-blue); }
.aex-v2-swatch-recessed { background: var(--aex-v2-surface-recessed); }
.aex-v2-swatch-fill { background: var(--aex-v2-fill-strong); }
.aex-v2-swatch-live { background: var(--aex-v2-live-fill); }

.aex-v2-page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--aex-v2-space-6) 0;
  color: var(--aex-v2-text-secondary);
  border-top: 1px solid var(--aex-v2-border);
  font-size: 12px;
  line-height: 15px;
}

@media (max-width: 900px) {
  .aex-v2-topbar-inner {
    grid-template-columns: 1fr auto;
  }

  .aex-v2-topnav {
    display: none;
  }

  .aex-v2-section-head,
  .aex-v2-foundations {
    grid-template-columns: 1fr;
  }

  .aex-v2-console-grid {
    grid-template-columns: 188px minmax(0, 1fr);
  }

  .aex-v2-metrics,
  .aex-v2-components-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .aex-v2-container {
    width: min(calc(100% - 28px), var(--aex-v2-container));
  }

  .aex-v2-wordmark {
    font-size: 12px;
  }

  .aex-v2-status {
    display: none;
  }

  .aex-v2-topbar-inner {
    grid-template-columns: 1fr;
  }

  .aex-v2-hero {
    min-height: auto;
    padding: var(--aex-v2-space-20) 0;
  }

  .aex-v2-hero h1 {
    font-size: clamp(2.4rem, 11.5vw, 3rem);
  }

  .aex-v2-hero-lead {
    font-size: 16px;
    line-height: 25px;
  }

  .aex-v2-actions {
    flex-direction: column;
  }

  .aex-v2-actions .aex-v2-btn {
    width: 100%;
    min-height: var(--aex-v2-control-touch);
  }

  .aex-v2-query {
    grid-template-columns: 1fr;
  }

  .aex-v2-query .aex-v2-btn {
    min-height: var(--aex-v2-control-touch);
  }

  .aex-v2-demo-meta {
    align-items: flex-start;
    flex-direction: column;
    padding-block: var(--aex-v2-space-2);
  }

  .aex-v2-section {
    padding-top: var(--aex-v2-space-20);
  }

  .aex-v2-section:last-of-type {
    padding-bottom: var(--aex-v2-space-20);
  }

  .aex-v2-console-frame {
    min-height: 0;
  }

  .aex-v2-console-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .aex-v2-sidebar {
    display: none;
  }

  .aex-v2-console-content {
    padding: var(--aex-v2-space-3);
  }

  .aex-v2-metric {
    min-height: 100px;
  }

  .aex-v2-spec-card,
  .aex-v2-type-specimen,
  .aex-v2-color-specimen {
    padding: var(--aex-v2-space-4);
  }

  .aex-v2-type-row {
    grid-template-columns: 1fr;
    gap: var(--aex-v2-space-2);
  }

  .aex-v2-page-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: var(--aex-v2-space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aex-v2 *,
  .aex-v2 *::before,
  .aex-v2 *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  /* The waiting pulse is an animation, which the rule above does not reach.
     The bars stay; only the breathing stops. */
  .aex-v2-skeleton,
  .aex-v2-loading,
  .aex-v2-toast {
    animation: none;
  }
}

/* ---- Long-form composer (9b: centred 720px modal, fixed header and footer, scrolling body). Every modal in its frame shares it: the
   confirmations and one-time dialogs built as a bare `.aex-v2-cp-modal` (controls.ts, keys.ts, publisher-apps.ts) at a compact width;
   the foundation draws no `.aex-v2-cp-modal` of its own, so without this they fell back to the browser's dialog box. ---- */
:is(.mrp-composer, .aex-v2-cp-modal) {
  width: min(720px, calc(100vw - 24px));
  max-height: min(820px, calc(100vh - 48px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: var(--aex-v2-text);
  background: var(--aex-v2-surface);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-dialog);
  box-shadow: var(--aex-v2-shadow-high);
}
:is(.mrp-composer, .aex-v2-cp-modal)[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
:is(.mrp-composer, .aex-v2-cp-modal)::backdrop {
  background: var(--aex-v2-scrim);
}
:is(.mrp-composer, .aex-v2-cp-modal) .aex-v2-cp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--aex-v2-space-3);
  padding: var(--aex-v2-space-5) var(--aex-v2-space-6) 14px;
}
:is(.mrp-composer, .aex-v2-cp-modal) h2 {
  margin: 0;
  font-size: var(--aex-v2-text-product-title);
  line-height: var(--aex-v2-lh-product-title);
}

:is(.mrp-composer, .aex-v2-cp-modal) .aex-v2-cp-modal-body {
  min-height: 0;
  padding: 0 var(--aex-v2-space-6) var(--aex-v2-space-5);
  overflow: auto;
}
/* A dialog whose footer is emptied (a show-once key's reveal) keeps no padded strip. */
:is(.mrp-composer, .aex-v2-cp-modal) .aex-v2-cp-modal-footer:empty {
  display: none;
}
:is(.mrp-composer, .aex-v2-cp-modal) .aex-v2-cp-modal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--aex-v2-space-2);
  padding: var(--aex-v2-space-4) var(--aex-v2-space-6);
}
.aex-v2-cp-modal:not(.mrp-composer) {
  width: min(540px, calc(100vw - 24px));
}

/* AX primitives: bounded border-box geometry on both Staff and Partner. */
:is(.aex-v2-cp-modal, .mrp-composer, .aex-v2-dialog),
:is(.aex-v2-cp-modal, .mrp-composer, .aex-v2-dialog) * { box-sizing: border-box; min-width: 0; }
:is(.aex-v2-cp-modal, .mrp-composer, .aex-v2-dialog) {
  max-width: calc(100vw - 24px);
  max-height: min(820px, calc(100dvh - 48px - var(--mrp-modal-toast-room, 0px)));
  bottom: var(--mrp-modal-toast-room, 0px);
}
.aex-v2-cp-modal-body :is(form, fieldset, label, div) { min-width: 0; }
.aex-v2-cp-modal-body > :first-child { margin-top: 0; }
.aex-v2-cp-modal-body > :last-child { margin-bottom: 0; }
.aex-v2-field { gap: 8px; min-width: 0; }
.aex-v2-input { box-sizing: border-box; min-width: 0; padding: 8px 12px; }
textarea.aex-v2-input { min-height: 64px; resize: vertical; }
.mrp-required { margin-left: 4px; font-size: 11px; font-weight: 400; color: var(--aex-v2-text-secondary); }
.aex-v2-cp-modal pre, [data-prompt] { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.aex-v2-selectbox { min-width: 0; max-width: 100%; }
.aex-v2-selectbox.is-inline { min-width: 0; }
.aex-v2-selectbox .aex-v2-selectbox-trigger {
  position: relative; width: 100%; min-width: 0; min-height: 36px;
  padding: 8px 52px 8px 12px; text-align: left; font-weight: 400;
  color: var(--aex-v2-text-secondary); background-image: none;
  border: 1px solid var(--aex-v2-border); border-radius: 8px;
}
.aex-v2-selectbox .aex-v2-selectbox-trigger:focus-visible,
.aex-v2-selectbox .aex-v2-selectbox-trigger[aria-expanded="true"] {
  outline: 0; border-color: var(--aex-v2-role-focus); box-shadow: 0 0 0 3px var(--aex-v2-role-focus-halo);
}
.aex-v2-selectbox .mrp-select-chevron {
  position: absolute; top: 50%; right: 24px; width: 12px; height: 12px;
  color: var(--aex-v2-text-secondary); transform: translateY(-50%); pointer-events: none;
}
.aex-v2-select-menu[popover] {
  position: fixed; inset: auto; margin: 0; padding: 6px; min-width: 0;
  box-sizing: border-box; max-width: calc(100vw - 16px); overflow: auto;
  background: var(--aex-v2-grey-50); border: 1px solid var(--aex-v2-border);
  border-radius: 12px; box-shadow: var(--aex-v2-shadow-high);
}
.aex-v2-select-menu .aex-v2-menu-item {
  width: 100%; min-height: 40px; padding: 10px 18px 10px 26px;
  white-space: normal; text-align: left; color: var(--aex-v2-text-tertiary); font-weight: 400;
}
.aex-v2-select-menu .aex-v2-menu-item.is-selected { color: var(--aex-v2-text); font-weight: 500; }
.aex-v2-select-menu .aex-v2-menu-item:disabled { color: var(--aex-v2-text-disabled); cursor: not-allowed; }
.aex-v2-toast-stack[popover] {
  position: fixed; inset: auto 20px 20px auto; margin: 0; padding: 0;
  width: max-content; max-width: calc(100vw - 40px); max-height: calc(100dvh - 40px);
  overflow: auto; border: 0; background: transparent; pointer-events: none;
}
.aex-v2-toast-stack[popover] .aex-v2-toast { pointer-events: auto; }


/* ---- Page ---- */
.mrc-page {
  font-size: var(--aex-v2-text-product-body);
  line-height: var(--aex-v2-lh-product-body);
}
.mrc-page h1,
.mrc-page h2,
.mrc-page summary,
.mrc-page legend {
  font-weight: 500;
}
.mrc-page h2 {
  margin: 0 0 var(--aex-v2-space-3);
  font-size: var(--aex-v2-text-product-component-title);
  line-height: var(--aex-v2-lh-product-component-title);
}
.mrc-dim,
.mrc-sub,
.mrc-hint {
  color: var(--aex-v2-text-secondary);
}
.mrc-sub {
  margin: 0 0 var(--aex-v2-space-5);
}
/* Identifiers and code: the code face with its shipped slashed zero (R8d). */
.mrc-id {
  font-family: var(--aex-v2-font-code);
  font-feature-settings: normal;
  overflow-wrap: anywhere;
}

/* ---- Wordmark (9b operator wordmark) ---- */
.mrc-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--aex-v2-space-2);
}
.mrc-mark {
  display: block;
  width: 28px;
  height: auto;
}
.mrc-wordmark {
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.mrc-scope-tag {
  padding: 0 var(--aex-v2-space-1);
  color: var(--aex-v2-text-secondary);
  background: var(--aex-v2-grey-100);
  border-radius: var(--aex-v2-radius-pill);
  font-size: 9px;
  font-weight: 500;
  line-height: 14px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

/* ---- Sign-in and message pages ---- */
.mrc-centered {
  display: flex;
  max-width: 420px;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--aex-v2-space-3);
  margin: 12vh auto;
  padding: var(--aex-v2-space-6);
}
.mrc-centered h1 {
  margin: var(--aex-v2-space-3) 0 0;
  font-size: var(--aex-v2-text-product-title);
  line-height: var(--aex-v2-lh-product-title);
  letter-spacing: -0.01em;
}
.mrc-centered .mrc-sub {
  margin: 0;
}
.mrc-centered .aex-v2-notice {
  align-self: stretch;
}

/* ---- Frame (Paper 3b): 240px sticky rail beside a fluid content column ---- */
.mrc-frame {
  display: flex;
  min-height: 100vh;
}
.mrc-rail {
  position: sticky;
  top: 0;
  display: flex;
  width: var(--aex-v2-sidebar);
  height: 100vh;
  flex: 0 0 var(--aex-v2-sidebar);
  flex-direction: column;
  gap: var(--aex-v2-space-5);
  align-self: flex-start;
  padding: var(--aex-v2-space-3) var(--aex-v2-space-2);
  border-right: 1px solid var(--aex-v2-border);
}
.mrc-rail-top {
  display: flex;
  min-height: var(--aex-v2-control);
  align-items: center;
  padding: 0 var(--aex-v2-space-2);
}
.mrc-nav {
  display: flex;
  flex-direction: column;
  gap: var(--aex-v2-space-1);
}
.mrc-nav-item {
  display: flex;
  height: var(--aex-v2-control);
  align-items: center;
  padding: 0 var(--aex-v2-space-2);
  border-radius: var(--aex-v2-radius-control-sm);
  font-size: 13px;
  font-weight: 500;
  line-height: 16px;
}
.mrc-nav-item.is-active {
  background: var(--aex-v2-grey-100);
}
.mrc-rail-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--aex-v2-space-1);
  margin-top: auto;
  padding: 0 var(--aex-v2-space-2);
  font-size: var(--aex-v2-text-product-note);
  line-height: var(--aex-v2-lh-product-note);
}
.mrc-workspace {
  font-weight: 500;
}
.mrc-env {
  padding: 0 var(--aex-v2-space-2);
  color: var(--aex-v2-text-secondary);
  background: var(--aex-v2-grey-100);
  border-radius: var(--aex-v2-radius-pill);
  font-size: var(--aex-v2-text-product-tag);
  line-height: var(--aex-v2-lh-product-tag);
}
.mrc-operator {
  max-width: 100%;
  color: var(--aex-v2-text-secondary);
  overflow-wrap: anywhere;
}
.mrc-rail-foot .aex-v2-btn {
  margin-top: var(--aex-v2-space-2);
}
.mrc-content {
  min-width: 0;
  flex: 1 1 auto;
  padding: var(--aex-v2-space-3) var(--aex-v2-space-6) var(--aex-v2-space-12);
}
.mrc-page-header {
  display: flex;
  height: var(--aex-v2-control);
  align-items: center;
  margin-bottom: var(--aex-v2-space-3);
}
.mrc-page-header h1 {
  margin: 0;
  font-size: var(--aex-v2-text-product-title);
  line-height: var(--aex-v2-lh-product-title);
  letter-spacing: -0.01em;
}

/* ---- Review surfaces ---- */
/* The unknown-result attempt stays on screen while the operator scrolls the proposal (it is persistent, never a toast). */
#mrc-unresolved {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--aex-v2-surface);
}
#mrc-unresolved:not(:empty) {
  padding: var(--aex-v2-space-3) 0;
}
.mrc-unresolved + .mrc-unresolved,
#mrc-access .aex-v2-notice,
#mrc-messages .aex-v2-notice {
  margin-top: var(--aex-v2-space-3);
}
#mrc-messages .aex-v2-notice {
  margin-bottom: var(--aex-v2-space-3);
}
#mrc-protected .aex-v2-toolbar {
  margin-bottom: var(--aex-v2-space-3);
}
.mrc-pager,
.mrc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--aex-v2-space-2);
}
.mrc-pager {
  margin-top: var(--aex-v2-space-3);
}
.mrc-actions {
  justify-content: flex-end;
}
.mrc-detail,
.mrc-receipt {
  margin: var(--aex-v2-space-8) 0 0;
  padding: var(--aex-v2-space-5);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-card);
}
.mrc-receipt {
  margin: 0 0 var(--aex-v2-space-5);
}
.mrc-facts {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: var(--aex-v2-space-2) var(--aex-v2-space-4);
  margin: 0 0 var(--aex-v2-space-5);
}
.mrc-facts dt {
  color: var(--aex-v2-text-secondary);
}
.mrc-facts dd {
  min-width: 0;
  margin: 0;
}
.mrc-facts ul {
  margin: 0;
  padding-left: var(--aex-v2-space-4);
}
.mrc-raw summary {
  cursor: pointer;
}
.mrc-raw pre {
  max-height: 320px;
  overflow: auto;
  margin: var(--aex-v2-space-3) 0 0;
  padding: var(--aex-v2-space-3);
  background: var(--aex-v2-grey-100);
  border-radius: var(--aex-v2-radius-control-sm);
  font-size: var(--aex-v2-text-product-note);
  line-height: var(--aex-v2-lh-product-note);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mrc-decision {
  margin-top: var(--aex-v2-space-5);
}
.mrc-fieldset {
  min-width: 0;
  margin: 0 0 var(--aex-v2-space-5);
  padding: var(--aex-v2-space-3) var(--aex-v2-space-4) var(--aex-v2-space-4);
  border: 1px solid var(--aex-v2-border);
  border-radius: var(--aex-v2-radius-control);
}
.mrc-check,
.mrc-field {
  display: block;
  margin: var(--aex-v2-space-2) 0;
}
.mrc-field {
  color: var(--aex-v2-text-secondary);
  font-size: var(--aex-v2-text-product-label);
  font-weight: 500;
  line-height: var(--aex-v2-lh-product-label);
}
.mrc-field .aex-v2-input {
  display: block;
  max-width: 520px;
  margin-top: var(--aex-v2-space-1);
  font-weight: 400;
}
.mrc-field textarea.aex-v2-input {
  padding: var(--aex-v2-space-2) var(--aex-v2-space-3);
  resize: vertical;
}
.mrc-field .mrc-id {
  font-family: var(--aex-v2-font-code);
}
.mrc-form-error {
  min-height: var(--aex-v2-lh-product-body);
  margin: var(--aex-v2-space-2) 0 0;
  color: var(--aex-v2-danger);
}
.mrc-dialog {
  margin: auto;
}
.mrc-dialog::backdrop {
  background: var(--aex-v2-scrim);
}
.mrc-dialog > p {
  margin: var(--aex-v2-space-3) 0 var(--aex-v2-space-5);
  color: var(--aex-v2-text-secondary);
}
.mrc-dialog .mrc-actions {
  margin: 0;
}

/* ---- Below 900px (open in Paper): the smallest accessible adaptation ----
   The rail stacks above the content at full width; nothing scrolls sideways except a wide table inside its own wrapper. */
@media (max-width: 899px) {
  .mrc-frame {
    flex-direction: column;
  }
  .mrc-rail {
    position: static;
    width: auto;
    height: auto;
    flex: none;
    align-self: stretch;
    gap: var(--aex-v2-space-3);
    border-right: 0;
    border-bottom: 1px solid var(--aex-v2-border);
  }
  .mrc-rail-foot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--aex-v2-space-2);
    margin-top: 0;
  }
  .mrc-rail-foot .aex-v2-btn {
    margin-top: 0;
  }
  .mrc-content {
    padding: var(--aex-v2-space-3) var(--aex-v2-space-3) var(--aex-v2-space-12);
  }
  .aex-v2-table .mrc-id {
    overflow-wrap: normal;
    white-space: nowrap;
  }
  .mrc-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .mrc-facts dd + dt {
    margin-top: var(--aex-v2-space-2);
  }
  .mrc-detail,
  .mrc-receipt {
    padding: var(--aex-v2-space-4);
  }
  .mrc-centered {
    margin: var(--aex-v2-space-8) auto;
  }
}

/* Catalog seed (catalog-seed.ts): the six steps of a brand, compact inside its table cell. */
.mrc-seed-steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); gap: 2px 16px; }

/* Concierge store setup uses the shared data table, button and figure tokens. */
.mrc-setup-count { margin-left: auto; font-family: var(--aex-v2-font-mono); }
.mrc-setup-table-wrap { max-width: 100%; overflow-x: auto; }
.mrc-setup-table { width: 100%; table-layout: fixed; }
.mrc-setup-table td { vertical-align: top; overflow-wrap: anywhere; }
.mrc-setup-table input { box-sizing: border-box; width: 100%; min-width: 0; }
.mrc-setup-actions { display: flex; flex-wrap: wrap; gap: var(--aex-v2-space-2); margin-top: var(--aex-v2-space-2); }
@media (max-width: 700px) {
  .mrc-setup-table thead { display: none; }
  .mrc-setup-table tr, .mrc-setup-table td { display: block; width: auto; }
  .mrc-setup-table td { height: auto; }
}

/* Staff catalog classification (classification.ts): wide tables scroll inside their own frame, never the page. */
.mrc-cc-wrap { max-width: 100%; overflow-x: auto; }
.mrc-cc-items td { vertical-align: top; }
.mrc-cc-items .aex-v2-selectbox { min-width: 9rem; }
[aria-label="Item review"] .mrc-unresolved, #mrc-cc-notes .aex-v2-notice, #mrc-cc-adoption .aex-v2-notice { margin-bottom: var(--aex-v2-space-3); }
/* At phone widths each item is a stacked card of labelled cells, so its Decision and Category controls sit on screen (explicit ARIA roles keep
   the table's semantics when the cells stop being table cells). */
@media (max-width: 700px) {
  .mrc-cc-items thead { display: none; }
  .mrc-cc-items, .mrc-cc-items tbody, .mrc-cc-items tr, .mrc-cc-items td { display: block; width: auto; }
  .mrc-cc-items tr { padding: var(--aex-v2-space-3) 0; border-bottom: 1px solid var(--aex-v2-border); }
  .mrc-cc-items td { height: auto; padding: var(--aex-v2-space-1) 0; border: 0; }
  .mrc-cc-items td::before { content: attr(data-label); display: block; color: var(--aex-v2-text-secondary); font-size: 12px; }
  .mrc-cc-items .aex-v2-selectbox { max-width: 100%; }
}
