/* =============================================================================
   Project Aether — Glance styling (FND-19)
   Follows the portfolio brand guide (blowfish-ct-folio/docs/brand): dark, warm,
   editorial. Ember orange on near-black stone; amber and rose only as gradient
   accents; Plus Jakarta Sans headings, Inter body, Fira Code for code.
   Every colour is a token here. Rules below :root use only role tokens
   (--ae-bg, --ae-text, --ae-accent-text, ...) and status tokens, never a
   palette name or a literal colour, so a theme only re-points the roles.
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@700;800&family=Inter:wght@400;600&family=Fira+Code:wght@400&display=swap");

:root {
  /* Brand palette */
  --ae-orange: #EA580C;          /* primary: links, key accents */
  --ae-orange-bright: #F97316;
  --ae-orange-light: #FB923C;    /* accent text on dark */
  --ae-amber: #D97706;
  --ae-amber-light: #FBBF24;
  --ae-rose: #E11D48;
  --ae-rose-light: #FB7185;

  /* Warm stone neutrals */
  --ae-stone-900: #1C1917;       /* page background */
  --ae-stone-800: #292524;       /* card surface */
  --ae-stone-700: #44403C;       /* borders */
  --ae-stone-600: #57534E;
  --ae-stone-400: #A8A29E;       /* muted text */
  --ae-stone-300: #D6D3D1;       /* body text on dark */
  --ae-stone-100: #F5F5F4;       /* headings on dark; light page background */

  /* Light-theme additions. Text colours are the -700 shades: the brand's
     #EA580C is 3.3:1 on #F5F5F4, under the 4.5:1 that body-size text needs. */
  --ae-white: #FFFFFF;           /* light card surface */
  --ae-stone-50: #FAFAF9;        /* light inset tiles */
  --ae-stone-200: #E7E5E4;       /* light borders */
  --ae-stone-550: #6B6560;       /* light muted text (#78716C is 4.4:1 on the page) */
  --ae-orange-dark: #C2410C;     /* accent text on light, 4.8:1 */
  --ae-amber-dark: #B45309;
  --ae-rose-dark: #BE123C;
  --ae-lime: #84CC16;
  --ae-lime-dark: #3F6212;       /* ok text on light, 5.7:1 on a tinted badge */

  /* ── Theme ─────────────────────────────────────────────────────────────
     Every role and status token is light-dark(<light>, <dark>). The
     color-scheme on <html> picks the side: dark by default, "light dark"
     (follow the OS) for Auto, light for the Light preset; see below :root.
     Rules use only these tokens: never a palette name or a literal colour. */
  color-scheme: dark;

  --ae-bg: light-dark(var(--ae-stone-100), var(--ae-stone-900));            /* page */
  --ae-surface: light-dark(var(--ae-white), var(--ae-stone-800));           /* cards, widgets */
  --ae-surface-hover: light-dark(var(--ae-stone-100), var(--ae-stone-700)); /* Glance's highlighted rows */
  --ae-inset: light-dark(var(--ae-stone-50), var(--ae-stone-900));          /* tiles inside a card: gauges, charts */
  --ae-border: light-dark(var(--ae-stone-200), var(--ae-stone-700));        /* card edges, row dividers, grid lines */
  --ae-border-strong: light-dark(var(--ae-stone-300), var(--ae-stone-600)); /* table heads, buttons, neutral dot */
  --ae-text-strong: light-dark(var(--ae-stone-900), var(--ae-stone-100));   /* headings, names, big numbers */
  --ae-text: light-dark(var(--ae-stone-600), var(--ae-stone-300));          /* body */
  --ae-text-muted: light-dark(var(--ae-stone-550), var(--ae-stone-400));    /* labels, captions, meta */
  --ae-accent-text: light-dark(var(--ae-orange-dark), var(--ae-orange-light)); /* links, code, accent labels */
  --ae-accent-line: var(--ae-orange);                                       /* lines, gauges, hover edges, nav underline */
  /* Light badge fills are opaque tints on white, so a badge reads the same on the page and on a card. */
  --ae-accent-wash: light-dark(color-mix(in srgb, var(--ae-orange) 7%, var(--ae-white)), rgba(234, 88, 12, 0.12)); /* accent badge fill */
  --ae-accent-edge: light-dark(rgba(194, 65, 12, 0.40), rgba(234, 88, 12, 0.45)); /* accent badge edge */
  --ae-plate: var(--ae-stone-900);                                          /* behind the dark diagrams, both themes */
  --ae-swatch-dark: var(--ae-stone-900);                                    /* theme picker chips */
  --ae-swatch-light: var(--ae-stone-100);

  --ae-gradient: linear-gradient(135deg,
    light-dark(var(--ae-orange-dark), var(--ae-orange)) 0%,
    light-dark(var(--ae-amber-dark), var(--ae-amber-light)) 55%,
    light-dark(var(--ae-rose-dark), var(--ae-rose-light)) 100%);
  --ae-glow: light-dark(rgba(234, 88, 12, 0.06), rgba(234, 88, 12, 0.10));
  --ae-area-top: light-dark(rgba(234, 88, 12, 0.22), rgba(234, 88, 12, 0.32));
  --ae-area-bottom: rgba(234, 88, 12, 0.02);

  /* Status (semantic, separate from the accent) */
  --ae-ok: light-dark(var(--ae-lime-dark), var(--ae-lime));
  --ae-warn: light-dark(var(--ae-amber-dark), var(--ae-amber-light));
  --ae-bad: light-dark(var(--ae-rose-dark), var(--ae-rose-light));
  --ae-ok-wash: light-dark(color-mix(in srgb, var(--ae-lime-dark) 8%, var(--ae-white)), rgba(132, 204, 22, 0.12));
  --ae-ok-edge: light-dark(rgba(63, 98, 18, 0.40), rgba(132, 204, 22, 0.45));
  --ae-bad-wash: light-dark(color-mix(in srgb, var(--ae-rose-dark) 7%, var(--ae-white)), rgba(251, 113, 133, 0.12));
  --ae-warn-wash: light-dark(color-mix(in srgb, var(--ae-amber-dark) 7%, var(--ae-white)), rgba(251, 191, 36, 0.10));
  --ae-bad-edge: light-dark(rgba(190, 18, 60, 0.40), rgba(251, 113, 133, 0.45));

  --ae-font-head: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --ae-font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ae-font-code: "Fira Code", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Glance's own variables, mapped onto the brand */
  --color-background: var(--ae-bg);
  --color-widget-background: var(--ae-surface);
  --color-widget-background-highlight: var(--ae-surface-hover);
  --color-widget-content-border: var(--ae-border);
  --color-separator: var(--ae-border);
  --color-popover-border: var(--ae-border);
  --color-text-base: var(--ae-text);
  --color-text-base-muted: var(--ae-text-muted);
  --color-text-highlight: var(--ae-text-strong);
  --color-text-subdue: var(--ae-text-muted);
  --color-primary: var(--ae-accent-text);
  --color-negative: var(--ae-bad);
  --border-radius: 10px;
}

/* Which side of light-dark() applies. Glance sets data-theme from the theme
   cookie: "default" = Auto (no choice yet, follows the OS), a preset with
   light: true sets data-scheme="light". */
:root[data-theme="default"] { color-scheme: light dark; }
:root[data-scheme="light"] { color-scheme: light; }

/* Auto on a light OS: Glance still renders data-scheme="dark", so give its
   own derived colours (selection, popovers, the widget shadow) the inputs its
   light preset would. Keep in step with theme.presets.default-light in glance.yml. */
@media (prefers-color-scheme: light) {
  :root[data-theme="default"] {
    --scheme: 100% -;
    --bgh: 60;
    --bgs: 5%;
    --bgl: 96%;
    --cm: 1.3;
    --tsm: 0.5;
  }
  /* Glance inverts monochrome bookmark icons unless data-scheme is light. */
  :root[data-theme="default"] .flat-icon { filter: none; }
}

/* ─── Base ──────────────────────────────────────────────────────────────── */

body {
  font-family: var(--ae-font-body);
  font-variant-ligatures: normal;
  background-image: radial-gradient(circle at 0% 0%, var(--ae-glow), transparent 45%);
  background-attachment: fixed;
}

code,
.ae-fact code {
  font-family: var(--ae-font-code);
  font-size: 0.92em;
  color: var(--ae-accent-text);
}

/* ─── Header ────────────────────────────────────────────────────────────── */

.logo {
  font-family: var(--ae-font-head);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--ae-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-item {
  font-family: var(--ae-font-head);
  font-weight: 700;
}

.nav-item-current {
  border-bottom-color: var(--ae-accent-line);
}

/* ─── Widget headers: small uppercase labels ───────────────────────────── */

.widget-header {
  font-family: var(--ae-font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 1.15rem;
  color: var(--ae-text-muted);
}

.bookmarks-group-title {
  font-family: var(--ae-font-head);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-accent-text);
}

/* ─── Cards (custom html widgets) ───────────────────────────────────────── */

.vitals-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
  background: var(--ae-surface);
  border: 1px solid var(--ae-border);
  border-radius: var(--border-radius);
}

.vitals-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ae-border);
}

.vitals-title {
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
  color: var(--ae-text-strong);
}

.ae-grad {
  background: var(--ae-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.vitals-badge {
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--ae-accent-text);
  background: var(--ae-accent-wash);
  border: 1px solid var(--ae-accent-edge);
  white-space: nowrap;
}

.ae-note {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.6;
  color: var(--ae-text);
  max-width: 75ch;
}

/* Fact tiles */
.top-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.top-item {
  padding: 10px 12px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
  min-width: 0;
}

.top-label {
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-text-muted);
}

.top-value {
  font-family: var(--ae-font-head);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 2px;
  color: var(--ae-text-strong);
}

.section-title {
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-accent-text);
}

/* Label / fact rows */
.bar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--ae-border);
}

.bar-row:last-child { border-bottom: none; }

.bar-name {
  flex: 0 0 110px;
  font-family: var(--ae-font-head);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ae-text-strong);
}

.ae-fact {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 1.3rem;
  line-height: 1.5;
  color: var(--ae-text);
}

/* Infrastructure table */
.ae-table-wrap { overflow-x: auto; }

.ae-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.3rem;
  text-align: left;
}

.ae-table th {
  padding: 8px 10px;
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-text-muted);
  border-bottom: 1px solid var(--ae-border-strong);
  white-space: nowrap;
}

.ae-table td {
  padding: 8px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--ae-border);
  color: var(--ae-text);
}

.ae-table td strong {
  font-family: var(--ae-font-head);
  color: var(--ae-text-strong);
}

.ae-table tr:last-child td { border-bottom: none; }

/* ─── FND-20: live widgets ──────────────────────────────────────────────── */

.vitals-badge.ae-live { color: var(--ae-ok); background: var(--ae-ok-wash); border-color: var(--ae-ok-edge); }
.vitals-badge.ae-stale { color: var(--ae-bad); background: var(--ae-bad-wash); border-color: var(--ae-bad-edge); }

.top-value.ae-ok { color: var(--ae-ok); }
.top-value.ae-bad { color: var(--ae-bad); }

/* Gauges */
.ae-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.ae-gauge {
  text-align: center;
  padding: 14px 8px 12px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
}

.ae-gauge svg { width: 104px; height: 104px; display: block; margin: 0 auto; }
.ae-gauge-track { fill: none; stroke: var(--ae-border); stroke-width: 7; }
.ae-gauge-fill { fill: none; stroke: var(--ae-accent-line); stroke-width: 7; stroke-linecap: round; }
.ae-gauge-fill.ae-warn { stroke: var(--ae-warn); }
.ae-gauge-fill.ae-high { stroke: var(--ae-bad); }
.ae-gauge-val { fill: var(--ae-text-strong); font-family: var(--ae-font-head); font-weight: 800; font-size: 14px; letter-spacing: -0.02em; }

.ae-gauge-label {
  margin-top: 8px;
  font-family: var(--ae-font-head);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ae-text-strong);
}

.ae-gauge-group { font-size: 1.05rem; color: var(--ae-text-muted); }

/* Trend charts */
.ae-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.ae-chart {
  padding: 10px 12px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
  min-width: 0;
}

.ae-chart svg { display: block; width: 100%; overflow: visible; }

.ae-chart-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.ae-chart-title { font-family: var(--ae-font-head); font-weight: 700; font-size: 1.2rem; color: var(--ae-text-strong); }
.ae-chart-now { font-family: var(--ae-font-head); font-weight: 800; font-size: 1.5rem; color: var(--ae-accent-text); font-variant-numeric: tabular-nums; }

.ae-grid { stroke: var(--ae-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ae-area { fill: var(--ae-area-top); stroke: none; }
.ae-line { fill: none; stroke: var(--ae-accent-line); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

.ae-chart-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 1.05rem;
  color: var(--ae-text-muted);
  font-variant-numeric: tabular-nums;
}

.ae-chart-big {
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 3.2rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ae-text-strong);
  font-variant-numeric: tabular-nums;
}

.ae-chart-big span { font-size: 0.5em; margin-left: 3px; color: var(--ae-accent-text); letter-spacing: 0; }
.ae-chart-range { text-align: right; font-size: 1.05rem; line-height: 1.4; color: var(--ae-text-muted); font-variant-numeric: tabular-nums; }
.ae-chart svg { height: 120px; }

.ae-backups-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 6px; }
.ae-status-meta b { color: var(--ae-text-strong); font-weight: 700; }

/* Heartbeat list */
.ae-status { list-style: none; margin: 0; padding: 0; }

.ae-status li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--ae-border);
}

.ae-status li:last-child { border-bottom: none; }
.ae-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ae-border-strong); }
.ae-dot.ae-ok { background: var(--ae-ok); }
.ae-dot.ae-warn { background: var(--ae-warn); }
.ae-dot.ae-bad { background: var(--ae-bad); }
.ae-status-name { font-size: 1.3rem; color: var(--ae-text-strong); min-width: 0; }
.ae-status-meta { font-size: 1.1rem; color: var(--ae-text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.ae-versions { list-style: none; margin: 10px 0 0; padding: 0; }
.ae-versions li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--ae-border); font-size: 1.2rem; }
.ae-versions li:last-child { border-bottom: none; }
.ae-versions code { overflow-wrap: anywhere; min-width: 0; }
.ae-versions span { color: var(--ae-text); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─── Infrastructure page: big numbers, bars, environment cards ────────── */

.ae-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.ae-stat {
  padding: 18px 20px;
  background: var(--ae-surface);
  border: 1px solid var(--ae-border);
  border-radius: var(--border-radius);
  min-width: 0;
}

.ae-stat-label,
.ae-env-kicker {
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-text-muted);
}

.ae-stat-num {
  margin: 6px 0 4px;
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 4.2rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ae-text-strong);
  font-variant-numeric: tabular-nums;
}

.ae-stat-num.ae-ok { color: var(--ae-ok); }
.ae-stat-num.ae-bad { color: var(--ae-bad); }
.ae-gap-top { margin-top: var(--widget-gap); }

.ae-live-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.ae-live-title {
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: -0.02em;
  color: var(--ae-text-strong);
}

.ae-stat-num span { font-size: 0.45em; margin-left: 4px; color: var(--ae-accent-text); letter-spacing: 0; }
.ae-stat-sub { font-size: 1.15rem; color: var(--ae-text-muted); }

.ae-envs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ae-env { margin-bottom: 0; }
.ae-env-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }

.ae-env-name {
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 2.6rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  background: var(--ae-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ae-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.ae-chips span {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 1.1rem;
  color: var(--ae-text);
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
}

.ae-muted { margin: 0; font-size: 1.2rem; color: var(--ae-text-muted); }

.ae-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr) 4.4rem;
  align-items: center;
  gap: 12px;
}

.ae-bar-label span { display: block; font-family: var(--ae-font-head); font-weight: 700; font-size: 1.25rem; color: var(--ae-text-strong); }
.ae-bar-label small { display: block; font-size: 1rem; color: var(--ae-text-muted); }
.ae-bar { display: block; width: 100%; height: 10px; }
.ae-bar-track { fill: var(--ae-border); }
.ae-bar-fill { fill: var(--ae-accent-line); }
.ae-bar-fill.ae-warn { fill: var(--ae-warn); }
.ae-bar-fill.ae-high { fill: var(--ae-bad); }

.ae-section-head {
  margin: 10px 0 10px;
  font-family: var(--ae-font-head);
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ae-text-muted);
}

.ae-bar-pct {
  text-align: right;
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
  color: var(--ae-text-strong);
  font-variant-numeric: tabular-nums;
}

/* ADR tiles */
.ae-adrs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.ae-adr {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color .2s;
  min-width: 0;
}

.ae-adr:hover, .ae-adr:focus-visible { border-color: var(--ae-accent-line); }

.ae-adr-num {
  font-family: var(--ae-font-head);
  font-weight: 800;
  font-size: 3rem;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--ae-accent-text);
}

.ae-adr-title { font-family: var(--ae-font-head); font-weight: 700; font-size: 1.35rem; color: var(--ae-text-strong); }
.ae-adr-sub { font-size: 1.1rem; color: var(--ae-text-muted); }

@media (max-width: 1100px) {
  .ae-envs { grid-template-columns: minmax(0, 1fr); }
  .ae-adrs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ─── Networking page ───────────────────────────────────────────────────── */

.ae-path { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.ae-hop {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
  min-width: 0;
}
.ae-hop-end { border-color: var(--ae-accent-edge); background: var(--ae-accent-wash); }
.ae-hop-k { font-family: var(--ae-font-head); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--ae-text-strong); }
.ae-hop-v { font-size: 1.15rem; color: var(--ae-text-muted); }
.ae-flow-arrow { align-self: center; font-family: var(--ae-font-head); font-weight: 800; font-size: 2rem; color: var(--ae-accent-text); }

.ae-flows { display: flex; flex-direction: column; }
.ae-flow {
  display: grid;
  grid-template-columns: minmax(0, 12rem) 2rem minmax(0, 14rem) max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--ae-border);
}
.ae-flow:last-child { border-bottom: none; }
.ae-flow .ae-flow-arrow { font-size: 1.6rem; text-align: center; }
.ae-flow-from, .ae-flow-to { font-family: var(--ae-font-head); font-weight: 700; font-size: 1.3rem; color: var(--ae-text-strong); }
.ae-flow-what {
  justify-self: start;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 1.1rem;
  color: var(--ae-accent-text);
  background: var(--ae-accent-wash);
  border: 1px solid var(--ae-accent-edge);
  white-space: nowrap;
}
.ae-flow-note { font-size: 1.15rem; color: var(--ae-text-muted); }

.ae-changes { list-style: none; margin: 0; padding: 0; }
.ae-changes li {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--ae-border);
}
.ae-changes li:last-child { border-bottom: none; }
.ae-change-id { font-family: var(--ae-font-code); font-size: 1.15rem; color: var(--ae-accent-text); }
.ae-change-title { font-family: var(--ae-font-head); font-weight: 700; font-size: 1.3rem; color: var(--ae-text-strong); }
.ae-change-text { font-size: 1.2rem; color: var(--ae-text-muted); }

@media (max-width: 900px) {
  .ae-flow { grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr); }
  .ae-flow-what, .ae-flow-note { grid-column: 1 / -1; }
  .ae-path > .ae-flow-arrow { display: none; }
}

/* ─── Overview intro (FND-21) ───────────────────────────────────────────── */

.ae-intro { border-color: var(--ae-accent-edge); }
.ae-intro-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ae-intro-name { font-family: var(--ae-font-head); font-weight: 800; font-size: 2.2rem; line-height: 1.1; letter-spacing: -0.02em; color: var(--ae-text-strong); }
.ae-intro-links { display: flex; flex-wrap: wrap; gap: 8px; }
.ae-intro-links a {
  padding: 5px 14px;
  border-radius: 999px;
  font-family: var(--ae-font-head);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ae-accent-text);
  background: var(--ae-accent-wash);
  border: 1px solid var(--ae-accent-edge);
  text-decoration: none;
}
.ae-intro-links a:hover, .ae-intro-links a:focus-visible { color: var(--ae-text-strong); border-color: var(--ae-accent-line); }
.ae-stat-sub a { color: var(--ae-accent-text); }

.ae-footer { font-size: 1.15rem; color: var(--ae-text-muted); text-align: center; }
.ae-footer a { color: var(--ae-accent-text); }

/* ─── How it fits together (FND-22) ─────────────────────────────────────── */

.ae-arch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem minmax(0, 1fr) 9rem minmax(0, 1fr) 7rem minmax(0, 0.7fr);
  align-items: center;
  gap: 8px;
}
.ae-node {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 12px 14px;
  background: var(--ae-inset);
  border: 1px solid var(--ae-border);
  border-radius: 8px;
  min-width: 0;
}
.ae-node-end { border-color: var(--ae-accent-edge); background: var(--ae-accent-wash); }
.ae-node-kicker { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ae-accent-text); }
.ae-node-name { font-family: var(--ae-font-head); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; color: var(--ae-text-strong); }
.ae-node-what { font-size: 1.15rem; color: var(--ae-text-muted); }
.ae-node-status { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; font-size: 1.1rem; color: var(--ae-text); font-variant-numeric: tabular-nums; }
.ae-link { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.ae-link-arrow { font-family: var(--ae-font-head); font-weight: 800; font-size: 2rem; line-height: 1; color: var(--ae-accent-text); }
.ae-link-text { font-size: 1.05rem; color: var(--ae-text-muted); }
.ae-link-diode .ae-link-arrow { color: var(--ae-ok); }
.ae-link b { color: var(--ae-bad); }

@media (max-width: 1100px) {
  .ae-arch { grid-template-columns: minmax(0, 1fr); }
  .ae-link { flex-direction: row; justify-content: center; gap: 8px; }
  .ae-link-arrow { transform: rotate(90deg); font-size: 1.6rem; }
}

/* ─── Reliability over time (FND-22) ───────────────────────────────────── */


.ae-record { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--widget-gap); }
.ae-record > .vitals-card { margin-bottom: 0; }
.ae-incidents { list-style: none; margin: 4px 0 0; padding: 0; }
.ae-incidents li { padding: 8px 0; border-bottom: 1px solid var(--ae-border); font-size: 1.2rem; }
.ae-incidents li:last-child { border-bottom: none; }
.ae-incidents a { color: var(--ae-text-strong); }
.ae-lesson { margin-top: 3px; color: var(--ae-text-muted); font-size: 1.15rem; }
.ae-sev { font-family: var(--ae-font-code); font-size: 1rem; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--ae-border-strong); color: var(--ae-text); }
.ae-sev.ae-sev1 { color: var(--ae-bad); border-color: var(--ae-bad-edge); }
.ae-sev.ae-sev2 { color: var(--ae-warn); border-color: var(--ae-warn); }
.ae-fact a { color: var(--ae-accent-text); }

@media (max-width: 1100px) {
  .ae-record { grid-template-columns: minmax(0, 1fr); }
}

/* Traffic diagram (GIF rendered from a private HTML source) */
/* The diagrams are drawn dark; in the light theme they sit on the page as dark plates. */
.ae-diagram { display: block; width: 100%; height: auto; border-radius: 8px; background: var(--ae-plate); }
/* The architecture diagram is dense: on narrow screens it keeps a readable width and scrolls sideways inside its card. */
.ae-diagram-scroll { overflow-x: auto; }
.ae-diagram-wide { min-width: 900px; }

/* ─── Status banner (FND-23) ────────────────────────────────────────────── */

.ae-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 16px;
  margin-bottom: 14px;
  border-radius: var(--border-radius);
  border: 1px solid var(--ae-ok-edge);
  background: var(--ae-ok-wash);
  font-size: 1.25rem;
  color: var(--ae-text);
}
.ae-banner-warn { border-color: var(--ae-warn); background: var(--ae-warn-wash); }
.ae-banner-bad { border-color: var(--ae-bad-edge); background: var(--ae-bad-wash); }
.ae-banner-plain { border-color: var(--ae-border); background: var(--ae-surface); }   /* storage line when all is well */
.ae-storage { margin-top: calc(-1 * var(--widget-gap)); }   /* sits under the Backups and alerting card, as its footer */
/* "a · b · c" that wraps without a "·" opening the next line: every item carries
   its separator in front, and the list is shifted into a clipped 20px strip. */
.ae-sep-clip { overflow: hidden; min-width: 0; }
.ae-sep-list { display: flex; flex-wrap: wrap; row-gap: 4px; margin-left: -20px; }
.ae-sep-list > span::before { content: "·"; display: inline-block; width: 20px; text-align: center; color: var(--ae-text-muted); }
.ae-banner .ae-dot { flex: none; }
.ae-banner-title { font-family: var(--ae-font-head); font-weight: 800; color: var(--ae-text-strong); }
.ae-banner-items { display: flex; flex-wrap: wrap; gap: 4px 0; }
.ae-banner-items > span + span::before { content: "·"; margin: 0 8px; color: var(--ae-text-muted); }

/* ─── Recovery objectives (FND-23) ──────────────────────────────────────── */

.ae-rto { display: flex; flex-direction: column; }
.ae-rto-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 2fr) minmax(0, 0.6fr) minmax(0, 1.5fr);
  gap: 12px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--ae-border);
  font-size: 1.2rem;
  color: var(--ae-text);
}
.ae-rto-row:last-child { border-bottom: none; }
.ae-rto-row b { color: var(--ae-text-strong); font-weight: 700; }
.ae-rto-head { font-size: 1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ae-text-muted); }
.ae-rto-name { font-family: var(--ae-font-head); font-weight: 700; color: var(--ae-text-strong); }
.ae-rto-proven .ae-dot, .ae-rto-backup .ae-dot { display: inline-block; margin-right: 6px; vertical-align: middle; }

@media (max-width: 900px) {
  .ae-rto-head { display: none; }
  .ae-rto-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ae-rto-name { grid-column: 1 / -1; }
  .ae-rto-proven, .ae-rto-backup { grid-column: 1 / -1; }
  .ae-rto-row > span:nth-child(2)::before { content: "RTO "; color: var(--ae-text-muted); }
  .ae-rto-row > span:nth-child(4)::before { content: "RPO "; color: var(--ae-text-muted); }
  .ae-rto-row > span:nth-child(2) { order: 1; }
  .ae-rto-row > span:nth-child(4) { order: 2; }
  .ae-rto-proven { order: 3; }
  .ae-rto-backup { order: 4; }
}

/* ─── Docs page (FND-23) ────────────────────────────────────────────────── */

.ae-badge-link { text-decoration: none; }
.ae-badge-link:hover, .ae-badge-link:focus-visible { color: var(--ae-text-strong); border-color: var(--ae-accent-line); }
.ae-doclist { list-style: none; margin: 0; padding: 0; }
.ae-doclist li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--ae-border); min-width: 0; }
.ae-doclist li:last-child { border-bottom: none; }
.ae-doclist a { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; color: var(--ae-text-strong); text-decoration: none; }
.ae-doclist a:hover .ae-doc-title, .ae-doclist a:focus-visible .ae-doc-title { color: var(--ae-accent-text); }
.ae-doclist-cols { columns: 2 22rem; column-gap: 28px; }
.ae-doclist-cols li { break-inside: avoid; }
.ae-doc-num, .ae-doc-date { flex: none; font-family: var(--ae-font-code); font-size: 1.1rem; color: var(--ae-accent-text); font-variant-numeric: tabular-nums; }
.ae-doc-title { font-size: 1.25rem; min-width: 0; }
.ae-doc-tag { flex: none; font-size: 1rem; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--ae-border-strong); color: var(--ae-text); }
.ae-doc-stack { flex-direction: column; gap: 3px !important; }
.ae-doc-note { display: flex; align-items: center; gap: 6px; font-size: 1.1rem; color: var(--ae-text-muted); }
.ae-doc-note .ae-dot { flex: none; }
.ae-record-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) {
  .ae-record-2 { grid-template-columns: minmax(0, 1fr); }
}

/* Writing page: blog posts as title + summary, no cover images (operator choice). */
.rss-detailed-thumbnail { display: none; }

/* ─── Narrow screens (recruiters open links on phones) ─────────────────── */

@media (max-width: 700px) {
  .ae-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ae-stat-num { font-size: 3.2rem; }
  .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar-name { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ─── Flow-diagram carousel (Docs page). CSS only: the page's CSP allows no inline script. ───────── */
.ae-carousel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.ae-carousel-hint { font-size: 1.1rem; color: var(--ae-text-muted); }
.ae-carousel {
  display: flex;
  gap: var(--widget-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--ae-border-strong) transparent;
}
.ae-carousel-slide { flex: 0 0 100%; min-width: 0; margin: 0; scroll-snap-align: center; scroll-margin-top: 120px; }
.ae-carousel-nav { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 8px 0 10px; }
.ae-carousel-count { min-width: 4.5em; text-align: center; font-size: 1.15rem; color: var(--ae-text-muted); font-variant-numeric: tabular-nums; }
.ae-carousel-btn { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--ae-border-strong); border-radius: 7px; background: var(--ae-surface); color: var(--ae-text-strong); font-size: 1.2rem; font-weight: 600; text-decoration: none; }
.ae-carousel-btn:hover, .ae-carousel-btn:focus-visible { border-color: var(--ae-accent-text); color: var(--ae-accent-text); }
.ae-carousel-slide figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-top: 10px; font-size: 1.2rem; color: var(--ae-text); }
.ae-carousel-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.ae-carousel-links a { color: var(--ae-accent-text); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .ae-carousel { scroll-behavior: auto; } }

/* ─── Theme picker ──────────────────────────────────────────────────────── */
/* Glance draws each chip as the theme's background with three colour dots and
   no text. The Auto chip ("default") is split dark/light, and the popover
   names each chip underneath. */

.theme-preset[data-key="default"] {
  background: linear-gradient(135deg, var(--ae-swatch-dark) 50%, var(--ae-swatch-light) 50%);
  box-shadow: inset 0 0 0 1px var(--ae-border-strong);
}

.theme-preset[data-key="default-light"] { box-shadow: inset 0 0 0 1px var(--ae-border); }

.theme-choices { padding-bottom: 1.8rem; }

.theme-choices .theme-preset::after {
  position: absolute;
  top: calc(100% + 0.7rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--ae-font-head);
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  color: var(--ae-text-muted);
  pointer-events: none;
}

.theme-choices .theme-preset-light::after { top: calc(100% + 0.8rem); } /* light chips are 0.2rem shorter */
.theme-choices .theme-preset[data-key="default"]::after { content: "Auto"; }
.theme-choices .theme-preset[data-key="default-dark"]::after { content: "Dark"; }
.theme-choices .theme-preset[data-key="default-light"]::after { content: "Light"; }
.theme-choices .theme-preset.current::after { color: var(--ae-text-strong); }
/* Visits card under Public sites (Overview) */
.ae-visits{display:grid;grid-template-columns:1fr 1fr;text-align:center}
.ae-visits + .ae-visits-note,.ae-visits-note{margin-top:12px;text-align:center}
.ae-visits-num{font-size:2.4rem;line-height:1.1;font-weight:600;color:var(--ae-text-strong);font-variant-numeric:tabular-nums}
