/* The IDP look shared by every app that wears it: fonts, tokens, light/dark themes and the common components. App-only rules go in the app's own stylesheet, loaded after this one. */
/* Tom Select, the library behind searchable selects, comes first so the theme's rules below win ties. */
/* Geist (variable, 300–700) */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("./fonts/geist-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("./fonts/geist-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("./fonts/geist-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* Geist Mono (variable, 400–500) */
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./fonts/geist-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./fonts/geist-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("./fonts/geist-mono-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* --- Tokens ------------------------------------------------- */
/* Colours follow the Sovrain design system (Figma "WD — Applications", DS 01–07). Figma draws the
   dark theme only; the light values mirror each token's role on a white page. Every colour is one
   light-dark() pair, resolved by the color-scheme the theme blocks below set. */

:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* surfaces get brighter as they come closer to the user: page, inset, card, raised control, hover */
  --color-surface: light-dark(#ffffff, #0a0b0d);
  --color-surface-sunken: light-dark(#f6f7f9, #0e0f12);
  --color-surface-subtle: light-dark(#fafafb, #111215);
  --color-surface-raised: light-dark(#ffffff, #17191d);
  --color-surface-hover: light-dark(#f1f2f4, #1f2227);
  --color-surface-pressed: light-dark(#e9ebee, #14161a);
  --color-surface-inverse: light-dark(#111215, #fafafb);
  /* a hover or quiet fill on a page or card: on dark the raised surface, on light a grey step */
  --color-fill-quiet: light-dark(#f1f2f4, #17191d);
  --color-btn-secondary-bg: var(--color-surface-raised);
  --color-badge-neutral: var(--color-fill-quiet);
  --color-notice-bg: var(--color-fill-quiet);
  --color-nav-active: var(--color-fill-quiet);
  --color-row-hover: var(--color-fill-quiet);

  /* borders: dividers and rows, cards, inputs and buttons, hover and dashed, unchecked controls */
  --color-divider: light-dark(#eaecef, #1e2126);
  --color-border: light-dark(#e3e5e9, #23262c);
  --color-control-border: light-dark(#d6d9de, #2b2f36);
  --color-border-strong: light-dark(#bcc1c8, #3a3f48);
  --color-border-off: light-dark(#a7adb6, #4a4f59);

  /* text: the current tab and nav entry (strong), titles and values, strong body, descriptions,
     labels and table heads, placeholders, disabled */
  --color-fg-strong: light-dark(#000000, #ffffff);
  --color-fg: light-dark(#111215, #ecedef);
  --color-fg-secondary: light-dark(#33373d, #c7cbd2);
  --color-fg-muted: light-dark(#5f6570, #9a9fa9);
  --color-fg-subtle: light-dark(#737985, #848994);
  --color-placeholder: light-dark(#8b919b, #7a808b);
  --color-fg-disabled: light-dark(#a1a6af, #6b707a);
  --color-fg-inverse: light-dark(#fafafb, #0a0b0d);

  /* Green marks the one thing to do, the current place and "on"; it is the only brand colour.
     On white the design's #3ECF8E is too faint for text and hairlines, so light uses a deeper green. */
  --color-accent: light-dark(#087f53, #3ecf8e);
  --color-accent-hover: light-dark(#066b46, #57db9f);
  --color-accent-pressed: light-dark(#055c3c, #2fb77a);
  --color-on-accent: light-dark(#ffffff, #04200f);
  --color-accent-soft: light-dark(rgb(8 127 83 / 0.1), rgb(62 207 142 / 0.12));
  --color-accent-line: light-dark(rgb(8 127 83 / 0.35), rgb(62 207 142 / 0.35));
  /* the focused field's glow */
  --color-accent-ring: light-dark(rgb(8 127 83 / 0.18), rgb(62 207 142 / 0.18));
  /* a chosen option, a selected row or radio card */
  --color-accent-wash: light-dark(rgb(8 127 83 / 0.06), rgb(62 207 142 / 0.06));
  --color-btn-primary-bg: var(--color-accent);
  --color-btn-primary-bg-hover: var(--color-accent-hover);
  --color-btn-primary-bg-pressed: var(--color-accent-pressed);
  --color-btn-primary-fg: var(--color-on-accent);

  /* Status: each tone has a text colour, an 8% fill and a 30% line. Never a colour alone: pair it
     with an icon or a word. */
  --color-success-fg: var(--color-accent);
  --color-success-bg: light-dark(rgb(8 127 83 / 0.08), rgb(62 207 142 / 0.08));
  --color-success-border: light-dark(rgb(8 127 83 / 0.3), rgb(62 207 142 / 0.3));
  --color-warn-fg: light-dark(#8f5400, #f2c979);
  --color-warn-strong: light-dark(#d99a1e, #f2b84b);
  --color-warn-bg: light-dark(rgb(242 184 75 / 0.14), rgb(242 184 75 / 0.08));
  --color-warn-border: light-dark(rgb(217 154 30 / 0.45), rgb(242 184 75 / 0.28));
  --color-info-fg: light-dark(#1d5fd1, #8fb8ff);
  --color-info-bg: light-dark(rgb(59 130 246 / 0.08), rgb(110 168 255 / 0.08));
  --color-info-border: light-dark(rgb(59 130 246 / 0.3), rgb(110 168 255 / 0.3));
  --color-danger-fg: light-dark(#c0283c, #f2a0a0);
  /* a failed field's border, the danger tab's underline, a full progress bar */
  --color-danger-strong: light-dark(#d93348, #f27a7a);
  --color-danger-bg: light-dark(rgb(217 51 72 / 0.08), rgb(242 109 109 / 0.08));
  --color-danger-border: light-dark(rgb(217 51 72 / 0.3), rgb(242 109 109 / 0.3));
  --color-danger-ring: light-dark(rgb(217 51 72 / 0.14), rgb(242 109 109 / 0.14));
  --color-btn-danger-bg: light-dark(#d93348, #f2a0a0);
  --color-btn-danger-bg-hover: light-dark(#c42a3e, #f5b3b3);
  --color-btn-danger-bg-pressed: light-dark(#ae2436, #e88a8a);
  --color-on-danger: light-dark(#ffffff, #2a0a0a);

  /* initials avatars (accent-tinted) and app tiles (neutral) */
  --color-avatar: light-dark(#d3f1e3, #1e5c4e);
  --color-on-avatar-default: light-dark(#0b5e40, #e8fff6);
  --avatar-neutral-bg: light-dark(#f1f2f4, #1a1d22);
  /* palette avatars set --avatar-bg inline to a saturated colour; their letter stays light */
  --color-on-avatar: #fafafa;

  /* Only menus float, so only menus cast a shadow. */
  --shadow-menu: 0 16px 40px rgb(15 20 30 / 0.12), 0 2px 6px rgb(15 20 30 / 0.08);
  --shadow-segment: 0 1px 2px rgb(15 20 30 / 0.12);
  /* the home page's top glow, softer over a light page */
  --home-glow-opacity: 0.35;
  /* native controls (scrollbars, date pickers) follow the theme */
  color-scheme: light;
  /* icons drawn as data URIs cannot take a custom property, so each theme spells its own colours:
     the select chevron in fg-muted, the checkbox marks in on-accent */
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235f6570' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  --select-chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%235f6570' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 10 4-4 4 4'/%3E%3C/svg%3E");
  --checkbox-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.25 6.375 4.65 8.625 9.75 3.375'/%3E%3C/svg%3E");
  --checkbox-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' d='M2.625 6h6.75'/%3E%3C/svg%3E");

  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-fg);
  background: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-6);
}

.page--subtle { background: var(--color-surface-subtle); }

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
  color: var(--color-fg);
  text-decoration: none;
}

.wordmark__dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--radius-full);
  background: var(--color-accent);
}

.wordmark--lg { font-size: var(--text-2xl); }
.wordmark--lg .wordmark__dot {
  width: 0.625rem;
  height: 0.625rem;
}

.wordmark__icon,
.wordmark__initials {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.wordmark__initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-size: var(--text-xs);
  font-weight: 600;
}

.wordmark--lg .wordmark__icon,
.wordmark--lg .wordmark__initials { width: 2rem; height: 2rem; }

/* One icon per theme; only the active theme's shows. */
.brand-only--dark { display: none; }
[data-theme="dark"] .brand-only--dark { display: inline-flex; }
[data-theme="dark"] .brand-only--light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .brand-only--dark { display: inline-flex; }
  :root:not([data-theme]) .brand-only--light { display: none; }
}

.login {
  width: 100%;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.login__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  text-align: center;
}

.login__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.login__subtitle {
  margin: var(--space-1) 0 0;
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}

/* The base container for every section of a settings page. */
.card {
  position: relative;
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}

/* Rounded cards drop the crosshair corner marks; the elements stay so older markup needs no change. */
.card > .card__corner-bl,
.card > .card__corner-br { display: none; }

.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* The label sits above and never moves; an error message replaces the helper line, so the field
   keeps its height. */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.field__label {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-fg);
}

.input {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-fg);
  background: var(--color-surface);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-lg);
  outline: 0;
  transition: border-color 120ms, box-shadow 120ms;
}

.input[type="file"] {
  height: auto;
  padding: var(--space-1);
  color: var(--color-fg-muted);
  cursor: pointer;
}
.input[type="file"]::file-selector-button {
  height: 2rem;
  margin-right: var(--space-3);
  padding: 0 var(--space-3);
  font: 500 var(--text-sm) var(--font-sans);
  color: var(--color-fg);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.input[type="file"]::file-selector-button:hover { border-color: var(--color-fg-muted); }

.input::placeholder, .textarea::placeholder { color: var(--color-placeholder); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--color-border-strong); }
/* Focus is always the green edge and glow; an error swaps both for red. Neither changes layout. */
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-ring);
}
:is(.input, .textarea, .select):is([aria-invalid="true"], .is-invalid),
.field--error :is(.input, .textarea, .select) {
  border-color: var(--color-danger-strong);
  box-shadow: 0 0 0 3px var(--color-danger-ring);
}
:is(.input, .textarea, .select):disabled {
  color: var(--color-fg-disabled);
  background-color: var(--color-surface-sunken);
  border-color: var(--color-divider);
  cursor: not-allowed;
}
:is(.input, .textarea)[readonly]:not(:disabled) {
  color: var(--color-fg-secondary);
  background-color: var(--color-surface-sunken);
  border-color: var(--color-border);
}
:is(.input, .textarea)[readonly]:not(:disabled):focus { border-color: var(--color-border); box-shadow: none; }

.input--underline {
  border: 0;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  padding: var(--space-2) 0;
  height: auto;
  background: transparent;
}

.input--underline:hover { border-color: var(--color-border-strong); }
.input--underline:focus {
  border-color: var(--color-accent);
  box-shadow: none;
}

.input--code,
.select.input--code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.input--code::placeholder { color: var(--color-placeholder); }

.input--spaced { letter-spacing: 0.18em; }

/* One primary action per view; secondary for everything else, ghost for low-priority actions.
   Destructive styles appear only inside danger flows. Disabled states spell their colours out
   instead of fading the button. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 2.5rem;
  padding: 0 var(--space-4);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background 120ms, color 120ms, border-color 120ms;
}

.btn svg { flex: none; width: 0.875rem; height: 0.875rem; }

/* Focus is the same green ring on every variant, danger included. */
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

.btn--primary,
.btn--accent {
  background: var(--color-btn-primary-bg);
  color: var(--color-btn-primary-fg);
  font-weight: 600;
}

.btn--primary:hover:not(:disabled),
.btn--accent:hover:not(:disabled) { background: var(--color-btn-primary-bg-hover); }
.btn--primary:active:not(:disabled),
.btn--accent:active:not(:disabled) { background: var(--color-btn-primary-bg-pressed); }

.btn--block { width: 100%; }

.muted-link {
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  text-decoration: none;
}

.muted-link:hover {
  color: var(--color-fg);
  text-decoration: underline;
}

.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}

.footer-links a {
  color: var(--color-fg-muted);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--color-fg);
  text-decoration: underline;
}

.login--minimal .form { gap: var(--space-5); }

/* --- Auth split (full-bleed two-panel layout for /login, /register, /verify) -- */

.auth-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.auth-split__brand {
  display: none;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-right: 1px solid var(--color-border);
}

.auth-split__brand-inner {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-12);
  height: 100%;
  width: 100%;
}

.auth-split__quote {
  margin: 0;
  max-width: 32rem;
  font-size: var(--text-2xl);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--color-fg);
}

.auth-split__quote p { margin: 0 0 var(--space-4); }

.auth-split__quote-cite {
  display: block;
  margin-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-fg-subtle);
}

.auth-split__meta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-split__form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  background: var(--color-surface);
}

@media (min-width: 768px) {
  .auth-split { grid-template-columns: 1fr 1fr; }
  .auth-split__brand { display: block; }
}

/* --- Inspiring backgrounds (aurora / lattice / mix) -------------------------- */

.bg-aurora,
.bg-lattice,
.bg-mix { background: var(--color-surface); }

.bg-aurora__blob {
  position: absolute;
  width: 90%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  translate: -50% -50%;
  filter: blur(var(--a-blur, 38px));
  will-change: transform;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.bg-aurora__blob--1 {
  background: radial-gradient(circle, var(--a-c1, transparent), transparent 60%);
  top: var(--a-y1, 30%); left: var(--a-x1, 30%);
  animation: var(--a-name1, bg-blob-a) var(--a-d1, 28s) ease-in-out infinite;
  animation-delay: var(--a-delay1, 0s);
}

.bg-aurora__blob--2 {
  background: radial-gradient(circle, var(--a-c2, transparent), transparent 60%);
  top: var(--a-y2, 50%); left: var(--a-x2, 70%);
  animation: var(--a-name2, bg-blob-b) var(--a-d2, 32s) ease-in-out infinite;
  animation-delay: var(--a-delay2, 0s);
}

.bg-aurora__blob--3 {
  background: radial-gradient(circle, var(--a-c3, transparent), transparent 60%);
  top: var(--a-y3, 70%); left: var(--a-x3, 50%);
  animation: var(--a-name3, bg-blob-c) var(--a-d3, 36s) ease-in-out infinite;
  animation-delay: var(--a-delay3, 0s);
}

@keyframes bg-blob-a {
  0%   { transform: translate(0%, 0%) scale(1); }
  25%  { transform: translate(28%, 14%) scale(1.08); }
  50%  { transform: translate(8%, 32%) scale(0.95); }
  75%  { transform: translate(-22%, 18%) scale(1.05); }
  100% { transform: translate(0%, 0%) scale(1); }
}
@keyframes bg-blob-b {
  0%   { transform: translate(0%, 0%) scale(1); }
  25%  { transform: translate(-20%, 22%) scale(0.92); }
  50%  { transform: translate(-32%, -14%) scale(1.1); }
  75%  { transform: translate(12%, -18%) scale(1); }
  100% { transform: translate(0%, 0%) scale(1); }
}
@keyframes bg-blob-c {
  0%   { transform: translate(0%, 0%) scale(1); }
  25%  { transform: translate(18%, -24%) scale(1.05); }
  50%  { transform: translate(34%, 4%) scale(0.92); }
  75%  { transform: translate(14%, 26%) scale(1.08); }
  100% { transform: translate(0%, 0%) scale(1); }
}
@keyframes bg-blob-d {
  0%   { transform: translate(0%, 0%) scale(1); }
  25%  { transform: translate(-26%, -8%) scale(1.1); }
  50%  { transform: translate(-12%, 28%) scale(0.95); }
  75%  { transform: translate(20%, 14%) scale(1.04); }
  100% { transform: translate(0%, 0%) scale(1); }
}

.bg-lattice::before, .bg-lattice::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.bg-lattice::before {
  background-image:
    radial-gradient(circle, var(--l-color1) var(--l-size1), transparent calc(var(--l-size1) + 0.6px));
  background-size: var(--l-gap1) var(--l-gap1);
  animation: bg-lattice-pan-far var(--l-speed1, 80s) linear infinite;
}
.bg-lattice::after {
  background-image:
    radial-gradient(circle, var(--l-color2) var(--l-size2), transparent calc(var(--l-size2) + 0.6px));
  background-size: var(--l-gap2) var(--l-gap2);
  animation: bg-lattice-pan-near var(--l-speed2, 40s) linear infinite;
}

@keyframes bg-lattice-pan-far {
  from { background-position: 0 0; }
  to   { background-position: calc(var(--l-gap1) * var(--l-dx)) calc(var(--l-gap1) * var(--l-dy)); }
}
@keyframes bg-lattice-pan-near {
  from { background-position: 0 0; }
  to   { background-position: calc(var(--l-gap2) * var(--l-dx)) calc(var(--l-gap2) * var(--l-dy)); }
}

/* Mix — aurora blobs underneath a parallax lattice */
.bg-mix .bg-aurora__blob { z-index: 0; }
.bg-mix::before, .bg-mix::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
}
.bg-mix::before {
  background-image:
    radial-gradient(circle, var(--l-color1) var(--l-size1), transparent calc(var(--l-size1) + 0.6px));
  background-size: var(--l-gap1) var(--l-gap1);
  animation: bg-lattice-pan-far var(--l-speed1, 80s) linear infinite;
}
.bg-mix::after {
  background-image:
    radial-gradient(circle, var(--l-color2) var(--l-size2), transparent calc(var(--l-size2) + 0.6px));
  background-size: var(--l-gap2) var(--l-gap2);
  animation: bg-lattice-pan-near var(--l-speed2, 40s) linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .bg-aurora__blob,
  .bg-lattice::before,
  .bg-lattice::after,
  .bg-mix::before,
  .bg-mix::after { animation: none; }
}

/* ============================================================
   THEME SHOWCASE — shared component primitives
   ============================================================ */

/* --- Layout shell -------------------------------------------- */

.shell {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}

.shell__hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.shell__eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-fg-subtle);
}

.shell__title {
  font-size: var(--text-3xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.shell__lede {
  font-size: var(--text-lg);
  color: var(--color-fg-muted);
  margin: 0;
  max-width: 44rem;
}

.section {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--color-border);
}

.section__title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}

.section__meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--color-fg-subtle);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.cluster--tight {
  gap: var(--space-2);
}

.fingerprint {
  display: inline-block;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}
/* Grid items may shrink below their content (long select options), so a column never widens the page. */
.grid-2 > *, .grid-3 > * { min-width: 0; }

@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 720px) {
  .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* --- Navbar -------------------------------------------------- */

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.75rem;
  padding: var(--space-2) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
  background: var(--brand-header-bg, var(--color-surface));
  color: var(--brand-header-fg, var(--color-fg));
}

.navbar .wordmark { color: inherit; }

.navbar--dark {
  background: var(--color-surface-inverse);
  border-color: #262626;
  color: var(--color-fg-inverse);
}

.navbar--dark .wordmark,
.navbar--dark .nav__link { color: var(--color-fg-inverse); }

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.nav__link:hover { color: var(--color-fg); }
.nav__link[aria-current="page"] {
  color: var(--color-fg);
  border-bottom-color: var(--color-fg);
}

.navbar--dark .nav__link[aria-current="page"] {
  color: var(--color-fg-inverse);
  border-bottom-color: var(--color-fg-inverse);
}

/* --- Buttons (extended) ------------------------------------- */

.btn--secondary {
  background: var(--color-btn-secondary-bg);
  color: var(--color-fg);
  border-color: var(--color-control-border);
}

.btn--secondary:hover:not(:disabled) { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.btn--secondary:active:not(:disabled) { background: var(--color-surface-pressed); border-color: var(--color-control-border); }

/* A borderless button for low-priority actions (Cancel, Discard); it takes a fill only under the pointer. */
.btn--ghost {
  background: transparent;
  color: var(--color-fg-secondary);
}

.btn--ghost:hover:not(:disabled) { background: var(--color-fill-quiet); color: var(--color-fg); }
.btn--ghost:active:not(:disabled) { background: var(--color-surface-hover); color: var(--color-fg); }

.btn--danger {
  background: var(--color-btn-danger-bg);
  color: var(--color-on-danger);
  font-weight: 600;
}

.btn--danger:hover:not(:disabled) { background: var(--color-btn-danger-bg-hover); }
.btn--danger:active:not(:disabled) { background: var(--color-btn-danger-bg-pressed); }

/* The quieter destructive action (Deactivate): a red outline that tints under the pointer. */
.btn--danger-outline {
  background: transparent;
  color: var(--color-danger-fg);
  border-color: color-mix(in srgb, var(--color-danger-strong) 40%, transparent);
}

.btn--danger-outline:hover:not(:disabled) {
  background: color-mix(in srgb, var(--color-danger-strong) 10%, transparent);
  border-color: color-mix(in srgb, var(--color-danger-strong) 60%, transparent);
}
.btn--danger-outline:active:not(:disabled) { background: color-mix(in srgb, var(--color-danger-strong) 16%, transparent); }

/* Large 44, medium 40 (the default), small 32. */
.btn--sm { height: 2rem; padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-md); }
.btn--lg { height: 2.75rem; padding: 0 var(--space-5); }

/* A square button holding one 16px icon (14px when small). */
.btn--icon { width: 2.5rem; padding: 0; }
.btn--icon svg { width: 1rem; height: 1rem; }
.btn--icon.btn--sm { width: 2rem; }
.btn--icon.btn--sm svg { width: 0.875rem; height: 0.875rem; }

.btn:disabled,
.btn[aria-disabled="true"] { color: var(--color-fg-disabled); cursor: not-allowed; }
:is(.btn--primary, .btn--accent):is(:disabled, [aria-disabled="true"]) { background: var(--color-border); }
.btn--secondary:is(:disabled, [aria-disabled="true"]) { border-color: var(--color-border); }
.btn--danger:is(:disabled, [aria-disabled="true"]) {
  color: color-mix(in srgb, var(--color-danger-fg) 70%, var(--color-surface));
  background: color-mix(in srgb, var(--color-danger-strong) 18%, var(--color-surface));
}
.btn--danger-outline:is(:disabled, [aria-disabled="true"]) {
  color: color-mix(in srgb, var(--color-danger-fg) 45%, var(--color-surface));
  border-color: color-mix(in srgb, var(--color-danger-strong) 18%, var(--color-surface));
}

.btn-group {
  display: inline-flex;
}

.btn-group .btn {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-fg);
  margin-left: -1px;
}

.btn-group .btn:first-child { margin-left: 0; }
.btn-group .btn:hover { border-color: var(--color-border-strong); z-index: 1; position: relative; }
.btn-group .btn[aria-pressed="true"] {
  background: var(--color-fg);
  color: var(--color-fg-inverse);
  border-color: var(--color-fg);
  z-index: 1;
  position: relative;
}

/* --- Typography ---------------------------------------------- */

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
}

.prose h1 { font-size: var(--text-3xl); }
.prose h2 { font-size: var(--text-2xl); }
.prose h3 { font-size: var(--text-xl); }
.prose h4 { font-size: var(--text-lg); }
.prose h5 { font-size: var(--text-base); }
.prose h6 { font-size: var(--text-sm); color: var(--color-fg-muted); }

.prose p { margin: 0 0 var(--space-3); color: var(--color-fg); }
.prose p + p { margin-top: 0; }

.prose small, .text-sm { font-size: var(--text-sm); color: var(--color-fg-muted); }
.text-muted { color: var(--color-fg-muted); }
.text-subtle { color: var(--color-fg-subtle); }
.text-warn { color: var(--color-warn-fg); }
.text-mono { font-family: var(--font-mono); }

.kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.code-inline {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.blockquote {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-left: 2px solid var(--color-fg);
  color: var(--color-fg-muted);
  font-size: var(--text-lg);
  line-height: 1.5;
}

.blockquote__cite {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--color-fg-subtle);
}

/* --- Tables -------------------------------------------------- */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th,
.table td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.table th {
  height: 2.5rem;
  padding-block: 0;
  font-weight: 500;
  color: var(--color-fg-subtle);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: transparent;
  border-bottom-color: var(--color-border);
}

.table tbody tr:hover { background: var(--color-row-hover); }
.table--striped tbody tr:nth-child(odd) { background: var(--color-surface-subtle); }

/* --- Form additions ----------------------------------------- */

.textarea {
  width: 100%;
  min-height: 7rem;
  padding: var(--space-3) 0.875rem;
  font-family: inherit;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-fg);
  background: var(--color-surface);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-lg);
  outline: 0;
  resize: vertical;
  transition: border-color 120ms, box-shadow 120ms;
}

/* The chevron turns up while a list is open; the chosen value truncates, never wraps. */
.select {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: var(--text-sm);
  text-overflow: ellipsis;
  color: var(--color-fg);
  background: var(--color-surface);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-lg);
  outline: 0;
  appearance: none;
  /* the chevron sits inset like the text padding */
  background-image: var(--select-chevron);
  background-position: right var(--space-3) center;
  background-repeat: no-repeat;
  padding-right: calc(var(--space-3) * 2 + 16px);
  transition: border-color 120ms, box-shadow 120ms;
}

/* The label is clickable; a disabled one greys out with its control. */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
}
.check:has(input:disabled) { color: var(--color-fg-disabled); cursor: not-allowed; }

/* Checkboxes everywhere: an 18px square, filled with the accent and a check (or a dash when mixed).
   .switch hides its own input, so this never shows inside a switch. */
input[type="checkbox"] {
  appearance: none;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  border: 1px solid var(--color-border-off);
  border-radius: var(--radius-sm);
  background: var(--color-surface) center / 0.75rem no-repeat;
  vertical-align: -0.1875rem;
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}
input[type="checkbox"]:hover { border-color: var(--color-fg-muted); }
input[type="checkbox"]:is(:checked, :indeterminate) {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
  background-image: var(--checkbox-check);
}
input[type="checkbox"]:indeterminate { background-image: var(--checkbox-dash); }
input[type="checkbox"]:is(:checked, :indeterminate):hover { border-color: var(--color-accent-hover); background-color: var(--color-accent-hover); }
input[type="checkbox"]:is([aria-invalid="true"], .is-invalid) {
  border-color: var(--color-danger-strong);
  box-shadow: 0 0 0 3px var(--color-danger-ring);
}

/* Radios: an 18px circle, an 8px accent dot when selected. */
input[type="radio"] {
  appearance: none;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  border: 1px solid var(--color-border-off);
  border-radius: 50%;
  background: var(--color-surface);
  vertical-align: -0.1875rem;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
input[type="radio"]:hover { border-color: var(--color-fg-muted); }
input[type="radio"]:checked {
  border-color: var(--color-accent);
  background: var(--color-accent);
  box-shadow: inset 0 0 0 4px var(--color-surface);
}

:is(input[type="checkbox"], input[type="radio"]):focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
:is(input[type="checkbox"], input[type="radio"]):disabled { cursor: not-allowed; opacity: 0.45; }

/* Radio cards: for choices that need a sentence of explanation; the whole card is the target.
   Selected gets a green hairline and a faint fill. */
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 0.875rem var(--space-4);
  border: 1px solid var(--color-control-border);
  border-radius: 0.625rem;
  background: var(--color-surface-sunken);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.radio-card input { margin-top: 1px; }
.radio-card:hover { background: var(--color-surface-subtle); border-color: var(--color-border-strong); }
.radio-card:has(input:checked) { background: var(--color-accent-wash); border-color: var(--color-accent-line); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.radio-card:has(input:focus-visible) input { outline: 0; }
.radio-card:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.radio-card__title { display: block; font-size: var(--text-sm); font-weight: 500; line-height: 1.4; color: var(--color-fg); }
.radio-card__desc { display: block; margin-top: 2px; font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); }

.switch {
  --switch-w: 2.25rem;
  --switch-h: 1.25rem;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.switch input { position: absolute; opacity: 0; }

.switch__slider {
  width: var(--switch-w);
  height: var(--switch-h);
  border: 1px solid var(--color-border-strong);
  border-radius: 4px;
  background: var(--color-surface);
  position: relative;
  transition: border-color 120ms;
}

.switch__slider::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(var(--switch-h) - 6px);
  height: calc(var(--switch-h) - 6px);
  border-radius: 2px;
  background: var(--color-border-strong);
  transition: transform 120ms, background 120ms;
}

.switch input:checked + .switch__slider { border-color: var(--color-accent); }
.switch input:checked + .switch__slider::after {
  transform: translateX(calc(var(--switch-w) - var(--switch-h)));
  background: var(--color-accent);
}
.switch input:focus-visible + .switch__slider { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.range {
  -webkit-appearance: none;
  width: 100%;
  height: 2px;
  background: var(--color-border);
  outline: 0;
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--color-fg);
  cursor: pointer;
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--color-fg);
  border: 0;
  cursor: pointer;
}

.field__hint {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-fg-muted);
}

.field__error {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-danger-fg);
}

/* --- Tabs ---------------------------------------------------- */

/* 44px tabs over a hairline; the current one is underlined in the accent. */
.tabs {
  display: flex;
  gap: var(--space-1);
  border-bottom: 1px solid var(--color-border);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tabs__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 2.75rem;
  padding: 0 0.875rem;
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1;
  color: var(--color-fg-muted);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-family: inherit;
}

.tabs__item:hover { color: var(--color-fg); }
.tabs__item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
/* Same weight as the other tabs: a heavier one is wider and would shift its neighbours. */
.tabs__item:is([aria-selected="true"], [aria-current="page"]) {
  color: var(--color-fg-strong);
  border-bottom-color: var(--color-accent);
}
.tabs__item:is(:disabled, [aria-disabled="true"]) { color: var(--color-fg-disabled); cursor: not-allowed; }
.tabs__item--danger { color: var(--color-danger-fg); }
.tabs__item--danger:hover { color: color-mix(in srgb, var(--color-danger-fg) 80%, var(--color-fg)); }
.tabs__item--danger:is([aria-selected="true"], [aria-current="page"]) {
  color: var(--color-danger-fg);
  border-bottom-color: var(--color-danger-strong);
}
/* A tab with something to fix carries an amber dot after its label. */
.tabs__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-warn-strong); }


/* --- Breadcrumbs & pagination ------------------------------- */

/* Links are muted and underline on hover; the current page is bright and not a link. */
.breadcrumb {
  display: flex;
  gap: var(--space-2);
  font-size: 0.8125rem;
  color: var(--color-fg-muted);
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
  line-height: 1.5;
}

.breadcrumb__item { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; }
.breadcrumb__item + .breadcrumb__item::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--color-border-off);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='m4.5 3 3 3-3 3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='m4.5 3 3 3-3 3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.breadcrumb a { color: var(--color-fg-muted); text-decoration: none; border-radius: var(--radius-sm); }
.breadcrumb a:hover { color: var(--color-fg); text-decoration: underline; }
.breadcrumb a:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.breadcrumb__item--current { color: var(--color-fg); font-weight: 500; }

.pagination {
  display: inline-flex;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination__item {
  min-width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  text-decoration: none;
  font-family: var(--font-mono);
}

/* Hover and the current page take the side nav's fills (.admin__nav-link). */
.pagination__item:hover { color: var(--color-fg); background: var(--color-nav-active); }
.pagination__item[aria-current="page"] {
  color: var(--color-fg-strong);
  background: var(--color-accent-soft);
  border-color: transparent;
  font-weight: 600;
}

/* --- Alerts (extended) --------------------------------------- */

/* Inline, tied to the section it belongs to: the tone's fill and line, an icon in the tone, the text
   itself in the regular colours. The icon is drawn by the alert, so the markup stays plain text. */
.alert--info,
.alert--success,
.alert--warn,
.alert--error {
  --alert-tone: var(--color-info-fg);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.575' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='7'/%3E%3Cpath d='M9 8.25v4M9 5.75v.01'/%3E%3C/svg%3E");
  position: relative;
  padding: 0.875rem var(--space-4) 0.875rem 2.875rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--color-fg);
  background: var(--color-info-bg);
  border: 1px solid var(--color-info-border);
}
.alert--info::before,
.alert--success::before,
.alert--warn::before,
.alert--error::before {
  content: "";
  position: absolute;
  top: calc(0.875rem + 1px);
  left: var(--space-4);
  width: 18px;
  height: 18px;
  background: var(--alert-tone);
  -webkit-mask: var(--alert-icon) center / contain no-repeat;
  mask: var(--alert-icon) center / contain no-repeat;
}
.alert--success {
  --alert-tone: var(--color-success-fg);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.575' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='7'/%3E%3Cpath d='m6.25 9.1 1.9 1.9 3.6-3.75'/%3E%3C/svg%3E");
  background: var(--color-success-bg);
  border-color: var(--color-success-border);
}
.alert--warn {
  --alert-tone: var(--color-warn-fg);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.575' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.7 3.05 1.9 13.1a1.5 1.5 0 0 0 1.3 2.25h11.6a1.5 1.5 0 0 0 1.3-2.25L10.3 3.05a1.5 1.5 0 0 0-2.6 0Z'/%3E%3Cpath d='M9 7.25v3M9 12.75v.01'/%3E%3C/svg%3E");
  background: var(--color-warn-bg);
  border-color: var(--color-warn-border);
}
.alert--error {
  --alert-tone: var(--color-danger-fg);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='1.575' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='9' r='7'/%3E%3Cpath d='M9 5.75v4M9 12.25v.01'/%3E%3C/svg%3E");
  background: var(--color-danger-bg);
  border-color: var(--color-danger-border);
}
.alert__title { display: block; font-size: var(--text-sm); font-weight: 500; line-height: 1.4; color: var(--color-fg); }
.alert__body { display: block; margin-top: 1px; color: var(--color-fg-secondary); }
.alert a { color: var(--color-fg); font-weight: 500; text-decoration: underline; }

.alert--plain {
  background: var(--color-notice-bg);
  color: var(--color-fg);
  border: 1px solid transparent;
}

/* --- Badges -------------------------------------------------- */

/* A badge is the status of a thing (Active, Expires soon): a 24px pill in sentence case. A status
   tone leads with a dot, so the colour never stands alone; the plain badge is the inactive one. */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 1.5rem;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1;
  text-transform: capitalize;
  letter-spacing: 0;
  white-space: nowrap;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-badge-neutral);
  color: var(--color-fg-muted);
}

.badge--solid { background: var(--color-fg); color: var(--color-fg-inverse); border-color: var(--color-fg); }
.badge--accent { color: var(--color-accent); border-color: var(--color-accent-line); background: transparent; }
.badge--success { color: var(--color-success-fg); background: var(--color-accent-soft); border-color: var(--color-accent-line); }
.badge--danger { color: var(--color-danger-fg); background: var(--color-danger-bg); border-color: var(--color-danger-border); }
.badge--warn { color: var(--color-warn-fg); background: var(--color-warn-bg); border-color: var(--color-warn-border); }
.badge:is(.badge--success, .badge--danger, .badge--warn, .badge--info)::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* The small badge: 20px, 11px text. */
.badge--sm { height: 1.25rem; padding: 0 var(--space-2); font-size: 0.6875rem; }

/* Shape modifiers from before the single pill; kept so existing markup needs no change. */
.badge--status,
.badge--soft,
.badge--lg,
.badge--pill { border-radius: var(--radius-full); }

/* Counters and pinned markers carry a number, not a state: no dot. A toned one is solid, so it
   reads on any surface, a primary button included; an empty pin is the dot alone. */
.badge:is(.badge--counter, .badge--pin)::before { display: none; }
.badge--counter.badge--danger,
.badge--pin.badge--danger { color: var(--color-on-danger); background: var(--color-btn-danger-bg); border-color: transparent; }
.badge--counter.badge--success,
.badge--pin.badge--success { color: var(--color-on-accent); background: var(--color-accent); border-color: transparent; }
.badge--pin:empty { width: 10px; height: 10px; min-width: 0; padding: 0; top: -4px; right: -4px; background: currentColor; }
.badge--counter {
  height: 1.25rem;
  padding: 0 var(--space-1);
  min-width: 1.25rem;
  justify-content: center;
}

.badge--info { color: var(--color-info-fg); background: var(--color-info-bg); border-color: var(--color-info-border); }

/* In-heading badges sit on the baseline with the text */
h1 .badge, h2 .badge, h3 .badge, h4 .badge, h5 .badge, h6 .badge {
  vertical-align: middle;
  margin-left: var(--space-2);
  transform: translateY(-2px);
}

/* Anchor + pinned overlay for notification-style counters */
.badge-anchor {
  position: relative;
  display: inline-flex;
}

.badge--pin {
  position: absolute;
  top: -8px;
  right: -10px;
  z-index: 1;
}

/* --- Progress ------------------------------------------------ */

/* A 6px rounded track; the fill is green, amber near the limit, red when full. */
.progress {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  border-radius: 3px;
  background: var(--color-accent);
}

.progress__bar--accent { background: var(--color-accent); }
.progress__bar--warn { background: var(--color-warn-strong); }
.progress__bar--danger { background: var(--color-danger-strong); }

.progress--striped .progress__bar {
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255,255,255,0.25) 0 6px,
    transparent 6px 12px
  );
}

/* --- List group --------------------------------------------- */

.list-group {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-group__item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.list-group__item:last-child { border-bottom: 0; }
.list-group__item--active { background: var(--color-surface-subtle); }

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.status__name { font-weight: 500; }

.status__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-fg-subtle);
  flex-shrink: 0;
}

.status__dot--ok { background: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 14%, transparent); }
.status__dot--warn { background: var(--color-warn-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-warn-fg) 14%, transparent); }
.status__dot--down { background: var(--color-danger-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-danger-fg) 14%, transparent); }
.status__dot--idle { background: var(--color-border-off); }

/* --- Card variants ------------------------------------------ */

.card--plain {
  background: var(--color-surface);
}

.card--plain::before,
.card--plain::after,
.card--plain > .card__corner-bl,
.card--plain > .card__corner-br { display: none; }

.card__header {
  margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-5);
  padding: 0.9375rem var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0;
}

.card__body { display: flex; flex-direction: column; gap: var(--space-5); }

/* A destructive card swaps the border for the danger line and the title for danger text. */
.card--danger { border-color: var(--color-danger-border); }
.card--danger > .card__header { border-bottom-color: color-mix(in srgb, var(--color-danger-strong) 20%, transparent); }
.card--danger .card__title { color: var(--color-danger-fg); }

.card__footer {
  margin: var(--space-5) calc(var(--space-5) * -1) calc(var(--space-5) * -1);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background: transparent;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* --- Accordion ----------------------------------------------- */

.accordion {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.accordion__item { border-bottom: 1px solid var(--color-border); }
.accordion__item:last-child { border-bottom: 0; }

.accordion__summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: inherit;
}

.accordion__summary::-webkit-details-marker { display: none; }

.accordion__summary::after {
  content: "+";
  font-family: var(--font-mono);
  color: var(--color-fg-muted);
}

.accordion__item[open] .accordion__summary::after { content: "−"; }

.accordion__body {
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  line-height: 1.6;
}

/* --- Modal (static showcase) -------------------------------- */

.modal {
  position: relative;
  max-width: 28rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-menu);
}

/* Rounded like cards, so the crosshair corner marks go; the elements stay so older markup needs no change. */
.modal > .card__corner-bl,
.modal > .card__corner-br { display: none; }

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.modal__title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}

.modal__close {
  background: none;
  border: 0;
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--color-fg-muted);
  cursor: pointer;
  line-height: 1;
}

.modal__body {
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
  margin-bottom: var(--space-4);
  line-height: 1.6;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.modal-backdrop {
  background: var(--color-surface-subtle);
  padding: var(--space-10);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}

/* --- Toast --------------------------------------------------- */

/* A toast floats bottom right, so it is a raised sheet with the menu shadow. */
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0.875rem;
  border: 1px solid var(--color-control-border);
  border-radius: 0.625rem;
  background: var(--color-surface-raised);
  box-shadow: var(--shadow-menu);
  max-width: 22rem;
}

.toast__title { font-size: 0.8125rem; font-weight: 500; line-height: 1.5; margin: 0 0 2px; }
.toast__body { font-size: var(--text-xs); color: var(--color-fg-muted); margin: 0; }

.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toasts .toast { pointer-events: auto; }
/* The error alert's frame over the raised sheet. */
.toast--error {
  border-color: var(--color-danger-border);
  background: linear-gradient(var(--color-danger-bg), var(--color-danger-bg)) var(--color-surface-raised);
}
.toast--error .toast__title { color: var(--color-danger-fg); }

/* --- Color swatches ----------------------------------------- */

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: var(--space-3);
}

.swatch {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
}

.swatch__chip {
  height: 3.5rem;
  border: 1px solid var(--color-border);
}

.swatch__label { color: var(--color-fg); }

/* --- Profile shell (side-nav layout) ------------------------ */

/* Laid out like the admin shell: edge to edge, the nav a rail with a divider, the same gutters. */
.shell:has(> .profile-shell) { max-width: none; padding: 0; gap: 0; }
.shell:has(> .profile-shell) > .shell__footer { padding: var(--space-4) var(--space-10); }

.profile-shell {
  display: grid;
  grid-template-columns: 1fr;
  width: 100%;
  min-height: 38rem;
}

.profile-shell__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

@media (min-width: 720px) {
  .profile-shell { grid-template-columns: 16.5rem 1fr; }
  .profile-shell__nav {
    flex-direction: column;
    flex-wrap: nowrap;
    padding: var(--space-6) var(--space-4);
    border-bottom: 0;
    border-right: 1px solid var(--color-divider);
  }
}

.profile-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-fg-secondary);
  text-decoration: none;
  border-radius: var(--radius-lg);
}
.profile-nav__link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.profile-nav__link:hover {
  color: var(--color-fg);
  background: var(--color-nav-active);
}

.profile-nav__link[aria-current="page"] {
  color: var(--color-fg-strong);
  background: var(--color-accent-soft);
}

.profile-shell__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  min-width: 0;
  padding: var(--space-4);
}
@media (min-width: 720px) {
  .profile-shell__content { padding: 1.75rem var(--space-10) var(--space-12); }
}
/* A page of forms reads as one column of at most 60rem; a page with a table keeps the full width
   for it. The fields fill their card, and its submit button sits at the card's right edge. */
.profile-shell__content:not(:has(table)) > * { width: 100%; max-width: 60rem; }
/* The profile page's cards in two halves once the screen is wide enough: account on the left,
   preferences on the right. Narrower, they stack in the 60rem column above. */
.profile-columns { display: grid; gap: var(--space-6); align-items: start; }
.profile-columns > .stack { gap: var(--space-6); }
@media (min-width: 1320px) {
  .profile-shell__content:has(> .profile-columns) > * { max-width: none; }
  .profile-columns { grid-template-columns: 1fr 1fr; }
}
.profile-shell__content .form > .btn--block,
.profile-shell__content .stack > .btn--block { width: auto; align-self: flex-end; }

.profile-shell__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.profile-shell__title {
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.profile-shell__subtitle {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}

/* --- Footer -------------------------------------------------- */

.shell__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
}

/* --- Avatar ------------------------------------------------- */

/* Initials on the accent-tinted avatar colour; 24, 32 (default), 40 and 56. */
.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-full);
  background: var(--avatar-bg, var(--color-avatar));
  color: var(--color-on-avatar-default);
  font-weight: 600;
  font-size: var(--text-xs);
  line-height: 1;
}
/* Palette avatars set --avatar-bg inline to a saturated color; keep their letter light. */
.avatar[style*="--avatar-bg"] { color: var(--color-on-avatar); }
.avatar--sm { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar--lg { width: 2.5rem; height: 2.5rem; font-size: var(--text-sm); }
.avatar--xl { width: 3.5rem; height: 3.5rem; font-size: var(--text-lg); }
/* Overlapping avatars, each ringed in the page colour. */
.avatar-stack { display: inline-flex; }
.avatar-stack > .avatar { box-shadow: 0 0 0 2px var(--color-surface); }
.avatar-stack > .avatar + .avatar { margin-left: -8px; }

/* An application's tile: its initial in the accent on a neutral square; 32 and 48. */
.app-icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--color-control-border);
  border-radius: 0.625rem;
  background: var(--avatar-neutral-bg);
  color: var(--color-accent);
  font-size: 0.8125rem;
  font-weight: 600;
}
.app-icon--lg { width: 3rem; height: 3rem; border-radius: var(--radius-xl); font-size: var(--text-xl); }

/* --- Account menu ------------------------------------------- */

.account-menu { position: relative; }
.account-menu__trigger { list-style: none; cursor: pointer; }
.account-menu__trigger::-webkit-details-marker { display: none; }

/* The menu follows the dropdown look: a raised, rounded sheet with inset rows. */
.account-menu__panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  width: 18rem;
  padding: 6px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-control-border);
  border-radius: 10px;
  box-shadow: var(--shadow-menu);
  z-index: 50;
}

.account-menu__section { display: flex; flex-direction: column; gap: 2px; }
.account-menu__section + .account-menu__section { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--color-border); }

.account-menu__identity {
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 10px;
}
.account-menu__email { font-size: var(--text-sm); color: var(--color-fg); word-break: break-all; }

.account-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.25rem;
  padding: var(--space-2) 10px;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--color-fg);
  text-decoration: none;
  background: transparent;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.account-menu__item svg { flex: none; width: 1rem; height: 1rem; color: var(--color-fg-muted); }
.account-menu__item:hover { background: var(--color-surface-hover); }
.account-menu__item--muted { color: var(--color-fg-muted); }
/* Destructive items sit last; their red tint shows only under the pointer. */
.account-menu__item--danger,
.account-menu__item--danger svg { color: var(--color-danger-fg); }
.account-menu__item--danger:hover { background: var(--color-danger-bg); }


/* --- Dark theme --------------------------------------------- */
/* The colour tokens hold both values (light-dark() above); a theme only switches color-scheme and
   the few values that are not colours. */

[data-theme="dark"] {
  color-scheme: dark;
  --home-glow-opacity: 1;
  --shadow-menu: 0 16px 40px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);
  --shadow-segment: 0 1px 1px rgb(0 0 0 / 0.4);
  --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%239a9fa9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  --select-chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%239a9fa9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 10 4-4 4 4'/%3E%3C/svg%3E");
  --checkbox-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2304200f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.25 6.375 4.65 8.625 9.75 3.375'/%3E%3C/svg%3E");
  --checkbox-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2304200f' stroke-width='1.8' stroke-linecap='round' d='M2.625 6h6.75'/%3E%3C/svg%3E");
}

/* Aurora blobs use multiply on light surfaces (darkens color over white).
   On dark surfaces multiply collapses to ~black, so switch to screen (lightens). */
[data-theme="dark"] .bg-aurora__blob { mix-blend-mode: screen; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --home-glow-opacity: 1;
    --shadow-menu: 0 16px 40px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);
    --shadow-segment: 0 1px 1px rgb(0 0 0 / 0.4);
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%239a9fa9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    --select-chevron-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%239a9fa9' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='m4 10 4-4 4 4'/%3E%3C/svg%3E");
    --checkbox-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2304200f' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M2.25 6.375 4.65 8.625 9.75 3.375'/%3E%3C/svg%3E");
    --checkbox-dash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2304200f' stroke-width='1.8' stroke-linecap='round' d='M2.625 6h6.75'/%3E%3C/svg%3E");
  }
  :root:not([data-theme]) .bg-aurora__blob { mix-blend-mode: screen; }
}

/* --- Table component (toolbar / sortable headers / footer / empty) --- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.toolbar__search { flex: 1 1 280px; min-width: 220px; }

.toolbar__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toolbar__label {
  font-size: var(--text-xs);
  color: var(--color-fg-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.daterange {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.daterange .input { width: 11.5rem; }

.daterange__sep {
  color: var(--color-fg-subtle);
  font-family: var(--font-mono);
}

.table-frame { border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface-subtle); overflow: hidden; }
.table-frame .table tbody tr:last-child td { border-bottom: 0; }
.table-frame .table { border: none; margin: 0; }

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  color: inherit;
  text-decoration: none;
}

.th-sort__arrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-fg-subtle);
  line-height: 1;
}

.th-sort--active .th-sort__arrow { color: var(--color-fg); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  flex-wrap: wrap;
}

.table-footer__count {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-fg-muted);
}

.table-footer .pagination { margin: 0; }

.table-empty {
  text-align: center;
  color: var(--color-fg-muted);
  padding: var(--space-5) var(--space-4);
}

/* --- Mail log (Gmail-style) --------------------------------- */

.table--mail-log thead { display: none; }

td.mail-log__main {
  width: 100%;
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-log__snippet { color: var(--color-fg-muted); }

td.mail-log__meta {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.mail-log__meta-inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.mail-log__type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
}

.mail-log__time {
  color: var(--color-fg-muted);
  font-variant-numeric: tabular-nums;
  min-width: 4ch;
}

/* =============================================================
   App shell, tables and shared controls
   ============================================================= */

/* --- Admin shell layout ----------------------------------- */
/* Admin pages are app chrome: header, side nav and footer run edge to edge, no outer frame. */
.shell:has(> .admin) { max-width: none; padding: 0; gap: 0; }
.shell:has(> .admin) > .shell__footer { padding: var(--space-4) var(--space-10); }

.admin {
  display: grid;
  grid-template-columns: 16.5rem 1fr;
  gap: 0;
  background: var(--color-surface);
  min-height: 38rem;
}
.admin__nav {
  border-right: 1px solid var(--color-divider);
  padding: var(--space-6) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.admin__nav-section {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg-subtle);
  padding: 7px var(--space-3) 6px;
}
.admin__nav-section:not(:first-child) { margin-top: var(--space-6); }
/* 40px items with a 16px outline icon 12px from the label. The current page gets a green wash and a
   green icon; nothing else is coloured. */
.admin__nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 2.5rem;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-fg-secondary);
  text-decoration: none;
  border-radius: var(--radius-lg);
}
.admin__nav-link .icon { color: var(--color-fg-muted); }
.admin__nav-link:hover {
  color: var(--color-fg);
  background: var(--color-nav-active);
}
.admin__nav-link:hover .icon { color: var(--color-fg); }
.admin__nav-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.admin__nav-link[aria-current="page"],
.admin__nav-link.is-active {
  color: var(--color-fg-strong);
  background: var(--color-accent-soft);
}
.admin__nav-link[aria-disabled="true"] { color: var(--color-fg-disabled); pointer-events: none; }
.admin__nav-link[aria-disabled="true"] .icon { color: inherit; }
.admin__nav-label { flex: 1 1 auto; min-width: 0; }
.admin__nav-link.is-active .icon,
.admin__nav-link[aria-current="page"] .icon { color: var(--color-accent); }
.admin__nav-count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-fg-subtle);
}
.admin__nav-sep {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2);
}
.admin__main {
  padding: 1.75rem var(--space-10) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}
.admin__main--detail { max-width: none; }
.admin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.admin__header h1 { margin: 0; font-size: 1.375rem; line-height: 1.2; letter-spacing: -0.015em; }

/* --- Generic admin table ---------------------------------- */
table.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--text-sm);
}
/* Rows are 56px under a 40px head with no fill of its own. Values people may copy (URLs, ids)
   are mono. */
.tbl th, .tbl td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-divider);
}
.tbl td { height: 3.5rem; }
.tbl th {
  height: 2.5rem;
  padding-block: 0;
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-fg-subtle);
  background: transparent;
  border-top: 1px solid var(--color-divider);
  border-bottom-color: var(--color-border);
}
/* only rows with something to act on highlight; a read-only row stays still */
.tbl tbody tr:has(a, button):hover { background: var(--color-row-hover); }
.tbl tbody tr:is(.is-selected, [aria-selected="true"]) { background: var(--color-accent-wash); }
/* an inactive row stays readable, its text dimmed rather than faded */
.tbl tbody tr.is-inactive td { color: var(--color-fg-disabled); }
.tbl__check { width: 1.5rem; padding-right: 0; }
/* A list page's table framed like a form card (Group access): the card's fill and corners,
   the header a shade darker. It scrolls sideways inside its frame. The element selectors
   outrank each table kind's own th/td rules (.tbl and the apps' own tables). */
.tbl-card {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface-subtle);
}
.tbl-card table th { background: transparent; border-top: 0; }
.tbl-card table :is(th, td):first-child { padding-left: var(--space-5); }
.tbl-card table :is(th, td):last-child { padding-right: var(--space-5); }
.tbl-card table tbody tr:last-child td { border-bottom: 0; }
/* Rows that already highlight keep doing so, a step off the card's fill. */
.tbl-card .tbl tbody tr:has(a, button):hover { background: var(--color-row-hover); }
/* :is(th, td) outranks the .tbl th/td rule that sets every cell left. */
.tbl :is(th, td).tbl__actions, .tbl__actions { text-align: right; white-space: nowrap; }
.tbl__row-link {
  color: var(--color-fg);
  text-decoration: none;
  font-weight: 500;
}
.tbl__row-link:hover { text-decoration: underline; }
/* The Activity subject is a button — it triggers a live read from the SP — but has to read as the
   link it looks like, not as a form control. */
button.tbl__row-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

/* --- Danger zone (detail pages) --------------------------- */
/* A destructive card: the danger line around the card fill, the title in danger text (as .card--danger). */
.danger {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface-subtle);
}
.danger__title {
  font-weight: 600;
  color: var(--color-danger-fg);
  margin: 0 0 var(--space-2);
}
.danger__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}
.danger__row + .danger__row { border-top: 1px solid color-mix(in srgb, var(--color-danger-strong) 20%, transparent); }
.danger__desc { font-size: var(--text-sm); color: var(--color-fg-muted); }

/* --- Segmented control (one-of filter, radio-backed) ------ */
/* Two to four short options that switch a view or a filter, not a stored setting; the radio drives a
   GET form. The chosen segment is a raised tile in the inset frame. */
.segmented {
  display: inline-flex;
  gap: 2px;
  height: 2.5rem;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: 0.625rem;
  background: var(--color-surface-sunken);
}
.segmented__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-3);
  font: 500 0.8125rem/1 var(--font-sans);
  color: var(--color-fg-muted);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
.segmented__item input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.segmented__item:hover { color: var(--color-fg); background: var(--color-fill-quiet); }
.segmented__item:has(input:checked),
.segmented__item[aria-pressed="true"],
.segmented__item[aria-selected="true"] {
  color: var(--color-fg);
  background: light-dark(var(--color-surface-raised), var(--color-border));
  box-shadow: var(--shadow-segment);
}
.segmented__item:has(input:focus-visible),
.segmented__item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -1px; }
.segmented__item:has(input:disabled),
.segmented__item:disabled { color: var(--color-fg-disabled); background: none; cursor: not-allowed; }
/* Compact (menus) and stretched (segments share the full width) variants. */
.segmented--sm { height: 2rem; padding: 2px; border-radius: var(--radius-lg); }
.segmented--sm .segmented__item { padding: 0 var(--space-2); font-size: var(--text-xs); border-radius: var(--radius-md); }
.segmented__count { margin-left: var(--space-1); font-weight: 400; }
/* An optional leading icon, e.g. the theme switch. */
.segmented__item svg { flex-shrink: 0; width: 0.875rem; height: 0.875rem; margin-right: var(--space-1); }
.segmented--block { display: flex; }
.segmented--block .segmented__item { flex: 1; }

/* --- Tags ------------------------------------------------- */
/* A tag is a fixed label (Required, Default, SAML): a small rectangle in mono caps, no fill. */
.chips { display: inline-flex; gap: var(--space-1); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  font: 500 0.65625rem/1.5 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-fg-muted);
  background: transparent;
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-sm);
}
.chip--accent { color: var(--color-accent); border-color: var(--color-accent-line); }
.chip--warn { color: var(--color-warn-fg); border-color: var(--color-warn-border); }
.chip--danger { color: var(--color-danger-fg); border-color: var(--color-danger-border); }
.chip--more { color: var(--color-fg-subtle); border-style: dashed; }

/* --- Badges (more) ----------------------------------------- */
/* neutral: a plain label with no state, so no fill and no dot */
.badge--neutral { color: var(--color-fg-secondary); background: transparent; border-color: var(--color-control-border); }
/* badges stacked in a column (a role legend) share one width */
.badge--even { min-width: 6rem; justify-content: center; }
/* a badge holding a literal value (a release id) keeps its case */
.badge--code { text-transform: none; }
/* a long value broken into lines inside one badge (a release id after its date) */
.badge--stack { flex-direction: column; align-items: flex-start; gap: 0; height: auto; padding-block: 3px; line-height: 1.5; }
.badge--stack::before { display: none; }

/* --- Actions row --------------------------------------------- */
/* confirming buttons sit at the right edge of their form */
.actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
/* Its display beats the user-agent [hidden] rule; scripts hide some action rows. */
.actions[hidden] { display: none; }
/* a long note beside the actions: it wraps, the buttons keep their size */
.actions--note { align-items: center; gap: var(--space-4); }
.actions--note > .btn { flex-shrink: 0; }
/* The primary action stays first in the markup, so Enter submits it, but is drawn last, at the right edge. */
.actions--reverse { flex-direction: row-reverse; justify-content: flex-start; }
/* a confirm field beside its button: the button lines up with the input, not the label */
.actions--field { align-items: flex-end; }
/* the field takes the row, so the button lands on the right edge */
.actions--field > :not(.btn):not(form) { flex: 1 1 auto; min-width: 0; }

/* --- Chevron link ("see all ›") ------------------------------ */
/* quiet text with a trailing chevron, brightening on hover - never underlined */
.link-chev { display: inline-flex; align-items: center; gap: var(--space-1); color: var(--color-fg-subtle); font-size: var(--text-xs); text-decoration: none; white-space: nowrap; }
.link-chev::after { content: "\203A"; font-size: var(--text-base); line-height: 1; }
.link-chev:hover, .link-chev:focus-visible { color: var(--color-fg); }

/* --- Table additions ----------------------------------------- */
/* many narrow columns: tighter side padding keeps them on screen */
.tbl.tbl--dense th, .tbl.tbl--dense td { padding-inline: var(--space-2); }
.tbl.tbl--dense th:first-child, .tbl.tbl--dense td:first-child { padding-left: var(--space-3); }
/* the column that takes the spare width, so the status columns sit at the right edge */
.tbl td.tbl__fill { width: 100%; }
/* an optional note column folds away when a row has nothing to say */
.tbl td.tbl__note:empty { padding: 0; }
/* a secondary line under a cell's main value (a host under a node name, an age under a badge) */
.tbl__sub { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--color-fg-muted); }
/* tag chips wrap onto a second line instead of widening the table */
.tbl td.tbl__tags { white-space: normal; min-width: 8.5rem; max-width: 9rem; line-height: 1.9; }
/* a row's open link as a bare chevron */
.tbl__chevron { display: inline-block; padding: 0 var(--space-2); color: var(--color-fg-subtle); font-size: var(--text-xl); line-height: 1; text-decoration: none; }
.tbl tr:hover .tbl__chevron, .tbl__chevron:focus-visible { color: var(--color-fg); }
/* a value and the badge that qualifies it (a release and OUTDATED) */
.tbl td > code + .badge { margin-left: var(--space-2); }

/* --- Account menu: icon trigger and theme row ------------------ */
/* a bare gear in the header's own text colour, for headers without an avatar */
.account-menu__trigger--icon { box-sizing: border-box; display: inline-grid; place-items: center; width: 2rem; height: 2rem; color: inherit; opacity: 0.7; transition: opacity 120ms; }
.account-menu__trigger--icon svg { width: 1.125rem; height: 1.125rem; }
.account-menu__trigger--icon:hover, .account-menu[open] .account-menu__trigger--icon { opacity: 1; }
.account-menu__trigger--icon:focus-visible { opacity: 1; outline: 2px solid var(--color-accent); outline-offset: 1px; }
/* a line under the email (the role, or why there is no session) */
.account-menu__note { font-size: var(--text-xs); color: var(--color-fg-muted); }
.account-menu__theme { gap: var(--space-2); padding: var(--space-3) var(--space-4); }
.account-menu__label { font: 500 var(--text-xs)/1 var(--font-mono); color: var(--color-fg-subtle); letter-spacing: 0.06em; text-transform: uppercase; }

/* --- Narrow viewport (shared components) ------------------ */
@media (max-width: 1024px) {
  .admin { grid-template-columns: 1fr; }
  .admin__nav {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
  /* In a row, section labels and separators read as stray items. */
  .admin__nav-section,
  .admin__nav-sep { display: none; }
  /* A wide table scrolls inside its box instead of widening the page. */
  .tbl-scroll { overflow-x: auto; }
  /* An open pick list or row menu would be clipped by that box, so it lets go while one is open. */
  .tbl-scroll:has(.ts-wrapper.dropdown-active, .menu[open]) { overflow-x: visible; }
}

@media (max-width: 720px) {
  .admin__main { padding: var(--space-4); }
  /* Headers and save bars stack: the text first, the actions on their own row at the right edge. */
  .page-header__top { flex-wrap: wrap; }
  .page-header__actions { flex-basis: 100%; justify-content: flex-end; }
  .save-bar { flex-wrap: wrap; }
  .save-bar__message { flex-basis: 100%; }
  /* Danger rows: text above, buttons below on the right. */
  .danger__row { flex-direction: column; align-items: stretch; }
  .danger__row > .btn,
  .danger__row > form { align-self: flex-end; }
}

/* --- User cell -------------------------------------------- */
.user-cell {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.user-cell__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.user-cell__email {
  font-weight: 500;
  color: var(--color-fg);
}
.user-cell__name {
  font-size: var(--text-xs);
  color: var(--color-fg-subtle);
}

/* --- Usage: rings and bars ------------------------------------ */
/* two small rings (a quota and the disk under it), the state as a quiet line underneath;
   --p on each ring is the percentage, the tone follows the state */
.usage-rings { --usage-tone: var(--color-accent); display: flex; flex-direction: column; gap: var(--space-1); }
.usage-rings--grow { --usage-tone: var(--color-warn-strong); }
.usage-rings--alert { --usage-tone: var(--color-danger-strong); }
.usage-rings__pair { display: flex; gap: var(--space-3); }
.usage-rings__item { display: inline-flex; align-items: center; gap: 6px; }
.usage-rings__ring { --ring: var(--usage-tone); flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: conic-gradient(var(--ring) calc(var(--p) * 1%), var(--color-border) 0); }
/* the second ring is context, not state: always grey */
.usage-rings__item--muted .usage-rings__ring { --ring: var(--color-fg-subtle); }
.usage-rings__ring::after { content: ""; width: 16px; height: 16px; border-radius: 50%; background: var(--color-surface); }
.usage-rings__text { display: flex; flex-direction: column; font: var(--text-xs)/1.15 var(--font-mono); color: var(--color-fg-muted); }
.usage-rings__text b { font-weight: 500; color: var(--color-fg); }
.usage-rings__state { color: var(--color-fg-muted); font-size: var(--text-xs); }
/* a labelled bar: label, track, figure */
.usage { display: grid; grid-template-columns: 7rem 1fr auto; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.usage__track { --usage-tone: var(--color-fg-subtle); height: 6px; overflow: hidden; border-radius: 3px; background: var(--color-border); }
.usage__track i { display: block; height: 100%; border-radius: 3px; background: var(--usage-tone); }
.usage__track--ok { --usage-tone: var(--color-accent); }
.usage__track--grow { --usage-tone: var(--color-warn-strong); }
.usage__track--alert { --usage-tone: var(--color-danger-strong); }

/* --- Color field ---------------------------------------------- */
/* swatch, hex and reset in one box, presets as dots beside it */
.color-field { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; min-width: 0; }
.color-field__box { display: inline-flex; align-items: stretch; height: 2.25rem; overflow: hidden; border: 1px solid var(--color-control-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.color-field__box:focus-within { border-color: var(--color-accent); box-shadow: 0 0 0 3px var(--color-accent-ring); }
.color-field__box:has(.color-field__hex:invalid) { border-color: var(--color-danger-fg); }
.color-field__swatch { position: relative; width: 2.25rem; border-right: 1px solid var(--color-border); cursor: pointer; }
/* the native picker covers the swatch, invisible */
.color-field__swatch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.color-field__hex { width: 6rem; border: 0; padding: 0 var(--space-2); background: none; color: var(--color-fg); font: var(--text-sm) var(--font-mono); }
.color-field__hex:focus { outline: none; }
.color-field__reset { width: 1.75rem; border: 0; padding: 0; background: none; color: var(--color-fg-muted); font-size: 1rem; cursor: pointer; }
.color-field__reset:hover { color: var(--color-fg); }
.color-field__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.color-field__preset { width: 1.25rem; height: 1.25rem; padding: 0; border: 1px solid rgb(128 128 128 / 0.45); border-radius: 50%; cursor: pointer; }
.color-field__preset[aria-pressed="true"] { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* --- Upload tile ---------------------------------------------- */
/* a dashed square (the current image or +) plus Upload / Remove text; stands in for the native file control */
.upload-tile { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.upload-tile__tile { position: relative; flex: none; width: 2.25rem; height: 2.25rem; display: grid; place-items: center; border: 1px dashed var(--color-border-strong); color: var(--color-fg-muted); font-size: 1.125rem; cursor: pointer; }
.upload-tile__tile:hover { border-color: var(--color-accent); color: var(--color-fg); }
.upload-tile__tile:focus-within { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.upload-tile__tile img { width: 100%; height: 100%; object-fit: contain; }
.upload-tile__tile input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-tile__meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: var(--text-sm); }
.upload-tile__action { padding: 0; border: 0; background: none; color: var(--color-fg); font: inherit; font-weight: 500; cursor: pointer; }
.upload-tile__action:hover { color: var(--color-accent); }
.upload-tile__action--muted { color: var(--color-fg-muted); font-weight: 400; }

/* File variant: the whole dashed box is the label, so a click anywhere opens the picker.
   The input stays in the box (not display:none) so `required` still reports on it. */
.upload-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  color: var(--color-fg-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color 120ms;
}
.upload-file:hover { border-color: var(--color-accent); }
.upload-file:focus-within { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.upload-file svg { flex: none; width: 1.25rem; height: 1.25rem; }
.upload-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-file__action { color: var(--color-fg); font-weight: 500; }
.upload-file__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: var(--text-xs); }
.upload-file.is-picked { border-style: solid; }
.upload-file.is-picked .upload-file__name { color: var(--color-fg); }

/* --- Spinner ------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Select with search (Tom Select) ------------------------ */
/* searchable-select.js turns <select class="js-searchable"> into a pick list with a search box,
   like Select2, and every other single .select into the same panel without one. The library's
   stylesheet comes in through the @import at the top of this file; it is more specific in places
   and pads with !important itself, hence the importants below. */

/* a floor so the widget is usable */
select.js-searchable + .ts-wrapper { min-width: 18rem; }

/* Once the widget exists, the original select must go. Class-based hiding is not enough:
   a swap restores the markup's class attribute, wiping the ts-hidden-accessible class TomSelect
   added — so hide by structure, not by class. Visually hidden rather than display:none: the browser
   anchors a required field's validation message to the select, and skips one that is not rendered. */
select:has(+ .ts-wrapper) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
/* TomSelect copies the select's classes onto its wrapper. That is handy for the mono value
   classes, and a trap for .select, whose border, background, arrow and padding would paint a
   second box around the widget's own control. The bare select keeps .select for the pre-init render. */
.ts-wrapper.text-mono .ts-control,
.ts-wrapper.text-mono .ts-dropdown,
.ts-wrapper.input--code .ts-control,
.ts-wrapper.input--code .ts-dropdown {
  font-family: var(--font-mono) !important;
}
.ts-wrapper.input--code .ts-control { font-size: 0.8125rem; }
.ts-wrapper.select,
.ts-wrapper.input {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  background-image: none;
  box-shadow: none;
}

/* The trigger: the text field's 44px box; focus and the open list draw the green edge and glow. */
.ts-wrapper .ts-control {
  min-height: 2.75rem;
  align-items: center;
  background: var(--color-surface) !important;
  color: var(--color-fg) !important;
  border: 1px solid var(--color-control-border) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: none !important;
  padding: var(--space-2) var(--space-3) var(--space-2) 0.875rem;
  font-size: var(--text-sm);
  transition: border-color 120ms, box-shadow 120ms;
}
.ts-wrapper:not(.disabled):not(.locked):hover .ts-control { border-color: var(--color-border-strong) !important; }
.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control {
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 0 3px var(--color-accent-ring) !important;
}
.ts-wrapper .ts-control input {
  color: var(--color-fg) !important;
  font-family: inherit;
  font-size: inherit;
}
.ts-wrapper .ts-control input::placeholder { color: var(--color-placeholder); }
/* Disabled (the select's own flag) or locked (inside a disabled fieldset) reads like .select:disabled. */
.ts-wrapper.disabled .ts-control,
.ts-wrapper.locked .ts-control {
  opacity: 1 !important;
  color: var(--color-fg-disabled) !important;
  background-color: var(--color-surface-sunken) !important;
  border-color: var(--color-divider) !important;
  cursor: not-allowed !important;
}
/* TomSelect marks the wrapper when the browser rejects the hidden select as invalid. */
.ts-wrapper.invalid .ts-control,
select:is([aria-invalid="true"], .is-invalid) + .ts-wrapper .ts-control,
.ts-wrapper:has(+ .field__error) .ts-control,
.field--error .ts-wrapper .ts-control {
  border-color: var(--color-danger-strong) !important;
  box-shadow: 0 0 0 3px var(--color-danger-ring) !important;
}

/* A plain pick list (no search box) reads as a select: pointer cursor and the same chevron.
   tom-select.css forces the control's right padding to max(--ts-pr-min, ...) !important,
   so the room for the chevron goes through that variable. */
.ts-wrapper.no-search { --ts-pr-min: 2.5rem; }
.ts-wrapper.no-search .ts-control {
  cursor: pointer;
  background-image: var(--select-chevron) !important;
  background-repeat: no-repeat !important;
  background-position: right var(--space-3) center !important;
}
.ts-wrapper.no-search .ts-control::after { display: none !important; }
/* the chevron turns up while the list is open */
.ts-wrapper.no-search.dropdown-active .ts-control { background-image: var(--select-chevron-up) !important; }
/* Size to the longest option: the control keeps its one line clear of the chevron,
   and the open list may grow past a narrow control instead of wrapping its rows. */
.ts-wrapper.no-search .ts-control { flex-wrap: nowrap; white-space: nowrap; }
.ts-wrapper.no-search .ts-dropdown { width: max-content; min-width: 100%; }
.ts-wrapper.no-search .ts-dropdown .option { white-space: nowrap; }
/* The control itself takes focus when there is no search box (TomSelect focuses it from script,
   so even a click counts as focus-visible); the accent edge from .focus marks it instead. */
.ts-wrapper.no-search .ts-control:focus { outline: none; }

/* The list: a raised panel 6px below the trigger, as wide as it; long lists scroll inside. */
.ts-dropdown {
  padding: 6px;
  background: var(--color-surface-raised) !important;
  color: var(--color-fg) !important;
  border: 1px solid var(--color-control-border) !important;
  border-radius: 0.625rem !important;
  box-shadow: var(--shadow-menu) !important;
  margin-top: 6px !important;
}
.ts-wrapper .ts-dropdown-content { display: flex; flex-direction: column; gap: 2px; max-height: min(20rem, 50vh); overflow-y: auto; }
/* Set by searchable-select.js when the list would open past the bottom of the window. */
.ts-wrapper.ts-drop-up .ts-dropdown {
  top: auto !important;
  bottom: 100%;
  margin-top: 0 !important;
  margin-bottom: 6px !important;
}

/* Rows are 36px with a 16px slot for the chosen one's check; tom-select.css pads options with a
   more specific selector, hence the doubled class. */
.ts-dropdown .option,
.ts-dropdown .create,
.ts-dropdown .no-results {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}
.ts-dropdown .ts-dropdown-content .option[data-selectable],
.ts-dropdown .ts-dropdown-content .create { padding: 0 10px 0 2.25rem; }
.ts-dropdown .option.active,
.ts-dropdown .option:hover,
.ts-dropdown .create.active,
.ts-dropdown .create:hover {
  background-color: var(--color-surface-hover) !important;
  color: var(--color-fg) !important;
}
.ts-dropdown .option.selected { background-color: color-mix(in srgb, var(--color-accent) 8%, transparent) !important; }
.ts-dropdown .option.selected.active { background-color: color-mix(in srgb, var(--color-accent) 12%, transparent) !important; }
.ts-dropdown .option.selected::before {
  content: "";
  position: absolute;
  left: 11px;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M2.625 7.4375 5.425 10.0625 11.375 3.9375'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round' d='M2.625 7.4375 5.425 10.0625 11.375 3.9375'/%3E%3C/svg%3E") center / contain no-repeat;
}
.ts-dropdown .option[aria-disabled="true"],
.ts-dropdown .option.disabled { color: var(--color-fg-disabled) !important; background: none !important; }
/* the typed text, marked inside each match */
.ts-dropdown .highlight { color: inherit; background: var(--color-accent-soft); border-radius: 2px; }
/* "Create" offers what was typed; an empty result says so in muted text. */
.ts-dropdown .create { color: var(--color-fg); }
.ts-dropdown .no-results { padding: 14px 10px 10px; color: var(--color-fg-muted); }

/* Option groups: mono caps headers, not selectable, a hairline between groups. */
.ts-dropdown .optgroup + .optgroup { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--color-border); }
.ts-dropdown .ts-dropdown-content .optgroup-header {
  padding: 7px 10px 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg-subtle) !important;
  background: transparent !important;
}

/* A remote search in flight: TomSelect draws its own dual ring in ::after; the element wears the
   .spinner ring instead. */
.ts-dropdown .spinner { width: 0.875rem !important; height: 0.875rem !important; margin: var(--space-2) !important; }
.ts-dropdown .spinner::after { content: none !important; }

/* =============================================================
   Type styles, effects, icons and the components from DS 02–07
   ============================================================= */

/* --- Type styles -------------------------------------------- */
/* Ten styles cover every screen: weight 400, 500 and 600 only, and mono text is never bold. */
.type-title { font: 600 1.375rem/1.2 var(--font-sans); letter-spacing: -0.015em; color: var(--color-fg); }
.type-section { font: 600 1.125rem/1.3 var(--font-sans); color: var(--color-fg); }
.type-card { font: 600 0.9375rem/1.3 var(--font-sans); color: var(--color-fg); }
.type-body { font: 400 var(--text-sm)/1.5 var(--font-sans); color: var(--color-fg); }
.type-label { font: 500 0.8125rem/1.4 var(--font-sans); color: var(--color-fg); }
.type-helper { font: 400 0.8125rem/1.55 var(--font-sans); color: var(--color-fg-muted); }
.type-badge { font: 500 var(--text-xs)/1 var(--font-sans); }
.type-mono { font: 400 0.8125rem/1.4 var(--font-mono); color: var(--color-fg); }
.type-mono-label { font: 500 0.6875rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-fg-subtle); }
.type-mono-chip { font: 400 0.65625rem/1.5 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--color-fg-muted); }

/* --- Effects ------------------------------------------------ */
/* Only menus float, so only menus cast a shadow (--shadow-menu). Focus is always the green ring;
   error and disabled change border and opacity, never layout. */
.focus-ring { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.focus-field { border-color: var(--color-accent) !important; box-shadow: 0 0 0 3px var(--color-accent-ring) !important; }
.focus-error { border-color: var(--color-danger-strong) !important; box-shadow: 0 0 0 3px var(--color-danger-ring) !important; }
/* A disabled control dims what depends on it too: wrap the dependent section. */
.is-disabled,
[data-disabled-scope] { opacity: 0.45; pointer-events: none; user-select: none; }

/* --- Icons -------------------------------------------------- */
/* 16px outline icons from icons.svg, drawn in currentColor:
   <svg class="icon"><use href="/webjars/idp-theme/1.0.0/icons.svg#users"/></svg> */
.icon { flex: none; display: block; width: 1rem; height: 1rem; }
.icon--sm { width: 0.875rem; height: 0.875rem; }
.icon--lg { width: 1.125rem; height: 1.125rem; }
.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;
}

/* --- Button loading ----------------------------------------- */
/* Same colours as the resting button, a 14px spinner before a label in -ing form ("Saving…"). */
.btn.is-loading,
.btn[aria-busy="true"] { cursor: progress; pointer-events: none; }
.btn.is-loading::before,
.btn[aria-busy="true"]::before {
  content: "";
  flex: none;
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.8;
  animation: spin 0.6s linear infinite;
}

/* --- Icon buttons ------------------------------------------- */
/* A bare 40px button holding one icon; grouped ones sit 2px apart. */
.icon-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 2px; }
.btn-icon {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem; padding: 0;
  color: var(--color-fg-muted);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-lg);
  cursor: pointer; list-style: none;
  transition: color 120ms, background 120ms;
}
.btn-icon::-webkit-details-marker { display: none; }
.btn-icon:hover { color: var(--color-fg); background: var(--color-fill-quiet); }
.btn-icon:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.btn-icon--sm { width: 2rem; height: 2rem; border-radius: var(--radius-md); }
.btn-icon--danger:hover { color: var(--color-danger-fg); background: var(--color-danger-bg); }
.btn-icon.is-copied, .copy-field__btn.is-copied { color: var(--color-accent); }

/* --- Actions menu ------------------------------------------- */
/* Opens from the ⋯ button in a row or card header: a raised panel of 36px items. Destructive items
   sit last, after a divider, and tint red only under the pointer; an ellipsis means a confirmation follows. */
.menu { position: relative; display: inline-block; }
/* the ⋯ trigger: a 32px raised square */
.menu__trigger {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem;
  color: var(--color-fg);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
  cursor: pointer; list-style: none;
}
.menu__trigger::-webkit-details-marker { display: none; }
.menu__trigger:hover,
.menu[open] > .menu__trigger { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
.menu__trigger:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.menu[open] > .btn-icon { color: var(--color-fg); background: var(--color-fill-quiet); }
.menu__panel {
  position: absolute; z-index: 20; top: calc(100% + 6px); right: 0;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 13.75rem; padding: 6px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-control-border);
  border-radius: 0.625rem;
  box-shadow: var(--shadow-menu);
  text-align: left;
}
.menu__panel--static { position: static; box-shadow: var(--shadow-menu); }
.menu__item {
  display: flex; align-items: center; gap: 10px;
  min-height: 2.25rem; padding: 0 10px;
  font: 0.8125rem var(--font-sans); color: var(--color-fg);
  text-decoration: none;
  background: transparent; border: 0; border-radius: var(--radius-md);
  cursor: pointer; text-align: left; white-space: nowrap;
}
.menu__item .icon { color: var(--color-fg-muted); }
.menu__item:hover { background: var(--color-surface-hover); }
.menu__item:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.menu__item:is(:disabled, [aria-disabled="true"]) { color: var(--color-fg-disabled); background: none; cursor: not-allowed; }
.menu__item:is(:disabled, [aria-disabled="true"]) .icon { color: var(--color-fg-disabled); }
.menu__item--danger,
.menu__item--danger .icon { color: var(--color-danger-fg); }
.menu__item--danger:hover { background: var(--color-danger-bg); }
/* the current pick in a switcher: the chosen-option fill and a check */
.menu__item[aria-current="true"] { background: color-mix(in srgb, var(--color-accent) 8%, transparent); }
.menu__item[aria-current="true"] .icon { color: var(--color-accent); }
.menu__shortcut { margin-left: auto; padding-left: var(--space-4); font: 400 0.6875rem/1 var(--font-mono); color: var(--color-fg-subtle); }
.menu__meta { margin-left: auto; }
.menu__sep { height: 1px; margin: 4px 0; background: var(--color-border); }
.menu__label { padding: 7px 10px 4px; font: 500 0.6875rem/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-fg-subtle); }

/* --- Read-only value with a copy button inside the field ------ */
.copy-field { position: relative; flex: 1 1 auto; min-width: 0; }
.copy-field .input { padding-right: 3rem; text-overflow: ellipsis; }
.copy-field__btn {
  position: absolute; top: 1px; right: 1px;
  display: grid; place-items: center;
  width: 2.5rem; height: calc(100% - 2px);
  color: var(--color-fg-muted);
  background: transparent; border: 0; border-radius: var(--radius-lg);
  cursor: pointer;
}
.copy-field__btn:hover { color: var(--color-fg); background: var(--color-fill-quiet); }
.copy-field__btn:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* --- Setting rows ------------------------------------------- */
/* The usual way a switch appears: a title and one line of help on the left, the control on the
   right. A dependent option sits indented below, or stays visible but disabled with a reason. Rows
   do not highlight on hover; only the control reacts. */
.setting-rows { border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface-subtle); }
.setting-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-6);
  padding: 0.9375rem var(--space-5);
}
.setting-row + .setting-row { border-top: 1px solid var(--color-divider); }
.setting-row__text { display: flex; flex-direction: column; gap: 1px; max-width: 32.5rem; min-width: 0; }
.setting-row__title { font-size: var(--text-sm); font-weight: 500; line-height: 1.4; color: var(--color-fg); }
.setting-row__help { font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); }
.setting-row__control { flex: none; padding-top: 1px; }
.setting-row--dependent { padding-left: calc(var(--space-5) + var(--space-6)); }
.setting-row--disabled .setting-row__title,
.setting-row--disabled .setting-row__help { color: var(--color-fg-disabled); }
.setting-row--disabled .setting-row__control { opacity: 0.45; pointer-events: none; }
/* an option that cannot apply yet: dimmed, its reason kept readable, a tag instead of the control */
.setting-row--unavailable { opacity: 0.5; }
.setting-row--unavailable .setting-row__title { color: var(--color-fg-disabled); }
.setting-row__status { flex: none; padding-top: 3px; font: 400 var(--text-xs)/1.5 var(--font-mono); color: var(--color-fg-subtle); }

/* --- Checkbox group ----------------------------------------- */
/* A parent that is mixed while some children are picked; its children indented under it. */
.check-group { display: flex; flex-direction: column; gap: 0.875rem; padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: var(--color-surface-subtle); }
.check-group__parent { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; }
.check-group__parent input { margin-top: 1px; }
.check-group__title { display: block; font-size: var(--text-sm); font-weight: 500; line-height: 1.4; }
.check-group__count { display: block; font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); }
.check-group__children { display: flex; flex-direction: column; gap: var(--space-3); padding-left: 1.875rem; }
.check-group__children .check { font: 400 0.8125rem/1.4 var(--font-mono); }

/* --- Removable chip ----------------------------------------- */
/* A value someone added (an email, a domain): a raised mono chip with a remove button. */
.chip-removable {
  display: inline-flex; align-items: center; gap: 6px;
  height: 1.75rem; padding: 0 6px 0 10px;
  font: 400 var(--text-xs)/1 var(--font-mono); color: var(--color-fg);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-md);
}
.chip-removable:hover { border-color: var(--color-border-strong); }
.chip-removable__remove {
  display: grid; place-items: center;
  width: 18px; height: 18px; padding: 0;
  color: var(--color-fg-muted);
  background: none; border: 0; border-radius: var(--radius-sm);
  cursor: pointer;
}
.chip-removable__remove:hover { color: var(--color-fg); background: var(--color-surface-hover); }
.chip-removable__remove .icon { width: 12px; height: 12px; }

/* --- Alert: dismiss, action, compact ------------------------ */
/* Dismiss only notices that will not return. */
.alert__dismiss {
  position: absolute; top: 0.75rem; right: 0.75rem;
  display: grid; place-items: center;
  width: 1.5rem; height: 1.5rem; padding: 0;
  color: var(--color-fg-muted);
  background: none; border: 0; border-radius: var(--radius-md);
  cursor: pointer;
}
.alert__dismiss:hover { color: var(--color-fg); background: var(--color-fill-quiet); }
.alert__dismiss .icon { width: 14px; height: 14px; }
.alert:has(> .alert__dismiss) { padding-right: 3rem; }
.alert__action { display: inline-block; margin-top: 6px; color: var(--color-fg); font-weight: 500; text-decoration: underline; }
/* one line: tighter, the icon centred on it */
.alert--compact { padding-top: 0.625rem; padding-bottom: 0.625rem; padding-left: 2.625rem; }
.alert--compact::before { top: 50%; left: 0.875rem; width: 16px; height: 16px; transform: translateY(-50%); }

/* --- Toast action ------------------------------------------- */
/* a one-line toast with an action (Undo) centres its row */
.toast:has(> .toast__action) { align-items: center; }
.toast__icon { flex: none; width: 18px; height: 18px; color: var(--color-accent); }
.toast__action { margin-left: auto; padding-left: var(--space-3); font: 500 0.8125rem/1.5 var(--font-sans); color: var(--color-fg); text-decoration: underline; background: none; border: 0; cursor: pointer; }

/* --- Progress label row ------------------------------------- */
.progress-row { display: flex; flex-direction: column; gap: var(--space-2); }
.progress-row__head { display: flex; justify-content: space-between; gap: var(--space-3); font-size: 0.8125rem; line-height: 1.5; color: var(--color-fg); }
.progress-row__value { font: 400 var(--text-xs)/1.5 var(--font-mono); color: var(--color-fg-muted); }

/* --- Breadcrumb, collapsed ---------------------------------- */
/* Truncate the middle on narrow screens, never the last item. */
.breadcrumb__ellipsis { color: var(--color-fg-muted); }

/* --- Empty, loading and error states ------------------------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: var(--space-10) var(--space-6);
  text-align: center;
}
.empty-state__icon {
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; margin-bottom: 6px;
  color: var(--color-fg-muted);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 0.625rem;
}
.empty-state__icon .icon { width: 18px; height: 18px; }
.empty-state__title { font-size: 0.9375rem; font-weight: 600; line-height: 1.5; color: var(--color-fg); }
.empty-state__text { max-width: 16.25rem; font-size: 0.8125rem; line-height: 1.55; color: var(--color-fg-muted); }
.empty-state__actions { margin-top: var(--space-3); }
/* the error state: the same layout, the icon in the danger tone */
.empty-state--error .empty-state__icon { color: var(--color-danger-fg); background: var(--color-danger-bg); border-color: var(--color-danger-border); }
/* skeleton bars while something loads */
.skeleton { display: flex; flex-direction: column; gap: 0.875rem; padding: var(--space-5); }
.skeleton__bar { height: 2.5rem; border-radius: var(--radius-md); background: var(--color-fill-quiet); animation: skeleton-pulse 1.6s ease-in-out infinite; }
.skeleton__bar--title { width: 40%; height: 0.875rem; }
.skeleton__bar--short { width: 80%; }
@keyframes skeleton-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .skeleton__bar { animation: none; } }

/* --- Page header -------------------------------------------- */
/* App tile, name, status and identifiers on one row with one secondary action on the right; the
   tabs run below, edge to edge inside the card. */
.page-header { background: var(--color-surface-subtle); border: 1px solid var(--color-border); border-radius: var(--radius-xl); }
.page-header__top { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-5); }
.page-header__text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.page-header__title { display: flex; align-items: center; gap: var(--space-3); margin: 0; font: 600 1.375rem/1.5 var(--font-sans); letter-spacing: -0.015em; color: var(--color-fg); }
/* a status beside the name is a pill, not a heading badge nudged onto the baseline */
.page-header__title .badge { margin-left: 0; transform: none; }
/* the second line: identifiers (mono chips and code) or one sentence of description */
.page-header__meta { display: flex; align-items: center; gap: var(--space-2) 10px; flex-wrap: wrap; font-size: 0.8125rem; line-height: 1.5; color: var(--color-fg-muted); }
.page-header__meta strong { font-weight: 400; color: var(--color-fg-muted); }
.page-header__meta .code-inline { padding: 2px 6px; border-radius: var(--radius-sm); font-size: var(--text-xs); color: var(--color-fg-muted); background: transparent; border-color: var(--color-control-border); }
.page-header__sep { color: var(--color-border-strong); }
.page-header__actions { flex: none; display: flex; gap: var(--space-2); }
.page-header > .tabs { padding: 0 var(--space-6); }
/* without tabs the card closes as it opened */
.page-header:not(:has(> .tabs)) > .page-header__top { padding-bottom: var(--space-6); }

/* --- Save bar ----------------------------------------------- */
/* At the bottom of the content column, not floating; Save stays disabled until something changes.
   A danger zone has no save bar. */
.save-bar {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
}
.save-bar__message { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: var(--space-2); font-size: 0.8125rem; line-height: 1.5; color: var(--color-fg-muted); }
.save-bar__actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.save-bar--dirty { border-color: var(--color-control-border); }
.save-bar--dirty .save-bar__message { color: var(--color-fg); }
.save-bar--dirty .save-bar__message::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--color-warn-strong); }
