/* ==========================================================================
   Design system — tokens, reset, layout, components.
   Every project overrides the token block in tokens.css; nothing else needs
   to change for a different brand.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* The UA [hidden] rule loses to .card/.grid/.stack display values, so any
   element toggled via the hidden property must win explicitly. */
[hidden] { display: none !important; }

:root {
  /* Colour — light theme. Override these five and the whole UI follows. */
  --accent: #4f46e5;
  --accent-hover: color-mix(in srgb, var(--accent) 88%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --accent-contrast: #ffffff;

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --surface-3: #e9ebf3;
  --border: #e3e6ef;
  --border-strong: #cfd4e2;
  --text: #101322;
  --text-soft: #45506b;
  --muted: #6b7590;

  --success: #0f9d68;
  --success-soft: #e4f7ee;
  --warning: #b7791f;
  --warning-soft: #fdf3e2;
  --danger: #d4443c;
  --danger-soft: #fdeceb;
  --info: #2563eb;
  --info-soft: #e8f0fe;

  /* Type */
  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans SC", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.3125rem;
  --fs-xl: 1.75rem;
  --fs-2xl: 2.25rem;
  --fs-3xl: 3rem;
  --lh-tight: 1.2;
  --lh-base: 1.6;

  /* Space — 4px scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  /* Shape + depth */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;
  --shadow-sm: 0 1px 2px rgb(16 19 34 / 6%), 0 1px 3px rgb(16 19 34 / 4%);
  --shadow-md: 0 4px 12px rgb(16 19 34 / 8%), 0 2px 4px rgb(16 19 34 / 4%);
  --shadow-lg: 0 16px 40px rgb(16 19 34 / 12%), 0 4px 12px rgb(16 19 34 / 5%);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent);
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --ease: cubic-bezier(0.2, 0, 0.13, 1);
}

[data-theme="dark"] {
  --accent-soft: color-mix(in srgb, var(--accent) 22%, #0b0e17);
  --bg: #0b0e17;
  --surface: #121724;
  --surface-2: #171d2c;
  --surface-3: #1e2536;
  --border: #232b3d;
  --border-strong: #313a50;
  --text: #eef1f8;
  --text-soft: #c2c9da;
  --muted: #8b95ac;
  --success: #34d399; --success-soft: #10301f;
  --warning: #fbbf24; --warning-soft: #33260c;
  --danger: #f87171; --danger-soft: #3a1618;
  --info: #60a5fa; --info-soft: #12233d;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-md: 0 6px 18px rgb(0 0 0 / 45%);
  --shadow-lg: 0 20px 48px rgb(0 0 0 / 55%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-soft: color-mix(in srgb, var(--accent) 22%, #0b0e17);
    --bg: #0b0e17; --surface: #121724; --surface-2: #171d2c; --surface-3: #1e2536;
    --border: #232b3d; --border-strong: #313a50;
    --text: #eef1f8; --text-soft: #c2c9da; --muted: #8b95ac;
    --success: #34d399; --success-soft: #10301f;
    --warning: #fbbf24; --warning-soft: #33260c;
    --danger: #f87171; --danger-soft: #3a1618;
    --info: #60a5fa; --info-soft: #12233d;
    color-scheme: dark;
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: var(--lh-tight); letter-spacing: -0.015em; font-weight: 650; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }
p { margin: 0 0 var(--s-4); color: var(--text-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
small { font-size: var(--fs-sm); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-6) 0; }
img, svg { max-width: 100%; }
code, pre, kbd { font-family: var(--font-mono); font-size: 0.875em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 5px; }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); overflow: auto; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--accent-contrast); padding: var(--s-2) var(--s-4);
}
.skip-link:focus { left: var(--s-2); top: var(--s-2); }

/* ---------------------------------------------------------------- shell -- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: var(--s-4) var(--s-3);
  gap: var(--s-2);
}
.brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-1) var(--s-3) var(--s-3); font-weight: 700; font-size: var(--fs-md); color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: var(--accent-contrast); font-size: var(--fs-sm); font-weight: 800;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #7c3aed));
  box-shadow: var(--shadow-sm);
}
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: var(--s-2) var(--s-3) 2px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: var(--s-3); padding: 6px var(--s-3);
  border-radius: var(--r-md); color: var(--text-soft); font-weight: 500; font-size: var(--fs-base);
  transition: background 120ms var(--ease), color 120ms var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item .icon { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.sidebar-footer { margin-top: auto; padding-top: var(--s-4); border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-6); border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.page { padding: var(--s-8) var(--s-6) var(--s-16); max-width: 1240px; width: 100%; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-6); }
.page-header .grow { flex: 1; min-width: 240px; }
.page-header h1 { font-size: var(--fs-xl); margin-bottom: var(--s-1); }
.page-header p { margin: 0; color: var(--muted); font-size: var(--fs-sm); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, var(--sidebar-w)); z-index: 60;
    transform: translateX(-102%); transition: transform 220ms var(--ease); box-shadow: var(--shadow-lg);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  .nav-scrim { position: fixed; inset: 0; background: rgb(6 9 16 / 48%); z-index: 55; opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease); }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  .page { padding: var(--s-6) var(--s-4) var(--s-12); }
  .topbar { padding: 0 var(--s-4); }
}

/* --------------------------------------------------------------- pieces -- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: var(--s-5);
}
.card + .card { margin-top: var(--s-4); }
.card-header { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-header h3, .card-header h2 { margin: 0; font-size: var(--fs-md); }
.card-header .actions { margin-left: auto; display: flex; gap: var(--s-2); }
.card-flush { padding: 0; overflow: hidden; }

.grid { display: grid; gap: var(--s-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: var(--s-2); } .mb-4 { margin-bottom: var(--s-4); }
.muted { color: var(--muted); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* stats */
.stat { display: flex; flex-direction: column; gap: var(--s-1); }
.stat-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.stat-value { font-size: var(--fs-xl); font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-delta { font-size: var(--fs-xs); font-weight: 600; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }

/* -------------------------------------------------------------- buttons -- */
.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-border: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 38px; padding: 0 var(--s-4); border-radius: var(--r-md);
  border: 1px solid var(--btn-border); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 600; font-size: var(--fs-sm); cursor: pointer;
  transition: transform 100ms var(--ease), background 120ms var(--ease), border-color 120ms var(--ease), box-shadow 120ms var(--ease);
  text-decoration: none; white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.55; pointer-events: none; }
.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--accent-contrast); --btn-border: var(--accent); box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent); --btn-border: transparent; }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.btn-ghost { --btn-bg: transparent; --btn-border: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, black); }
.btn-sm { min-height: 30px; padding: 0 var(--s-3); font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn-lg { min-height: 46px; padding: 0 var(--s-6); font-size: var(--fs-base); border-radius: var(--r-lg); }
.btn-icon { width: 36px; padding: 0; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-md);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* --------------------------------------------------------------- forms -- */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-soft); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.field .field-errors { margin: 0; padding-left: var(--s-4); color: var(--danger); font-size: var(--fs-xs); }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-base);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.input.has-error, .textarea.has-error { border-color: var(--danger); }
.input-sm { min-height: 32px; font-size: var(--fs-sm); }

.input-group { display: flex; gap: var(--s-2); align-items: center; }
.input-group .input { flex: 1; }

.checkbox, .radio { display: flex; align-items: flex-start; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-soft); }
.checkbox input, .radio input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: var(--s-3); cursor: pointer; font-size: var(--fs-sm); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { width: 38px; height: 22px; border-radius: var(--r-full); background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background 160ms var(--ease); }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform 160ms var(--ease); }
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: var(--ring); }

.search-input { position: relative; }
.search-input .input { padding-left: 34px; }
.search-input svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }

/* --------------------------------------------------------------- table -- */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left; font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
.table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table-actions { display: flex; gap: var(--s-1); justify-content: flex-end; }

/* --------------------------------------------------------------- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.7; border: 1px solid transparent;
  background: var(--surface-2); color: var(--text-soft); white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------------- alerts -- */
.flash {
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-sm); margin-bottom: var(--s-4); animation: slide-in 260ms var(--ease);
}
.flash-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); color: var(--success); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--danger); }
.flash-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 28%, transparent); color: var(--info); }

.alert { padding: var(--s-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); font-size: var(--fs-sm); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }

/* ---------------------------------------------------------------- empty -- */
.empty { text-align: center; padding: var(--s-12) var(--s-4); color: var(--muted); }
.empty-mark {
  width: 52px; height: 52px; border-radius: var(--r-lg); margin: 0 auto var(--s-4);
  display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--muted);
}
.empty h3 { font-size: var(--fs-md); color: var(--text); margin-bottom: var(--s-1); }
.empty p { margin: 0 auto var(--s-4); max-width: 42ch; font-size: var(--fs-sm); }

/* ------------------------------------------------------------ pagination -- */
.pagination { display: flex; align-items: center; gap: var(--s-2); justify-content: space-between; flex-wrap: wrap; margin-top: var(--s-4); }
.pagination .pages { display: flex; gap: var(--s-1); }
.page-link {
  min-width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0 var(--s-2);
  border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
  color: var(--text-soft); font-size: var(--fs-sm); font-weight: 500;
}
.page-link:hover { background: var(--surface-2); text-decoration: none; }
.page-link.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 700; }

/* ---------------------------------------------------------------- modal -- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: var(--s-4); }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgb(6 9 16 / 52%); backdrop-filter: blur(2px); }
.modal-panel {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 88vh; overflow: auto;
  padding: var(--s-6); animation: pop-in 200ms var(--ease);
}
.modal-panel h2 { font-size: var(--fs-lg); }
.modal-close { position: absolute; top: var(--s-3); right: var(--s-3); }

/* -------------------------------------------------------------- dropdown -- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); padding: var(--s-1); display: none;
}
.dropdown.is-open .dropdown-menu { display: block; animation: pop-in 140ms var(--ease); }
.dropdown-item {
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm); color: var(--text-soft); font-size: var(--fs-sm); width: 100%;
  background: none; border: 0; text-align: left; cursor: pointer; font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.dropdown-sep { height: 1px; background: var(--border); margin: var(--s-1); }

/* ---------------------------------------------------------------- toast -- */
.toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 90; display: flex; flex-direction: column; gap: var(--s-2); }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: var(--s-3) var(--s-4);
  font-size: var(--fs-sm); min-width: 240px; animation: slide-in 200ms var(--ease);
}
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }

/* ---------------------------------------------------------------- tabs -- */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--border); margin-bottom: var(--s-5); overflow-x: auto; }
.tab {
  padding: var(--s-2) var(--s-4); border: 0; background: none; color: var(--muted);
  font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ------------------------------------------------------------- progress -- */
.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); border-radius: inherit; transition: width 400ms var(--ease); }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: var(--fs-sm); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-md); }

/* ---------------------------------------------------------------- auth -- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside {
  background:
    radial-gradient(1200px 600px at 10% 0%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
    linear-gradient(160deg, #0c1020, #131a2f 55%, #0a0d17);
  color: #fff; padding: var(--s-12); display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside h1 { font-size: var(--fs-3xl); letter-spacing: -0.03em; line-height: 1.1; max-width: 22ch; }
.auth-aside p { color: rgb(255 255 255 / 72%); max-width: 44ch; }
.auth-points { display: flex; flex-direction: column; gap: var(--s-4); margin-top: var(--s-8); }
.auth-point { display: flex; gap: var(--s-3); align-items: flex-start; font-size: var(--fs-sm); color: rgb(255 255 255 / 82%); }
.auth-point .dot { width: 22px; height: 22px; border-radius: 50%; background: rgb(255 255 255 / 12%); display: grid; place-items: center; flex: none; font-size: 11px; }
.auth-main { display: grid; place-items: center; padding: var(--s-8) var(--s-4); background: var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-card h2 { font-size: var(--fs-xl); margin-bottom: var(--s-1); }
.auth-card .sub { color: var(--muted); font-size: var(--fs-sm); margin-bottom: var(--s-6); }
@media (max-width: 900px) { .auth-shell { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ------------------------------------------------------------ installer -- */
.install-shell { min-height: 100vh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.install-panel { width: min(760px, 100%); }
.install-steps { display: flex; gap: var(--s-2); margin-bottom: var(--s-6); flex-wrap: wrap; }
.install-step {
  display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.install-step.is-done { background: var(--success-soft); color: var(--success); border-color: transparent; }
.install-step.is-current { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.check-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.check-row:last-child { border-bottom: 0; }
.check-row .ok { color: var(--success); }
.check-row .bad { color: var(--danger); }
.check-row .detail { margin-left: auto; color: var(--muted); font-size: var(--fs-xs); }

/* ------------------------------------------------------------ animation -- */
@keyframes slide-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes skeleton { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skeleton {
  border-radius: var(--r-sm); height: 14px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: skeleton 1.4s ease infinite;
}
.reveal { animation: slide-in 320ms var(--ease) both; }

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

/* ---------------------------------------------------------------- print -- */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ddd; box-shadow: none; break-inside: avoid; }
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------- prose -- */
.prose { font-size: var(--fs-md); line-height: 1.7; color: var(--text-soft); }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--text); margin: var(--s-8) 0 var(--s-3); }
.prose h2 { font-size: var(--fs-xl); padding-bottom: var(--s-2); border-bottom: 1px solid var(--border); }
.prose h3 { font-size: var(--fs-lg); }
.prose p { margin: 0 0 var(--s-4); }
.prose ul, .prose ol { margin: 0 0 var(--s-4); padding-left: var(--s-6); }
.prose li { margin-bottom: var(--s-1); }
.prose li::marker { color: var(--muted); }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 1px 5px; font-size: 0.875em; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--s-4); overflow-x: auto; margin: 0 0 var(--s-4); }
.prose pre code { background: none; border: 0; padding: 0; font-size: var(--fs-sm); }
.prose blockquote { margin: 0 0 var(--s-4); padding: var(--s-2) var(--s-4); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 var(--r-md) var(--r-md) 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose hr { margin: var(--s-6) 0; }
.prose img { border-radius: var(--r-md); border: 1px solid var(--border); }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: var(--s-4); font-size: var(--fs-sm); }
.prose th, .prose td { border: 1px solid var(--border); padding: var(--s-2) var(--s-3); text-align: left; }
.prose th { background: var(--surface-2); }

/* ==========================================================================
   2.0 — growth modules: KPIs, charts, CRM, invoices, calendar, kiosk.
   Same tokens, same rhythm; nothing here introduces a new palette.
   ========================================================================== */

.icon-svg { flex: none; display: inline-block; vertical-align: -0.15em; }
.btn .icon-svg { margin-right: -2px; }
.nav { display: flex; flex-direction: column; gap: var(--s-1); }
.row.wrap { flex-wrap: wrap; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.uppercase { text-transform: uppercase; letter-spacing: 0.06em; }

.card-accent { border-color: color-mix(in srgb, var(--accent) 32%, var(--border)); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }

/* --------------------------------------------------------------- KPI row -- */
.kpi-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--s-4); }
.kpi-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: var(--fs-xl); font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: var(--fs-xs); color: var(--muted); }
.kpi-hint.is-up { color: var(--success); font-weight: 600; }
.kpi-hint.is-down { color: var(--danger); font-weight: 600; }
@media (max-width: 1180px) { .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ------------------------------------------------------------ segmented -- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.segmented-item {
  padding: 5px 12px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted); white-space: nowrap;
}
.segmented-item:hover { color: var(--text); text-decoration: none; }
.segmented-item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------------------------------------------------------------- charts -- */
.chart { display: flex; align-items: flex-end; gap: var(--s-2); height: 180px; padding-top: var(--s-2); }
.chart-tall { height: 160px; }
.chart-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--s-2); height: 100%; }
.chart-bars { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart-bar {
  position: absolute; bottom: 0; width: 58%; max-width: 26px; border-radius: 5px 5px 2px 2px;
  height: var(--h, 0%); min-height: 2px; transition: height 500ms var(--ease);
}
.chart-bar.is-accent { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent)); left: 0; }
.chart-bar.is-ghost { background: var(--surface-3); right: 0; width: 34%; }
.chart-label { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.chart-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--muted); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-left: 6px; }
.legend-dot.is-accent { background: var(--accent); }
.legend-dot.is-ghost { background: var(--surface-3); border: 1px solid var(--border-strong); }
.sparkline { width: 100%; height: 150px; display: block; }

.mix-row { display: flex; flex-direction: column; gap: 6px; }
.mix-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); }

.heatmap { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.heat-cell {
  position: relative; aspect-ratio: 1 / 2.4; border-radius: 3px; background: var(--surface-2);
  background-image: linear-gradient(180deg, var(--accent) 0%, var(--accent) 100%);
  background-size: 100% calc(var(--level, 0%) + 4%);
  background-position: bottom; background-repeat: no-repeat;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
}
.heat-cell em { position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%); font-size: 9px; color: var(--muted); font-style: normal; }
@media (max-width: 700px) { .heatmap { grid-template-columns: repeat(12, 1fr); } .heat-cell em { display: none; } }

.rank { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 11px; font-weight: 700; }

/* ----------------------------------------------------------------- CRM -- */
.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-3); }
.pipeline-col {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  transition: border-color 120ms var(--ease), transform 120ms var(--ease);
}
.pipeline-col:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.pipeline-col.is-active { border-color: var(--accent); box-shadow: var(--ring); }
.pipeline-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.pipeline-count { font-size: var(--fs-lg); font-weight: 680; letter-spacing: -0.02em; }
.pipeline-flag { font-size: 10px; color: var(--danger); font-weight: 600; }
@media (max-width: 760px) { .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.chip {
  display: inline-flex; align-items: center; gap: var(--s-2); padding: 6px 12px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text);
}
.chip:hover { text-decoration: none; border-color: var(--accent); }

.detail-list { display: flex; flex-direction: column; }
.detail-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); padding: var(--s-2) 0; border-bottom: 1px dashed var(--border); font-size: var(--fs-sm); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list .muted { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-4); }
.timeline-item { display: flex; gap: var(--s-3); position: relative; padding-left: var(--s-4); }
.timeline-item::before { content: ""; position: absolute; left: 3px; top: 12px; bottom: -16px; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: absolute; left: 0; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline-body { flex: 1; min-width: 0; }

/* ------------------------------------------------------------ invoices -- */
.line-items { display: flex; flex-direction: column; gap: var(--s-2); }
.line-item { display: grid; grid-template-columns: 1fr 84px 120px; gap: var(--s-2); }
@media (max-width: 640px) { .line-item { grid-template-columns: 1fr 1fr; } .line-item input:first-child { grid-column: 1 / -1; } }

.invoice-doc {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); padding: var(--s-10); max-width: 820px; margin: 0 auto;
}
.invoice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-6); padding-bottom: var(--s-6); border-bottom: 1px solid var(--border); }
.invoice-club { font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.02em; }
.invoice-number { font-size: var(--fs-md); font-weight: 700; }
.invoice-paid { display: inline-block; margin-top: 6px; padding: 2px 10px; border-radius: var(--r-full); background: var(--success-soft); color: var(--success); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.invoice-parties { display: flex; justify-content: space-between; gap: var(--s-6); padding: var(--s-5) 0; }
.invoice-table { border: 0; }
.invoice-table th { background: transparent; border-bottom: 1px solid var(--border-strong); }
.invoice-table td { font-size: var(--fs-sm); }
.invoice-totals { margin-left: auto; width: min(320px, 100%); display: flex; flex-direction: column; gap: 6px; padding-top: var(--s-4); }
.invoice-totals > div { display: flex; justify-content: space-between; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.invoice-grand { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; font-size: var(--fs-md) !important; font-weight: 700; }
.invoice-note { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px dashed var(--border); }
.invoice-foot { margin-top: var(--s-8); padding-top: var(--s-4); border-top: 1px solid var(--border); text-align: center; }

/* --------------------------------------------------------------- comms -- */
.segment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
@media (max-width: 560px) { .segment-grid { grid-template-columns: 1fr; } }
.segment-option { position: relative; display: block; cursor: pointer; }
.segment-option input { position: absolute; opacity: 0; inset: 0; }
.segment-body {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
  transition: border-color 120ms var(--ease), background 120ms var(--ease);
}
.segment-option:hover .segment-body { border-color: var(--border-strong); }
.segment-option input:checked + .segment-body { border-color: var(--accent); background: var(--accent-soft); }
.segment-option input:focus-visible + .segment-body { box-shadow: var(--ring); }
.segment-name { font-weight: 600; font-size: var(--fs-sm); }
.segment-count { margin-left: auto; font-weight: 700; font-size: var(--fs-sm); color: var(--accent); }
.segment-desc { flex-basis: 100%; font-size: var(--fs-xs); color: var(--muted); }

/* ------------------------------------------------------------ calendar -- */
.calendar-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.calendar-head span { padding: var(--s-3) var(--s-2); text-align: center; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-cell {
  min-height: 108px; padding: var(--s-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px; color: var(--text); position: relative;
  transition: background 120ms var(--ease);
}
.calendar-cell:nth-child(7n) { border-right: 0; }
.calendar-cell:hover { background: var(--surface-2); text-decoration: none; }
.calendar-cell.is-muted { background: var(--surface-2); color: var(--muted); }
.calendar-cell.is-muted .calendar-day { color: var(--muted); }
.calendar-cell.is-today .calendar-day { background: var(--accent); color: var(--accent-contrast); }
.calendar-cell.is-selected { box-shadow: inset 0 0 0 2px var(--accent); }
.calendar-day { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700; }
.calendar-count { position: absolute; top: var(--s-2); right: var(--s-2); font-size: 10px; font-weight: 700; color: var(--accent); }
.calendar-list { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.calendar-chip { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar-chip .dot { width: 5px; height: 5px; border-radius: 50%; flex: none; }
.calendar-more { font-size: 10px; color: var(--muted); }
@media (max-width: 900px) {
  .calendar-cell { min-height: 72px; }
  .calendar-list { display: none; }
  .calendar-head span { font-size: 10px; }
}
.capacity { display: flex; flex-direction: column; gap: 4px; min-width: 110px; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.capacity .progress { height: 5px; }

/* ---------------------------------------------------------------- kiosk -- */
.kiosk-body { background: radial-gradient(1200px 700px at 15% -10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 60%), linear-gradient(160deg, #0a0d17, #121729 55%, #0a0d17); color: #eef1f8; }
.kiosk-shell { min-height: 100vh; display: flex; flex-direction: column; gap: var(--s-6); padding: var(--s-8) clamp(var(--s-4), 4vw, var(--s-12)); }
.kiosk-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.kiosk-brand { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-md); }
.kiosk-brand .muted { color: rgb(255 255 255 / 55%); }
.kiosk-clock { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kiosk-stats { display: flex; align-items: center; gap: var(--s-3); }
.kiosk-main { flex: 1; display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s-6); align-items: start; }
@media (max-width: 900px) { .kiosk-main { grid-template-columns: 1fr; } }
.kiosk-panel, .kiosk-side {
  background: rgb(255 255 255 / 6%); border: 1px solid rgb(255 255 255 / 12%); border-radius: var(--r-xl);
  padding: clamp(var(--s-5), 4vw, var(--s-10)); backdrop-filter: blur(12px); box-shadow: var(--shadow-lg);
}
.kiosk-form { display: flex; flex-direction: column; gap: var(--s-4); }
.kiosk-label { font-size: var(--fs-lg); font-weight: 600; }
.kiosk-input { min-height: 84px; font-size: clamp(1.6rem, 4vw, 2.4rem); letter-spacing: 0.14em; text-align: center; background: rgb(0 0 0 / 30%); border-color: rgb(255 255 255 / 20%); color: #fff; }
.kiosk-input:focus { border-color: var(--accent); }
.kiosk-submit { min-height: 64px; font-size: var(--fs-md); }
.kiosk-form .hint { color: rgb(255 255 255 / 55%); font-size: var(--fs-xs); }
.kiosk-result { display: grid; grid-template-columns: auto 1fr; gap: var(--s-2) var(--s-4); align-items: center; margin-bottom: var(--s-6); padding: var(--s-5); border-radius: var(--r-lg); }
.kiosk-result.is-ok { background: color-mix(in srgb, var(--success) 22%, transparent); border: 1px solid color-mix(in srgb, var(--success) 40%, transparent); }
.kiosk-result.is-blocked { background: color-mix(in srgb, var(--danger) 20%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 38%, transparent); }
.kiosk-result-icon { grid-row: span 3; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: rgb(255 255 255 / 12%); }
.kiosk-result-title { font-size: var(--fs-lg); font-weight: 700; }
.kiosk-result-name { font-size: var(--fs-md); }
.kiosk-result-message { font-size: var(--fs-sm); color: rgb(255 255 255 / 75%); }
.kiosk-side h2 { font-size: var(--fs-md); margin-bottom: var(--s-4); }
.kiosk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.kiosk-list li { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); }
.kiosk-list time { margin-left: auto; color: rgb(255 255 255 / 50%); }
.kiosk-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; }
.kiosk-dot.is-ok { background: var(--success); }

/* --------------------------------------------------------------- exports -- */
.export-row {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3);
  border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text);
  transition: border-color 120ms var(--ease), background 120ms var(--ease);
}
.export-row:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-soft); }
.export-row .grow { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.export-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--accent); flex: none; }

/* -------------------------------------------------------------- trainers -- */
.trainer-card { position: relative; overflow: hidden; padding-top: var(--s-5); }
.trainer-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--trainer-colour, var(--accent)); }
.trainer-card.is-inactive { opacity: 0.72; }
.trainer-top { display: flex; align-items: center; gap: var(--s-3); }
.trainer-avatar { background: color-mix(in srgb, var(--trainer-colour, var(--accent)) 16%, var(--surface)) !important; color: var(--trainer-colour, var(--accent)) !important; }
.trainer-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.trainer-id strong { font-size: var(--fs-md); }
.trainer-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin: var(--s-4) 0 var(--s-3); }
.trainer-stats div { display: flex; flex-direction: column; gap: 2px; }
.trainer-stats dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.trainer-stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.trainer-foot { border-top: 1px solid var(--border); padding-top: var(--s-3); }
.colour-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ------------------------------------------- previously missing pieces -- */
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }

.scanner-input { min-height: 56px; font-size: var(--fs-lg); letter-spacing: 0.16em; text-align: center; text-transform: uppercase; }
.scan-result {
  display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4);
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2);
  animation: slide-in 240ms var(--ease);
}
.scan-result.is-ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 34%, transparent); }
.scan-result.is-blocked { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 34%, transparent); }
.scan-result-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-size: 20px; background: rgb(255 255 255 / 55%); color: var(--text);
}
.scan-result.is-ok .scan-result-icon { color: var(--success); }
.scan-result.is-blocked .scan-result-icon { color: var(--danger); }

.member-card {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: var(--s-6);
  background: linear-gradient(135deg, #12162a, #1d2340 55%, #0d1020);
  color: #fff; box-shadow: var(--shadow-lg); border: 1px solid rgb(255 255 255 / 10%);
  max-width: 420px;
}
.member-card::before {
  content: ""; position: absolute; inset: -40% -10% auto auto; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%);
  filter: blur(6px);
}
.member-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); position: relative; }
.member-card-club { font-weight: 700; letter-spacing: -0.01em; }
.member-card-label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.1em; color: rgb(255 255 255 / 55%); }
.member-card-name { font-size: var(--fs-lg); font-weight: 650; margin-top: var(--s-6); position: relative; }
.member-card-code { font-family: var(--font-mono); letter-spacing: 0.18em; font-size: var(--fs-md); margin-top: var(--s-1); position: relative; }
.member-card-barcode { margin-top: var(--s-4); background: #fff; border-radius: var(--r-sm); padding: var(--s-3); position: relative; }
.member-card-barcode svg { display: block; width: 100%; height: auto; }
.member-card-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-4); position: relative; }
.member-card.is-inactive { filter: grayscale(0.55); opacity: 0.85; }

.rotating-code { background: #fff; border-radius: var(--r-sm); padding: var(--s-3); overflow-x: auto; }
.rotating-code svg { display: block; width: 100%; height: auto; min-width: 420px; }

.notification { display: flex; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); }
.notification.is-unread { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.booking-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px solid var(--border); }
.booking-row:last-child { border-bottom: 0; }

/* ---------------------------------------------------------------- print -- */
@media print {
  body { background: #fff; }
  .invoice-doc { border: 0; box-shadow: none; max-width: none; padding: 0; }
  .page { padding: 0; }
}
