/* Muster Drill portal. Plain CSS, no build step. The page's CSP allows styles from this file only (style-src 'self'):
   no style attributes, no <style> blocks, and no data: URIs (img-src 'self'), so every icon is drawn with CSS or is a
   file next to this one. Fonts are self-hosted IBM Plex, the marketing site's text faces (font-src 'self').

   Design rules, so later changes stay consistent:
   - Colour: only the tokens below. Every text/background pair meets WCAG 2.2 AA (4.5:1, 3:1 for large text and UI
     edges) in both schemes. Status is never colour alone: pills carry the word.
   - Type: one sans family at a few sizes (--fs-*), weights 400/500/600, mono for IDs, ARNs, codes and labels.
   - Space: a 4 px scale (--s-*).
   - Motion: transform and opacity only, 120 to 320 ms, --ease. Nothing moves under prefers-reduced-motion. */

/* ---------- Fonts ---------- */
@font-face {
  font-family: "Plex Sans";
  font-style: normal; font-weight: 100 700; font-stretch: 85% 100%; font-display: swap;
  src: url("fonts/plex-sans-var-0.2.0-latin1.woff2") format("woff2");
  unicode-range: U+0000, U+000D, U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014,
    U+2018-201A, U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
}
@font-face {
  font-family: "Plex Sans";
  font-style: normal; font-weight: 100 700; font-stretch: 85% 100%; font-display: swap;
  src: url("fonts/plex-sans-var-0.2.0-latin2.woff2") format("woff2");
  unicode-range: U+0100-0101, U+0104-0130, U+0132-0151, U+0154-017F, U+018F, U+0192, U+01A0-01A1, U+01AF-01B0,
    U+01FA-01FF, U+0218-021B, U+0237, U+0259, U+1E80-1E85, U+1E9E, U+20A1, U+20A4, U+20A6, U+20A8-20AA, U+20AD-20AE,
    U+20B1-20B2, U+20B4-20B5, U+20B8-20BA, U+20BD, U+20BF;
}
@font-face {
  font-family: "Plex Mono";
  font-style: normal; font-weight: 100 700; font-display: swap;
  src: url("fonts/plex-mono-var-1.0.0-latin1.woff2") format("woff2");
  unicode-range: U+0020-007E, U+00A0-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2013-2014, U+2018-201A,
    U+201C-201E, U+2020-2022, U+2026, U+2030, U+2039-203A, U+2044, U+20AC, U+2122, U+2212, U+FB01-FB02;
}
/* Fallbacks sized to Plex's metrics, so the swap from the system font barely moves the text. */
@font-face { font-family: "Plex Sans Fallback"; src: local("Arial"), local("Helvetica Neue"), local("Helvetica"), local("Liberation Sans");
  size-adjust: 104%; ascent-override: 98%; descent-override: 26%; line-gap-override: 0%; }
@font-face { font-family: "Plex Mono Fallback"; src: local("Courier New"), local("Menlo"), local("Liberation Mono");
  size-adjust: 100%; ascent-override: 102%; descent-override: 27%; line-gap-override: 0%; }

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Surfaces, from the page up */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;      /* inset areas inside a surface */
  --surface-3: #f1f3f6;      /* hover, sunken */
  --overlay: rgba(9, 13, 22, .48);

  /* Text */
  --ink: #0b1220;            /* 18.7:1 on --surface */
  --ink-2: #2b3546;          /* 12.4:1 */
  --muted: #5a6475;          /*  6.0:1 on --surface, 5.6:1 on --bg */
  --faint: #6b7483;          /*  4.7:1, placeholders */

  /* Lines */
  --line: #e5e8ed;
  --line-2: #d3d8e0;
  --line-strong: #8590a2;    /* 3.2:1 on --surface, 3.0:1 on --bg, 3.1:1 on --surface-2: control borders (1.4.11) */

  /* Brand: the logo's gradient, #1d4ed8 to #6a3df0 */
  --brand-0: #1d4ed8;
  --brand-1: #6a3df0;
  --accent: #2448d8;         /*  7.0:1 on --surface: links, focus, selected */
  --accent-hover: #1b38b0;
  --accent-ink: #ffffff;
  --accent-soft: #eef2ff;
  --accent-line: #c7d2fe;
  --focus: #2448d8;

  /* Status: text, tint, edge */
  --pass: #04754b;  --pass-bg: #ecf8f2; --pass-line: #a7dcc4;   /* 5.3:1 on its tint */
  --warn: #8f4e00;  --warn-bg: #fdf5e7; --warn-line: #efc98a;   /* 5.9:1 */
  --fail: #b4261f;  --fail-bg: #fdf0ef; --fail-line: #f1b5af;   /* 5.8:1 */
  --info: #2448d8;  --info-bg: #eef2ff; --info-line: #c7d2fe;   /* 6.3:1 */
  --neutral: #535d6d; --neutral-bg: #f1f3f6; --neutral-line: #d3d8e0;
  --danger-ink: #ffffff;

  /* Depth */
  --shadow-xs: 0 1px 2px rgba(11, 18, 32, .05);
  --shadow-sm: 0 1px 2px rgba(11, 18, 32, .05), 0 1px 3px rgba(11, 18, 32, .04);
  --shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 4px 12px -2px rgba(11, 18, 32, .06), 0 12px 32px -12px rgba(11, 18, 32, .10);
  --shadow-lg: 0 2px 4px rgba(11, 18, 32, .04), 0 12px 24px -6px rgba(11, 18, 32, .10), 0 32px 64px -24px rgba(11, 18, 32, .22);
  --ring: 0 0 0 3px rgba(36, 72, 216, .22);
  --ring-fail: 0 0 0 3px rgba(180, 38, 31, .20);

  /* Background treatment */
  --glow-a: rgba(29, 78, 216, .10);
  --glow-b: rgba(106, 61, 240, .08);
  --grid: rgba(11, 18, 32, .045);

  /* Type */
  --sans: "Plex Sans", "Plex Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Plex Mono", "Plex Mono Fallback", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: .75rem;     /* 12: labels, pills */
  --fs-sm: .8125rem;   /* 13: meta, hints */
  --fs-md: .875rem;    /* 14: secondary text, controls */
  --fs-base: 1rem;     /* 16: body */
  --fs-lg: 1.125rem;   /* 18: section titles */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: clamp(1.75rem, 1.35rem + 1.6vw, 2.375rem); /* 28 to 38: page title */

  /* Space, radius, layout */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;
  --container: 1200px;
  --header-h: 60px;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 120ms;
  --t: 200ms;
  --t-slow: 320ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d16;
    --surface: #0f1521;
    --surface-2: #121927;
    --surface-3: #18202f;
    --overlay: rgba(2, 4, 9, .66);

    --ink: #e9edf4;          /* 15.6:1 on --surface */
    --ink-2: #c5ccd8;        /* 11.4:1 */
    --muted: #949fb1;        /*  6.8:1 */
    --faint: #7f8a9c;        /*  5.2:1 */

    --line: #1f2737;
    --line-2: #2a3446;
    --line-strong: #5f6f89;  /* 3.6:1 on --surface, 3.8:1 on --bg, 3.5:1 on --surface-2 */

    --accent: #8ba4ff;       /*  7.7:1 on --surface */
    --accent-hover: #aabdff;
    --accent-ink: #0a0f1c;
    --accent-soft: #161f3a;
    --accent-line: #2c3a6b;
    --focus: #8ba4ff;

    --pass: #4fd19e;  --pass-bg: #0e2219; --pass-line: #1f5a41;
    --warn: #f2b65e;  --warn-bg: #261b0b; --warn-line: #6a4a18;
    --fail: #ff8f80;  --fail-bg: #2a1311; --fail-line: #6e2d27;
    --info: #8ba4ff;  --info-bg: #161f3a; --info-line: #2c3a6b;
    --neutral: #a3adbd; --neutral-bg: #18202f; --neutral-line: #2f394b;
    --danger-ink: #1c0806;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .015);
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .5), 0 32px 64px -24px rgba(0, 0, 0, .8);
    --ring: 0 0 0 3px rgba(139, 164, 255, .28);
    --ring-fail: 0 0 0 3px rgba(255, 143, 128, .24);

    --glow-a: rgba(53, 86, 224, .16);
    --glow-b: rgba(124, 77, 255, .12);
    --grid: rgba(255, 255, 255, .035);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column; position: relative; isolation: isolate;
  background: var(--bg); color: var(--ink);
  font: 400 var(--fs-base)/1.55 var(--sans);
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
@supports (min-height: 100dvh) { body { min-height: 100dvh; } }

/* The background: a faint brand glow at the top and a fine grid that fades out. A fixed layer behind everything,
   so it costs one composite and works on iOS (background-attachment: fixed does not). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60rem 28rem at 12% -8%, var(--glow-a), transparent 70%),
    radial-gradient(50rem 26rem at 92% -12%, var(--glow-b), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 24rem, transparent 44rem);
  mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 24rem, transparent 44rem);
}

main { flex: 1; outline: 0; }
.card, .report, .account-id, h1, h2, #addaccount, input, textarea, select, details.resource { scroll-margin-top: calc(var(--header-h) + 24px); }

h1, h2, h3, h4 { margin: 0; color: var(--ink); font-family: var(--sans); text-wrap: balance; }
h1 { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.12; letter-spacing: -.022em; font-stretch: 92%; }
h2 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; letter-spacing: -.012em; }
h3 { font-size: var(--fs-base); font-weight: 600; line-height: 1.35; letter-spacing: -.006em; }
h4 { font-size: var(--fs-md); font-weight: 600; line-height: 1.4; }
/* Headings and panels take focus from script when the page changes (tabindex=-1). They are not controls, so no ring:
   Chrome shows :focus-visible after script focus, which drew a box round the page title. Controls keep theirs. */
h1:focus, h2:focus, h3:focus, h1[tabindex="-1"]:focus-visible, h2[tabindex="-1"]:focus-visible, h3[tabindex="-1"]:focus-visible,
.tabpanel:focus, .tabpanel:focus-visible { outline: 0; }
p { margin: 0; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: var(--accent-line); transition: color var(--t-fast) var(--ease), text-decoration-color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: .9em; font-weight: 450; overflow-wrap: anywhere; font-variant-ligatures: none; }
time, .kv dd, .day, .counts { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--accent-soft); color: var(--ink); }
img { max-width: 100%; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-md); }
.eyebrow { font: 500 var(--fs-xs)/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: 1.0625rem; line-height: 1.6; color: var(--muted); max-width: 54ch; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 640px) { .wrap { padding-inline: 24px; } }
@media (min-width: 1024px) { .wrap { padding-inline: 32px; } }

.skip { position: absolute; left: 12px; top: 10px; z-index: 60; background: var(--ink); color: var(--bg); padding: .6rem .9rem;
  border-radius: var(--r-sm); font-weight: 500; text-decoration: none; transform: translateY(-200%); transition: transform var(--t) var(--ease); }
.skip:focus { transform: none; color: var(--bg); }

/* Header */
.top { position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .top { background: rgba(246, 247, 249, .78); -webkit-backdrop-filter: saturate(1.8) blur(14px); backdrop-filter: saturate(1.8) blur(14px); }
  @media (prefers-color-scheme: dark) { .top { background: rgba(9, 13, 22, .72); } }
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.0625rem; letter-spacing: -.015em; color: var(--ink); flex-shrink: 0; }
.brand .mark { display: block; width: 24px; height: 24px; border-radius: 7px; box-shadow: 0 4px 10px -3px var(--brand-1); }
.brand-tag { font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--r-pill); background: var(--surface); }
@media (max-width: 480px) { .brand-tag { display: none; } }
.session { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.session .btn { white-space: nowrap; }
/* The email, cut with an ellipsis; the dot says "signed in" next to the text, which says it too. */
.who { position: relative; display: block; min-width: 0; max-width: 30ch; padding-left: 16px; color: var(--ink-2); font-size: var(--fs-md);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: var(--pass); }
@media (max-width: 520px) { .who { max-width: 16ch; } }
@media (max-width: 359px) { .who { display: none; } }

/* Footer */
.foot { border-top: 1px solid var(--line); margin-top: var(--s-12); background: var(--bg); }
.foot-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); flex-wrap: wrap; padding-block: var(--s-5); color: var(--muted); }
.foot-brand { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 500; color: var(--ink-2); }
.foot-brand img { display: block; border-radius: 6px; }
.foot a { color: var(--muted); text-decoration-color: var(--line-2); }
.foot a:hover { color: var(--ink); }

/* Views */
.view { display: grid; gap: var(--s-6); padding-block: var(--s-8) var(--s-4); min-width: 0; animation: view-in var(--t-slow) var(--ease) backwards; }
@media (min-width: 900px) { .view { padding-block: var(--s-10) var(--s-4); } }
.view-narrow { max-width: 600px; width: 100%; margin-inline: auto; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--s-4) var(--s-6); }
.page-head > * { min-width: 0; }
.page-head > div:first-child { display: grid; gap: var(--s-2); }
.idline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 6px 6px 6px 12px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-xs); max-width: 100%; }
.idline .small { font-size: var(--fs-sm); }
.idline code { font-size: var(--fs-md); color: var(--ink); }

/* ---------- Panels and cards ---------- */
.panel { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-sm);
  padding: clamp(18px, 3vw, 28px); display: grid; gap: var(--s-5); min-width: 0; }
.panel > .muted { max-width: 72ch; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2) var(--s-4); }
.panel-head > * { min-width: 0; }
.panel-head > div { display: grid; gap: 2px; }
.panel-head .small, .panel-head .muted.small { font-size: var(--fs-sm); }

.hero-panel { gap: var(--s-5); padding: clamp(24px, 5vw, 44px); box-shadow: var(--shadow-lg); overflow: hidden; }
.hero-panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--brand-0), var(--brand-1)); }
.hero-panel::after { content: ""; position: absolute; inset: -40% -30% auto auto; width: 70%; height: 90%; pointer-events: none;
  background: radial-gradient(closest-side, var(--glow-b), transparent); }
.hero-panel > * { position: relative; z-index: 1; }
.hero-panel h1 { font-size: clamp(1.875rem, 1.4rem + 2vw, 2.625rem); }
.hero-panel .actions .btn { min-height: 46px; padding-inline: 1.35rem; }
.hero-panel > .muted.small { padding-top: var(--s-4); border-top: 1px solid var(--line); }
.wordmark { display: block; }
.wordmark img { display: block; width: auto; height: 36px; }
.hero-panel .eyebrow { margin-top: var(--s-2); }

.panel-intro .intro-mark, .empty-mark { display: block; border-radius: 12px; box-shadow: 0 8px 20px -8px var(--brand-1); }
.panel-intro .eyebrow { margin-bottom: calc(var(--s-2) * -1); }

.subpanel { border: 1px solid var(--line-2); background: var(--surface-2); border-radius: var(--r-lg); padding: clamp(16px, 3vw, 24px);
  display: grid; gap: var(--s-4); animation: rise var(--t) var(--ease) backwards; }

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.cards:empty { display: none; }
.card { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(16px, 2.6vw, 22px); display: grid; gap: var(--s-4);
  background: var(--surface); min-width: 0; box-shadow: var(--shadow-xs); overflow: visible; }
/* A status edge on the left: the pill carries the word, the edge helps scanning a list. */
.card::before { content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-2); }
.card.is-connected::before { background: var(--pass); }
.card.is-waiting::before { background: var(--info); }
.card.is-attention::before { background: var(--fail); }
.card.is-waiting { border-color: var(--info-line); }
.card.is-attention { border-color: var(--fail-line); }
.card.is-disconnected { background: var(--surface-2); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-3); }
.card-head code { font-size: 1.0625rem; font-weight: 500; letter-spacing: .03em; color: var(--ink); }
.status-line { color: var(--ink-2); max-width: 80ch; }
.empty { border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: clamp(24px, 5vw, 40px); display: grid; gap: var(--s-3);
  text-align: center; justify-items: center; background: var(--surface-2); }
.empty p { max-width: 54ch; }
.empty-mark { margin-bottom: var(--s-1); }

/* Definition lists: one column on phones, label | value on tablets, two pairs per row on wide screens */
.kv { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px var(--s-4); font-size: var(--fs-md);
  padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { margin: 0 0 var(--s-2); min-width: 0; overflow-wrap: anywhere; color: var(--ink); }
.kv dd:last-of-type { margin-bottom: 0; }
@media (min-width: 560px) {
  .kv { grid-template-columns: minmax(8.5rem, max-content) minmax(0, 1fr); row-gap: var(--s-2); }
  .kv dt { padding-top: 1px; }
  .kv dd { margin: 0; }
}
@media (min-width: 1100px) {
  .kv { grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr) minmax(8rem, max-content) minmax(0, 1fr); column-gap: var(--s-6); }
}
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; vertical-align: top; }
.chips li { font: 500 var(--fs-xs)/1 var(--mono); padding: 5px 8px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line); }
.chips.plain li { background: var(--surface); color: var(--ink-2); border-color: var(--line-2); }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) 10px; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: .55rem 1.1rem;
  border-radius: var(--r); border: 1px solid transparent; font: 500 .9375rem/1.2 var(--sans); letter-spacing: -.003em; text-decoration: none;
  cursor: pointer; color: var(--ink); background: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.btn-primary { color: #fff; border-color: #1f3fc4;
  background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0)), linear-gradient(135deg, var(--brand-0), var(--brand-1));
  box-shadow: 0 1px 2px rgba(11, 18, 32, .2), 0 6px 16px -8px var(--brand-1), inset 0 1px 0 rgba(255, 255, 255, .22); }
.btn-primary:hover { color: #fff; box-shadow: 0 1px 2px rgba(11, 18, 32, .2), 0 10px 22px -8px var(--brand-1), inset 0 1px 0 rgba(255, 255, 255, .28);
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .04)), linear-gradient(135deg, var(--brand-0), var(--brand-1)); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn-danger { background: var(--fail); color: var(--danger-ink); border-color: var(--fail); box-shadow: var(--shadow-xs); }
.btn-danger:hover { filter: brightness(1.06); }
.btn-ghost { color: var(--accent); border-color: transparent; }
.btn-ghost:hover { background: var(--accent-soft); }
.btn-sm { min-height: 40px; padding: .4rem .85rem; font-size: var(--fs-md); border-radius: var(--r-sm); }
.btn-xs { min-height: 32px; padding: .2rem .6rem; font-size: var(--fs-sm); border-radius: var(--r-xs); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; transform: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.btn.is-done { color: var(--pass); border-color: var(--pass-line); background: var(--pass-bg); }
.spinner { width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block;
  vertical-align: -2px; animation: spin .7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* More actions menu (a disclosure, not an ARIA menu) */
.more { position: relative; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg); margin-left: 2px; transition: transform var(--t) var(--ease); }
.more[open] > summary { background: var(--surface-3); border-color: var(--line-strong); }
.more[open] > summary::after { transform: translateY(1px) rotate(-135deg); }
.more-list { list-style: none; margin: 6px 0 0; padding: 6px; display: grid; gap: 2px; min-width: 15.5rem; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); transform-origin: top left;
  animation: pop var(--t) var(--ease) backwards; }
@media (min-width: 640px) { .more-list { position: absolute; z-index: 10; left: 0; } }
.more-list .btn { width: 100%; justify-content: flex-start; min-height: 40px; font-weight: 500; color: var(--ink); border-radius: var(--r-sm); }
.more-list .btn:hover { background: var(--surface-3); }
.more-list .btn.is-danger { color: var(--fail); }
.more-list .btn.is-danger:hover { background: var(--fail-bg); }
.more-list li + li:last-child:has(.is-danger) { border-top: 1px solid var(--line); padding-top: 2px; margin-top: 2px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* ---------- Status pills ---------- */
.st { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 9px 5px 8px; color: var(--neutral); background: var(--neutral-bg); border: 1px solid var(--neutral-line); border-radius: var(--r-pill);
  white-space: nowrap; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.st.pass { color: var(--pass); background: var(--pass-bg); border-color: var(--pass-line); }
.st.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.st.fail { color: var(--fail); background: var(--fail-bg); border-color: var(--fail-line); }
.st.info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.st.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-line); }
.st.info.is-live::before { animation: pulse 1.8s var(--ease-in-out) infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--s-5); }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 500; font-size: var(--fs-md); color: var(--ink); }
.optional { font: 500 .6875rem var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-left: 6px;
  padding: 2px 6px; border: 1px solid var(--line-2); border-radius: var(--r-pill); vertical-align: 1px; }
input, textarea, select { width: 100%; max-width: 44rem; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); padding: .65rem .8rem; min-height: 44px; box-shadow: var(--shadow-xs);
  -webkit-appearance: none; appearance: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
textarea { font: 400 .875rem/1.55 var(--mono); min-height: 8rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--muted); }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: var(--ring); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 0; }
input:disabled, textarea:disabled { background: var(--surface-3); color: var(--muted); cursor: not-allowed; box-shadow: none; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--fail); }
input[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus { box-shadow: var(--ring-fail); }
.hint { color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; max-width: 72ch; }
.field-error, .form-error { color: var(--fail); font-size: var(--fs-md); font-weight: 500; display: flex; gap: 8px; line-height: 1.45; animation: rise var(--t) var(--ease) backwards; }
.field-error::before, .form-error::before { content: "!"; flex-shrink: 0; display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem;
  border-radius: 50%; background: var(--fail); color: var(--surface); font: 700 .6875rem/1 var(--sans); margin-top: .14rem; }
.form-error { padding: 10px 12px; border: 1px solid var(--fail-line); background: var(--fail-bg); border-radius: var(--r); }
.form-ok { color: var(--pass); font-weight: 500; font-size: var(--fs-md); padding: 10px 12px 10px 36px; border: 1px solid var(--pass-line);
  background: var(--pass-bg); border-radius: var(--r); position: relative; animation: rise var(--t) var(--ease) backwards; }
.form-ok::before { content: ""; position: absolute; left: 14px; top: 15px; width: 10px; height: 5px; border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); }

/* ---------- Notices ---------- */
.banner { margin-top: var(--s-6); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4);
  padding: 14px 16px 14px 44px; position: relative; border: 1px solid var(--fail-line); background: var(--fail-bg); color: var(--ink);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs); animation: rise var(--t) var(--ease) backwards; }
.banner::before { content: "!"; position: absolute; left: 16px; top: 16px; display: grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; background: var(--fail); color: var(--surface); font: 700 .75rem/1 var(--sans); }
.banner.is-info { border-color: var(--warn-line); background: var(--warn-bg); }
.banner.is-info::before { content: "i"; background: var(--warn); font-family: var(--mono); }
.banner p { flex: 1 1 18rem; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.banner-actions { display: flex; gap: var(--s-2); }
.inline-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--fail-line); background: var(--fail-bg); color: var(--ink); font-size: var(--fs-md); }
.inline-error p { min-width: 0; overflow-wrap: anywhere; }
.note { padding: 10px 14px; border-radius: var(--r); font-size: var(--fs-md); line-height: 1.5; border: 1px solid var(--info-line);
  background: var(--info-bg); color: var(--ink); }
.warn-note, .once { border-color: var(--warn-line); background: var(--warn-bg); }
.once { font-weight: 500; }

/* ---------- Setup checklist: a vertical timeline ---------- */
.setup { gap: var(--s-4); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.step { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 4px 14px; padding: 0 0 var(--s-4); }
.step:last-child { padding-bottom: 0; }
.step::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--pass-line); }
.step-mark { grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 500 var(--fs-sm)/1 var(--mono);
  border: 1.5px solid var(--line-2); color: var(--muted); background: var(--surface); position: relative; z-index: 1; }
.step.is-done .step-mark { background: var(--pass); border-color: var(--pass); color: var(--surface); font-family: var(--sans); font-weight: 700; }
.step.is-next .step-mark { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--accent-line); }
.step-title { font-weight: 500; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 28px; }
.step.is-done .step-title { color: var(--muted); font-weight: 400; }
.step-body { grid-column: 2; display: grid; gap: var(--s-3); color: var(--muted); font-size: var(--fs-md); padding: var(--s-1) 0 var(--s-1); max-width: 70ch; }
.setup.is-complete .steps { display: none; }
#setup-progress { font: 500 var(--fs-xs)/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 6px 10px; border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--ink-2); }
#setup-progress:empty { display: none; }

/* ---------- Connect flow inside an account card ---------- */
.connect { display: grid; gap: var(--s-4); border-top: 1px solid var(--line); padding-top: var(--s-4); }
.connect-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-5); counter-reset: c; }
.connect-steps > li { display: grid; grid-template-columns: 26px 1fr; gap: var(--s-2) var(--s-3); counter-increment: c; }
.connect-steps > li::before { content: counter(c); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font: 500 var(--fs-sm)/1 var(--mono); background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); grid-row: span 4; }
.connect-steps > li > * { grid-column: 2; min-width: 0; }
.connect-steps h4 { font-size: .9375rem; font-weight: 600; line-height: 26px; }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.secret code { display: block; flex: 1 1 18rem; min-width: 0; padding: .6rem .8rem; border-radius: var(--r); border: 1px dashed var(--line-strong);
  background: var(--surface-2); font-size: .9375rem; font-weight: 500; color: var(--ink); user-select: all; -webkit-user-select: all; }
.copy-fallback { font: 400 var(--fs-md) var(--mono); }

/* ---------- Reports ---------- */
.reports-layout { display: grid; gap: var(--s-4); min-width: 0; }
@media (min-width: 900px) { .reports-layout { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; gap: var(--s-5); } }
#reportsstate { padding: var(--s-4); border: 1px dashed var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); font-size: var(--fs-md); }
.daylist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; }
.daylist:empty { display: none; }
/* Sticky, and scrollable by itself: thirty days are taller than a window. */
@media (min-width: 900px) { .daylist { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100vh - var(--header-h) - 32px); overflow-y: auto; overscroll-behavior: contain; } }
@media (max-width: 899px) {
  .daylist { display: flex; overflow-x: auto; gap: var(--s-2); padding: 2px 2px 6px; margin: -2px; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .daylist li { flex-shrink: 0; scroll-snap-align: start; }
}
.day { width: 100%; text-decoration: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 44px; padding: .5rem .8rem;
  border-radius: var(--r); border: 1px solid transparent; background: transparent; color: var(--ink-2); font: 400 var(--fs-md) var(--sans);
  cursor: pointer; text-align: left; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
@media (max-width: 899px) { .day { border-color: var(--line-2); background: var(--surface); } }
.day:hover { background: var(--surface-3); color: var(--ink); }
.day[aria-current="page"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.day small { color: var(--muted); font: 500 .6875rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.day[aria-current="page"] small { color: var(--accent); }
.report { display: grid; gap: var(--s-4); min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(16px, 2.6vw, 24px);
  outline: 0; background: var(--surface); animation: rise var(--t) var(--ease) backwards; }
@media (max-width: 600px) { .report { border: 0; padding: 0; background: transparent; } .resource { padding: 14px; } }
.report:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--s-3) var(--s-4);
  padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); }
.report-head > div:first-child { display: grid; gap: 2px; min-width: 0; }
.report-head h3 { font-size: var(--fs-lg); }
#reportgenerated { font-size: var(--fs-sm); }
#reportloading { display: flex; align-items: center; gap: 8px; }
#reportbody { display: grid; gap: var(--s-4); min-width: 0; }
.counts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.counts > li:first-child { margin-right: var(--s-2); }
.counts .st { font-size: var(--fs-sm); padding: 6px 11px 6px 9px; }
.checker-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: var(--fs-md); color: var(--ink-2); }
.checker-lines:empty { display: none; }
.checker-lines li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.resources { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.resource { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; display: grid; gap: var(--s-3); min-width: 0;
  background: var(--surface); box-shadow: var(--shadow-xs); }
.resource:has(.resource-head .st.fail) { border-color: var(--fail-line); }
.resource-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-2) var(--s-3); }
.resource-head h4 { flex: 1 1 16rem; min-width: 0; }
.resource-head code { font-size: var(--fs-md); font-weight: 500; overflow-wrap: anywhere; color: var(--ink); }
.meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: var(--fs-sm); }
.meta > span:first-child { font: 500 .6875rem/1.9 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
  padding: 0 7px; border-radius: var(--r-xs); background: var(--surface-3); }
.checks { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.checks th, .checks td { text-align: left; vertical-align: top; padding: 10px 12px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.checks thead th { border-top: 0; color: var(--muted); font: 500 .6875rem var(--mono); text-transform: uppercase; letter-spacing: .08em; background: var(--surface-2); }
.checks tbody tr { transition: background-color var(--t-fast) var(--ease); }
.checks tbody tr:hover { background: var(--surface-2); }
.checks td:first-child { font-weight: 500; color: var(--ink); }
.checks tr.is-target { background: var(--accent-soft); }
.checks tr.is-target td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.checks td:last-child { color: var(--ink-2); }
@media (max-width: 600px) {
  .checks { border: 0; border-radius: 0; }
  .checks thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .checks, .checks tbody, .checks tr, .checks td { display: block; width: 100%; }
  .checks tr { border-top: 1px solid var(--line); padding: 10px 0; }
  .checks td { border: 0; padding: 2px 0; }
  .checks td:nth-child(2) { padding: 4px 0; }
}

/* ---------- Danger zone ---------- */
.danger-zone { border-color: var(--fail-line); box-shadow: none; background: var(--surface); }
.danger-zone h2 { color: var(--fail); font-size: var(--fs-base); }
details > summary { cursor: pointer; font-weight: 500; min-height: 40px; display: inline-flex; align-items: center; gap: 10px; border-radius: var(--r-sm); }
details:not(.more) > summary { list-style: none; }
details:not(.more) > summary::-webkit-details-marker { display: none; }
details:not(.more) > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); transition: transform var(--t) var(--ease); flex-shrink: 0; }
details[open]:not(.more) > summary::before { transform: rotate(45deg); }
details:not(.more) > summary:hover { color: var(--ink); }
details:not(.more)[open] > :not(summary) { animation: rise var(--t) var(--ease) backwards; }
.danger-body { display: grid; gap: var(--s-3); margin-top: var(--s-3); color: var(--ink-2); max-width: 72ch; }
.quiet { padding-inline: 4px; color: var(--muted); }
.quiet[open] { color: var(--ink); }
.quiet .form { margin-top: var(--s-3); }

/* ---------- Skeleton ---------- */
.skeleton { position: relative; overflow: hidden; border-radius: var(--r-lg); background: var(--line); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: shimmer 1.4s var(--ease-in-out) infinite; }
@media (prefers-color-scheme: dark) { .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent); } }
.skeleton-eyebrow { height: .75rem; width: 7rem; border-radius: var(--r-xs); }
.skeleton-title { height: 2.25rem; width: min(22rem, 70%); border-radius: var(--r-sm); margin-top: calc(var(--s-4) * -1); }
.skeleton-card { height: 12rem; border-radius: var(--r-xl); }
.skeleton-card-short { height: 7rem; }
@keyframes shimmer { to { transform: translateX(100%); } }
#loadingtext { font-size: var(--fs-sm); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 50; right: 16px; bottom: 16px; left: 16px; display: grid; gap: var(--s-2); justify-items: end; pointer-events: none;
  padding-bottom: env(safe-area-inset-bottom, 0); }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: var(--s-3); max-width: 26rem; width: 100%; padding: 12px 8px 12px 40px;
  position: relative; border-radius: var(--r-lg); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: var(--fs-md);
  animation: toast-in var(--t-slow) var(--ease) backwards; }
.toast::before { content: ""; position: absolute; left: 16px; top: 17px; width: 10px; height: 5px; border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor; transform: rotate(-45deg); opacity: .9; }
.toast p { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.toast button { flex-shrink: 0; min-height: 32px; min-width: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit;
  font: 400 1.25rem/1 var(--sans); cursor: pointer; opacity: .75; transition: opacity var(--t-fast) var(--ease); }
.toast button:hover { opacity: 1; }
.toast button:focus-visible { outline-color: var(--bg); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* ---------- Dialog ---------- */
dialog { width: min(30rem, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-xl); background: var(--surface);
  color: var(--ink); box-shadow: var(--shadow-lg); }
dialog[open] { animation: dialog-in var(--t) var(--ease) backwards; }
dialog::backdrop { background: var(--overlay); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  dialog::backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
}
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog-form { display: grid; gap: var(--s-4); padding: clamp(20px, 4vw, 28px); }
.dialog-form h2 { font-size: var(--fs-xl); letter-spacing: -.018em; }
#confirm-body { display: grid; gap: var(--s-2); color: var(--ink-2); font-size: .9375rem; }
.dialog-form .actions { justify-content: flex-end; margin-top: var(--s-2); padding-top: var(--s-4); border-top: 1px solid var(--line); }

/* ---------- Checks: the layer picker on an account card ---------- */
.picker { border-top: 1px solid var(--line); padding-top: var(--s-3); }
.picker > summary { font-size: var(--fs-base); }
.picker-body { display: grid; gap: var(--s-4); margin-top: var(--s-2); max-width: 72ch; }
.picker-body h4 { font-size: var(--fs-base); }
.layers { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
.layer { border: 1px solid var(--line); border-radius: var(--r); padding: var(--s-3) var(--s-4); display: grid; gap: var(--s-2); background: var(--surface); min-width: 0; }
.layer.is-missing { border-color: var(--fail-line); background: var(--fail-bg); }
.layer-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); min-height: 40px; }
.layer-head .st { margin-left: auto; }
.layer-name { font-weight: 600; color: var(--ink); flex: 1 1 12rem; min-width: 0; }
label.layer-name { cursor: pointer; }
.layer-info { display: grid; gap: var(--s-2); color: var(--ink-2); }
.layer-info .caveat { color: var(--warn); font-weight: 500; }
.layer-info .layer-detail { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.layer-more > summary { font-size: var(--fs-md); color: var(--muted); }
.layer-more .kv { margin-top: var(--s-2); }
.layer-fields { margin: var(--s-2) 0 0; padding: var(--s-3) 0 0; border-top: 1px dashed var(--line-2); display: grid; gap: var(--s-3); min-width: 0; }
.layer-fields h5 { margin: 0; font-size: var(--fs-base); font-weight: 600; }
.keys { background: var(--surface-2); }
.keys .field { gap: var(--s-2); }
.picker-out { border-top: 1px solid var(--line); padding-top: var(--s-3); display: grid; gap: var(--s-3); }
.picker-out .kv { margin: 0; padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.picker-out .kv code { font-size: var(--fs-sm); }
.needs { display: grid; gap: var(--s-3); }
/* A checkbox drawn as a switch: the native input stays, so keyboard and screen readers work unchanged. */
input[type="checkbox"] { -webkit-appearance: none; appearance: none; flex: 0 0 auto; width: 44px; min-width: 44px; height: 26px; min-height: 26px; max-width: none;
  padding: 0; margin: 0; border-radius: 13px; position: relative; cursor: pointer; background: var(--neutral-bg); border: 1px solid var(--line-strong); box-shadow: none; }
input[type="checkbox"]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted);
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: translateX(18px); background: var(--accent-ink); }
input[type="checkbox"]:focus-visible { outline: 0; box-shadow: var(--ring); }

/* ---------- Shell: top bar, section navigation, sections ---------- */
.top-row { gap: var(--s-4); }
.orgchip { margin-right: auto; min-width: 0; max-width: 32ch; padding: 4px 0 4px var(--s-4); border-left: 1px solid var(--line-2);
  font-size: var(--fs-md); font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
@media (max-width: 639px) { .orgchip, .only-wide { display: none !important; } }
@media (min-width: 640px) { .only-narrow { display: none !important; } }
.head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }

.frame { display: block; }
.main-in { min-width: 0; }
.section { display: grid; gap: var(--s-6); min-width: 0; }
.section[hidden] { display: none; }
.section > .section { gap: var(--s-6); }

.sections ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.sections a { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: .5rem .75rem; border-radius: var(--r);
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--fs-md);
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.sections a:hover { background: var(--surface-3); color: var(--ink); }
.sections a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-text { min-width: 0; }
.badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; display: inline-grid; place-items: center; border-radius: var(--r-pill);
  background: var(--fail); color: var(--danger-ink); font: 600 var(--fs-xs)/1 var(--mono); font-variant-numeric: tabular-nums; }
.nav-help { margin-top: var(--s-4); padding-left: .75rem; font-size: var(--fs-sm); }
.nav-help a { display: inline; min-height: 0; padding: 0; color: var(--muted); font-weight: 400; font-size: inherit; box-shadow: none;
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.nav-help a:hover { background: none; color: var(--ink); }

/* The icons are drawn with gradients: no files, and nothing the CSP forbids. */
.nav-icon { width: 20px; height: 20px; flex: none; background-repeat: no-repeat; opacity: .9; }
.nav-overview { background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 8px 8px; background-position: 0 0, 12px 0, 0 12px, 12px 12px; }
.nav-reports { background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 5px 11px, 5px 18px, 5px 7px; background-position: 0 100%, 7.5px 100%, 15px 100%; }
.nav-accounts { background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 20px 4px; background-position: 0 1px, 0 8px, 0 15px; }
.nav-settings { background-image: linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor), linear-gradient(currentColor, currentColor);
  background-size: 20px 2px, 20px 2px, 6px 8px, 6px 8px; background-position: 0 5px, 0 14px, 3px 2px, 11px 11px; }

@media (min-width: 900px) {
  .frame.has-nav { display: grid; grid-template-columns: 13.75rem minmax(0, 1fr); column-gap: var(--s-8); align-items: start; }
  .sections { position: sticky; top: calc(var(--header-h) + 24px); margin-top: var(--s-10); }
}
/* On a phone the same links are a bar along the bottom edge, in reach of a thumb. */
@media (max-width: 899px) {
  .sections { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line-2);
    box-shadow: 0 -4px 16px -8px rgba(11, 18, 32, .18); padding-bottom: env(safe-area-inset-bottom, 0); }
  .sections ul { grid-template-columns: repeat(4, 1fr); gap: 0; }
  .sections a { flex-direction: column; justify-content: center; gap: 4px; min-height: 58px; padding: .4rem .25rem; border-radius: 0;
    font-size: var(--fs-xs); text-align: center; }
  .sections a[aria-current="page"] { box-shadow: inset 0 3px 0 var(--accent); }
  .badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 20px; height: 20px; padding: 0 5px; }
  .nav-help { display: none; }
  .frame.has-nav .main-in { padding-bottom: 72px; }
  body:has(.frame.has-nav) .foot { padding-bottom: 64px; }
  body:has(.frame.has-nav) .toasts { bottom: 76px; }
}

kbd { font: 500 var(--fs-xs)/1 var(--mono); padding: 3px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink); }
.keys-list { grid-template-columns: max-content minmax(0, 1fr); }
.empty h2.empty-title { font-size: var(--fs-base); }
.empty h1 { font-size: var(--fs-xl); }

/* ---------- Overview ---------- */
.attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.attn-list:empty { display: none; }
.attn-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--s-2) var(--s-4); padding: 12px 14px;
  border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); }
.attn-row.is-fail { border-color: var(--fail-line); }
.attn-row.is-warn { border-color: var(--warn-line); }
.attn-main { min-width: 0; display: grid; gap: 2px; }
.attn-title { font-weight: 600; overflow-wrap: anywhere; }
.attn-detail { color: var(--ink-2); font-size: var(--fs-md); overflow-wrap: anywhere; }
@media (max-width: 599px) {
  .attn-row { grid-template-columns: minmax(0, 1fr); justify-items: start; }
  .attn-row .st { justify-self: start; }
}
.ov-grid { display: grid; gap: var(--s-6); min-width: 0; }
@media (min-width: 1600px) { .ov-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
#latest-body { display: grid; gap: var(--s-4); min-width: 0; }
.latest-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.latest-row { display: flex; align-items: flex-start; gap: var(--s-3); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r);
  color: var(--ink); text-decoration: none; background: var(--surface); transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.latest-row:hover { background: var(--surface-3); border-color: var(--line-strong); color: var(--ink); }
.latest-row .st { margin-top: 1px; }
.lr-main { display: grid; min-width: 0; gap: 1px; }
.lr-name { font-weight: 500; overflow-wrap: anywhere; }
.lr-detail { font-size: var(--fs-sm); overflow-wrap: anywhere; }
.glance { list-style: none; margin: 0; padding: 0; display: grid; }
.glance:empty { display: none; }
.glance-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: 10px 0; border-top: 1px solid var(--line); }
.glance-row:first-child { border-top: 0; padding-top: 0; }
.glance-main { display: grid; min-width: 0; gap: 1px; }
.glance-main code { font-size: var(--fs-base); font-weight: 500; }
.glance li.muted { padding-top: var(--s-2); }

/* ---------- Accounts: list rows, one account, its tabs ---------- */
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-6); font-size: var(--fs-md); }
.facts li { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
@media (min-width: 700px) {
  .card.account:not(.detail) { grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-6); row-gap: var(--s-3); align-items: start; }
  .card.account:not(.detail) > .card-head, .card.account:not(.detail) > .status-line, .card.account:not(.detail) > .facts { grid-column: 1; }
  .card.account:not(.detail) > .card-head { justify-content: flex-start; gap: var(--s-3); }
  .card.account:not(.detail) > .card-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; flex-direction: column; align-items: stretch; }
}
.account.card .account-id a { color: var(--ink); text-decoration-color: var(--line-strong); }
.account.card .account-id a:hover { color: var(--accent); }
.account h2.account-id { font-size: var(--fs-base); }
.back { font-size: var(--fs-md); }
.detail { gap: var(--s-4); padding: clamp(18px, 3vw, 28px); }
.detail .head-id { display: grid; gap: 4px; min-width: 0; }
.detail h1.account-id { font-size: var(--fs-xl); }
.detail .account-id code { font-size: var(--fs-xl); letter-spacing: .03em; }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line-2); scrollbar-width: thin; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: .5rem .9rem; margin-bottom: -1px; white-space: nowrap;
  border-bottom: 3px solid transparent; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--fs-md); }
.tabs a:hover { color: var(--ink); background: var(--surface-3); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fail); flex: none; }
.tabpanel { display: grid; gap: var(--s-4); min-width: 0; }
.tabpanel > .connect:first-child { border-top: 0; padding-top: 0; }
.tabpanel > .picker { border-top: 0; padding-top: 0; }
.picker-title { font-size: var(--fs-lg); }
.edit-form { padding: var(--s-4); border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface-2); }

/* ---------- Reports: filters, and a row per restored copy ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-3) var(--s-4); }
.filters .field { flex: 1 1 9.5rem; min-width: min(9.5rem, 100%); max-width: 14rem; }
.filters .small { align-self: center; }
select { padding-right: 2.25rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.counts button.st { cursor: pointer; font: 500 var(--fs-sm)/1 var(--mono); }
.counts button.st:hover { box-shadow: 0 0 0 1px currentColor; }
.counts button.st[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px currentColor; }
.empty-filter { display: grid; justify-items: start; gap: var(--s-2); padding: var(--s-4); border: 1px dashed var(--line-2); border-radius: var(--r-lg); }
.res-cols, details.resource > summary.res-sum { display: grid; grid-template-columns: minmax(0, 3fr) 8.5rem 8.5rem 6.5rem 5rem; gap: var(--s-3); align-items: center; }
.res-cols { padding: 0 16px; font: 500 .6875rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.res-cols[hidden] { display: none; }
.resources > li { min-width: 0; }
details.resource { display: block; padding: 0; overflow: hidden; }
details.resource.is-fail { border-color: var(--fail-line); }
details.resource > summary.res-sum { padding: 10px 16px; min-height: 52px; cursor: pointer; border-radius: 0; font-weight: 400; }
details.resource > summary.res-sum::-webkit-details-marker { display: none; }
details.resource > summary.res-sum::before { content: none; }
details.resource > summary.res-sum:hover { background: var(--surface-2); }
details.resource > summary.res-sum:focus-visible { outline-offset: -3px; }
.res-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.res-name::before { content: ""; width: 6px; height: 6px; flex: none; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); transition: transform var(--t) var(--ease); }
details.resource[open] .res-name::before { transform: rotate(45deg); }
.res-title { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.res-type, .res-time { font-size: var(--fs-md); color: var(--ink-2); }
.res-acct code { font-size: var(--fs-sm); color: var(--ink-2); }
.res-body { display: grid; gap: var(--s-3); padding: var(--s-4); border-top: 1px solid var(--line); background: var(--surface-2); min-width: 0; }
.res-arn { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.res-arn code { font-size: var(--fs-sm); overflow-wrap: anywhere; min-width: 0; }
.res-body .checks { background: var(--surface); }
.resource .meta > span:first-child { font: inherit; text-transform: none; letter-spacing: 0; padding: 0; background: none; color: inherit; line-height: inherit; }
/* The report's own width decides the layout (the page's does not: the day list and the rail take some of it). */
.report { container: report / inline-size; }
@container report (max-width: 700px) {
  .res-cols { display: none; }
  details.resource > summary.res-sum { grid-template-columns: auto auto 1fr auto; grid-template-areas: "name name name status" "type acct time time"; row-gap: 6px; }
  .res-name { grid-area: name; }
  .res-status { grid-area: status; }
  .res-type { grid-area: type; }
  .res-acct { grid-area: acct; }
  .res-time { grid-area: time; }
  .res-type, .res-time, .res-acct code { font-size: var(--fs-sm); color: var(--muted); }
}
@media (max-width: 600px) {
  .report { padding: 0; border: 0; background: transparent; }
  .report-head { padding-bottom: var(--s-3); }
}
@media (forced-colors: active) {
  .sections a[aria-current="page"], .tabs a[aria-current="page"], .day[aria-current="page"] { border: 2px solid CanvasText; }
  .badge, .dot { forced-color-adjust: none; background: Highlight; color: HighlightText; }
}

/* ---------- Large screens ---------- */
@media (min-width: 1600px) { :root { --container: 1280px; } }

/* ---------- Forced colours (Windows high contrast) ---------- */
@media (forced-colors: active) {
  .st, .btn, .card, .panel, .chips li { border: 1px solid CanvasText; }
  .card::before, body::before { display: none; }
  .step.is-done .step-mark { forced-color-adjust: none; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important;
    scroll-behavior: auto !important; }
  .spinner { animation: none; border-right-color: currentColor; opacity: .5; }
  .skeleton::after { display: none; }
  .st.info.is-live::before { animation: none; }
  .btn:active:not(:disabled) { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  body::before, .top, .foot, .toasts, .skip, .actions, .danger-zone, #setup, .sections { display: none !important; }
  .panel, .card, .report, .resource { box-shadow: none; break-inside: avoid; }
}

@media (forced-colors: active) {
  input[type="checkbox"]:checked { forced-color-adjust: none; background: Highlight; border-color: Highlight; }
  input[type="checkbox"]:checked::after { background: HighlightText; }
}
