/* ===========================================================================
   Aegis ID brand layer — appended last, so it is the final word on colour.
   ===========================================================================

   Why this is a layer and not a rewrite. The 10,000 lines above grew three
   token families (the original --navy / --ink / --line set, the --workspace
   set, and the --aeg set) and every rule in the file reads one of them.
   Redefining those families here, from a
   single palette, turns the whole stylesheet over to the new design and gives
   it dark mode at the same time — without touching the rules that use them.

   The palette is the official brand: #0F75BC from AegisLogoColour, black
   wordmark, nothing invented. Display type is Saira (closest Google-hosted
   match to the outlined logotype), body Inter, data JetBrains Mono.

   Three theme states, because that is what a viewer actually has:
     - no data-theme attribute  -> follow the operating system
     - data-theme="light"       -> light, whatever the OS says
     - data-theme="dark"        -> dark, whatever the OS says
   Every token is first defined on bare :root. The two dark blocks only
   redefine. A token that exists only inside a media query is the classic
   unreadable-page bug, so nothing is declared that way.
   ========================================================================= */

:root {
  /* --- brand ------------------------------------------------------------ */
  --ag-brand:        #0F75BC;   /* the logo blue, exactly — fills and borders */
  --ag-brand-ink:    #0B5A91;   /* pressed / deep */
  /* Brand as TEXT is a shade darker than the logo. #0F75BC is 4.89:1 on pure
     white but only 4.45:1 on --ag-bg, and most brand-coloured text sits on the
     canvas, not on a card. This passes on both. Fills keep the exact logo
     colour, where contrast is measured against the label instead. */
  --ag-brand-text:   #0E6EB0;
  --ag-brand-on:     #ffffff;   /* text on a brand fill (4.9:1) */
  /* The hover fill for a brand button, and the text that goes on it.
     A single "pressed" colour cannot serve both themes: pressing means
     DARKER on a light page and LIGHTER on a dark one, and white on the
     lighter blue is 2.9:1. The two move together, so the label follows the
     fill instead of being assumed white. */
  --ag-brand-hover:    #0B5A91;
  --ag-brand-hover-on: #ffffff;   /* 8.0:1 */
  --ag-brand-soft:   #e8f3fb;
  --ag-brand-line:   #b9d9ef;

  /* --- the icon plate ---------------------------------------------------
     The small square a tile's glyph sits on. It is a solid fill rather than
     a transparent one, so the glyph never picks up whatever happens to be
     behind the tile, and the glyph itself is near-black with a blue bias
     rather than brand blue — brand blue on a tile reads as a link.
     It inverts in dark mode: dark plate, near-white glyph. */
  --ag-plate:        #eef1f6;
  --ag-plate-ink:    #16222f;   /* 15.4:1 on --ag-plate */
  --ag-plate-line:   #d6dce6;

  /* --- surfaces --------------------------------------------------------- */
  --ag-bg:           #f4f4f5;
  --ag-surface:      #ffffff;
  --ag-surface-2:    #f4f4f5;
  --ag-surface-3:    #ebebed;
  --ag-line:         #e4e4e7;
  --ag-line-strong:  #d4d4d8;

  /* --- ink -------------------------------------------------------------- */
  --ag-text:         #09090b;
  --ag-muted:        #5f5f6a;   /* 6.3:1 on --ag-surface */
  --ag-subtle:       #65656e;   /* 5.1:1 on --ag-surface-2 — small labels */

  /* --- state ------------------------------------------------------------ */
  --ag-good:         #047857;  --ag-good-soft: #ecfdf5;  --ag-good-line: #a7f3d0;
  --ag-warn:         #92400e;  --ag-warn-soft: #fffbeb;  --ag-warn-line: #fde68a;
  --ag-bad:          #b91c1c;  --ag-bad-soft:  #fef2f2;  --ag-bad-line:  #fecaca;
  /* Text on a status FILL. The status colours invert between themes — they
     are dark inks on the light page and light inks on the dark one, because
     most of their use is as text. Used as a fill they therefore need the
     opposite label colour, and a hard-coded white fails in dark: white on
     the dark theme's #f87171 is 2.5:1. */
  --ag-good-on:      #ffffff;   /* 5.6:1 */
  --ag-warn-on:      #ffffff;   /* 7.1:1 */
  --ag-bad-on:       #ffffff;   /* 6.5:1 */
  /* The third accent, for the middle architecture column. A token rather
     than a literal so it inverts with the rest of them. */
  --ag-teal:         #0e7490;
  --ag-teal-on:      #ffffff;   /* 5.1:1 */
  --ag-info:         #0F75BC;  --ag-info-soft: #e8f3fb;  --ag-info-line: #b9d9ef;

  /* --- dark chrome (the app's navy bar keeps its own scale) -------------- */
  --ag-nav:          #0b1a26;
  --ag-nav-2:        #12283a;
  --ag-nav-line:     #1d3b52;
  --ag-nav-text:     #e6eef6;
  --ag-nav-muted:    #9db4c7;

  /* --- type ------------------------------------------------------------- */
  --ag-display: Saira, "Segoe UI", system-ui, -apple-system, sans-serif;
  --ag-sans:    Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ag-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;

  /* --- shape ------------------------------------------------------------ */
  --ag-r:       8px;
  --ag-r-sm:    6px;
  --ag-r-lg:    12px;
  --ag-r-pill:  999px;
  --ag-sh:      0 1px 2px rgba(9, 9, 11, .05), 0 1px 3px rgba(9, 9, 11, .04);
  --ag-sh-lg:   0 12px 32px rgba(9, 9, 11, .10);
  /* The raised panel. A card is an object sitting on the page rather than a
     rectangle drawn on it: a contact shadow that holds the edge, a soft cast
     below it, and a one-pixel highlight along the top where the light would
     catch. Applied once, by class list, in main.css. */
  --ag-raise:    inset 0 1px 0 rgba(255, 255, 255, .9), 0 1px 1px rgba(9, 22, 37, .05), 0 10px 26px rgba(9, 22, 37, .08);
  --ag-raise-hi: inset 0 1px 0 rgba(255, 255, 255, .9);
  --ag-raise-lift: 0 1px 1px rgba(9, 22, 37, .06), 0 18px 40px rgba(9, 22, 37, .14);

  color-scheme: light;
}

/* --- dark: OS preference, unless an explicit light choice overrides ------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ag-brand:        #0F75BC;
    --ag-brand-ink:    #3B9FE0;
    --ag-brand-text:   #3B9FE0;   /* 6.8:1 on --ag-bg; #0F75BC is only 4.0:1 there */
    --ag-brand-on:     #ffffff;
    --ag-brand-hover:    #3B9FE0;
    --ag-brand-hover-on: #06243a;   /* 5.5:1 — dark ink on the lifted blue */
    --ag-brand-soft:   #0b1f2e;
    --ag-brand-line:   #1c3f5c;

    /* Lighter than the card it sits on (#111113), so the plate reads as a
       plate rather than as a hole. The glyph on it is still 10.7:1. */
    --ag-plate:        #2a3444;
    --ag-plate-ink:    #e8eef7;
    --ag-plate-line:   #3d4a5d;

    --ag-bg:           #09090b;
    --ag-surface:      #111113;
    --ag-surface-2:    #18181b;
    --ag-surface-3:    #1f1f23;
    --ag-line:         #27272a;
    --ag-line-strong:  #3f3f46;

    --ag-text:         #fafafa;
    --ag-muted:        #a1a1aa;
    --ag-subtle:       #8b8b94;

    --ag-good: #34d399; --ag-good-soft: #052e22; --ag-good-line: #10b981;
    --ag-warn: #fbbf24; --ag-warn-soft: #2b1f04; --ag-warn-line: #a16207;
    --ag-bad:  #f87171; --ag-bad-soft:  #2d1113; --ag-bad-line:  #b91c1c;
    --ag-good-on: #09090b;  /* 10.4:1 */
    --ag-warn-on: #09090b;  /* 12.0:1 */
    --ag-bad-on:  #09090b;  /*  7.2:1 */
    --ag-teal:    #22d3ee;
    --ag-teal-on: #09090b;  /* 11.0:1 */
    --ag-info: #3B9FE0; --ag-info-soft: #0b1f2e; --ag-info-line: #1c3f5c;

    --ag-nav:          #060d14;
    --ag-nav-2:        #0e1d2a;
    --ag-nav-line:     #17303f;
    --ag-nav-text:     #e6eef6;
    --ag-nav-muted:    #9db4c7;

    --ag-sh:    0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .30);
    --ag-sh-lg: 0 12px 32px rgba(0, 0, 0, .45);
    /* In the dark the cast does almost nothing — a shadow on near-black is
       invisible — so the highlight does the separating instead. */
    --ag-raise:    inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 1px rgba(0, 0, 0, .55), 0 10px 26px rgba(0, 0, 0, .42);
    --ag-raise-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
    --ag-raise-lift: 0 1px 1px rgba(0, 0, 0, .6), 0 20px 44px rgba(0, 0, 0, .55);

    color-scheme: dark;
  }
}

/* --- dark: explicit choice, so the toggle wins both ways ----------------- */
:root[data-theme="dark"] {
  --ag-brand:        #0F75BC;
  --ag-brand-ink:    #3B9FE0;
  --ag-brand-text:   #3B9FE0;
  --ag-brand-on:     #ffffff;
  --ag-brand-hover:    #3B9FE0;
  --ag-brand-hover-on: #06243a;
  --ag-brand-soft:   #0b1f2e;
  --ag-brand-line:   #1c3f5c;

  --ag-plate:        #2a3444;
  --ag-plate-ink:    #e8eef7;
  --ag-plate-line:   #3d4a5d;

  --ag-bg:           #09090b;
  --ag-surface:      #111113;
  --ag-surface-2:    #18181b;
  --ag-surface-3:    #1f1f23;
  --ag-line:         #27272a;
  --ag-line-strong:  #3f3f46;

  --ag-text:         #fafafa;
  --ag-muted:        #a1a1aa;
  --ag-subtle:       #8b8b94;

  --ag-good: #34d399; --ag-good-soft: #052e22; --ag-good-line: #10b981;
  --ag-warn: #fbbf24; --ag-warn-soft: #2b1f04; --ag-warn-line: #a16207;
  --ag-bad:  #f87171; --ag-bad-soft:  #2d1113; --ag-bad-line:  #b91c1c;
  --ag-good-on: #09090b;
  --ag-warn-on: #09090b;
  --ag-bad-on:  #09090b;
  --ag-teal:    #22d3ee;
  --ag-teal-on: #09090b;
  --ag-info: #3B9FE0; --ag-info-soft: #0b1f2e; --ag-info-line: #1c3f5c;

  --ag-nav:          #060d14;
  --ag-nav-2:        #0e1d2a;
  --ag-nav-line:     #17303f;
  --ag-nav-text:     #e6eef6;
  --ag-nav-muted:    #9db4c7;

  --ag-sh:    0 1px 2px rgba(0, 0, 0, .40), 0 1px 3px rgba(0, 0, 0, .30);
  --ag-sh-lg: 0 12px 32px rgba(0, 0, 0, .45);
  --ag-raise:    inset 0 1px 0 rgba(255, 255, 255, .06), 0 1px 1px rgba(0, 0, 0, .55), 0 10px 26px rgba(0, 0, 0, .42);
  --ag-raise-hi: inset 0 1px 0 rgba(255, 255, 255, .06);
  --ag-raise-lift: 0 1px 1px rgba(0, 0, 0, .6), 0 20px 44px rgba(0, 0, 0, .55);

  color-scheme: dark;
}

/* ===========================================================================
   Legacy families, redefined from the palette above.

   This is what turns the existing stylesheet over. Every --navy-900,
   --workspace-line and --aeg-text in the 10,000 lines above now resolves to a
   brand token that already knows about dark mode. Nothing above needed
   editing, and nothing below re-states a colour.
   ========================================================================= */
:root,
:root[data-theme="dark"] {
  /* -- original family -- */
  --navy-950:  var(--ag-nav);
  --navy-900:  var(--ag-nav-2);
  --navy-800:  var(--ag-nav-line);
  --blue-600:  var(--ag-brand);
  --cyan-500:  var(--ag-brand-ink);
  --green-500: var(--ag-good);
  --amber-400: var(--ag-warn);
  --ink:       var(--ag-text);
  --muted:     var(--ag-muted);
  --line:      var(--ag-line);
  /* The legacy family had no strong line, so every `var(--line-strong)` in
     main.css resolved to nothing and the border fell back to the inherited
     colour — a muted grey where a hairline was meant. */
  --line-strong: var(--ag-line-strong);
  --paper:     var(--ag-surface);
  --mist:      var(--ag-bg);
  --soft-blue: var(--ag-brand-soft);
  /* Every card in the stylesheet already asks for one of these three, so
     repointing them is what applies the raised treatment everywhere at once —
     dashboard tiles, organization tiles, wizard panels, the people table,
     every blade. --ag-sh stays the small one, for chrome that is not a card. */
  --shadow:    var(--ag-raise);

  /* -- workspace family -- */
  --workspace-ink:    var(--ag-text);
  --workspace-muted:  var(--ag-muted);
  --workspace-line:   var(--ag-line);
  --workspace-soft:   var(--ag-surface-2);
  --workspace-blue:   var(--ag-brand);
  --workspace-cyan:   var(--ag-brand-ink);
  --workspace-green:  var(--ag-good);
  --workspace-shadow: var(--ag-raise);

  /* -- aeg family -- */
  --aeg-bg:            var(--ag-bg);
  --aeg-surface:       var(--ag-surface);
  --aeg-surface-2:     var(--ag-surface-2);
  --aeg-surface-3:     var(--ag-surface-3);
  --aeg-border:        var(--ag-line);
  --aeg-border-strong: var(--ag-line-strong);
  --aeg-text:          var(--ag-text);
  --aeg-muted:         var(--ag-muted);
  --aeg-subtle:        var(--ag-subtle);
  --aeg-brand:         var(--ag-brand);
  --aeg-brand-ink:     var(--ag-brand-ink);
  --aeg-brand-soft:    var(--ag-brand-soft);
  --aeg-brand-line:    var(--ag-brand-line);
  --aeg-accent:        var(--ag-brand-ink);
  --aeg-nav:           var(--ag-nav);
  --aeg-nav-2:         var(--ag-nav-2);
  --aeg-nav-line:      var(--ag-nav-line);
  --aeg-nav-text:      var(--ag-nav-text);
  /* The two surfaces that use this — .aeg-card and .aeg-stat-card — are the
     settings tiles, which is why they were the last flat things on the page. */
  --aeg-sh:            var(--ag-raise);
  --aeg-sh-lg:         var(--ag-raise);
  --aeg-sh-brand:      0 3px 14px rgba(15, 117, 188, .14);

  /* State triples. Status pills read these; without the alias they keep their
     light hex values and stay light-on-light in dark mode. */
  --aeg-ok:      var(--ag-good);  --aeg-ok-bg:   var(--ag-good-soft);  --aeg-ok-br:   var(--ag-good-line);
  --aeg-warn:    var(--ag-warn);  --aeg-warn-bg: var(--ag-warn-soft);  --aeg-warn-br: var(--ag-warn-line);
  --aeg-bad:     var(--ag-bad);   --aeg-bad-bg:  var(--ag-bad-soft);   --aeg-bad-br:  var(--ag-bad-line);
}

/* ===========================================================================
   Typography
   ========================================================================= */
body {
  font-family: var(--ag-sans);
  background: var(--ag-bg);
  color: var(--ag-text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6,
.workspace-blade__head h1,
.aeg-page-title, .aeg-section-title {
  font-family: var(--ag-display);
  letter-spacing: -.01em;
  text-wrap: balance;
}
code, pre, .mono, .aeg-mono { font-family: var(--ag-mono); }
pre { background: var(--ag-nav); color: var(--ag-nav-text); border-color: var(--ag-nav-line); }

/* ===========================================================================
   Brand lockup. Two images, one per theme; CSS alone decides which shows, so
   it is correct before any script runs and in all three theme states.

   The light image must NOT carry an inline display, or it wins over the rule
   that hides it and both render at once.
   ========================================================================= */
.ag-logo { display: block; width: auto; }
.ag-logo--dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ag-logo--light { display: none; }
  :root:not([data-theme="light"]) .ag-logo--dark  { display: block; }
}
:root[data-theme="dark"] .ag-logo--light { display: none; }
:root[data-theme="dark"] .ag-logo--dark  { display: block; }

.ag-lockup { display: inline-flex; align-items: center; text-decoration: none; }
.ag-lockup img { height: auto; }

/* ===========================================================================
   Shell: header and footer
   ========================================================================= */
.site-header {
  position: fixed; z-index: 20; top: 0; right: 0; left: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; min-height: 68px; padding: 12px 6%;
  color: var(--ag-nav-text);
  background: var(--ag-nav);
  border-bottom: 1px solid var(--ag-nav-line);
  backdrop-filter: none;
}
.site-header a { color: var(--ag-nav-text); }
.site-footer {
  background: var(--ag-surface);
  border-top: 1px solid var(--ag-line);
  color: var(--ag-muted);
}
.site-footer a { color: var(--ag-muted); }
.site-footer a:hover { color: var(--ag-brand-text); }
@media (max-width: 760px) { .site-header { position: static; } }

/* ===========================================================================
   Theme switch
   ========================================================================= */
.ag-theme-switch {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px; border-radius: var(--ag-r-pill);
  background: rgba(255, 255, 255, .08);
  border: 1px solid var(--ag-nav-line);
}
.ag-theme-switch button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 24px; padding: 0;
  border: 0; border-radius: var(--ag-r-pill);
  background: transparent; color: var(--ag-nav-muted);
  cursor: pointer;
}
.ag-theme-switch button:hover { color: #ffffff; }
.ag-theme-switch button[aria-pressed="true"] {
  background: var(--ag-brand); color: var(--ag-brand-on);
}
.ag-theme-switch svg { width: 14px; height: 14px; display: block; }

/* ===========================================================================
   Component vocabulary. New markup uses these; old markup keeps working
   through the aliased families above.
   ========================================================================= */
.ag-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r);
}
.ag-card--pad { padding: 16px; }

.ag-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 13px; border-radius: var(--ag-r-sm);
  border: 1px solid var(--ag-line-strong);
  background: var(--ag-surface); color: var(--ag-text);
  cursor: pointer; text-decoration: none;
}
.ag-btn:hover { background: var(--ag-surface-2); }
.ag-btn--primary {
  background: var(--ag-brand); border-color: var(--ag-brand);
  color: var(--ag-brand-on); font-weight: 550;
}
.ag-btn--primary:hover { background: var(--ag-brand-hover); border-color: var(--ag-brand-hover); color: var(--ag-brand-hover-on); }
.ag-btn--danger { color: var(--ag-bad); border-color: var(--ag-bad); }
.ag-btn--block { width: 100%; justify-content: center; padding: 10px 14px; font-size: 14px; }
.ag-btn[disabled] { opacity: .5; cursor: default; }

.ag-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; padding: 2px 8px;
  border-radius: var(--ag-r-pill); border: 1px solid;
  white-space: nowrap;
}
.ag-pill--good { background: var(--ag-good-soft); color: var(--ag-good); border-color: var(--ag-good-line); }
.ag-pill--warn { background: var(--ag-warn-soft); color: var(--ag-warn); border-color: var(--ag-warn-line); }
.ag-pill--bad  { background: var(--ag-bad-soft);  color: var(--ag-bad);  border-color: var(--ag-bad-line); }
.ag-pill--info { background: var(--ag-info-soft); color: var(--ag-info); border-color: var(--ag-info-line); }
.ag-pill--mute { background: var(--ag-surface-2); color: var(--ag-muted); border-color: var(--ag-line); }

.ag-field {
  width: 100%; font: inherit; font-size: 14px;
  padding: 9px 11px; border-radius: var(--ag-r-sm);
  border: 1px solid var(--ag-line-strong);
  background: var(--ag-bg); color: var(--ag-text);
}
.ag-field:focus { outline: 2px solid var(--ag-brand); outline-offset: 1px; }
.ag-label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 5px; color: var(--ag-text); }
.ag-hint { margin: 5px 0 0; font-size: 12px; color: var(--ag-subtle); line-height: 1.5; }

.ag-table-wrap { overflow-x: auto; }
.ag-table { width: 100%; border-collapse: collapse; }
.ag-table th {
  text-align: left; font-family: var(--ag-display);
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ag-subtle); padding: 0 14px 10px; white-space: nowrap;
}
.ag-table td { padding: 12px 14px; font-size: 13.5px; border-top: 1px solid var(--ag-line); vertical-align: middle; }
.ag-table tbody tr:hover { background: var(--ag-surface-2); }

.ag-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: var(--ag-r); border: 1px solid;
}
.ag-banner--good { background: var(--ag-good-soft); border-color: var(--ag-good-line); }
.ag-banner--warn { background: var(--ag-warn-soft); border-color: var(--ag-warn-line); }
.ag-banner--bad  { background: var(--ag-bad-soft);  border-color: var(--ag-bad-line); }
.ag-banner--info { background: var(--ag-info-soft); border-color: var(--ag-info-line); }
.ag-banner__body { flex: 1 1 300px; min-width: 0; }
.ag-banner__title { margin: 0 0 3px; font-family: var(--ag-display); font-size: 14px; font-weight: 600; }
.ag-banner__text  { margin: 0; font-size: 13px; color: var(--ag-muted); line-height: 1.55; }

/* A focus ring that is visible on every surface, in both themes. */
:focus-visible { outline: 2px solid var(--ag-brand-text); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   Structure — the part that makes a page look like the mockup.

   The token layer above changed every colour. This changes the skeleton:
   .page-hero (38 templates) and .band (47) are the shared page frame, so
   restyling those two moves the whole application at once, without editing
   every template.

   What changes, against the old design:
     - the hero loses its dark photographic band. The mockup opens on the
       light canvas with type, not an illustration.
     - the header follows the theme instead of being permanently navy, so the
       colour lockup shows on light and the reverse lockup on dark.
     - the type ramp drops: a 56px marketing h1 was being used on operational
       pages that need 23px.
   ========================================================================= */

/* --- header: a surface, not a navy slab ---------------------------------- */
.site-header {
  position: sticky;
  min-height: 64px;
  padding: 10px max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  color: var(--ag-text);
  background: var(--ag-surface);
  border-bottom: 1px solid var(--ag-line);
}
.site-header a { color: var(--ag-muted); }
.site-header a:hover { color: var(--ag-brand-text); }
.site-header .brand-lockup { flex: none; }
.site-header .brand-logo { width: auto; height: 30px; }
.site-nav {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  font-size: 14px; font-weight: 500;
}
.site-nav a.is-active { color: var(--ag-text); font-weight: 600; }
.site-nav .aeg-admin-link { color: var(--ag-text); }

/* The switch sits on a light bar now, so it cannot rely on white-on-navy. */
.ag-theme-switch { background: var(--ag-surface-2); border-color: var(--ag-line); }
.ag-theme-switch button { color: var(--ag-subtle); }
.ag-theme-switch button:hover { color: var(--ag-text); }
.ag-theme-switch button[aria-pressed="true"] { background: var(--ag-brand); color: #fff; }

/* main sits under a sticky header rather than a fixed one */
main { padding-top: 0; }

/* --- page header: type on the canvas, no illustration -------------------- */
.page-hero {
  padding: 56px max(16px, env(safe-area-inset-left, 0px)) 36px;
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  color: var(--ag-text);
  background: var(--ag-bg);
  background-image: none;
}
.page-hero > * { max-width: 1140px; margin-inline: auto; }
.page-hero--compact { min-height: 0; }
.page-hero h1 {
  max-width: 17ch;
  margin: 0 0 16px;
  font-family: var(--ag-display);
  font-size: clamp(2.1rem, 1.3rem + 2.6vw, 3.3rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -.022em;
  color: var(--ag-text);
}
.page-hero p {
  max-width: 62ch;
  color: var(--ag-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}
.page-hero .eyebrow, .eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  font-family: var(--ag-display);
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--ag-subtle);
}
/* An operational page is not a landing page: 23px, per the mockup. */
.page-hero--compact h1 { font-size: 1.45rem; letter-spacing: -.014em; max-width: 30ch; }
.page-hero--compact p  { font-size: .92rem; }

/* --- bands: sections on the canvas --------------------------------------- */
.band {
  padding: 36px max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--ag-bg);
}
.band > * { max-width: 1140px; margin-inline: auto; }
.band--light, .band--white { background: var(--ag-bg); }
.band + .band { padding-top: 0; }

.section-heading h2 {
  font-family: var(--ag-display);
  font-size: 1.35rem; font-weight: 650; letter-spacing: -.014em;
  color: var(--ag-text); margin: 0 0 8px;
}
.section-heading p { color: var(--ag-muted); font-size: .92rem; line-height: 1.6; max-width: 62ch; }

/* --- auth: one centred column, not a two-column marketing split ---------- */
.auth-grid, .auth-grid--compact {
  display: block;
  max-width: 404px;
  margin-inline: auto;
}
/* The explanatory column belongs beside a marketing hero, not above a login
   form. "Passport.js" as an eyebrow was an implementation detail on screen. */
.auth-grid > .section-heading { display: none; }
.auth-panel {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r-lg);
  padding: 26px 24px;
  box-shadow: var(--ag-sh);
}
.auth-panel__form { display: flex; flex-direction: column; gap: 16px; }
.auth-panel__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.auth-panel__links p { margin: 0; font-size: .82rem; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 14px;
  font-family: var(--ag-display);
  font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase;
  color: var(--ag-subtle);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--ag-line); }
.auth-panel__alternatives { display: flex; flex-direction: column; gap: 9px; }
.auth-hint { margin: 0; font-size: .78rem; color: var(--ag-subtle); line-height: 1.5; }

/* --- form controls ------------------------------------------------------- */
.field-group { display: flex; flex-direction: column; gap: 0; }
.field-group label { font-size: 12.5px; font-weight: 550; margin-bottom: 5px; color: var(--ag-text); }
.field-group input, .field-group select, .field-group textarea {
  width: 100%; font: inherit; font-size: 14px;
  padding: 10px 12px; border-radius: var(--ag-r-sm);
  border: 1px solid var(--ag-line-strong);
  background: var(--ag-bg); color: var(--ag-text);
  min-height: 0;
}
.field-group input:focus, .field-group select:focus, .field-group textarea:focus {
  outline: 2px solid var(--ag-brand); outline-offset: 1px; background: var(--ag-surface);
}

/* --- buttons ------------------------------------------------------------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 14px; font-weight: 550;
  padding: 10px 17px; border-radius: var(--ag-r-sm);
  border: 1px solid var(--ag-line-strong);
  background: var(--ag-surface); color: var(--ag-text);
  cursor: pointer; text-decoration: none;
  box-shadow: none;
}
.button:hover { background: var(--ag-surface-2); }
.button--primary {
  background: var(--ag-brand); border-color: var(--ag-brand); color: #fff;
}
.button--primary:hover { background: var(--ag-brand-hover); border-color: var(--ag-brand-hover); color: var(--ag-brand-hover-on); }
.button--ghost { background: var(--ag-surface); color: var(--ag-text); }
.button--ghost:hover { background: var(--ag-surface-2); border-color: var(--ag-brand); }

/* --- the stat strip the mockup opens with -------------------------------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--ag-line);
  border: 1px solid var(--ag-line); border-radius: var(--ag-r);
  overflow: hidden; margin-top: 32px;
}
.stat-strip > div { background: var(--ag-surface); padding: 20px 18px; }
.stat-strip dt, .stat-strip .stat-strip__label {
  margin: 6px 0 0; font-size: .8rem; color: var(--ag-muted); font-weight: 500;
}
.stat-strip dd, .stat-strip .stat-strip__value {
  margin: 0; font-family: var(--ag-display);
  font-size: 1.85rem; font-weight: 700; letter-spacing: -.02em; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ag-text);
}

@media (max-width: 760px) {
  .site-header { position: static; }
  .page-hero { padding-top: 32px; }
}

/* --- landing hero: type on the canvas, per the approved mockup ----------- */
.hero {
  position: static;
  display: block;
  min-height: 0;
  padding: 72px max(16px, env(safe-area-inset-left, 0px)) 56px;
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow: visible;
  color: var(--ag-text);
  background: var(--ag-bg);
  background-image: none;
}
.hero__overlay { display: none; }
.hero__content { max-width: 1140px; margin-inline: auto; }

.hero__badge {
  display: inline-block;
  margin: 0 0 24px;
  padding: 7px 15px;
  border: 1px solid var(--ag-brand-line);
  border-radius: var(--ag-r-pill);
  background: var(--ag-surface);
  color: var(--ag-brand-text);
  font-size: 13px;
  font-weight: 600;
}
.hero__title {
  max-width: 18ch;
  margin: 0 0 20px;
  font-family: var(--ag-display);
  font-size: clamp(2.3rem, 1.1rem + 3.8vw, 3.9rem);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -.028em;
  color: var(--ag-text);
  text-wrap: balance;
}
.hero__lead {
  max-width: 58ch;
  margin: 0 0 28px;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ag-muted);
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero__actions .button { padding: 12px 22px; font-size: 15px; }
.hero__note { margin: 18px 0 0; font-size: .84rem; color: var(--ag-subtle); }
.hero__logo { display: none; }

/* Header calls to action, per the mockup: the secondary action is outlined,
   the primary one filled. A row of identical links gives a first-time visitor
   nothing to aim at. */
.site-nav__cta {
  display: inline-flex; align-items: center;
  padding: 7px 15px; border-radius: var(--ag-r-sm);
  border: 1px solid var(--ag-line-strong);
  background: var(--ag-surface);
  font-size: 13.5px; font-weight: 600;
  color: var(--ag-text);
}
/* Scoped to the header on purpose. `.site-header a` is 0,1,1 and sets the
   muted link colour for the whole bar, so a bare `.site-nav__cta` at 0,1,0
   loses to it — which painted "Start a trial" in #5f5f6a on the brand fill,
   1.5:1 and effectively unreadable. These restate it one class higher. */
.site-header .site-nav__cta { color: var(--ag-text); }
.site-header .site-nav__cta:hover { background: var(--ag-surface-2); color: var(--ag-text); }
.site-header .site-nav__cta--primary {
  background: var(--ag-brand); border-color: var(--ag-brand); color: var(--ag-brand-on);
}
.site-header .site-nav__cta--primary:hover {
  background: var(--ag-brand-hover); border-color: var(--ag-brand-hover); color: var(--ag-brand-hover-on);
}

/* --- button variants that were scoped to a context -----------------------
   main.css carries higher-specificity copies of the button rules — the
   sign-in panel's primary button was .auth-panel .button--primary with a navy
   fill and, oddly, a GREEN hover. Those win over a plain .button--primary, so
   the variants have to be restated at the same specificity rather than
   relying on load order.
   -------------------------------------------------------------------------- */
.auth-panel .button--primary,
.workspace-blade .button--primary,
.workspace-blade .button--primary.button--blue,
.organization-tile__actions > .button--blue:first-child,
.button--blue {
  background: var(--ag-brand);
  border-color: var(--ag-brand);
  color: #fff;
}
.auth-panel .button--primary:hover,
.workspace-blade .button--primary:hover,
.workspace-blade .button--primary.button--blue:hover,
.organization-tile__actions > .button--blue:first-child:hover,
.button--blue:hover,
.button--primary:hover {
  background: var(--ag-brand-hover);
  border-color: var(--ag-brand-hover);
  color: var(--ag-brand-hover-on);
}
.auth-panel .button--ghost,
.workspace-blade .button--ghost,
.organization-tile__actions .button--ghost,
.button--secondary,
.product-brief-panel .button--secondary {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line-strong);
  color: var(--ag-text);
}
.auth-panel .button--ghost:hover,
.workspace-blade .button--ghost:hover,
.organization-tile__actions .button--ghost:hover,
.button--secondary:hover,
.product-brief-panel .button--secondary:hover {
  background: var(--ag-surface-2);
  border-color: var(--ag-brand);
  color: var(--ag-text);
}

/* --- auth pages: one centred column, title included ---------------------
   The page header was a separate full-width band above a centred card, which
   left the title hard left and the lede floating mid-page. --------------- */
body.auth-page .page-hero,
.page-hero:has(+ .band .auth-grid) {
  padding-bottom: 8px;
  text-align: center;
}
.page-hero:has(+ .band .auth-grid) > * { max-width: 404px; }
.page-hero:has(+ .band .auth-grid) h1 {
  max-width: none; margin-inline: auto;
  font-size: 1.6rem; letter-spacing: -.016em;
}
.page-hero:has(+ .band .auth-grid) p { max-width: none; font-size: .92rem; }
.page-hero:has(+ .band .auth-grid) .eyebrow { margin-bottom: 10px; }

/* --- one left edge for every band ---------------------------------------
   Constraining `.band > *` lines up the CHILDREN, so a band that is itself a
   grid (.mobile-downloads) measured from a different origin than a plain one
   and its heading sat further right. Now the band is the measured element and
   its internals can lay out however they like. Safe because every band shares
   the canvas colour: there is no full-bleed background left to preserve.
   ------------------------------------------------------------------------ */
.band, .page-hero, .hero {
  max-width: 1188px;         /* 1140 content + the 24px gutters */
  margin-inline: auto;
  padding-inline: 24px;
}
.band > *, .page-hero > *, .hero__content { max-width: none; margin-inline: 0; }
.page-hero:has(+ .band .auth-grid) > * { max-width: 404px; margin-inline: auto; }

/* --- auth cards: put back the width the band rule took away -------------
   `.band > *` above is also (0,1,0) and is written later in this file, so it
   beat `.auth-grid { max-width: 404px }` and every sign-in, registration,
   reset and recovery card stretched to the full 1140px content width. Stating
   it as `.band > .auth-grid` (0,2,0) settles it on specificity rather than on
   which rule happens to come last.
   ------------------------------------------------------------------------ */
.band > .auth-grid,
.band > .auth-grid--compact { max-width: 404px; margin-inline: auto; }

/* --- the sign-in page is a split, not a column --------------------------
   A single 404px card left two thirds of the page empty, and widening the
   card alone would have given a login form line lengths no form wants. The
   form keeps a form's width; the space beside it carries what somebody
   actually wonders about at a sign-in screen.
   ------------------------------------------------------------------------ */
.band > .auth-grid--split {
  display: grid;
  grid-template-columns: minmax(0, 404px) minmax(0, 1fr);
  align-items: start;
  gap: 56px;
  max-width: 920px;
}
.auth-grid--split > .auth-panel { min-width: 0; }

.auth-aside { min-width: 0; padding-top: 4px; }
.auth-aside__title {
  font-family: var(--ag-display);
  font-size: 1.12rem; font-weight: 650; letter-spacing: -.012em; line-height: 1.35;
  color: var(--ag-text);
  margin: 0 0 20px;
  max-width: 26ch;
}
.auth-aside__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.auth-aside__list > li { display: flex; gap: 12px; align-items: flex-start; }
.auth-aside__icon {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--ag-brand-soft);
  border: 1px solid var(--ag-brand-line);
  color: var(--ag-brand-text);
}
.auth-aside__list h3 {
  font-family: var(--ag-display);
  font-size: .9rem; font-weight: 640; letter-spacing: -.004em;
  color: var(--ag-text);
  margin: 3px 0 4px;
}
.auth-aside__list p {
  margin: 0;
  font-size: .855rem; line-height: 1.6;
  color: var(--ag-muted);
  max-width: 44ch;
}
.auth-aside__foot {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--ag-line);
  font-size: .845rem; line-height: 1.6;
  color: var(--ag-muted);
}
.auth-aside__foot a { color: var(--ag-brand-text); }

/* The hero sits over the grid, so it stops being a centred column once there
   is a second column for it to be off-centre against. */
.page-hero:has(+ .band .auth-grid--split) {
  max-width: 968px;            /* 920 content + the 24px gutters */
  text-align: left;
}
.page-hero:has(+ .band .auth-grid--split) > * { max-width: 60ch; margin-inline: 0; }

@media (max-width: 860px) {
  .band > .auth-grid--split {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
    max-width: 404px;
  }
  .page-hero:has(+ .band .auth-grid--split) { max-width: 452px; }
  .auth-aside { padding-top: 0; }
}
.mobile-downloads { border-bottom: 1px solid var(--ag-line); padding-bottom: 32px; }
.mobile-downloads__copy { max-width: 62ch; }

/* --- store badges: cards on the canvas, not navy slabs ------------------- */
.store-badge {
  color: var(--ag-text);
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  box-shadow: var(--ag-sh);
}
.store-badge:hover { border-color: var(--ag-brand); }
.store-badge small, .store-badge__label {
  color: var(--ag-subtle);
  font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
}
.store-badge strong, .store-badge__value {
  color: var(--ag-text);
  font-family: var(--ag-display); font-weight: 650;
}
.store-badge-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

@media (max-width: 860px) {
  .mobile-downloads { grid-template-columns: minmax(0, 1fr); }
}

/* --- marks on a brand fill take pure white ------------------------------
   --ag-nav-text (#e6eef6) is tuned for the navy chrome. On the brand blue it
   measures 4.18:1, under AA for the small capitals these tiles carry. Pure
   white on #0F75BC is 4.89:1. Caught on every authenticated page by the
   contrast sweep.
   ------------------------------------------------------------------------ */
.store-badge__mark,
.aeg-tenant-switcher__icon,
.workspace-brand-mark,
.m-mark {
  color: #ffffff;
}

/* --- header: the avatar was wrapping to a second row --------------------
   Eight items plus a switcher plus the theme control overflowed at laptop
   width and the profile button dropped below the logo. The link list is the
   part that may shrink and scroll; the controls stay put.
   ------------------------------------------------------------------------ */
.site-header { flex-wrap: nowrap; gap: 14px; }
.site-nav {
  flex: 1 1 auto; min-width: 0;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; gap: 14px;
  justify-content: flex-end;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav > a { white-space: nowrap; }
.site-nav > .ag-theme-switch,
.site-nav > .site-header__profile-trigger,
.site-nav > details { flex: none; }
@media (max-width: 760px) {
  .site-header { flex-wrap: wrap; }
  .site-nav { justify-content: flex-start; }
}

/* ===========================================================================
   The application shell
   ---------------------------------------------------------------------------
   One sidebar for every authenticated surface, replacing the dashboard's own
   icon rail and menu blade.

   Three things the old shell did that this one deliberately does not:

     - it was `height: 100vh; overflow: hidden` with its content column as the
       scrolling element. A nested scroller means the browser's own
       scroll-to-anchor, find-in-page and restore-position all act on the wrong
       box, and on iOS the address bar never collapses. This scrolls the
       document and makes the sidebar sticky instead.
     - it reserved a 68px icon rail of single capital letters beside a menu
       that spelled the same destinations out. One labelled list is not a
       downgrade from two unlabelled ones.
     - it used the marketing type ramp inside an operational page, so a panel
       heading rendered at up to 46px. The ramp here tops out at 21px, which is
       what AGENTS.md's "avoid oversized typography in dashboards" is about.
   ========================================================================= */
.app-shell {
  display: grid;
  grid-template-columns: minmax(210px, 248px) minmax(0, 1fr);
  /* `start` here, with the sidebar itself sticky, sized the rail to its own
     content — so on a long page the surface and its right border stopped
     part way down and the canvas showed through below them. The rail
     stretches; `.app-side__inner` is what sticks. */
  align-items: stretch;
  min-height: calc(100vh - 64px);
  background: var(--ag-bg);
}

/* --- the sidebar --------------------------------------------------------- */
.app-side {
  min-width: 0;
  background: var(--ag-surface);
  border-right: 1px solid var(--ag-line);
}

.app-side__inner {
  position: sticky;
  /* Under the sticky site header rather than over it. */
  top: 64px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 64px);
  padding: 14px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.app-side__org {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r-sm);
  color: var(--ag-text);
  text-decoration: none;
}

.app-side__org:hover { border-color: var(--ag-line-strong); background: var(--ag-surface-2); }

.app-side__org-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--ag-brand);
  color: var(--ag-brand-on);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}

.app-side__org-text { min-width: 0; line-height: 1.25; }

.app-side__org-text strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-side__org-text small {
  display: block;
  overflow: hidden;
  color: var(--ag-subtle);
  font-family: var(--ag-mono);
  font-size: 10.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-side__nav { display: flex; flex-direction: column; gap: 1px; }

.app-side__label {
  margin: 15px 0 5px;
  padding: 0 9px;
  color: var(--ag-subtle);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-side__label:first-child { margin-top: 2px; }

.app-nav {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: var(--ag-r-sm);
  color: var(--ag-muted);
  font-size: 13px;
  font-weight: 450;
  text-decoration: none;
}

.app-nav .ag-icon { flex: none; color: var(--ag-subtle); }
.app-nav:hover { background: var(--ag-surface-2); color: var(--ag-text); }
.app-nav:hover .ag-icon { color: var(--ag-text); }

.app-nav__label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* `is-active` is set by the blade script for an in-page panel and by the
   shell service for a route. One appearance for both, so the reader cannot
   tell which kind of destination a row is — and should not need to. */
.app-nav.is-active {
  background: var(--ag-brand-soft);
  color: var(--ag-brand-text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--ag-brand);
}

.app-nav.is-active .ag-icon { color: var(--ag-brand-text); }

.app-nav__dot {
  flex: none;
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-radius: 50%;
  background: var(--ag-subtle);
}

.app-nav__dot--success { background: var(--ag-good); }
.app-nav__dot--warning { background: var(--ag-warn); }
.app-nav__dot--danger  { background: var(--ag-bad); }

.app-side__advice {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 16px 0 0;
  padding: 10px 11px;
  border: 1px solid var(--ag-brand-line);
  border-radius: var(--ag-r-sm);
  background: var(--ag-brand-soft);
}

.app-side__advice strong {
  color: var(--ag-brand-text);
  font-family: var(--ag-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.app-side__advice span { color: var(--ag-text); font-size: 12px; line-height: 1.5; }

.app-side__viewer {
  display: flex;
  align-items: center;
  gap: 9px;
  /* Pushed to the bottom of the rail when the nav is shorter than the
     viewport, and immediately after it when it is not. */
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--ag-line);
}

.app-side__viewer-mark {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r-pill);
  background: var(--ag-surface-2);
  color: var(--ag-text);
  font-size: 10.5px;
  font-weight: 600;
}

.app-side__viewer-text { min-width: 0; line-height: 1.3; }

.app-side__viewer-text strong {
  display: block;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.app-side__viewer-text small { display: block; color: var(--ag-subtle); font-size: 11px; }

/* --- the body column ---------------------------------------------------- */
.app-shell__body { display: flex; min-width: 0; flex-direction: column; }

.app-top {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: var(--ag-surface);
  border-bottom: 1px solid var(--ag-line);
}

.app-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--ag-muted);
  font-size: 13px;
}

.app-crumb a { color: var(--ag-muted); text-decoration: none; }
.app-crumb a:hover { color: var(--ag-brand-text); text-decoration: underline; }
.app-crumb [aria-current="page"] { color: var(--ag-text); font-weight: 500; }
/* A hairline token on a white bar is 1.5:1 — the separator was there and
   nobody could see it. The same grey as the links reads as a separator
   anyway, because it is one thin glyph between two words. */
.app-crumb__sep { color: var(--ag-subtle); }

.app-shell__main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

/* --- the panels inside it ------------------------------------------------
   The dashboard's blades keep their own markup; what changes is the ramp they
   are drawn at. Each rule here restates an existing one at matching
   specificity rather than reaching for !important.
   ------------------------------------------------------------------------ */
/* The bands centre themselves on a plain page with `max-width` plus
   `margin-inline: auto`. Inside the shell's main column that is wrong twice
   over: the column is already the measure, and an auto inline margin on a
   flex-column child cancels the stretch — so each band shrank to its own
   content and floated in the middle, which read as a page indented by a
   couple of hundred pixels for no reason. */
.app-shell .blade-panel,
.app-shell .band,
.app-shell .page-hero,
.app-shell .hero {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: 0;
  background: transparent;
}

.app-shell .band { padding: 0; }
.app-shell .page-hero { padding: 0; }
.app-shell .page-hero > * { max-width: none; margin-inline: 0; }

.app-shell .section-heading,
.app-shell .blade-overview {
  max-width: none;
  margin-bottom: 4px;
  gap: 4px;
}

.app-shell .section-heading h2,
.app-shell .section-heading > h2,
.app-shell .blade-overview h1 {
  max-width: 48ch;
  margin: 0;
  font-family: var(--ag-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.2;
}

.app-shell .section-heading p:last-child,
.app-shell .section-heading > p:last-child,
.app-shell .blade-overview p:not(.eyebrow) {
  max-width: 68ch;
  color: var(--ag-muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.6;
}

.app-shell .eyebrow {
  color: var(--ag-subtle);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-shell h3 { font-family: var(--ag-display); font-size: 15px; font-weight: 600; }

/* Cards: one surface, one hairline, no drop shadow. The old panels carried a
   44px-blur shadow each, which on a page of twelve of them read as haze
   rather than as elevation. */
.app-shell .platform-card,
.app-shell .people-directory,
.app-shell .config-tile,
/* These are tiles, and they were flattened inside the shell while every tile
   outside it lifted — the dashboard's own summary cards among them. */
.app-shell .policy,
.app-shell .note-panel,
.app-shell .demo-qr-card,
.app-shell .dashboard-summary article {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r);
  box-shadow: var(--ag-raise);
}

.app-shell .dashboard-summary,
.app-shell .dashboard-summary--four {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.app-shell .dashboard-summary article { padding: 16px; }

.app-shell .dashboard-summary .metric {
  font-family: var(--ag-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.018em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.app-shell .dashboard-summary p { margin: 6px 0 0; color: var(--ag-muted); font-size: 12px; }

/* Tables read as data rather than as prose: an uppercase micro-label header
   row, hairline row rules, and tabular figures. */
.app-shell .people-table th,
.app-shell .connected-app-table th {
  padding: 0 14px 9px;
  background: transparent;
  border-color: var(--ag-line);
  color: var(--ag-subtle);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.app-shell .people-table td { font-size: 13px; }

/* --- narrow widths ------------------------------------------------------
   The sidebar becomes a horizontally-scrolling strip above the content rather
   than disappearing: these rows are the only navigation on the page, so
   hiding them with nothing behind a button would strand the reader.
   ---------------------------------------------------------------------- */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .app-side { border-right: 0; border-bottom: 1px solid var(--ag-line); }
  .app-side__inner {
    position: static;
    max-height: none;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 12px;
  }
  .app-side__nav { flex-direction: row; gap: 4px; }
  .app-side__label { display: none; }
  .app-side__org { flex: none; margin-bottom: 0; }
  .app-side__advice { display: none; }
  .app-side__viewer { display: none; }
  .app-nav { flex: none; }
  .app-nav.is-active { box-shadow: inset 0 -2px 0 var(--ag-brand); }
  .app-top { top: 0; }
  .app-shell__main { padding: 16px 14px; }
}

/* --- the admin and settings pages inside the shell ----------------------
   These templates open with `.band > .aeg-page`, a centred 1140px column with
   its own 26px/64px padding — correct when the page was the whole window, and
   a second set of margins now that the shell's main column already provides
   them. The band and the page both become plain blocks here.

   `.aeg-crumb` goes with them: each settings template carried its own
   breadcrumb, and the shell draws one above every page.
   ---------------------------------------------------------------------- */
.app-shell .aeg-page {
  max-width: none;
  margin: 0;
  padding: 0;
}

.app-shell .aeg-crumb { display: none; }

.app-shell .aeg-page-head { margin-bottom: 4px; }

.app-shell .aeg-page-head h1 {
  font-family: var(--ag-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.012em;
  line-height: 1.2;
}

.app-shell .aeg-page-head p { font-size: 13px; line-height: 1.6; }

.app-shell .aeg-eyebrow {
  color: var(--ag-subtle);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* The card grids read as one system with the dashboard's — which now means
   raised rather than flat. This rule said `box-shadow: none`, so the settings
   tiles stayed flat while every other tile in the product lifted, and they
   were the last ones left looking like the old design. */
.app-shell .aeg-stat-card {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r);
  box-shadow: var(--ag-raise);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.app-shell .aeg-stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--ag-brand-line);
  background: var(--ag-surface);
  box-shadow: var(--ag-raise-lift);
}

@media (prefers-reduced-motion: reduce) {
  .app-shell .aeg-stat-card { transition: none; }
  .app-shell .aeg-stat-card:hover { transform: none; }
}

/* ===========================================================================
   The architecture band
   ---------------------------------------------------------------------------
   `.band--ink` was a navy slab, and everything inside it was coloured for
   that ground: `--ag-nav-text` type, white-alpha card fills, a translucent
   amber lab panel. The facelift turned every band onto the light canvas —
   `.band` sets the background and outranks `.band--ink`, which only ever set
   `color` — so the band went light while its contents stayed dressed for the
   dark. The lab panel ended up near-white type on cream at 1.1:1, and the
   column headings disappeared entirely.

   Recoloured here rather than by deleting `.band--ink`, because the class
   still marks the section that carries the architecture diagram and the
   spacing that goes with it. Every value is a token, so dark mode follows.
   ========================================================================= */
.band--ink { color: var(--ag-text); background: var(--ag-bg); }
.section-heading--inverse { color: var(--ag-text); }
.section-heading--inverse p { color: var(--ag-muted); }

.arch-flow { color: var(--ag-text); }

.arch-col {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  border-radius: var(--ag-r);
  color: var(--ag-text);
}

.arch-col__head h3 { color: var(--ag-text); }
.arch-col__head p { color: var(--ag-muted); }

/* The three columns were told apart by three different translucent fills on
   navy, which on a white card is three barely-different whites. A coloured
   top edge says the same thing and survives both themes. */
.arch-col--blue  { border-top: 3px solid var(--ag-brand); }
.arch-col--cyan  { border-top: 3px solid var(--ag-teal); }
.arch-col--green { border-top: 3px solid var(--ag-good); }

.arch-col__list li {
  background: var(--ag-surface-2);
  border: 1px solid var(--ag-line);
  color: var(--ag-text);
}

.arch-col__list li strong { color: var(--ag-text); }
.arch-col__list li span { color: var(--ag-muted); }

.arch-lab {
  background: var(--ag-warn-soft);
  border: 1px solid var(--ag-warn-line);
  color: var(--ag-text);
}

.arch-lab__copy h3 { color: var(--ag-text); }
.arch-lab__copy p { color: var(--ag-muted); }

.arch-lab__label {
  background: var(--ag-warn);
  color: var(--ag-warn-on);
}

.arch-lab__list li {
  background: var(--ag-surface);
  border: 1px solid var(--ag-warn-line);
  color: var(--ag-warn);
}

/* --- the architecture kickers -------------------------------------------
   `.arch-col--green .arch-col__kicker` set a green fill and green text: a
   1.0:1 pill reading "Step 3" that nobody could see at any point in the
   product's life, dark band or light. The cyan one inherited the base
   `--ag-text` onto its own fill at 2.7:1. All three now say the same thing
   the blue one always did.
   ---------------------------------------------------------------------- */
.arch-col--blue .arch-col__kicker  { background: var(--ag-brand); color: var(--ag-brand-on); }
.arch-col--cyan .arch-col__kicker  { background: var(--ag-teal);  color: var(--ag-teal-on); }
.arch-col--green .arch-col__kicker { background: var(--ag-good);  color: var(--ag-good-on); }

/* --- the product-brief panel --------------------------------------------
   A blue-to-cyan-to-green gradient carrying `--ag-muted` body text at
   1.2:1. White would not have saved it either: the green end composites to
   roughly #1ba971, and white on that is 2.4:1. A gradient that no text can
   sit on is not a surface, so this is a card like every other one.
   ---------------------------------------------------------------------- */
.product-brief-panel {
  color: var(--ag-text);
  background: var(--ag-surface);
  border: 1px solid var(--ag-line);
  box-shadow: none;
}

.product-brief-panel p { color: var(--ag-muted); font-weight: 400; }

.product-brief-panel .button--secondary {
  color: var(--ag-text);
  background: var(--ag-surface);
  border-color: var(--ag-line-strong);
}

.brief-path span {
  color: var(--ag-text);
  background: var(--ag-surface-2);
  border: 1px solid var(--ag-line);
  font-weight: 600;
}

.brief-path i { background: var(--ag-line-strong); }

/* --- the journey path ----------------------------------------------------
   Four equal grid tracks of a fixed 86px, with 16px of side padding each, so
   every chip had 54px for its label: "credential" needs 93px and simply ran
   out past the chip's edge. The step names are not all the same length and
   never will be, so the row sizes to its content and wraps instead of
   dividing the width equally and hoping.
   ---------------------------------------------------------------------- */
.brief-path {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.brief-path span {
  display: flex;
  align-items: center;
  padding: 9px 13px;
  border-radius: var(--ag-r-sm);
  font-size: 12.5px;
  line-height: 1.35;
}

/* The connector between two steps. Vertical in the stacked form. */
.brief-path i {
  align-self: center;
  width: 2px;
  height: 10px;
  border-radius: 2px;
}

/* Four steps side by side need about 440px, and the panel only has that much
   once the two-column brief layout has room for it. Below that the path
   stacks rather than wrapping: a wrapped row leaves one chip stretched across
   its own line with a connector dangling off the row above. */
@media (min-width: 1100px) {
  .brief-path { flex-direction: row; align-items: stretch; gap: 7px; }
  .brief-path span {
    /* `flex: 1 1 0` with `min-width: 0`, not `min-width: max-content`. The
       latter sizes each chip to its longest word, which pushed the whole
       panel wider than its grid column and slid it under the card grid
       beside it. Equal shares that may shrink means the label wraps to a
       second line at worst, and the panel always stays in its column. */
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 9px 10px;
    text-align: center;
    overflow-wrap: break-word;
  }
  .brief-path i { width: 12px; height: 2px; flex: 0 0 12px; }
}

/* --- the icon tiles ------------------------------------------------------
   `.platform-icon` was sized for a two- or three-letter abbreviation. It
   holds an SVG now, which has to be centred and told what colour to stroke.

   The plate is a solid fill rather than a brand gradient, and the glyph on it
   is near-black with a blue bias. Three reasons, in order: a glyph on a
   transparent plate picks up whatever band is behind the tile and changes
   colour from page to page; a wall of saturated blue squares is the loudest
   thing on a dashboard without being the most important; and brand blue is
   this product's link colour, so a blue square inside a card claims to be a
   second thing to click. The plate inverts in dark mode rather than staying
   light, so the glyph is never a dark shape on a bright square in a dark
   page. Both pairs are above 12:1.
   ---------------------------------------------------------------------- */
.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ag-plate);
  border: 1px solid var(--ag-plate-line);
  color: var(--ag-plate-ink);
}

/* Inside the shell the same tiles are restated at 0,2,0 with the workspace
   gradient, so the flat fill has to be restated there too. */
.app-shell .platform-icon,
.app-shell .blade-action-card span,
.aeg-stat-card__icon {
  background: var(--ag-plate);
  border: 1px solid var(--ag-plate-line);
  color: var(--ag-plate-ink);
}

/* The glyph is an SVG that strokes `currentColor`, and three rules upstream
   set that to the on-brand white for what used to be a lettered abbreviation.
   Restated here at the same place the plate is decided, so the two can never
   drift apart. */
.platform-icon .ag-icon,
.blade-action-card span .ag-icon,
.aeg-stat-card__icon .ag-icon { color: var(--ag-plate-ink); }

/* --- a tile reads left to right -----------------------------------------
   The glyph sat above the title, which made every card three stacked rows
   and pushed the one line that says what the card is for a third of the way
   down it. Pinned at the top left with the title beside it, the eye lands on
   the pair at once and the description keeps the full width underneath.
   ---------------------------------------------------------------------- */
.blade-action-card {
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 10px;
  align-content: start;
  /* The row stretches every card to the tallest of them, so a floor of its
     own only added empty space under the short ones. */
  min-height: 0;
}

.blade-action-card > span { grid-column: 1; grid-row: 1; }

.blade-action-card > strong {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  min-width: 0;
}

.blade-action-card > small {
  grid-column: 1 / -1;
  grid-row: 2;
}

/* --- outline buttons inside an organization tile -------------------------
   `.organization-tile__actions .button--outline-success` (0,2,0) re-asserts
   the white background, and it is declared after
   `.button--outline-success:hover` (also 0,2,0) — so hovering swapped the
   text to the light-on-fill colour while the fill stayed white. 1.07:1, and
   the label vanished under the pointer on "Root wallets" and "Delete".

   The warning variant had the mirror of it everywhere: `--ag-text` on
   `--ag-warn`, dark brown on dark amber at 1.9:1.
   ---------------------------------------------------------------------- */
.organization-tile__actions .button--outline-success:hover {
  color: var(--ag-good-on); background: var(--ag-good); border-color: var(--ag-good);
}
.organization-tile__actions .button--outline-danger:hover {
  color: var(--ag-bad-on); background: var(--ag-bad); border-color: var(--ag-bad);
}
.organization-tile__actions .button--outline-warning:hover {
  color: var(--ag-warn-on); background: var(--ag-warn); border-color: var(--ag-warn);
}
.organization-tile__actions .button--outline-info:hover,
.organization-tile__actions .button--outline-secondary:hover {
  color: var(--ag-brand-on); background: var(--ag-brand); border-color: var(--ag-brand);
}

.button--outline-success:hover { color: var(--ag-good-on); background: var(--ag-good); border-color: var(--ag-good); }
.button--outline-danger:hover  { color: var(--ag-bad-on);   background: var(--ag-bad);  border-color: var(--ag-bad); }
.button--outline-warning:hover { color: var(--ag-warn-on); background: var(--ag-warn); border-color: var(--ag-warn); }

/* --- two more hovers written for the navy header and the old shell -------
   `.aeg-admin-link:hover` lifted a 16% white veil and set `--ag-nav-text`:
   correct on navy, and on a surface header it is a light grey word on a
   slightly different light grey, 3.2:1.

   `.button--ghost:hover` shared a declaration with `.icon-button--danger`
   inside the shell, so every ghost button in the admin pages turned red on
   hover — and in dark mode `--ag-bad` is a light red, which put `--ag-nav-text`
   on it at 2.4:1. Separated: a ghost is not a destructive action.
   ---------------------------------------------------------------------- */
.aeg-admin-link:hover {
  color: var(--ag-brand-text);
  background: var(--ag-surface-2);
  border-color: var(--ag-brand-line);
}

.app-shell .button--ghost:hover {
  color: var(--ag-text);
  background: var(--ag-surface-2);
  border-color: var(--ag-brand);
}

.app-shell .icon-button--danger:hover {
  color: var(--ag-bad-on);
  background: var(--ag-bad);
  border-color: var(--ag-bad);
}

/* --- the small marks ----------------------------------------------------
   `.store-badge__mark` and its Android variant fill with a gradient that
   ends on `--ag-good`. In dark that token is a light mint (#34d399), because
   the status colours invert, and the white "iOS"/"AOS" capitals on it
   measure 1.9:1. The same answer as the icon tiles: one flat brand fill,
   where the label's contrast is a property of the pair rather than of
   whichever end of a gradient the glyph happens to sit on.
   ---------------------------------------------------------------------- */
.store-badge__mark,
.store-badge--android .store-badge__mark {
  background: var(--ag-brand);
  color: var(--ag-brand-on);
}

/* --- the shell's legacy workspace tokens --------------------------------
   main.css sets these on `.app-shell` as fixed hexes, which beat the `:root`
   aliases for anything inside the shell — so the body copy on the onboarding
   page stayed at #64748b and measured 4.0:1 on the dark surface. Pointed at
   the theme tokens, where they follow light and dark like everything else.
   ---------------------------------------------------------------------- */
.app-shell {
  --workspace-ink:    var(--ag-text);
  --workspace-muted:  var(--ag-muted);
  --workspace-line:   var(--ag-line);
  --workspace-soft:   var(--ag-surface-2);
  --workspace-blue:   var(--ag-brand);
  --workspace-cyan:   var(--ag-brand-ink);
  --workspace-green:  var(--ag-good);
  --workspace-shadow: none;
}

/* --- the language control in the profile modal -------------------------- */
.profile-locale {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ag-line);
}

.profile-locale__label {
  margin: 0;
  color: var(--ag-subtle);
  font-family: var(--ag-display);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.profile-locale__choices { display: flex; gap: 6px; }

.profile-locale__option {
  padding: 5px 12px;
  border: 1px solid var(--ag-line-strong);
  border-radius: var(--ag-r-pill);
  background: var(--ag-surface);
  color: var(--ag-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.profile-locale__option:hover {
  border-color: var(--ag-brand);
  background: var(--ag-surface-2);
  color: var(--ag-text);
}

.profile-locale__option.is-active {
  background: var(--ag-brand);
  border-color: var(--ag-brand);
  color: var(--ag-brand-on);
  font-weight: 600;
}

.profile-locale__option.is-active:hover {
  background: var(--ag-brand-hover);
  border-color: var(--ag-brand-hover);
  color: var(--ag-brand-hover-on);
}

/* ===========================================================================
   The embedded documents
   ---------------------------------------------------------------------------
   The Get Started Guide and the Product Brief are standalone HTML files with
   their own stylesheets, rendered inside the application by
   `buildDocumentPage`. That scoping rewrites their `:root` to
   `.embedded-document`, which is the hook used here: their palette is
   redefined from the application's tokens, so one block turns both documents
   over to the brand and gives them dark mode.

   Scoped under `body.document-page` to outrank the document's own block —
   its <style> is emitted in the body, after this stylesheet, so at equal
   specificity the document would win on source order.

   The documents themselves are left alone. They are real deliverables that
   open from disk and get served statically, where `--ag-*` does not exist
   and their own light palette is the right one.
   ========================================================================= */
body.document-page .embedded-document {
  --ink:    var(--ag-text);
  --ink-2:  var(--ag-text);
  --muted:  var(--ag-muted);
  --blue:   var(--ag-brand);
  --cyan:   var(--ag-teal);
  --green:  var(--ag-good);
  --amber:  var(--ag-warn);
  --red:    var(--ag-bad);
  --paper:  var(--ag-surface);
  --mist:   var(--ag-surface-2);
  --soft:   var(--ag-surface-2);
  --line:   var(--ag-line);
  --line-2: var(--ag-line);
  --shadow: none;
  /* The documents declare `color-scheme: light`, which forces light form
     controls and scrollbars inside a dark page. */
  color-scheme: light dark;
  color: var(--ag-text);
  background: var(--ag-bg);
  font-family: var(--ag-sans);
}

body.document-page { background: var(--ag-bg); }

/* --- the guide's own section navigation ---------------------------------
   Kept for the navigation, restyled as a sub-bar under the application
   header. The document styles it as a translucent white slab with a
   backdrop blur, which on a dark page is a white stripe.
   ---------------------------------------------------------------------- */
body.document-page .embedded-document .doc-topbar {
  background: var(--ag-surface);
  border-bottom: 1px solid var(--ag-line);
  backdrop-filter: none;
  /* Not sticky here. `.embedded-document` is `overflow: hidden`, which makes
     it the sticky container rather than the viewport — so the bar cannot
     stick to the page at all, and a `top` offset on it is applied
     immediately as a gap instead. That gap, plus the old 90px clearance on
     main, was the black strip under the site header. The site header is
     sticky on its own; the guide's section nav scrolls with the guide. */
  position: static;
}

body.document-page .embedded-document .doc-topbar__inner { min-height: 56px; }

body.document-page .embedded-document .doc-nav a {
  color: var(--ag-muted);
  background: var(--ag-surface);
  border-color: var(--ag-line);
}

body.document-page .embedded-document .doc-nav a:hover {
  color: var(--ag-brand-text);
  background: var(--ag-surface-2);
  border-color: var(--ag-brand-line);
}

/* --- headings and body copy --------------------------------------------- */
body.document-page .embedded-document h1,
body.document-page .embedded-document h2,
body.document-page .embedded-document h3,
body.document-page .embedded-document h4 {
  color: var(--ag-text);
  font-family: var(--ag-display);
}

/* No blanket rule for body copy. The documents set it from their own --ink
   and --muted, both of which are mapped onto the theme above, and forcing
   every <p> to full-strength ink flattened the lead-versus-body hierarchy
   they were written with. Inheritance from `.embedded-document` covers
   anything that sets no colour at all.
   ---------------------------------------------------------------------- */

body.document-page .embedded-document code,
body.document-page .embedded-document pre {
  background: var(--ag-surface-2);
  border-color: var(--ag-line);
  color: var(--ag-text);
  font-family: var(--ag-mono);
}

/* --- the documents' accent, which is text far more often than it is a fill
   ----------------------------------------------------------------------
   `--blue` does the same double duty `--ink` does: link and accent text, and
   the fill of a handful of buttons and numbered steps. As text on the dark
   theme's ground the logo blue is 3.5:1, so the token follows the text role
   and the few fills are restated below with the label colour that goes with
   them. Same reasoning as --ag-brand-text existing at all.
   ---------------------------------------------------------------------- */
body.document-page .embedded-document { --blue: var(--ag-brand-text); }

/* Every fill the documents paint with `--blue`, restated with the solid
   brand and the label colour that belongs to it. Listed rather than
   pattern-matched because there is no way to select "an element whose
   background happens to be the accent", and because each one's label has to
   be decided deliberately — which is the whole lesson of this refit. */
body.document-page .embedded-document .doc-button--primary,
body.document-page .embedded-document .doc-ui-button,
body.document-page .embedded-document .doc-step-number,
body.document-page .embedded-document .doc-aegis-mark,
body.document-page .embedded-document .doc-ms-mark,
body.document-page .embedded-document .doc-app-mark,
body.document-page .embedded-document .doc-yubikey-mark,
body.document-page .embedded-document .doc-connector-chip span,
body.document-page .embedded-document .doc-avatar,
body.document-page .embedded-document .doc-steps li::before,
body.document-page .embedded-document .doc-mini-steps li::before {
  background: var(--ag-brand);
  border-color: var(--ag-brand);
  color: var(--ag-brand-on);
}

/* The status fills. These colours invert between themes — dark inks on the
   light page, light inks on the dark one — so the label comes from the pair
   rather than being assumed white. */
body.document-page .embedded-document .doc-phone-action,
body.document-page .embedded-document .doc-verified-dot {
  background: var(--ag-good);
  border-color: var(--ag-good);
  color: var(--ag-good-on);
}

body.document-page .embedded-document .doc-meter__fill { background: var(--ag-good); }

/* The dark-chrome rules above set every descendant's colour, which also
   catches the brand-filled marks sitting inside them — nav ink on the brand
   blue is 4.18:1, the same pairing that was wrong across the application
   chrome. Restated one level deeper so the mark keeps its own label. */
body.document-page .embedded-document .doc-portal-hero .doc-app-mark,
body.document-page .embedded-document .doc-portal-hero .doc-aegis-mark,
body.document-page .embedded-document .doc-portal-hero .doc-ms-mark,
body.document-page .embedded-document .doc-portal-hero .doc-avatar,
body.document-page .embedded-document .doc-phone-card .doc-app-mark,
body.document-page .embedded-document .doc-phone-card .doc-avatar {
  color: var(--ag-brand-on);
}

/* A screenshot of the portal: dark chrome in both themes, like the phone.
   Its gradient ended on `--blue`, which now follows the text role and is a
   light blue on the dark theme — pale type on a pale blue. */
body.document-page .embedded-document .doc-portal-hero {
  background: var(--ag-nav);
}

/* --- type inside the drawn device chrome --------------------------------
   `.doc-phone-card` is the screen of an illustrated phone, so it stays dark
   in both themes — it is a picture of a device, not a surface the reader's
   theme applies to. Its contents therefore need the chrome ink rather than
   the page ink, which in light mode is near-black on that dark screen.
   ---------------------------------------------------------------------- */
body.document-page .embedded-document .doc-quote-panel,
body.document-page .embedded-document .doc-quote-panel h1,
body.document-page .embedded-document .doc-quote-panel h2,
body.document-page .embedded-document .doc-quote-panel h3,
body.document-page .embedded-document .doc-quote-panel p,
body.document-page .embedded-document .doc-quote-panel li,
body.document-page .embedded-document .doc-quote-panel strong,
body.document-page .embedded-document .doc-quote-panel span,
body.document-page .embedded-document .doc-portal-hero,
body.document-page .embedded-document .doc-portal-hero h1,
body.document-page .embedded-document .doc-portal-hero h2,
body.document-page .embedded-document .doc-portal-hero h3,
body.document-page .embedded-document .doc-portal-hero p,
body.document-page .embedded-document .doc-portal-hero li,
body.document-page .embedded-document .doc-portal-hero strong,
body.document-page .embedded-document .doc-portal-hero span,
body.document-page .embedded-document .doc-phone-card,
body.document-page .embedded-document .doc-phone-card h1,
body.document-page .embedded-document .doc-phone-card h2,
body.document-page .embedded-document .doc-phone-card h3,
body.document-page .embedded-document .doc-phone-card h4,
body.document-page .embedded-document .doc-phone-card p,
body.document-page .embedded-document .doc-phone-card li,
body.document-page .embedded-document .doc-phone-card strong,
body.document-page .embedded-document .doc-phone-card span {
  color: var(--ag-nav-text);
}

body.document-page .embedded-document .doc-phone-card .doc-eyebrow,
body.document-page .embedded-document .doc-phone-card small {
  color: var(--ag-nav-muted);
}

/* --- cookie notice -------------------------------------------------------
   A bar, not a dialog. What this deployment stores is strictly necessary, so
   the notice is information rather than a decision: it never covers the page,
   never traps focus, never locks scrolling and carries no Accept/Decline
   pair. It sits under the modal layer (z 80+) and over ordinary content.

   `[hidden]` is (0,2,0) against the block's own (0,1,0), so it wins whatever
   the order — the bar stays invisible until the script has read storage.
   ------------------------------------------------------------------------ */
.cookie-notice {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--ag-surface);
  border-top: 1px solid var(--ag-line-strong);
  box-shadow: 0 -10px 34px rgb(9 9 11 / .10);
}
.cookie-notice[hidden] { display: none; }

.cookie-notice__text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: .875rem;
  line-height: 1.55;
  color: var(--ag-muted);
  max-width: 78ch;
}

.cookie-notice__link {
  flex: 0 0 auto;
  font-size: .845rem;
  font-weight: 600;
  color: var(--ag-brand-text);
}

.cookie-notice__dismiss {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 9px 22px;
  font: inherit;
  font-size: .845rem;
  font-weight: 600;
  color: var(--ag-text);
  background: var(--ag-surface);
  border: 1px solid var(--ag-line-strong);
  border-radius: 9px;
  cursor: pointer;
}
.cookie-notice__dismiss:hover {
  border-color: var(--ag-brand);
  color: var(--ag-brand-text);
}
.cookie-notice__dismiss:focus-visible {
  outline: 2px solid var(--ag-brand);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .cookie-notice {
    flex-wrap: wrap;
    gap: 12px 18px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .cookie-notice__text { flex: 1 1 100%; }
  .cookie-notice__dismiss { margin-left: auto; }
}

/* --- the cookie table on /privacy#cookies -------------------------------- */

/* The site header is sticky and 64px tall, so following /cookies landed the
   section's eyebrow and heading underneath it. */
#cookies { scroll-margin-top: 80px; }

.cookie-table-wrap { overflow-x: auto; }

.cookie-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.cookie-table th {
  text-align: left;
  padding: 0 16px 10px 0;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ag-muted);
  border-bottom: 1px solid var(--ag-line-strong);
  white-space: nowrap;
}
.cookie-table td {
  padding: 13px 16px 13px 0;
  line-height: 1.6;
  color: var(--ag-muted);
  border-bottom: 1px solid var(--ag-line);
  vertical-align: top;
}
.cookie-table td:first-child { color: var(--ag-text); }
.cookie-table code {
  font-size: .82rem;
  background: var(--ag-surface-2);
  padding: 1px 6px;
  border-radius: 5px;
  color: var(--ag-text);
}
.cookie-table tr:last-child td { border-bottom: 0; }


/* ---------------------------------------------------------------------------
   Ghost buttons as pills.

   `.button` above sets `box-shadow: none`, and this file loads after main.css
   at the same specificity — so the pill treatment written there was being
   cancelled here for `.button--ghost`, while `.aeg-btn--ghost`, which this
   file does not mention, kept it. Stated once more in the place that wins.
   --------------------------------------------------------------------------- */
.button--ghost {
  background: var(--ag-surface);
  border: 1px solid var(--ag-line-strong);
  border-radius: 999px;
  box-shadow: var(--ag-sh);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.button--ghost:hover,
.button--ghost:focus-visible {
  transform: translateY(-2px);
  border-color: var(--ag-brand-line);
  background: var(--ag-surface);
  box-shadow: var(--ag-raise-lift);
}

.button--ghost:active {
  transform: translateY(0);
  box-shadow: var(--ag-sh);
}

@media (prefers-reduced-motion: reduce) {
  .button--ghost { transition: none; }
  .button--ghost:hover,
  .button--ghost:focus-visible { transform: none; }
}
