/* ============================================================================
   Flowy design tokens.

   One dark surface, one accent, depth from light rather than from boxes.
   Every value a screen is allowed to use lives here: if a component needs a
   colour or a spacing step that is not in this file, the answer is almost
   always that it should use an existing one.
   ========================================================================= */

:root {
  color-scheme: dark;

  /* --- Surface -----------------------------------------------------------
     Four steps, each a small tonal lift rather than a new colour. Cards are
     separated by tone and a hairline, never by a shadow-drawn rectangle. */
  --bg: #050609;
  --surface: #0b0d12;
  --surface-raised: #101319;
  --surface-hover: #161a22;

  /* Glass: a translucent pane over the page's own blue light, not a grey
     rectangle. Used on the cards and the floating nav - the two places where
     depth actually helps read the layout. */
  --glass: rgba(16, 19, 26, 0.55);
  --glass-strong: rgba(12, 14, 20, 0.72);
  --glass-blur: saturate(1.35) blur(22px);
  --glass-sheen: inset 0 1px 0 rgba(255, 255, 255, 0.055);

  --border-subtle: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* --- Text --------------------------------------------------------------
     Three levels only. A fourth would just be an excuse to avoid deciding
     what matters on a screen. */
  --text: #edeef2;
  --text-secondary: #9ba1af;
  --text-muted: #6a7182;

  /* --- Accent ------------------------------------------------------------
     A single cold indigo. It means "this is the way forward" and nothing
     else - never decoration, never a second meaning. */
  --accent: #7c86ff;
  --accent-hover: #8f97ff;
  --accent-quiet: rgba(124, 134, 255, 0.14);
  --accent-line: rgba(124, 134, 255, 0.32);
  --on-accent: #0a0b10;

  /* No green anywhere in the product: "healthy" is said in the brand blue,
     which keeps the whole surface on one hue. Red stays, because an error
     that looks like everything else is not an error. */
  --success: #8f9bff;
  --success-quiet: rgba(124, 134, 255, 0.16);
  --warning: #dcb257;
  --warning-quiet: rgba(220, 178, 87, 0.13);
  --danger: #e8737a;
  --danger-quiet: rgba(232, 115, 122, 0.13);

  /* --- Type --------------------------------------------------------------
     SF Pro on the operator's Mac, a sane stack elsewhere. The hierarchy is
     carried by size and tracking, with only two weights in play. */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter",
    system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --text-display: 44px;
  --text-h1: 27px;
  --text-h2: 19px;
  --text-h3: 15px;
  --text-body: 14px;
  --text-sm: 13px;
  --text-xs: 12px;
  --text-micro: 11px;

  /* --- Space -------------------------------------------------------------
     A 4px grid, and nothing between the steps. */
  --s1: 4px;  --s2: 8px;   --s3: 12px;  --s4: 16px;  --s5: 24px;
  --s6: 32px; --s7: 48px;  --s8: 64px;  --s9: 80px;  --s10: 120px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  /* --- Motion ------------------------------------------------------------
     Fast enough that nobody waits for it. One easing curve everywhere. */
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Depth: a soft ambient shadow for things that genuinely float, and a
     glow reserved for the one number that matters on a screen. */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px rgba(0, 0, 0, 0.36);
  --shadow-float: 0 8px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  --glow: radial-gradient(60% 120% at 50% 0%, rgba(124, 134, 255, 0.18), transparent 70%);
  --glow-card: radial-gradient(80% 100% at 20% 0%, rgba(124, 134, 255, 0.1), transparent 65%);
  --glow-accent: 0 0 0 1px rgba(124, 134, 255, 0.24), 0 8px 32px rgba(124, 134, 255, 0.22);

  --page: 1160px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   Base
   ========================================================================= */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  /* The page is lit from above by a single diffuse blue source; every glass
     surface below is showing this light through, which is what makes the
     panes read as glass rather than as grey boxes. */
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(124, 134, 255, 0.13), transparent 60%),
    radial-gradient(60% 40% at 90% 15%, rgba(124, 134, 255, 0.06), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: var(--text-h1); line-height: 1.15; }
h2 { font-size: var(--text-h2); line-height: 1.3; }
h3 { font-size: var(--text-h3); line-height: 1.4; }
p { margin: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* The one label style the whole product uses above numbers and sections.
   Small, tracked, quiet - it is what makes a figure read as a figure. */
.label {
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.muted { color: var(--text-muted); font-size: var(--text-sm); }
.secondary-text { color: var(--text-secondary); font-size: var(--text-sm); }
.num { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* ============================================================================
   Buttons
   ========================================================================= */

.btn {
  --btn-bg: var(--surface-raised);
  --btn-fg: var(--text);
  --btn-border: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 34px;
  padding: 0 var(--s4);
  border: 1px solid var(--btn-border);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
/* A press should feel like a press: small, immediate, physical. */
.btn:active { transform: scale(0.98); }

/* The primary action carries a rotating conic ring: a lit edge around a dark
   pill. Done with two pseudo-elements on the button itself rather than a
   wrapper + inner span, so every existing <button class="btn btn--primary">
   in the product gets it without touching a single call site.

   Only the primary button glows. If everything glowed, nothing would - the
   ring is what says "this is the action on this screen". */
.btn--primary {
  --btn-bg: transparent;
  --btn-fg: #fff;
  --btn-border: transparent;
  position: relative;
  z-index: 0;
  isolation: isolate;
  padding: 0 var(--s5);
  border-radius: var(--r-full);
  overflow: hidden;
  font-weight: 600;
}

/* The ring. Oversized and rotated about its own centre, so the visible part
   sweeps around the button's edge. */
.btn--primary::before {
  content: "";
  position: absolute;
  inset: -150%;
  z-index: -2;
  /* Soft stops rather than hard sectors: on a wide button a narrow sector
     maps onto the top and bottom edges as two straight bars, which reads as
     a glitch. A wide, feathered sweep reads as light travelling along the
     edge at any button width. */
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(139, 92, 246, 0) 40deg,
    #8b5cf6 150deg,
    var(--accent) 230deg,
    rgba(124, 134, 255, 0) 330deg,
    transparent 360deg
  );
  filter: blur(3px);
  /* The light only travels while the cursor is on the button. Paused rather
     than removed, so nothing animates off-screen: an idle screen costs the
     GPU nothing, and the ring starts from where it stopped. */
  opacity: 0;
  animation: spin-ring 2.2s linear infinite;
  animation-play-state: paused;
  transition: opacity var(--dur) var(--ease);
}

/* The face of the button, inset by the ring's thickness. */
.btn--primary::after {
  content: "";
  position: absolute;
  inset: 2px;
  z-index: -1;
  border-radius: inherit;
  background: var(--btn-face, #0b0f19);
  /* A permanent hairline in the accent, so the button has a defined edge even
     at the moment the travelling light is on the far side of it. */
  box-shadow: inset 0 0 0 1px rgba(124, 134, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background var(--dur-fast) var(--ease);
}

.btn--primary:hover { background: transparent; border-color: transparent; }
/* Hover - and keyboard focus, which must not be a second-class citizen here -
   lights the ring and sets it running, and lifts the face towards the accent. */
.btn--primary:hover::before,
.btn--primary:focus-visible::before {
  opacity: 1;
  animation-play-state: running;
}
.btn--primary:hover::after { background: #141a2b; }

@keyframes spin-ring {
  to { transform: rotate(1turn); }
}

/* Without motion the ring still appears on hover - it simply does not
   travel. */
@media (prefers-reduced-motion: reduce) {
  .btn--primary::before {
    background: conic-gradient(from 200deg, transparent, #8b5cf6, var(--accent), transparent);
  }
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
  --btn-fg: var(--text-secondary);
  padding: 0 var(--s3);
}
.btn--ghost:hover { background: var(--surface-raised); color: var(--text); border-color: transparent; }

.btn--danger { --btn-fg: var(--danger); }
.btn--danger:hover { background: var(--danger-quiet); border-color: transparent; }

.btn--sm { height: 28px; padding: 0 var(--s3); font-size: var(--text-xs); }

.btn[disabled], .btn[aria-busy="true"] { opacity: 0.5; pointer-events: none; }

/* Busy buttons say what is happening in their own label; the dot is there so
   a slow job never looks like a frozen page. */
.btn[aria-busy="true"]::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* ============================================================================
   Fields
   ========================================================================= */

.field { display: flex; flex-direction: column; gap: var(--s2); }
.field > .label { line-height: 1; }

.input, .select {
  height: 34px;
  padding: 0 var(--s3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.input::placeholder { color: var(--text-muted); }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus, .select:focus { outline: none; border-color: var(--accent-line); background: var(--surface-raised); }

.select {
  appearance: none;
  padding-right: var(--s6);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236a7182' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s3) center;
}

input[type="date"] { font-variant-numeric: tabular-nums; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

/* ============================================================================
   Surfaces
   ========================================================================= */

.panel, .card {
  position: relative;
  isolation: isolate;
  padding: var(--s6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-sheen);
  overflow: hidden;
}

/* The glow lives inside the pane, top-left, so a row of cards is lit from a
   consistent direction instead of each one glowing at itself. */
.panel::before, .card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--glow-card);
  opacity: 0.9;
  transition: opacity var(--dur) var(--ease);
  pointer-events: none;
}

.card {
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.card:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--glass-sheen), var(--shadow-float);
}
.card:hover::before { opacity: 1.4; }

/* ============================================================================
   Tables - hairlines, no boxes
   ========================================================================= */

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
  padding: 0 var(--s3) var(--s3);
  text-align: left;
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}
.table td {
  padding: var(--s3);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.table td:first-child { color: var(--text); }
.table th.num, .table td.num { text-align: right; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: var(--surface-raised); }
.table-scroll { overflow-x: auto; margin: 0 calc(var(--s6) * -1); padding: 0 var(--s6); }

/* ============================================================================
   Badges
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  height: 20px;
  padding: 0 var(--s2);
  border-radius: var(--r-full);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface-hover);
  color: var(--text-secondary);
}
.badge--ok, .badge.ok, .badge.completed, .badge.processed { background: var(--success-quiet); color: var(--success); }
.badge--warn, .badge.pending, .badge.running, .badge.queued, .badge.processing { background: var(--warning-quiet); color: var(--warning); }
.badge--err, .badge.error, .badge.failed, .badge.dead_letter { background: var(--danger-quiet); color: var(--danger); }

/* ============================================================================
   Stats
   ========================================================================= */

.stat { display: flex; flex-direction: column; gap: var(--s2); }
.stat__value {
  font-size: var(--text-h1);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat__sub { font-size: var(--text-xs); color: var(--text-muted); }

/* The one figure a screen is about: bigger than everything else by a wide
   margin, lit from above, and never repeated twice on the same page. */
.hero-stat { position: relative; }
/* The headline figure gets the strongest light in the product - it is the
   one place where the glow is doing work rather than decorating. */
.hero-stat::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(75% 90% at 12% 0%, rgba(124, 134, 255, 0.22), transparent 70%);
  pointer-events: none;
}
.hero-stat__value {
  position: relative;
  font-size: var(--text-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ============================================================================
   Empty / error states
   ========================================================================= */

.state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s7) var(--s5);
  max-width: 460px;
}
/* A short lit rule instead of a placeholder box: an empty square reads as a
   broken image, a line reads as a deliberate mark. */
.state__mark {
  width: 28px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.7;
  margin-bottom: var(--s2);
}
.state__title { font-size: var(--text-h3); font-weight: 600; color: var(--text); }
.state__text { font-size: var(--text-sm); color: var(--text-muted); }
.state__actions { display: flex; gap: var(--s2); margin-top: var(--s2); }
.state--error .state__mark { background: var(--danger); }

/* ============================================================================
   Skeleton
   ========================================================================= */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.045), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ============================================================================
   Toasts - the product speaks here, never through window.alert
   ========================================================================= */

.toasts {
  position: fixed;
  right: var(--s5);
  bottom: var(--s5);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  width: min(380px, calc(100vw - var(--s6)));
}
.toast {
  display: flex;
  gap: var(--s3);
  padding: var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float), var(--glass-sheen);
  animation: toast-in var(--dur-slow) var(--ease);
}
.toast.is-leaving { animation: toast-out var(--dur) var(--ease) forwards; }
.toast__dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 7px; flex: none; background: var(--text-muted); }
.toast--ok .toast__dot { background: var(--success); }
.toast--error .toast__dot { background: var(--danger); }
.toast__title { font-size: var(--text-sm); font-weight: 600; }
.toast__text { font-size: var(--text-xs); color: var(--text-secondary); margin-top: 2px; white-space: pre-line; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* ============================================================================
   Dialog
   ========================================================================= */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--s5);
  background: rgba(4, 5, 8, 0.72);
  animation: fade var(--dur) var(--ease);
}
.dialog {
  width: min(460px, 100%);
  padding: var(--s6);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float), var(--glass-sheen);
  animation: dialog-in var(--dur-slow) var(--ease);
}
.dialog__title { font-size: var(--text-h3); font-weight: 600; }
.dialog__text { margin-top: var(--s2); font-size: var(--text-sm); color: var(--text-secondary); }
.dialog__actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
@keyframes fade { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ============================================================================
   Tabs
   One screen, several audiences. Tabs keep each audience's settings whole
   instead of stacking three funnels into one endless column.
   ========================================================================= */

.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-full);
  background: var(--surface);
}
.tab {
  padding: 7px var(--s4);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text-secondary); }
.tab.is-active { color: var(--accent); background: var(--accent-quiet); }

/* ============================================================================
   Fold
   A native <details> dressed as a card. A long settings screen becomes five
   closed rows, and the one that is open reads as the same pane every other
   screen uses - no new surface, no chevron icon font, no hover lift (a block
   that moves when you reach for a field inside it is a nuisance).
   ========================================================================= */

.fold {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-sheen);
}
.fold[open] { border-color: var(--border); }
.fold__head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s6);
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: var(--text-h3);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background var(--dur-fast) var(--ease);
  border-radius: inherit;
}
.fold__head::-webkit-details-marker { display: none; }
.fold__head:hover { background: rgba(255, 255, 255, 0.03); }
.fold[open] > .fold__head { border-bottom: 1px solid var(--border-subtle); border-radius: var(--r-xl) var(--r-xl) 0 0; }
/* The chevron is a border, not a glyph: it turns with the state. */
.fold__head::before {
  content: "";
  flex: none;
  width: 7px; height: 7px;
  margin-left: 2px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease);
}
.fold[open] > .fold__head::before { transform: rotate(45deg); }
.fold__head .muted { font-weight: 400; }
.fold__head > .spacer { flex: 1; }
.fold__body { padding: var(--s5) var(--s6) var(--s6); }

/* A fold inside a fold: one hairline, no glass of its own, tighter head. */
.fold--nested { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border-radius: var(--r-lg); }
.fold--nested > .fold__head { padding: var(--s3) var(--s4); font-size: var(--text-body); border-radius: var(--r-lg); }
.fold--nested[open] > .fold__head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.fold--nested > .fold__body { padding: var(--s4); }
/* A quiet fold is just a line you can open: the "how to" under a form. */
.fold--quiet { border: 0; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none; border-radius: 0; }
.fold--quiet > .fold__head { padding: var(--s1) 0; font-size: var(--text-sm); font-weight: 500; color: var(--accent); border-radius: 0; }
.fold--quiet > .fold__head:hover { background: transparent; color: var(--accent-hover); }
.fold--quiet[open] > .fold__head { border-bottom: 0; }
.fold--quiet > .fold__body { padding: var(--s2) 0 0; }
.fold__steps { margin: 0; padding-left: var(--s5); display: flex; flex-direction: column; gap: var(--s2); font-size: var(--text-sm); color: var(--text-secondary); }

/* A switch reads as a setting you turn on; a bare checkbox reads as a form
   field you fill in. These are settings. */
.switch { display: flex; align-items: flex-start; gap: var(--s3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  flex: none;
  width: 38px; height: 22px;
  margin-top: 1px;
  border-radius: var(--r-full);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
  position: relative;
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.switch input:checked + .switch__track { background: var(--accent-quiet); border-color: var(--accent-line); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: var(--accent); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch__label { display: block; font-size: var(--text-sm); }
.switch__hint { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--s1); line-height: 1.45; }

/* ============================================================================
   Bento grid
   A twelve-column grid where tiles claim different widths. The point is not
   variety for its own sake: the tile that answers the screen's question is
   physically bigger than the ones that qualify it.
   ========================================================================= */

.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--s4);
}
.bento > * { grid-column: span 12; }
.b3 { grid-column: span 3 !important; }
.b4 { grid-column: span 4 !important; }
.b5 { grid-column: span 5 !important; }
.b6 { grid-column: span 6 !important; }
.b7 { grid-column: span 7 !important; }
.b8 { grid-column: span 8 !important; }
.b12 { grid-column: span 12 !important; }

@media (max-width: 900px) {
  .b3, .b4, .b5, .b7, .b8 { grid-column: span 6 !important; }
}
@media (max-width: 620px) {
  .b3, .b4, .b5, .b6, .b7, .b8 { grid-column: span 12 !important; }
}

/* ============================================================================
   Floating dock
   The navigation is one object hovering over the page: glass, a hairline, and
   a blue pill that slides to whatever section you are in. It sits at the
   bottom because that is where a thumb and a resting hand already are.
   ========================================================================= */

.dock {
  position: fixed;
  left: 50%;
  bottom: var(--s5);
  transform: translateX(-50%);
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-float), var(--glass-sheen);
  max-width: calc(100vw - var(--s5) * 2);
}

.dock__indicator {
  position: absolute;
  top: 5px;
  left: 0;
  height: calc(100% - 10px);
  border-radius: var(--r-full);
  background: var(--accent-quiet);
  box-shadow: var(--glow-accent);
  transition: transform var(--dur) var(--ease), width var(--dur) var(--ease);
  pointer-events: none;
}

.dock__item {
  position: relative;
  padding: 9px var(--s4);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.dock__item:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.dock__item.is-active { color: var(--accent); }
.dock__item.is-active:hover { background: transparent; }

.dock__divider { width: 1px; height: 20px; margin: 0 var(--s1); background: var(--border); flex: none; }

.dock__user {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 6px var(--s3) 6px 6px;
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.dock__user:hover { background: rgba(255, 255, 255, 0.045); color: var(--text); }
.dock__avatar {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-quiet);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
}

@media (max-width: 620px) {
  .dock { overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .dock::-webkit-scrollbar { display: none; }
  .dock__item { padding: 9px var(--s3); }
}

/* ============================================================================
   Language switch
   Two words, one lit. It rides inside the dock on the admin screens and sits in
   the corner of the card on the sign-in ones, so the same object is always
   where the eye last left it.
   ========================================================================= */

.lang {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  flex: none;
  padding: 2px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.03);
}

.lang__opt {
  appearance: none;
  padding: 5px var(--s2);
  border: 0;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.lang__opt:hover { color: var(--text); }
.lang__opt[aria-pressed="true"] { background: var(--accent-quiet); color: var(--accent); }

/* On an auth card the switch is the only chrome, so it hangs in the corner
   instead of taking a row of its own away from the form. */
.lang--corner { position: absolute; top: var(--s4); right: var(--s4); z-index: 1; }

/* ============================================================================
   Small screens
   The display size is set for a laptop; on a phone the same number would fill
   the width and stop reading as a figure. Tables keep their own horizontal
   scroll (.table-scroll) rather than collapsing into unreadable columns.
   ========================================================================= */

@media (max-width: 560px) {
  :root {
    --text-display: 34px;
    --text-h1: 23px;
    --page: 100%;
  }
  .toasts { right: var(--s4); left: var(--s4); bottom: var(--s4); width: auto; }
  .state { padding: var(--s6) 0; }
}

/* ============================================================================
   Utilities
   ========================================================================= */

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

/* A partner's mark beside a block title: small, rounded, never a colour of
   its own - the logo is the colour, the title stays in the product's voice. */
.integration-logo {
  width: 20px; height: 20px;
  flex: none;
  border-radius: 5px;
  object-fit: contain;
  vertical-align: middle;
}
.integration-logo--lg { width: 28px; height: 28px; border-radius: 7px; }

/* A person: a round photo, or their initial in the accent when there is no
   photo yet. Same object at 28px in a table, 48px in a settings row, 56px on
   a card and 72px at the head of the manager page; the initial grows with it. */
.avatar {
  width: 28px; height: 28px;
  flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-quiet);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  vertical-align: middle;
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar--md { width: 48px; height: 48px; font-size: var(--text-h2); }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }
.avatar--xl { width: 72px; height: 72px; font-size: 28px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; }
.divider { height: 1px; background: var(--border-subtle); }
[hidden] { display: none !important; }
