/* ==========================================================================
   VEDA GYM CRM — "Chalk & Iron" design system
   Layout: app shell = dark iron sidebar (or top nav) + chalk-white workspace.
   Every text color below meets WCAG AA (4.5:1) on the surface it sits on.
   ========================================================================== */

:root {
  /* ---- Neutrals: chalk (light workspace) ---- */
  --bg: #F2F3F5;            /* page background */
  --surface: #FFFFFF;       /* cards, tables, forms */
  --surface-2: #F7F8FA;     /* table headers, inset areas */
  --surface-3: #ECEEF1;     /* hover, chips */
  --border: #DCDFE4;
  --border-strong: #C3C8CF;

  /* ---- Text (contrast on --surface) ---- */
  --text: #111418;          /* 18.4:1  headings, body */
  --text-2: #3D4651;        /*  9.6:1  secondary copy, labels */
  --text-3: #5B6570;        /*  5.9:1  meta, hints — the lightest text allowed */

  /* ---- Brand accent: iron orange ---- */
  --accent: #C2410C;        /* button fill; white text 5.2:1 */
  --accent-hover: #9A3412;
  --on-accent: #FFFFFF;
  --accent-ink: #B13A0A;    /* accent-colored text on white 5.9:1 */
  --accent-soft: #FFEDE3;

  /* ---- Semantic (separate from accent) ---- */
  --ok: #15803D;  --ok-ink: #14532D;  --ok-soft: #E3F5EA;
  --warn: #B45309; --warn-ink: #7C2D12; --warn-soft: #FEF3C7;
  --bad: #B91C1C; --bad-ink: #991B1B; --bad-soft: #FDE8E8; --on-bad: #FFFFFF;
  --info: #1D4ED8; --info-ink: #1E3A8A; --info-soft: #E5ECFD;

  /* ---- Bumper-plate palette (IWF colours) for charts & plan tags ---- */
  --plate-red: #D62828;     /* 25 kg */
  --plate-blue: #2563EB;    /* 20 kg */
  --plate-yellow: #D99A06;  /* 15 kg */
  --plate-green: #16A34A;   /* 10 kg */
  --plate-grey: #6B7280;

  /* ---- Iron (sidebar) — stays dark in both themes ---- */
  --iron: #15171A;
  --iron-2: #1F2226;
  --iron-3: #2A2E33;
  --iron-text: #D5D9DE;     /* 12.6:1 on --iron */
  --iron-muted: #9AA1AA;    /*  6.9:1 on --iron */
  --iron-strong: #FFFFFF;   /* hover / active text in the sidebar */
  --sidebar-edge: transparent;

  /* ---- Type ---- */
  --font-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-body: "Barlow", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --title-case: uppercase;  /* headings: uppercase in Barlow/Oswald/Bebas themes, normal in Poppins */
  --display-weight: 700;
  --fs-xs: 12.5px; --fs-sm: 13.5px; --fs-base: 15px; --fs-md: 17px;
  --fs-lg: 20px; --fs-xl: 24px; --fs-2xl: 30px; --fs-3xl: 38px;

  /* ---- Shape & depth ---- */
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --shadow: 0 1px 2px rgba(17,20,24,.06), 0 1px 3px rgba(17,20,24,.06);
  --shadow-pop: 0 12px 32px rgba(17,20,24,.18);
  --focus: 0 0 0 3px rgba(194,65,12,.35);

  --sidebar-w: 260px; --rail-w: 72px; --topbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0E1012; --surface: #171A1D; --surface-2: #1C2024; --surface-3: #252A2F;
    --border: #2C3238; --border-strong: #3B424A;
    --text: #F1F3F5; --text-2: #C6CCD3; --text-3: #A0A9B3;
    --accent: #F26B2A; --accent-hover: #FF8447; --on-accent: #111214; --accent-ink: #FF8F5A; --accent-soft: #3A2116;
    --ok: #34C771; --ok-ink: #7EE2A6; --ok-soft: #12301F;
    --warn: #F0A73A; --warn-ink: #FBCB7E; --warn-soft: #3A2A10;
    --bad: #F46262; --bad-ink: #FCA5A5; --bad-soft: #3B1717; --on-bad: #111214;
    --info: #6B9BFF; --info-ink: #A9C3FF; --info-soft: #172446;
    --plate-red: #F25555; --plate-blue: #5B8DF6; --plate-yellow: #F2C230; --plate-green: #34C771; --plate-grey: #9AA1AA;
    --iron: #0A0B0D; --iron-2: #15181B; --iron-3: #262A2F;
    --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 14px 36px rgba(0,0,0,.55);
    --focus: 0 0 0 3px rgba(242,107,42,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1012; --surface: #171A1D; --surface-2: #1C2024; --surface-3: #252A2F;
  --border: #2C3238; --border-strong: #3B424A;
  --text: #F1F3F5; --text-2: #C6CCD3; --text-3: #A0A9B3;
  --accent: #F26B2A; --accent-hover: #FF8447; --on-accent: #111214; --accent-ink: #FF8F5A; --accent-soft: #3A2116;
  --ok: #34C771; --ok-ink: #7EE2A6; --ok-soft: #12301F;
  --warn: #F0A73A; --warn-ink: #FBCB7E; --warn-soft: #3A2A10;
  --bad: #F46262; --bad-ink: #FCA5A5; --bad-soft: #3B1717; --on-bad: #111214;
  --info: #6B9BFF; --info-ink: #A9C3FF; --info-soft: #172446;
  --plate-red: #F25555; --plate-blue: #5B8DF6; --plate-yellow: #F2C230; --plate-green: #34C771; --plate-grey: #9AA1AA;
  --iron: #0A0B0D; --iron-2: #15181B; --iron-3: #262A2F;
  --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-pop: 0 14px 36px rgba(0,0,0,.55);
  --focus: 0 0 0 3px rgba(242,107,42,.45);
  color-scheme: dark;
}

/* ==========================================================================
   Extra themes (Light and Dark above are unchanged)
   Each changes the sidebar style, colours and/or typefaces.
   Set on <html data-theme="clean|ocean|plum|volt">. All text pairs meet WCAG AA.
   ========================================================================== */

/* 3 · CLEAN: light sidebar + light body, same orange accent and Barlow type */
:root[data-theme="clean"] {
  --bg: #F4F5F7;
  --iron: #FFFFFF; --iron-2: #F1F3F5; --iron-3: #E2E5E9;
  --iron-text: #3D4651; --iron-muted: #5B6570; --iron-strong: #111418;
  --sidebar-edge: #DCDFE4;
  color-scheme: light;
}

/* 4 · OCEAN: navy sidebar, cobalt accent, Poppins (rounded, friendly) in normal case */
:root[data-theme="ocean"] {
  --bg: #EEF2F7; --surface: #FFFFFF; --surface-2: #F5F8FB; --surface-3: #E6ECF3;
  --border: #D3DCE6; --border-strong: #B8C4D2;
  --text: #0E1726; --text-2: #344257; --text-3: #556377;
  --accent: #1D4ED8; --accent-hover: #1E3A8A; --on-accent: #FFFFFF; --accent-ink: #1D4ED8; --accent-soft: #E3EBFD;
  --info: #0E7490; --info-ink: #155E75; --info-soft: #E0F4F8;
  --iron: #0F1E36; --iron-2: #1A2C4A; --iron-3: #263A5C; --iron-text: #D6DEEA; --iron-muted: #9AABC4;
  --focus: 0 0 0 3px rgba(29,78,216,.35);
  --font-display: "Poppins", "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: "Poppins", "Segoe UI", Roboto, Arial, sans-serif;
  --title-case: none; --display-weight: 600;
  color-scheme: light;
}
:root[data-theme="ocean"] body { font-size: 14.5px; }
:root[data-theme="ocean"] .kpi-value, :root[data-theme="ocean"] .plan-price { font-size: 30px; letter-spacing: -.01em; }
:root[data-theme="ocean"] .page-title { font-size: 26px; letter-spacing: -.01em; }
:root[data-theme="ocean"] .card-title { font-size: 16.5px; letter-spacing: 0; }
:root[data-theme="ocean"] .nav-link, :root[data-theme="ocean"] .nav-group-btn { font-size: 14px; }

/* 5 · PLUM: aubergine sidebar, violet accent, Oswald headings + Nunito Sans body */
:root[data-theme="plum"] {
  --bg: #F4F2F6; --surface: #FFFFFF; --surface-2: #F9F8FB; --surface-3: #ECE8F1;
  --border: #DDD7E5; --border-strong: #C4BCD0;
  --text: #17121F; --text-2: #40384D; --text-3: #615873;
  --accent: #6D28D9; --accent-hover: #5B21B6; --on-accent: #FFFFFF; --accent-ink: #6D28D9; --accent-soft: #EFE7FD;
  --iron: #1C1326; --iron-2: #2A1E38; --iron-3: #3A2C4C; --iron-text: #DCD4E6; --iron-muted: #A699B8;
  --focus: 0 0 0 3px rgba(109,40,217,.35);
  --font-display: "Oswald", "Arial Narrow", sans-serif;
  --font-body: "Nunito Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --display-weight: 600;
  color-scheme: light;
}
:root[data-theme="plum"] .kpi-value { font-size: 34px; }

/* 6 · VOLT: all-black, electric-lime accent, Bebas Neue headings + Inter body (CrossFit / HIIT) */
:root[data-theme="volt"] {
  --bg: #0B0D0C; --surface: #141716; --surface-2: #191D1B; --surface-3: #222826;
  --border: #2A302D; --border-strong: #3A423E;
  --text: #F2F5F3; --text-2: #C5CDC8; --text-3: #9DA8A2;
  --accent: #C6F432; --accent-hover: #D6FF5C; --on-accent: #0B0D0C; --accent-ink: #C6F432; --accent-soft: #263015;
  --ok: #34C771; --ok-ink: #7EE2A6; --ok-soft: #12301F;
  --warn: #F0A73A; --warn-ink: #FBCB7E; --warn-soft: #3A2A10;
  --bad: #F46262; --bad-ink: #FCA5A5; --bad-soft: #3B1717; --on-bad: #111214;
  --info: #6B9BFF; --info-ink: #A9C3FF; --info-soft: #172446;
  --plate-red: #F25555; --plate-blue: #5B8DF6; --plate-yellow: #F2C230; --plate-green: #34C771; --plate-grey: #9AA1AA;
  --iron: #060807; --iron-2: #121513; --iron-3: #1E2320; --iron-text: #D5DBD7; --iron-muted: #95A099;
  --shadow: 0 1px 2px rgba(0,0,0,.45); --shadow-pop: 0 14px 36px rgba(0,0,0,.6);
  --focus: 0 0 0 3px rgba(198,244,50,.4);
  --font-display: "Bebas Neue", "Arial Narrow", sans-serif;
  --font-body: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
  --display-weight: 400;
  font-synthesis: none;
  color-scheme: dark;
}
:root[data-theme="volt"] body { font-size: 14.5px; }
:root[data-theme="volt"] .page-title { font-size: 36px; letter-spacing: .04em; }
:root[data-theme="volt"] .card-title { font-size: 22px; letter-spacing: .05em; }
:root[data-theme="volt"] .kpi-value { font-size: 42px; letter-spacing: .02em; }

/* 7 · AZURE: royal-blue sidebar, blue-tinted body, Outfit type */
:root[data-theme="azure"] {
  --bg: #E9F1FD; --surface: #FFFFFF; --surface-2: #F4F8FE; --surface-3: #DFEAFB;
  --border: #C9DAF5; --border-strong: #A9C2EC;
  --text: #0B1A33; --text-2: #2A3F63; --text-3: #4A5F82;
  --accent: #1D4ED8; --accent-hover: #1E3A8A; --on-accent: #FFFFFF; --accent-ink: #1D4ED8; --accent-soft: #DCE7FD;
  --info: #0E7490; --info-ink: #155E75; --info-soft: #E0F4F8;
  --iron: #1D4ED8; --iron-2: #1E40AF; --iron-3: #3B67E0;
  --iron-text: #E8EFFF; --iron-muted: #D4E1FF; --iron-strong: #FFFFFF;
  --nav-active-bg: #FFFFFF; --nav-active-fg: #1D4ED8; --nav-marker: #FFFFFF; --brand-ring: #93B4FF;
  --focus: 0 0 0 3px rgba(29,78,216,.35);
  --font-display: "Outfit", "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: "Outfit", "Segoe UI", Roboto, Arial, sans-serif;
  --title-case: none; --display-weight: 600;
  color-scheme: light;
}
:root[data-theme="azure"] .topbar { background: #F7FAFF; }
:root[data-theme="azure"] .page-title { font-size: 28px; letter-spacing: -.01em; }
:root[data-theme="azure"] .card-title { font-size: 17.5px; letter-spacing: 0; }
:root[data-theme="azure"] .kpi-value { font-size: 34px; }

/* 8 · SAFFRON: amber sidebar with dark text, warm body, Montserrat + Work Sans */
:root[data-theme="saffron"] {
  --bg: #FFF7E8; --surface: #FFFFFF; --surface-2: #FFFBF2; --surface-3: #FBEFD8;
  --border: #F0DFC0; --border-strong: #DCC59C;
  --text: #1F1608; --text-2: #4A3B22; --text-3: #6B5A3D;
  --accent: #B45309; --accent-hover: #92400E; --on-accent: #FFFFFF; --accent-ink: #A34A06; --accent-soft: #FFEDD5;
  --iron: #F59E0B; --iron-2: #E58A00; --iron-3: #D97E00;
  --iron-text: #1C1206; --iron-muted: #4A3006; --iron-strong: #1C1206;
  --nav-active-bg: #1C1206; --nav-active-fg: #FCD34D; --nav-marker: #1C1206; --brand-ring: #1C1206;
  --focus: 0 0 0 3px rgba(180,83,9,.35);
  --font-display: "Montserrat", "Segoe UI", Arial, sans-serif;
  --font-body: "Work Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --display-weight: 800;
  color-scheme: light;
}
:root[data-theme="saffron"] .page-title { font-size: 27px; letter-spacing: .01em; }
:root[data-theme="saffron"] .card-title { font-size: 16px; letter-spacing: .04em; }
:root[data-theme="saffron"] .kpi-value { font-size: 32px; letter-spacing: -.01em; }
:root[data-theme="saffron"] .nav-group-items .badge-new { background: #1C1206; color: #FCD34D; }
:root[data-theme="saffron"] .sidebar .avatar { box-shadow: 0 0 0 2px #1C1206; }

:root[data-nav="top"] .sidebar { border-right: 0; border-bottom: 1px solid var(--sidebar-edge); }

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: var(--fs-base); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; text-wrap: balance; color: var(--text); }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.ok-text { color: var(--ok-ink); } .bad-text { color: var(--bad-ink); } .warn-text { color: var(--warn-ink); }
.strong { font-weight: 600; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { min-height: 100vh; }

/* ---- Sidebar (vertical nav) ---- */
.sidebar {
  border-right: 1px solid var(--sidebar-edge);
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--iron); color: var(--iron-text);
  display: flex; flex-direction: column;
  padding-left: env(safe-area-inset-left, 0px);
  transition: width .2s ease, transform .25s ease;
}
.brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 20px; border-bottom: 1px solid var(--iron-2); flex-shrink: 0;
  color: var(--iron-strong); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at center, var(--iron) 0 5px, #E8E9EB 5px 7px, var(--brand-ring, var(--accent)) 7px 100%);
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.25);
}
.brand-name { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px; letter-spacing: .06em; text-transform: var(--title-case); line-height: 1; }
.brand-name small { display: block; font-family: var(--font-body); font-size: 11px; font-weight: 500; letter-spacing: .14em; color: var(--iron-muted); margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 24px; scrollbar-width: thin; scrollbar-color: var(--iron-3) transparent; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--iron-muted); padding: 16px 12px 6px; }
.nav-group { position: relative; }
.nav-link, .nav-group-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 8px; border: 0; background: none;
  color: var(--iron-text); font: 500 15px/1.2 var(--font-body); text-align: left; cursor: pointer; text-decoration: none;
}
.nav-link:hover, .nav-group-btn:hover { background: var(--iron-2); color: var(--iron-strong); text-decoration: none; }
.nav-link.active { background: var(--nav-active-bg, var(--accent)); color: var(--nav-active-fg, var(--on-accent)); font-weight: 600; }
.nav-group-btn .chev { margin-left: auto; transition: transform .2s; opacity: .8; }
.nav-group.open > .nav-group-btn .chev { transform: rotate(180deg); }
.nav-group.has-active > .nav-group-btn { color: var(--iron-strong); }
.nav-group-items { display: none; padding: 2px 0 6px 30px; }
.nav-group.open > .nav-group-items { display: block; }
.nav-group-items a {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px;
  color: var(--iron-text); font-size: 14.5px; text-decoration: none; position: relative;
}
.nav-group-items a::before { content: ""; width: 6px; height: 6px; border-radius: 50%; border: 1.5px solid var(--iron-muted); flex-shrink: 0; }
.nav-group-items a:hover { background: var(--iron-2); color: var(--iron-strong); }
.nav-group-items a.active { color: var(--iron-strong); font-weight: 600; background: var(--iron-2); }
.nav-group-items a.active::before { background: var(--nav-marker, var(--accent)); border-color: var(--nav-marker, var(--accent)); }
.nav-group-items .badge-new { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: #111; background: #F2C230; padding: 1px 6px; border-radius: 4px; }
.nav-flyout-title { display: none; }

.sidebar-foot { border-top: 1px solid var(--iron-2); padding: 12px; display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; }
.sidebar-foot .who b { display: block; color: var(--iron-strong); font-size: 14px; }
.sidebar-foot .who span { font-size: 12.5px; color: var(--iron-muted); }

/* ---- Topbar ---- */
.main { margin-left: var(--sidebar-w); min-width: 0; transition: margin .2s ease; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; height: var(--topbar-h);
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.topbar .brand { display: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid transparent; background: none;
  color: var(--text-2); display: inline-grid; place-items: center; cursor: pointer; position: relative; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
.global-search { flex: 1; max-width: 520px; position: relative; }
.global-search input {
  width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 70px 0 42px; font: 15px var(--font-body); color: var(--text);
}
.global-search input::placeholder { color: var(--text-3); }
.global-search input:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); background: var(--surface); }
.global-search > svg { position: absolute; left: 13px; top: 12px; color: var(--text-3); }
.global-search kbd { position: absolute; right: 10px; top: 10px; font: 600 11.5px var(--font-mono); color: var(--text-2); border: 1px solid var(--border); background: var(--surface); padding: 2px 6px; border-radius: 5px; }
.search-results {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 50;
}
.search-results a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a.hl { background: var(--surface-3); }
.search-results .sr-head { font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px 4px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.branch-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--text-2); padding: 7px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }

/* ---- Content ---- */
.content {
  padding-block: 24px 48px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
  max-width: 1480px;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head > div:first-child { min-width: 0; }
.crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--text-3); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); }
.page-title { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--fs-2xl); letter-spacing: .02em; text-transform: var(--title-case); }
.page-sub { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Collapsed rail mode (desktop) ---- */
:root[data-sidebar="rail"] .sidebar { width: var(--rail-w); }
:root[data-sidebar="rail"] .main { margin-left: var(--rail-w); }
:root[data-sidebar="rail"] .brand { padding: 0 18px; }
:root[data-sidebar="rail"] .brand-name,
:root[data-sidebar="rail"] .nav-label,
:root[data-sidebar="rail"] .nav-text,
:root[data-sidebar="rail"] .chev,
:root[data-sidebar="rail"] .sidebar-foot .who { display: none; }
:root[data-sidebar="rail"] .nav { overflow: visible; padding: 14px 10px; }
:root[data-sidebar="rail"] .nav-link, :root[data-sidebar="rail"] .nav-group-btn { justify-content: center; padding: 12px; }
:root[data-sidebar="rail"] .nav-group.has-active > .nav-group-btn { background: var(--iron-2); box-shadow: inset 3px 0 0 var(--nav-marker, var(--accent)); }
:root[data-sidebar="rail"] .nav-group-items {
  display: none !important; position: absolute; left: calc(100% + 8px); top: 0; width: 230px;
  background: var(--iron); border: 1px solid var(--iron-3); border-radius: 10px; padding: 8px; box-shadow: var(--shadow-pop);
}
:root[data-sidebar="rail"] .nav-group:hover > .nav-group-items,
:root[data-sidebar="rail"] .nav-group:focus-within > .nav-group-items { display: block !important; }
:root[data-sidebar="rail"] .nav-flyout-title { display: block; font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .08em; text-transform: var(--title-case); color: var(--iron-strong); padding: 6px 12px 8px; }

/* ---- Horizontal (top) nav mode ---- */
:root[data-nav="top"] .sidebar {
  position: sticky; top: 0; width: auto; height: auto; flex-direction: row; align-items: center; padding: 0 16px; gap: 8px;
  transform: none;
}
:root[data-nav="top"] .main { margin-left: 0; }
:root[data-nav="top"] .brand { border: 0; padding: 0 12px 0 4px; height: 58px; }
:root[data-nav="top"] .nav { display: flex; align-items: center; gap: 2px; padding: 0; overflow: visible; flex-wrap: wrap; }
:root[data-nav="top"] .nav-label, :root[data-nav="top"] .sidebar-foot { display: none; }
:root[data-nav="top"] .nav-link, :root[data-nav="top"] .nav-group-btn { padding: 9px 11px; gap: 7px; font-size: 14.5px; white-space: nowrap; }
:root[data-nav="top"] .nav-group-btn .chev { margin-left: 0; width: 15px; height: 15px; }
:root[data-nav="top"] .nav-group.has-active > .nav-group-btn { background: var(--iron-2); box-shadow: inset 0 -3px 0 var(--nav-marker, var(--accent)); border-radius: 8px 8px 0 0; }
:root[data-nav="top"] .nav-group-items {
  display: none !important; position: absolute; top: calc(100% + 4px); left: 0; width: 240px; z-index: 60;
  background: var(--iron); border: 1px solid var(--iron-3); border-radius: 10px; padding: 8px; box-shadow: var(--shadow-pop);
}
:root[data-nav="top"] .nav-group:hover > .nav-group-items,
:root[data-nav="top"] .nav-group.open-top > .nav-group-items,
:root[data-nav="top"] .nav-group:focus-within > .nav-group-items { display: block !important; }
:root[data-nav="top"] .topbar { top: 58px; }
:root[data-nav="top"] #toggleSidebar { display: none; }
:root[data-nav="top"] .content { margin-inline: auto; }

/* ---- Mobile ---- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; display: none; }
@media (max-width: 1100px) {
  :root[data-nav="top"] .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); flex-direction: column; align-items: stretch; padding: 0; transform: translateX(-100%); }
  :root[data-nav="top"] .nav { display: block; padding: 14px 12px; overflow-y: auto; }
  :root[data-nav="top"] .nav-group-items { position: static; width: auto; box-shadow: none; border: 0; padding: 2px 0 6px 30px; }
  :root[data-nav="top"] .nav-group.open > .nav-group-items { display: block !important; }
  :root[data-nav="top"] .topbar { top: 0; }
  :root[data-nav="top"] #toggleSidebar { display: inline-grid; }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; }
  .main { margin-left: 0 !important; }
  :root[data-sidebar="rail"] .brand-name, :root[data-sidebar="rail"] .nav-label, :root[data-sidebar="rail"] .nav-text,
  :root[data-sidebar="rail"] .chev, :root[data-sidebar="rail"] .sidebar-foot .who { display: revert; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-pop); }
  body.nav-open .scrim { display: block; }
  .topbar .brand { display: flex; border: 0; padding: 0; height: auto; }
  .topbar .brand .brand-name { color: var(--text); font-size: 20px; }
  .topbar .brand .brand-name small { display: none; }
}
@media (max-width: 720px) {
  .topbar { gap: 4px; padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); }
  .global-search { display: none; }
  .topbar .icon-btn { width: 36px; height: 36px; }
  .topbar .btn-sm { padding: 0 10px; }
  .global-search.mobile-open { display: block; position: absolute; left: 12px; right: 12px; top: 11px; max-width: none; }
  .branch-pill, .hide-sm { display: none !important; }
  .content { padding-block: 18px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .page-title { font-size: 26px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
}
@media (min-width: 721px) { .show-sm { display: none !important; } }
@media (max-width: 430px) { .topbar .brand .brand-name { display: none; } }

/* ==========================================================================
   Components
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 14.5px/1 var(--font-body); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-dark { background: var(--text); border-color: var(--text); color: var(--surface); }
.btn-dark:hover { background: var(--text-2); color: var(--surface); }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); }
.btn-danger:hover { filter: brightness(.92); background: var(--bad); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: var(--on-bad); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn-lg { height: 50px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 34px; padding: 0; justify-content: center; }
.btn svg.lucide { width: 17px; height: 17px; }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: .03em; text-transform: var(--title-case); }
.card-sub { font-size: 13.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-flush .card-body { padding: 0; }

/* ---- Grid helpers ---- */
.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.g-side-main { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
@media (max-width: 1280px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .g-main-side, .g-side-main, .g-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) { .g-2, .g-4 { grid-template-columns: minmax(0, 1fr); } .grid { gap: 14px; } }

/* ---- KPI tiles ---- */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.kpi-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.kpi-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.kpi-icon.ok { background: var(--ok-soft); color: var(--ok-ink); }
.kpi-icon.warn { background: var(--warn-soft); color: var(--warn-ink); }
.kpi-icon.bad { background: var(--bad-soft); color: var(--bad-ink); }
.kpi-icon.info { background: var(--info-soft); color: var(--info-ink); }
.kpi-value { font-family: var(--font-display); font-weight: var(--display-weight); font-size: var(--fs-3xl); line-height: 1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 20px; font-weight: 600; color: var(--text-2); }
.kpi-foot { font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 13px; padding: 1px 7px; border-radius: 999px; }
.delta.up { color: var(--ok-ink); background: var(--ok-soft); }
.delta.down { color: var(--bad-ink); background: var(--bad-soft); }
.delta svg.lucide { width: 14px; height: 14px; }

/* ---- Badges / pills ---- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 5px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.badge.bad { background: var(--bad-soft); color: var(--bad-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 3px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); }
.plate { display: inline-block; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(0,0,0,.18); flex-shrink: 0; }
.plate.red { background: var(--plate-red); } .plate.blue { background: var(--plate-blue); } .plate.yellow { background: var(--plate-yellow); } .plate.green { background: var(--plate-green); } .plate.grey { background: var(--plate-grey); }

/* ---- Avatars ---- */
.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; flex-shrink: 0; font: 700 14px var(--font-body); color: #fff; background: var(--plate-grey); letter-spacing: .02em; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.av-1 { background: #9A3412; } .av-2 { background: #1E40AF; } .av-3 { background: #166534; } .av-4 { background: #6B21A8; } .av-5 { background: #9F1239; } .av-6 { background: #0F766E; } .av-7 { background: #854D0E; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person b { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person > span:last-child { min-width: 0; }
.person > span:last-child > span { display: block; font-size: 13px; color: var(--text-3); }
a.person:hover { text-decoration: none; } a.person:hover b { color: var(--accent-ink); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.actions { text-align: right; white-space: nowrap; }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--border-strong); border-bottom: 0; }
.table .check { width: 40px; }
.table-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.table-toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); flex-wrap: wrap; }
.pager .pages { display: flex; gap: 4px; }
.pager .pages button { min-width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 600 13.5px var(--font-body); cursor: pointer; }
.pager .pages button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty svg.lucide { width: 34px; height: 34px; color: var(--text-3); margin: 0 auto 10px; display: block; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px 20px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
@media (max-width: 900px) { .col-4, .col-3 { grid-column: span 6; } .col-8 { grid-column: span 12; } }
@media (max-width: 600px) { .col-6, .col-4, .col-3 { grid-column: span 12; } }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field label .req { color: var(--bad-ink); margin-left: 2px; }
.hint { font-size: 13px; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: 15px var(--font-body); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position: calc(100% - 19px) 19px, calc(100% - 14px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input[readonly] { background: var(--surface-2); color: var(--text-2); }
.input.is-invalid { border-color: var(--bad); }
.error-text { font-size: 13px; color: var(--bad-ink); font-weight: 500; }
.input-group { display: flex; align-items: stretch; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 14px; }
.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; }
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 13px; top: 13px; color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.form-section { padding: 22px 20px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.form-section-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: .04em; text-transform: var(--title-case); margin-bottom: 16px; }
.form-section-title .step { width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--surface); font: 700 13px var(--font-body); display: grid; place-items: center; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--accent); }

/* segmented / radio pills */
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; flex-wrap: wrap; }
.seg button, .seg label { border: 0; background: none; padding: 7px 14px; border-radius: 8px; font: 600 14px var(--font-body); color: var(--text-2); cursor: pointer; }
.seg button.on, .seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg label { padding: 0; } .seg label span { display: block; padding: 7px 14px; border-radius: 8px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice > span { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--border-strong); border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--text); background: var(--surface); }
.choice > span small { font-weight: 500; color: var(--text-3); font-size: 13px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

/* switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); cursor: pointer; transition: .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* upload */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--r); padding: 26px; text-align: center; color: var(--text-2); background: var(--surface-2); cursor: pointer; }
.dropzone:hover { border-color: var(--accent); }
.dropzone svg.lucide { width: 30px; height: 30px; margin: 0 auto 8px; display: block; color: var(--text-3); }
.photo-pick { display: flex; align-items: center; gap: 16px; }
.photo-pick .ph { width: 96px; height: 96px; border-radius: 12px; border: 2px dashed var(--border-strong); display: grid; place-items: center; color: var(--text-3); background: var(--surface-2); }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 12px 16px; border: 0; background: none; font: 600 14.5px var(--font-body); color: var(--text-2); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .count { font-size: 12px; background: var(--surface-3); color: var(--text-2); padding: 1px 7px; border-radius: 999px; }
.tab.on .count { background: var(--accent-soft); color: var(--accent-ink); }
.tab-panel { display: none; } .tab-panel.on { display: block; }

/* ---- Filters bar ---- */
.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 16px; }
.filters .field { min-width: 160px; flex: 1; max-width: 240px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: 600 13.5px var(--font-body); cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.chip .n { font-weight: 700; opacity: .85; }

/* ---- Lists ---- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.dl { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 10px 16px; font-size: 14.5px; margin: 0; }
.dl dt { color: var(--text-3); } .dl dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---- Progress / meters ---- */
.meter { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.ok > span { background: var(--ok); } .meter.warn > span { background: var(--warn); } .meter.bad > span { background: var(--bad); } .meter.info > span { background: var(--info); }

/* ---- Alerts ---- */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r); font-size: 14.5px; border: 1px solid transparent; }
.alert.info { background: var(--info-soft); color: var(--info-ink); }
.alert.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert.bad { background: var(--bad-soft); color: var(--bad-ink); }
.alert.ok { background: var(--ok-soft); color: var(--ok-ink); }
.alert b { color: inherit; }

/* ---- Modal / drawer ---- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(10,11,13,.55); }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: var(--r-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow: auto; box-shadow: var(--shadow-pop); border: 1px solid var(--border); }
.modal-box.lg { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-family: var(--font-display); font-size: 21px; font-weight: var(--display-weight); letter-spacing: .03em; text-transform: var(--title-case); }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); flex-wrap: wrap; }

/* ---- Dropdown ---- */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; display: none; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: 7px; color: var(--text); font: 500 14.5px var(--font-body); text-align: left; cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-menu svg.lucide { color: var(--text-2); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-menu .dm-head { padding: 8px 11px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-menu .nm-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 600; }
.notif-item { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.notif-item:last-of-type { border-bottom: 0; }
.notif-item .t { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.ni-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }

/* ---- Toast ---- */
.toasts { position: fixed; right: max(20px, env(safe-area-inset-right, 0px)); bottom: max(20px, env(safe-area-inset-bottom, 0px)); z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-pop); font-weight: 500; font-size: 14.5px; animation: toastIn .25s ease; max-width: 380px; }
.toast svg.lucide { color: var(--ok); }
@keyframes toastIn { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Timeline ---- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--text-3); }
.timeline li.ok::before { border-color: var(--ok); } .timeline li.accent::before { border-color: var(--accent); } .timeline li.bad::before { border-color: var(--bad); } .timeline li.info::before { border-color: var(--info); }
.timeline .t { font-size: 12.5px; color: var(--text-3); }

/* ---- Charts ---- */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---- Kanban ---- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(240px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
.kcol-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; color: var(--text); padding: 2px 4px 6px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); cursor: grab; }
.kcard b { font-weight: 600; }
.kcard .meta svg.lucide { width: 14px; height: 14px; vertical-align: -2px; } .kcard .meta { font-size: 13px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---- Week planner (workout / classes) ---- */
.week { display: grid; grid-template-columns: repeat(6, minmax(170px, 1fr)); gap: 12px; overflow-x: auto; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); min-width: 170px; display: flex; flex-direction: column; }
.day-head { padding: 10px 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: stretch; gap: 6px; background: var(--surface-2); border-radius: var(--r) var(--r) 0 0; }
.day-head b { font-family: var(--font-display); font-size: 17px; letter-spacing: .06em; text-transform: var(--title-case); }
.day-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.ex { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 14px; background: var(--surface); }
.ex b { display: block; font-weight: 600; }
.ex small { color: var(--text-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.add-slot { border: 1.5px dashed var(--border-strong); border-radius: 8px; padding: 8px; text-align: center; color: var(--text-2); font-weight: 600; font-size: 13.5px; background: none; cursor: pointer; font-family: var(--font-body); }
.add-slot:hover { border-color: var(--accent); color: var(--accent-ink); }

.timetable { display: grid; grid-template-columns: 70px repeat(7, minmax(130px, 1fr)); min-width: 1000px; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.timetable > div { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; min-height: 64px; font-size: 13.5px; }
.timetable .tt-h { background: var(--surface-2); font-weight: 700; text-align: center; min-height: 0; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.timetable .tt-t { background: var(--surface-2); color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; }
.klass { border-radius: 8px; padding: 7px 9px; border-left: 4px solid; background: var(--surface-2); color: var(--text); }
.klass b { display: block; font-size: 13.5px; } .klass small { color: var(--text-2); font-size: 12px; }
.klass.red { border-color: var(--plate-red); } .klass.blue { border-color: var(--plate-blue); } .klass.yellow { border-color: var(--plate-yellow); } .klass.green { border-color: var(--plate-green); }

/* ---- Locker grid ---- */
.lockers { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.locker { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 8px; text-align: center; background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--text-2); }
.locker b { display: block; font-family: var(--font-display); font-size: 22px; color: var(--text); }
.locker.taken { background: var(--info-soft); border-color: var(--info); color: var(--info-ink); }
.locker.due { background: var(--warn-soft); border-color: var(--warn); color: var(--warn-ink); }
.locker.out { background: var(--surface-3); border-style: dashed; }

/* ---- Plan cards ---- */
.plan-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; }
.plan-card .plan-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.plan-card h3 { font-family: var(--font-display); font-size: 22px; font-weight: var(--display-weight); letter-spacing: .03em; text-transform: var(--title-case); }
.plan-price { font-family: var(--font-display); font-weight: var(--display-weight); font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: 16px; color: var(--text-2); font-weight: 600; }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; font-size: 14.5px; color: var(--text-2); }
.plan-card ul li { display: flex; gap: 8px; align-items: center; }
.plan-card ul svg.lucide { color: var(--ok); width: 16px; height: 16px; }
.plan-ring { position: absolute; right: -34px; top: -34px; width: 110px; height: 110px; border-radius: 50%; border: 16px solid; opacity: .14; }

/* ---- Member hero ---- */
.member-hero { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.member-hero .info { flex: 1; min-width: 220px; }
.member-hero h2 { font-family: var(--font-display); font-size: 30px; font-weight: var(--display-weight); letter-spacing: .02em; text-transform: var(--title-case); }
.member-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--border); }
.member-stats > div { padding: 14px 20px; border-right: 1px solid var(--border); }
.member-stats > div:last-child { border-right: 0; }
.member-stats b { display: block; font-family: var(--font-display); font-size: 24px; font-variant-numeric: tabular-nums; }
.member-stats span { font-size: 12.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
@media (max-width: 720px) { .member-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .member-stats > div:nth-child(2) { border-right: 0; } .member-stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); } }

/* ---- Check-in kiosk ---- */
.kiosk-hero { position: relative; border-radius: var(--r-lg); overflow: hidden; background: #0E1012; color: #fff; padding: 28px; min-height: 220px; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; }
.kiosk-hero::before { content: ""; position: absolute; inset: 0; background: url("../img/floor.jpg") center/cover; opacity: .38; }
.kiosk-hero > * { position: relative; }
.kiosk-hero h2 { font-family: var(--font-display); font-size: 34px; font-weight: var(--display-weight); text-transform: var(--title-case); letter-spacing: .03em; color: #fff; }
.kiosk-hero p { color: #E4E7EB; }
.kiosk-input { display: flex; gap: 10px; flex-wrap: wrap; }
.kiosk-input .input { height: 56px; font-size: 20px; font-family: var(--font-mono); background: #fff; color: #111418; border-color: #fff; flex: 1; min-width: 200px; }
.kiosk-input .btn { height: 56px; font-size: 17px; }
.checkin-result { display: flex; gap: 20px; align-items: center; padding: 22px; flex-wrap: wrap; }
.checkin-result.ok { border-left: 6px solid var(--ok); }
.checkin-result.bad { border-left: 6px solid var(--bad); }
.big-status { font-family: var(--font-display); font-size: 30px; font-weight: var(--display-weight); text-transform: var(--title-case); letter-spacing: .04em; }

/* ---- Invoice (print) ---- */
.invoice { max-width: 860px; margin: 0 auto; background: #fff; color: #111418; border: 1px solid #DCDFE4; border-radius: var(--r-lg); padding: 40px; }
.invoice h1 { font-family: var(--font-display); font-size: 34px; text-transform: var(--title-case); letter-spacing: .04em; color: #111418; }
.invoice .inv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 28px 0; }
.invoice table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.invoice th { text-align: left; background: #F2F3F5; padding: 10px 12px; font-size: 12.5px; letter-spacing: .07em; text-transform: uppercase; color: #3D4651; }
.invoice td { padding: 12px; border-bottom: 1px solid #DCDFE4; color: #111418; }
.invoice .num { text-align: right; font-variant-numeric: tabular-nums; }
.invoice .totals { margin-left: auto; width: 320px; max-width: 100%; margin-top: 16px; }
.invoice .totals div { display: flex; justify-content: space-between; padding: 6px 0; color: #3D4651; }
.invoice .totals .grand { border-top: 2px solid #111418; margin-top: 6px; padding-top: 10px; font-weight: 700; font-size: 18px; color: #111418; }
.invoice .muted { color: #5B6570; }
.stamp { display: inline-block; border: 3px solid #15803D; color: #15803D; font-family: var(--font-display); font-weight: var(--display-weight); font-size: 22px; letter-spacing: .12em; padding: 4px 14px; border-radius: 6px; transform: rotate(-6deg); }
@media (max-width: 640px) { .invoice { padding: 22px; } .invoice .inv-grid { grid-template-columns: 1fr; } }
@media print {
  .sidebar, .topbar, .page-head, .no-print, .toasts { display: none !important; }
  .main { margin: 0 !important; } .content { padding: 0 !important; max-width: none; }
  body { background: #fff; } .invoice { border: 0; padding: 0; }
}

/* ---- Auth ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-art { position: relative; background: #0E1012 url("../img/login.jpg") center/cover; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,11,13,.55) 0%, rgba(10,11,13,.1) 40%, rgba(10,11,13,.85) 100%); }
.auth-art > * { position: relative; }
.auth-art .brand { padding: 0; border: 0; height: auto; color: #fff; }
.auth-art .brand-name small { color: #C9CDD3; }
.auth-quote { font-family: var(--font-display); font-weight: var(--display-weight); font-size: clamp(36px, 4.5vw, 64px); line-height: .95; text-transform: var(--title-case); letter-spacing: .01em; color: #fff; max-width: 12ch; }
.auth-quote em { font-style: normal; color: #FF8F5A; }
.auth-stats { display: flex; gap: 32px; flex-wrap: wrap; color: #E4E7EB; font-size: 14px; }
.auth-stats b { display: block; font-family: var(--font-display); font-size: 30px; color: #fff; }
.auth-form { display: flex; align-items: center; justify-content: center; padding-block: 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); background: var(--surface); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-family: var(--font-display); font-size: 36px; text-transform: var(--title-case); letter-spacing: .02em; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { min-height: 240px; padding: 24px; } .auth-quote { font-size: 38px; } .auth-stats { display: none; } }

/* ---- Misc ---- */
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.sum-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 15px; color: var(--text-2); }
.sum-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.sum-row.total { border-top: 2px solid var(--text); margin-top: 6px; padding-top: 12px; font-size: 20px; color: var(--text); font-weight: 700; }
.sum-row.total b { font-family: var(--font-display); font-size: 28px; }
.sticky-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
.stat-inline { display: flex; gap: 28px; flex-wrap: wrap; }
.stat-inline div b { display: block; font-family: var(--font-display); font-size: 26px; font-variant-numeric: tabular-nums; }
.stat-inline div span { font-size: 13px; color: var(--text-3); }
.hbar { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 12px; align-items: center; font-size: 14px; }
.hbar-row .num { text-align: right; font-weight: 600; }
@media (max-width: 520px) { .hbar-row { grid-template-columns: 96px 1fr 76px; } }
.swatch { border-radius: 10px; border: 1px solid var(--border); overflow: hidden; }
.swatch .sw { height: 64px; display: flex; align-items: flex-end; padding: 8px 10px; font: 600 12px var(--font-mono); }
.swatch .sw-meta { padding: 8px 10px; font-size: 13px; }
.swatch .sw-meta b { display: block; }
.att-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.heat { display: grid; grid-template-columns: repeat(15, 16px); gap: 4px; }
.heat i { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-3); display: block; }
.heat i.l1 { background: color-mix(in srgb, var(--ok) 35%, var(--surface-3)); }
.heat i.l2 { background: color-mix(in srgb, var(--ok) 65%, var(--surface-3)); }
.heat i.l3 { background: var(--ok); }
.print-sheet { background: #fff; color: #111418; border: 1px solid #DCDFE4; border-radius: var(--r-lg); padding: 32px; max-width: 900px; margin: 0 auto; }
.print-sheet h2, .print-sheet h3 { color: #111418; }
.print-sheet .table th { background: #F2F3F5; color: #3D4651; }
.print-sheet .table td { color: #111418; border-color: #DCDFE4; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.print-sheet .table tbody tr:hover td { background: #F7F8FA; }
.print-sheet .table td[rowspan] { background: #fff; vertical-align: top; }

.day-head .select { width: 100% !important; }
@media (min-width: 1101px) and (max-width: 1680px) {
  :root[data-nav="top"] .nav > .nav-group > .nav-link > svg.lucide:first-child,
  :root[data-nav="top"] .nav > .nav-group > .nav-group-btn > svg.lucide:first-child { display: none; }
  :root[data-nav="top"] .nav-link, :root[data-nav="top"] .nav-group-btn { padding: 9px 9px; font-size: 14px; }
  :root[data-nav="top"] .brand-name small { display: none; }
}
@media (min-width: 1101px) and (max-width: 1680px) {
  :root[data-nav="top"] .nav-group-btn .chev { display: none; }
  :root[data-nav="top"] .nav-link, :root[data-nav="top"] .nav-group-btn { padding: 9px 8px; }
  :root[data-nav="top"] .nav { flex-wrap: nowrap; }
}
@media (min-width: 1101px) and (max-width: 1360px) {
  :root[data-nav="top"] .nav-link, :root[data-nav="top"] .nav-group-btn { font-size: 13.5px; padding: 9px 6px; }
  :root[data-nav="top"] .brand-name { display: none; }
}

/* ---- Theme pickers ---- */
.theme-dot { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; border: 1px solid rgba(0,0,0,.15);
  background: conic-gradient(var(--d-accent) 0 33%, var(--d-side) 0 66%, var(--d-bg) 0); }
.theme-list { display: flex; flex-direction: column; gap: 2px; margin: 0 8px 8px; padding: 3px; border-radius: 10px; background: var(--surface-3); }
.theme-list button { display: flex !important; align-items: center; gap: 10px; }
.theme-list button.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 600; }
.theme-list button[disabled] { opacity: .55; cursor: not-allowed; }
.theme-lock { margin: 0 8px 8px; font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; align-items: center; }
.theme-lock svg.lucide { width: 14px; height: 14px; }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.theme-card { position: relative; cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; }
.theme-card .tc { border: 2px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); transition: border-color .15s; }
.theme-card input:checked + .tc { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-card input:focus-visible + .tc { box-shadow: var(--focus); }
.tc-preview { height: 92px; display: grid; grid-template-columns: 30% 1fr; }
.tc-side { padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.tc-side i { display: block; height: 5px; border-radius: 3px; opacity: .55; }
.tc-side i:first-child { opacity: 1; }
.tc-main { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tc-main .bar { height: 7px; border-radius: 4px; width: 70%; }
.tc-main .box { flex: 1; border-radius: 6px; }
.tc-main .btn-s { height: 10px; width: 38%; border-radius: 4px; }
.tc-meta { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-meta b { font-size: 14.5px; }
.tc-meta span { font-size: 12.5px; color: var(--text-3); display: block; }
.tc-check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; display: grid; place-items: center; }
.theme-card input:checked + .tc .tc-check { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); }
.tabs-vertical { flex-direction: column; border: 0; padding: 8px; }
.tabs-vertical .tab { border: 0; border-radius: 8px; justify-content: flex-start; margin: 0; }
.tabs-vertical .tab.on { background: var(--accent-soft); color: var(--accent-ink); }
.tc-font { font-size: 17px; line-height: 1; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.table td .row { flex-wrap: nowrap; white-space: nowrap; }
@media (min-width: 1101px) and (max-width: 1680px) {
  :root[data-nav="top"][data-theme="saffron"] .nav-link, :root[data-nav="top"][data-theme="saffron"] .nav-group-btn,
  :root[data-nav="top"][data-theme="azure"] .nav-link, :root[data-nav="top"][data-theme="azure"] .nav-group-btn,
  :root[data-nav="top"][data-theme="ocean"] .nav-link, :root[data-nav="top"][data-theme="ocean"] .nav-group-btn { font-size: 13px; padding: 9px 6px; }
}
