/* ==========================================================================
   Gyms Cloud design system — "mission control".
   Dark by default, light theme via [data-theme="light"]. Red / black / white.
   Every colour is a token; components never hard-code a colour.
   ========================================================================== */

:root,
[data-theme="dark"] {
  --bg: #05060a;
  --bg-2: #090b11;
  --surface: rgba(16, 19, 27, .78);
  --surface-solid: #10131b;
  --surface-2: #161a24;
  --surface-3: #1d2230;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #eef0f5;
  --text-2: #b4b9c7;
  --muted: #7c8396;
  --red: #ff2d46;
  --red-2: #ff5a6c;
  --red-deep: #b0001c;
  --red-soft: rgba(255, 45, 70, .12);
  --red-glow: 0 0 0 1px rgba(255, 45, 70, .35), 0 8px 32px -6px rgba(255, 45, 70, .55);
  --green: #1fe08a;
  --green-soft: rgba(31, 224, 138, .12);
  --amber: #ffb547;
  --amber-soft: rgba(255, 181, 71, .13);
  --blue: #5ab8ff;
  --blue-soft: rgba(90, 184, 255, .12);
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 50px -20px rgba(0, 0, 0, .8);
  --grid: rgba(255, 255, 255, .025);
  --input: #0c0f16;
  --overlay: rgba(2, 3, 6, .72);
  --scan: rgba(255, 45, 70, .06);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f3f4f7;
  --bg-2: #eceef2;
  --surface: rgba(255, 255, 255, .9);
  --surface-solid: #ffffff;
  --surface-2: #f6f7f9;
  --surface-3: #eceef2;
  --line: rgba(10, 12, 20, .08);
  --line-2: rgba(10, 12, 20, .14);
  --text: #0b0d13;
  --text-2: #3b4150;
  --muted: #6b7183;
  --red: #e0102f;
  --red-2: #ff2d46;
  --red-deep: #a3001a;
  --red-soft: rgba(224, 16, 47, .08);
  --red-glow: 0 0 0 1px rgba(224, 16, 47, .25), 0 10px 26px -10px rgba(224, 16, 47, .5);
  --green: #0a9f5c;
  --green-soft: rgba(10, 159, 92, .1);
  --amber: #c97a00;
  --amber-soft: rgba(201, 122, 0, .1);
  --blue: #1b74c9;
  --blue-soft: rgba(27, 116, 201, .09);
  --shadow: 0 1px 2px rgba(10, 12, 20, .05), 0 12px 32px -18px rgba(10, 12, 20, .25);
  --grid: rgba(10, 12, 20, .035);
  --input: #ffffff;
  --overlay: rgba(10, 12, 20, .45);
  --scan: rgba(224, 16, 47, .04);
  color-scheme: light;
}

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --sidebar: 248px;
  --topbar: 64px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.5 var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(255, 45, 70, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255, 45, 70, .06), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
[data-theme="light"] body {
  background-image:
    radial-gradient(1000px 500px at 90% -10%, rgba(224, 16, 47, .07), transparent 60%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 40px 40px, 40px 40px;
}
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-2); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 28px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0 0 1em; }
img { max-width: 100%; }
.mono, .num { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.up { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; }
.red { color: var(--red); } .green { color: var(--green); } .amber { color: var(--amber); } .blue { color: var(--blue); }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- boot screen ---------- */
.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); z-index: 100; transition: opacity .4s var(--ease); }
.boot.done { opacity: 0; pointer-events: none; }
.boot-core { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.boot-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--red); animation: spin 1s linear infinite; box-shadow: 0 0 40px -6px var(--red); }
.boot-text { font-size: 11px; letter-spacing: .3em; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout: app frame ---------- */
.frame { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(180deg, var(--surface-solid), var(--bg-2));
  border-right: 1px solid var(--line); padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { width: 34px; height: 34px; }
.brand-name { font: 700 18px/1 var(--font-display); letter-spacing: -.02em; }
.brand-name b { color: var(--red); font-weight: 700; }
.brand-sub { font: 500 10px/1.2 var(--font-mono); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }
.gym-chip { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); margin-bottom: 8px; }
.gym-chip img, .gym-chip .gym-ph { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: var(--surface-3); display: grid; place-items: center; font-weight: 700; color: var(--red); flex: none; }
.gym-chip .t { font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gym-chip .s { font-size: 11px; color: var(--muted); }
.nav-group { margin-top: 10px; }
.nav-label { font: 600 10px/1 var(--font-mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--red-soft); color: var(--text); }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--red); box-shadow: 0 0 12px var(--red); }
.nav a.active svg { color: var(--red); opacity: 1; }
.nav .count { margin-left: auto; font: 600 11px/1 var(--font-mono); padding: 3px 6px; border-radius: 6px; background: var(--red); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar .crumb { font: 600 15px/1 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.cmdk-btn {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; min-width: 260px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted); cursor: pointer; font: inherit;
}
.cmdk-btn kbd { margin-left: auto; }
.cmdk-btn svg { width: 16px; height: 16px; flex: none; }
kbd { font: 500 11px/1 var(--font-mono); padding: 3px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-3); color: var(--text-2); }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-2); cursor: pointer; position: relative; flex: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.clock { font: 500 12px/1 var(--font-mono); color: var(--muted); letter-spacing: .06em; }
.clock b { color: var(--text); font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 var(--green); animation: pulse 2s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; animation: rise .35s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; }
.page-head .eyebrow { font: 600 11px/1 var(--font-mono); letter-spacing: .2em; color: var(--red); text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.page-head .eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--red); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* mobile bottom bar */
.tabbar { display: none; }

/* ---------- cards ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.card.pad, .card > .pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--muted); }
.card-body { padding: 20px; }
/* HUD corner brackets */
.hud::before, .hud::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--red); opacity: .7; pointer-events: none; }
.hud::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-top-left-radius: var(--r-lg); }
.hud::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-bottom-right-radius: var(--r-lg); }
.scan { overflow: hidden; }
.scan > .scanline { position: absolute; left: 0; right: 0; height: 60px; top: -60px; background: linear-gradient(180deg, transparent, var(--scan), transparent); animation: scan 5s linear infinite; pointer-events: none; }
@keyframes scan { to { top: 110%; } }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.gap-s { gap: 6px; }

/* KPI tiles */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-height: 120px; overflow: hidden; }
.kpi .label { font: 600 10.5px/1 var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.kpi .value { font: 600 30px/1.1 var(--font-display); letter-spacing: -.03em; }
.kpi .value.mono { font-family: var(--font-mono); font-size: 26px; letter-spacing: -.02em; }
.kpi .delta { font: 500 12px/1 var(--font-mono); }
.kpi .spark { position: absolute; right: 0; bottom: 0; left: 0; height: 46px; opacity: .9; pointer-events: none; }
.kpi .ico { position: absolute; right: 16px; top: 16px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.kpi .ico svg { width: 18px; height: 18px; }
.kpi.alert { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }

/* ---------- buttons ---------- */
.btn {
  --b: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--b); color: var(--text); font: 600 13.5px/1 var(--font); cursor: pointer;
  transition: transform .08s, box-shadow .2s, background .2s, border-color .2s; white-space: nowrap; user-select: none; text-decoration: none;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, var(--red-2), var(--red) 55%, var(--red-deep)); border-color: transparent; color: #fff; box-shadow: var(--red-glow); }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); }
.btn.success { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 38px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font: 600 11px/1.2 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err { font-size: 12px; color: var(--red); display: none; }
.field.invalid .err { display: block; }
.field.invalid .input, .field.invalid .select, .field.invalid textarea { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input); color: var(--text);
  font: 500 14px/1 var(--font); transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea.input { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c8396' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input::placeholder { color: var(--muted); opacity: .8; }
.input.mono { font-family: var(--font-mono); }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); background: var(--surface-3); color: var(--muted); font: 600 13px/1 var(--font-mono); }
.input-group .addon:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.input-group .addon:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s var(--ease), background .2s; }
.switch input:checked { background: var(--red); border-color: var(--red); }
.switch input:checked::after { transform: translateX(18px); background: #fff; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: none; color: var(--muted); font: 600 12.5px/1 var(--font); padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.seg button.on, .seg a.on { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
[data-theme="dark"] .seg button.on, [data-theme="dark"] .seg a.on { background: var(--surface-3); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button, .tabs a { border: 0; background: none; color: var(--muted); font: 600 13px/1 var(--font); padding: 12px 14px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs .on { color: var(--text); border-bottom-color: var(--red); }

/* ---------- badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 6px; font: 600 11px/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-green { color: var(--green); background: var(--green-soft); }
.b-red { color: var(--red); background: var(--red-soft); }
.b-amber { color: var(--amber); background: var(--amber-soft); }
.b-blue { color: var(--blue); background: var(--blue-soft); }
.b-grey { color: var(--muted); background: var(--surface-3); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); cursor: pointer; }
.chip.on { border-color: var(--red); color: var(--text); background: var(--red-soft); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font: 600 10.5px/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
.t td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .12s; }
.t tbody tr:hover { background: color-mix(in srgb, var(--red) 4%, transparent); }
.t tbody tr.click { cursor: pointer; }
.t .num, .t td.num, .t th.num { text-align: right; font-family: var(--font-mono); }
.t tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 200px; position: relative; }
.toolbar .search .input { padding-left: 38px; }
.toolbar .search svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who .n { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .s { font-size: 12px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; font: 700 13px/1 var(--font-display); color: #fff; background: linear-gradient(135deg, #3a3f4f, #1c2030); overflow: hidden; border: 1px solid var(--line-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; border-radius: 18px; font-size: 24px; }
.avatar.red { background: linear-gradient(135deg, var(--red-2), var(--red-deep)); }

/* mobile card list (tables become cards) */
.mlist { display: none; }
.mitem { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.mitem:last-child { border-bottom: 0; }
.mitem .grow { flex: 1; min-width: 0; }
.mitem .end { text-align: right; }

/* empty + skeleton */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .glyph { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.empty .glyph svg { width: 28px; height: 28px; }
.empty h3 { color: var(--text); }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* key/value lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* progress */
.bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--red-deep), var(--red-2)); box-shadow: 0 0 12px var(--red); transition: width .8s var(--ease); }
.bar.green > i { background: var(--green); box-shadow: 0 0 12px var(--green); }
.ring { position: relative; display: grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-in { position: absolute; text-align: center; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 60; display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: 0 40px 100px -20px rgba(0,0,0,.7); animation: pop .25s var(--ease); position: relative; }
.modal.wide { width: min(860px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface-solid); z-index: 1; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface-solid); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 380px; padding: 12px 14px 12px 16px; border-radius: 12px; background: var(--surface-solid); border: 1px solid var(--line-2); box-shadow: 0 20px 50px -12px rgba(0,0,0,.6); display: flex; gap: 10px; align-items: flex-start; animation: pop .25s var(--ease); border-left: 3px solid var(--green); font-weight: 500; }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--amber); }

/* command palette */
.cmdk { width: min(640px, 100%); align-self: start; margin-top: 10vh; background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden; box-shadow: 0 40px 100px -20px rgba(0,0,0,.7), 0 0 0 1px var(--red-soft); animation: pop .2s var(--ease); }
.cmdk input { width: 100%; height: 58px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--text); padding: 0 20px; font: 500 16px var(--font); outline: none; }
.cmdk .res { max-height: 50vh; overflow: auto; padding: 8px; }
.cmdk .it { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text-2); }
.cmdk .it.on, .cmdk .it:hover { background: var(--red-soft); color: var(--text); }
.cmdk .it svg { width: 18px; height: 18px; }
.cmdk .grp { font: 600 10px/1 var(--font-mono); letter-spacing: .18em; color: var(--muted); padding: 12px 12px 6px; text-transform: uppercase; }

/* dropdown menu */
.menu { position: absolute; z-index: 70; min-width: 200px; background: var(--surface-solid); border: 1px solid var(--line-2); border-radius: 12px; padding: 6px; box-shadow: 0 20px 50px -12px rgba(0,0,0,.6); animation: pop .15s var(--ease); }
.menu a, .menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); font: 500 13.5px var(--font); border: 0; background: none; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--text); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 0; }

/* charts */
.chart { width: 100%; height: 220px; }
.chart text { fill: var(--muted); font: 500 10px var(--font-mono); }
.chart .gridline { stroke: var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* auth + site share these */
.glass { background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-radius: 22px; box-shadow: var(--shadow); }
.alert { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.alert > svg, .alert .ico svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.err { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-soft); color: var(--text); }
.alert.ok { border-color: color-mix(in srgb, var(--green) 40%, transparent); background: var(--green-soft); }
.alert.warn { border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: var(--amber-soft); }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: 14px 10px; align-items: center; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .nav a span, .sidebar .gym-chip .gym-txt, .sidebar .nav .count { display: none; }
  .sidebar .gym-chip { padding: 6px; border: 0; background: none; }
  .nav a { justify-content: center; padding: 11px; }
  .nav a.active::before { left: -10px; }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmdk-btn { min-width: 0; }
  .cmdk-btn span { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; background-attachment: scroll; }
  .frame { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 80; align-items: stretch; box-shadow: 30px 0 80px rgba(0,0,0,.6); animation: slide .25s var(--ease); }
  .sidebar.open .brand-text, .sidebar.open .nav-label, .sidebar.open .nav a span, .sidebar.open .gym-chip .gym-txt, .sidebar.open .nav .count { display: initial; }
  .sidebar.open .nav a { justify-content: flex-start; padding: 11px 12px; }
  .sidebar.open .gym-chip { padding: 10px; border: 1px solid var(--line); background: var(--surface-2); }
  @keyframes slide { from { transform: translateX(-100%); } }
  .topbar { padding: 0 14px; gap: 8px; height: 58px; }
  .topbar .clock { display: none; }
  .cmdk-btn { width: 38px; padding: 0; justify-content: center; }
  .cmdk-btn kbd { display: none; }
  .content { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .page-head h1 { font-size: 22px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .g4.keep2, .g3.keep2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .span2 { grid-column: auto; }
  .form-grid { grid-template-columns: 1fr; }
  .kpi { padding: 14px 16px; min-height: 104px; }
  .kpi .value { font-size: 24px; }
  .kpi .value.mono { font-size: 20px; }
  .kpi .ico { width: 28px; height: 28px; right: 12px; top: 12px; }
  .table-wrap.cards table { display: none; }
  .table-wrap.cards .mlist { display: block; }
  .modal { border-radius: 20px 20px 0 0; align-self: end; max-height: 92vh; }
  .overlay { padding: 0; place-items: end stretch; }
  .modal-foot .btn { flex: 1; }
  .toasts { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .toast { min-width: 0; max-width: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30;
    height: 64px; border-radius: 20px; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px rgba(0,0,0,.6);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font: 600 10px/1 var(--font); }
  .tabbar a svg { width: 21px; height: 21px; }
  .tabbar a.active { color: var(--red); }
  .tabbar a.fab { position: relative; }
  .tabbar a.fab .fab-in { width: 50px; height: 50px; margin-top: -26px; border-radius: 16px; display: grid; place-items: center; color: #fff; background: linear-gradient(180deg, var(--red-2), var(--red-deep)); box-shadow: var(--red-glow); }
  .tabbar a.fab span { display: none; }
  .hide-m { display: none !important; }
}
@media (min-width: 761px) { .show-m { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* print: invoices preview etc. */
@media print {
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .tabbar, .no-print { display: none !important; }
  .frame { display: block; }
  .content { padding: 0; }
}

/* app-wide banners (support session, trial) */
.app-banner { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; font-size: 13px; text-align: center; border-bottom: 1px solid var(--line); }
.app-banner.support { background: var(--red); color: #fff; }
.app-banner.support .btn { background: rgba(0,0,0,.25); color: #fff; border-color: rgba(255,255,255,.35); }
.app-banner.trial { background: var(--amber-soft); color: var(--text); }
