/* ═══════════════════════════════════════════════════════════════
   CLASSY NAIL BAR — Design System
   Base CSS: tokens, typography, reset, utilities
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties (Design Tokens) ───────────────────── */
:root {
  /* Color Palette */
  --color-bg:           #0a0a0f;
  --color-surface:      #111118;
  --color-surface-2:    #1a1a2e;
  --color-surface-3:    #22223a;
  --color-border:       rgba(255,255,255,0.08);
  --color-border-hover: rgba(255,255,255,0.16);

  /* Interaction overlays (theme-aware) */
  --overlay-hover:      rgba(255,255,255,0.10);
  --overlay-row-hover:  rgba(255,255,255,0.02);
  --overlay-glass:      rgba(255,255,255,0.03);

  /* Brand Gradient */
  --color-primary:      #c084fc;
  --color-primary-dark: #a855f7;
  --color-secondary:    #f472b6;
  --color-accent:       #38bdf8;

  --gradient-brand: linear-gradient(135deg, #c084fc 0%, #f472b6 100%);
  --gradient-surface: linear-gradient(180deg, #1a1a2e 0%, #111118 100%);

  /* Semantic Colors */
  --color-success:  #22c55e;
  --color-warning:  #f59e0b;
  --color-danger:   #ef4444;
  --color-info:     #38bdf8;

  /* Workflow status colors — solid, theme-independent (readable on light + dark) */
  --status-booked:     #c2410c;  /* booked, not checked in — burnt orange */
  --status-checked-in: #15803d;  /* checked in — green */
  --status-in-service: #2563eb;  /* in service — blue */
  --status-done:       #475569;  /* done — slate */

  /* Text */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --text-inverse:   #0a0a0f;

  /* Typography */
  --font-sans:   'Inter', system-ui, sans-serif;
  --font-display:'Plus Jakarta Sans', system-ui, sans-serif;

  /* Font Sizes */
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;
  --text-5xl:  3rem;

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

  /* Border Radius */
  --radius-sm:  0.375rem;
  --radius-md:  0.75rem;
  --radius-lg:  1rem;
  --radius-xl:  1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(192,132,252,0.25);
  --shadow-glow-pink: 0 0 24px rgba(244,114,182,0.2);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow:   400ms ease;

  /* Layout */
  --header-height: 64px;
  --content-max-width: 1400px;
  --sidebar-width: 248px;
}

/* ── Light Theme (GoCheckIn-style: airy, indigo/violet + blue) ───── */
[data-theme="light"] {
  /* Color Palette */
  --color-bg:           #f3f4f6;
  --color-surface:      #ffffff;
  --color-surface-2:    #f8fafc;
  --color-surface-3:    #eef2f7;
  --color-border:       rgba(17,24,39,0.08);
  --color-border-hover: rgba(17,24,39,0.16);

  /* Interaction overlays */
  --overlay-hover:      rgba(17,24,39,0.05);
  --overlay-row-hover:  rgba(47,128,216,0.05);
  --overlay-glass:      rgba(17,24,39,0.02);

  /* Brand — GoCheckIn sky-blue (matches the app.gocheckin.net photos) */
  --color-primary:      #1d72c4;
  --color-primary-dark: #155a9e;
  --color-secondary:    #3b8fd4;
  --color-accent:       #2f80d8;

  --gradient-brand: linear-gradient(135deg, #4f9fe0 0%, #2570c0 100%);
  --gradient-surface: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);

  /* Semantic Colors — checkout green, processing orange */
  --color-success:  #16a34a;
  --color-warning:  #ea580c;
  --color-danger:   #dc2626;
  --color-info:     #2f80d8;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #6b7280;
  --text-inverse:   #ffffff;

  /* Shadows — soft float, GoCheckIn-style */
  --shadow-sm: 0 1px 3px rgba(17,24,39,0.06);
  --shadow-md: 0 4px 16px rgba(17,24,39,0.08);
  --shadow-lg: 0 10px 30px rgba(17,24,39,0.10);
  --shadow-glow: 0 6px 20px rgba(47,128,216,0.20);
  --shadow-glow-pink: 0 6px 20px rgba(79,143,203,0.18);
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-secondary); }

img, video { max-width: 100%; display: block; }

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ── Typography ───────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  background: var(--overlay-hover);
  transition: opacity var(--transition-fast);
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover {
  box-shadow: 0 0 32px color-mix(in srgb, var(--color-primary) 38%, transparent);
  color: white;
}

.btn-secondary {
  background: var(--color-surface-3);
  color: var(--text-primary);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover {
  border-color: var(--color-border-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--color-danger);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-success {
  background: rgba(34,197,94,0.15);
  color: var(--color-success);
  border: 1px solid rgba(34,197,94,0.3);
}
.btn-success:hover { background: rgba(34,197,94,0.25); }

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: var(--space-2);
  width: 36px;
  height: 36px;
}

/* ── Theme Toggle ─────────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: all var(--transition-fast);
}
.theme-toggle:hover {
  border-color: var(--color-border-hover);
  color: var(--text-primary);
  background: var(--color-surface-3);
}
.theme-toggle .theme-icon-light { display: none; }
.theme-toggle .theme-icon-dark  { display: inline; }
[data-theme="light"] .theme-toggle .theme-icon-light { display: inline; }
[data-theme="light"] .theme-toggle .theme-icon-dark  { display: none; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}
.card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--overlay-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  font-family: var(--font-display);
}

/* ── Stat Cards ───────────────────────────────────────────────── */
.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.stat-card:hover { border-color: var(--color-border-hover); box-shadow: var(--shadow-md); }
.stat-card:hover::before { opacity: 1; }

.stat-value {
  font-size: var(--text-4xl);
  font-weight: 800;
  font-family: var(--font-display);
  line-height: 1;
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  font-weight: 500;
}
.stat-icon {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  font-size: 2rem;
  opacity: 0.15;
}

/* ── Forms ────────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.025em;
}

.form-control {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--text-primary);
  font-size: var(--text-base);
  transition: all var(--transition-fast);
  width: 100%;
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent);
}
.form-control::placeholder { color: var(--text-muted); }

.form-control-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* ── Badges / Tags ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.025em;
}
/* Dark theme (default): solid, high-contrast chips — readable on the dark surface.
   Light theme restores the softer translucent look below via [data-theme="light"]. */
.badge-waiting    { background: #c2410c; color: #fff; border: 0; }
.badge-service    { background: #0369a1; color: #fff; border: 0; }
.badge-done       { background: #15803d; color: #fff; border: 0; }
.badge-vip        { background: #7c3aed; color: #fff; border: 0; }
.badge-risk       { background: #dc2626; color: #fff; border: 0; }
.badge-new        { background: #0369a1; color: #fff; border: 0; }
.badge-processing { background: #c2410c; color: #fff; border: 0; }
.badge-confirmed  { background: #2563eb; color: #fff; border: 0; }
.badge-checkin    { background: #15803d; color: #fff; border: 0; }
.badge-wait       { background: #2563eb; color: #fff; border: 0; }
.badge-regular    { background: #334155; color: #fff; border: 0; }

/* Light theme — softer translucent chips (kept as-is; reads well on white) */
[data-theme="light"] .badge-waiting  { background: rgba(245,158,11,0.15);  color: var(--color-warning); border: 1px solid rgba(245,158,11,0.3); }
[data-theme="light"] .badge-service  { background: rgba(56,189,248,0.15);  color: var(--color-info);    border: 1px solid rgba(56,189,248,0.3); }
[data-theme="light"] .badge-done     { background: rgba(34,197,94,0.15);   color: var(--color-success); border: 1px solid rgba(34,197,94,0.3); }
[data-theme="light"] .badge-vip      { background: rgba(124,58,237,0.12);  color: #6d28d9; border: 1px solid rgba(124,58,237,0.28); }
[data-theme="light"] .badge-risk     { background: rgba(239,68,68,0.15);   color: var(--color-danger);  border: 1px solid rgba(239,68,68,0.3); }
[data-theme="light"] .badge-new      { background: rgba(56,189,248,0.15);  color: var(--color-info);    border: 1px solid rgba(56,189,248,0.3); }
[data-theme="light"] .badge-processing { background: color-mix(in srgb, var(--color-warning) 14%, transparent); color: var(--color-warning); border: 1px solid color-mix(in srgb, var(--color-warning) 32%, transparent); }
[data-theme="light"] .badge-confirmed  { background: color-mix(in srgb, var(--color-accent)  14%, transparent); color: var(--color-accent);  border: 1px solid color-mix(in srgb, var(--color-accent)  32%, transparent); }
[data-theme="light"] .badge-checkin    { background: color-mix(in srgb, var(--color-success) 14%, transparent); color: var(--color-success); border: 1px solid color-mix(in srgb, var(--color-success) 32%, transparent); }
[data-theme="light"] .badge-wait       { background: color-mix(in srgb, var(--color-accent)  14%, transparent); color: var(--color-accent);  border: 1px solid color-mix(in srgb, var(--color-accent)  32%, transparent); }
[data-theme="light"] .badge-regular    { background: var(--color-surface-3); color: var(--text-secondary); border: 1px solid var(--color-border); }

/* Consistent workflow status pills (processing board, appointment detail, customer
   history). Solid + theme-independent — identical and readable on light and dark. */
.badge-booked,
.badge-status-checked-in,
.badge-status-in-service,
.badge-status-done {
  border: 0;
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
}
.badge-booked             { background: var(--status-booked); }
.badge-status-checked-in  { background: var(--status-checked-in); }
.badge-status-in-service  { background: var(--status-in-service); }
.badge-status-done        { background: var(--status-done); }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

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

.table thead {
  background: var(--color-surface-2);
}

.table th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--color-border);
}

.table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover { background: var(--overlay-row-hover); }

/* ── Top App Bar (replaces the sidebar — GoCheckIn-style) ──────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.appbar-home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.appbar-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--gradient-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}
.appbar-logo--sm { width: 32px; height: 32px; font-size: 1.05rem; }

/* Salon identity (name + phone) — GoCheckIn places this top-right */
.appbar-identity {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  padding-left: var(--space-3);
  margin-left: var(--space-1);
  border-left: 1px solid var(--color-border);
}
.appbar-identity-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  min-width: 0;
}
.appbar-identity-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--text-primary);
  white-space: nowrap;
}
.appbar-identity-phone {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Minimal hub header (GoCheckIn launcher: identity + user menu only) */
.appbar--hub {
  background: transparent;
  border-bottom: none;
  box-shadow: none;
  justify-content: flex-end;
}
.hub-usermenu { position: relative; }
.hub-usermenu-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
}
.hub-usermenu-trigger:hover { background: var(--overlay-hover); }
.hub-usermenu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hub-usermenu-pop[hidden] { display: none; }
.hub-usermenu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
}
.hub-usermenu-item:hover { background: var(--color-surface-2); color: var(--text-primary); }

/* Hub page = pure white canvas like the GoCheckIn launcher */
body.page-hub { background: var(--color-surface); }

.appbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0 var(--space-2);
}
.appbar-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.appbar-tab:hover { background: var(--color-surface-2); color: var(--text-primary); }
.appbar-tab.active {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
  flex-shrink: 0;
}
.appbar-user { display: inline-flex; text-decoration: none; }
.appbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: var(--gradient-brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
}

/* ── Page context sub-bar (title + page actions) ──────────────── */
.subbar {
  display: none;            /* revealed via .has-content (set by JS) */
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-6) var(--space-8) 0;
  flex-wrap: wrap;
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
}
.subbar.has-content { display: flex; }
.subbar-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}
.subbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }

/* ── In-module top tabs (GoCheckIn underline style) ──────────────── */
.module-tabs-bar {
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--space-8);
}
.module-tabs-bar:empty { display: none; }
.module-tabs {
  display: flex;
  gap: var(--space-1);
  margin-top: var(--space-5);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}
.module-tab {
  padding: var(--space-3) var(--space-4);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.module-tab:hover { color: var(--text-primary); }
.module-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Module switcher drawer + shared nav atoms ────────────────── */
.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: var(--space-4) var(--space-3) var(--space-2);
}
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }

.module-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
}
.module-drawer.open { visibility: visible; pointer-events: auto; }
.module-drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17,24,39,0.45);
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.module-drawer.open .module-drawer-scrim { opacity: 1; }
.module-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 86vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
}
.module-drawer.open .module-drawer-panel { transform: translateX(0); }
.module-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}
.module-drawer-title { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.module-drawer-nav {
  padding: var(--space-3) var(--space-4);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.drawer-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.drawer-link:hover { background: var(--color-surface-2); color: var(--text-primary); }
/* A POST action (e.g. Quick Pay) styled as a sidebar link. */
button.drawer-link { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.drawer-soon {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 1px 7px;
  border-radius: var(--radius-full);
  background: color-mix(in srgb, var(--color-warning) 16%, transparent);
  color: var(--color-warning);
  flex-shrink: 0;
}
.module-drawer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}

/* ── Bottom tab bar (tablet / mobile) ─────────────────────────── */
.bottomnav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 12px rgba(17,24,39,0.06);
  padding: var(--space-1) var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
}
.bottomnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.bottomnav-item.active { color: var(--color-primary); }
.bottomnav-icon { font-size: 1.25rem; line-height: 1; }

/* ── App shell: persistent LEFT sidebar + content column ──────────── */
.app-layout { display: flex; align-items: flex-start; }
.app-content-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sidebar {
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
/* active module highlight (sidebar nav reuses .drawer-link) */
.drawer-link.active {
  background: color-mix(in srgb, var(--color-primary) 12%, transparent);
  color: var(--color-primary);
  font-weight: 600;
}

/* hamburger — only on mobile, opens the off-canvas sidebar */
.appbar-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  flex-shrink: 0;
}
.appbar-burger:hover { background: var(--color-surface-2); color: var(--text-primary); }

.sidebar-scrim { display: none; }

/* Single collapsible "Coming Soon" group in the sidebar */
.sidebar-soon > summary { list-style: none; cursor: pointer; }
.sidebar-soon > summary::-webkit-details-marker { display: none; }
.sidebar-soon-caret { margin-left: auto; transition: transform var(--transition-fast); }
.sidebar-soon[open] .sidebar-soon-caret { transform: rotate(180deg); }
.sidebar-soon-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-soon-list .drawer-link { padding-left: var(--space-8); font-size: var(--text-xs); }

/* ── Main Content ─────────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--header-height));
}

.page-content {
  padding: var(--space-8);
  flex: 1;
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
}
/* Centre any width-capped page wrapper so content doesn't hug the sidebar.
   (Many pages set an inline max-width with no auto margin.) */
.page-content > * { margin-left: auto; margin-right: auto; }

.page-header {
  margin-bottom: var(--space-8);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/* ── Grid Layouts ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

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

/* ── Alerts / Toasts ──────────────────────────────────────────── */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.alert-success { background: rgba(34,197,94,0.1);  border: 1px solid rgba(34,197,94,0.3);  color: var(--color-success); }
.alert-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: var(--color-danger); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--color-warning); }
.alert-info    { background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.3); color: var(--color-info); }

/* ── Divider ──────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-6) 0;
}

/* ── Utilities ────────────────────────────────────────────────── */
.text-primary-color { color: var(--color-primary); }
.text-muted         { color: var(--text-muted); }
.text-secondary     { color: var(--text-secondary); }
.text-success       { color: var(--color-success); }
.text-danger        { color: var(--color-danger); }
.text-warning       { color: var(--color-warning); }

.font-mono { font-family: 'Courier New', monospace; }
.font-display { font-family: var(--font-display); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.flex           { display: flex; }
.flex-col       { flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2          { gap: var(--space-2); }
.gap-3          { gap: var(--space-3); }
.gap-4          { gap: var(--space-4); }
.gap-6          { gap: var(--space-6); }

.relative       { position: relative; }
.absolute       { position: absolute; }
.inset-0        { top: 0; right: 0; bottom: 0; left: 0; }
.opacity-0      { opacity: 0; }
.opacity-100    { opacity: 1; }
.duration-1000  { transition-duration: 1000ms; }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

.w-full         { width: 100%; }
.h-full         { height: 100%; }
.text-center    { text-align: center; }
.text-right     { text-align: right; }

.mt-2  { margin-top: var(--space-2); }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }

/* ── HTMX Loading Indicator ───────────────────────────────────── */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 16px rgba(192,132,252,0.2); }
  50%       { box-shadow: 0 0 32px rgba(192,132,252,0.4); }
}

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

.animate-fade-in  { animation: fadeIn 0.3s ease forwards; }
.animate-pulse-glow { animation: pulse-glow 2s ease-in-out infinite; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .appbar-nav { display: none; }          /* primary tabs collapse… */
  .appbar-burger { display: inline-flex; }/* …into the hamburger + sidebar */
  .bottomnav { display: flex; }           /* …and the bottom tab bar */
  .main-content { padding-bottom: 64px; } /* clear the fixed bottom bar */
  .content-grid { grid-template-columns: 1fr; }

  /* Sidebar becomes an off-canvas drawer from the LEFT */
  .sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    height: auto;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(17,24,39,0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal);
    z-index: 199;
  }
  .sidebar-scrim.open { opacity: 1; visibility: visible; }
}
@media (max-width: 560px) {
  .appbar-identity { display: none; }     /* drop name/phone on tiny screens */
  .subbar { padding-left: var(--space-5); padding-right: var(--space-5); }
  .module-tabs-bar { padding-left: var(--space-5); padding-right: var(--space-5); }
  .page-content { padding: var(--space-5); }
}
/* Drawer entries that are already a primary top tab (Reports) hide on desktop,
   so the tab and the drawer never show the same link at once. */
@media (min-width: 1025px) {
  .hide-when-tabs { display: none; }
}
