/* ===================================================
   DIALER — LIQUID GLASS DESIGN SYSTEM
   =================================================== */

/* ─── 1. DESIGN TOKENS ─────────────────────────────── */
:root {
  /* Background */
  --bg-base:    #080c18;
  --bg-surface: #0d1220;

  /* Glass surfaces */
  --glass-1:           rgba(8, 12, 30, 0.65);
  --glass-2:           rgba(8, 12, 30, 0.75);
  --glass-3:           rgba(8, 12, 30, 0.80);
  --glass-hover:       rgba(8, 12, 30, 0.70);
  --glass-border:      rgba(255, 255, 255, 0.10);
  --glass-border-md:   rgba(255, 255, 255, 0.16);
  --glass-border-str:  rgba(255, 255, 255, 0.24);

  /* Accent */
  --accent:      #6366f1;
  --accent-lt:   #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.22);
  --accent-bg:   rgba(99, 102, 241, 0.10);

  /* Status */
  --success:     #22c55e;
  --success-bg:  rgba(34, 197, 94, 0.12);
  --success-bd:  rgba(34, 197, 94, 0.28);
  --danger:      #ef4444;
  --danger-bg:   rgba(239, 68, 68, 0.12);
  --danger-bd:   rgba(239, 68, 68, 0.28);
  --warning:     #f59e0b;
  --warning-bg:  rgba(245, 158, 11, 0.12);
  --warning-bd:  rgba(245, 158, 11, 0.28);

  /* Text */
  --tx-1: #ffffff;
  --tx-2: #e2e8f0;
  --tx-3: #a0aec0;

  /* Spacing (8px grid) */
  --s1: 4px;  --s2: 8px;  --s3: 16px;  --s4: 24px;
  --s5: 32px; --s6: 48px; --s8: 64px;  --s10: 80px;

  /* Typography */
  --fxs:  0.75rem;
  --fsm:  0.875rem;
  --fmd:  1rem;
  --flg:  1.125rem;
  --fxl:  1.25rem;
  --f2xl: 1.5rem;
  --f3xl: 1.875rem;
  --f4xl: 2.25rem;

  /* Extra backgrounds */
  --bg-2: rgba(255, 255, 255, 0.04);
  --bg-3: rgba(255, 255, 255, 0.06);

  /* Border */
  --bd: rgba(255, 255, 255, 0.08);

  /* Radius */
  --r2: 8px;
  --rsm: 8px;  --rmd: 12px;  --rlg: 16px;
  --rxl: 22px; --r2xl: 32px;

  /* Shadows */
  --sh-sm: 0 2px 8px rgba(0,0,0,0.30);
  --sh-md: 0 8px 28px rgba(0,0,0,0.40);
  --sh-lg: 0 20px 60px rgba(0,0,0,0.50);
  --sh-glow: 0 0 32px rgba(99,102,241,0.18);

  /* Layout */
  --page-max:  1200px;
  --nav-h:     64px;
  --input-h:   44px;
  --input-hsm: 36px;
}

/* ─── 2. RESET & BASE ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #050714;
  min-height: 100vh;
  color: var(--tx-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Dark theme gradient backdrop */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.30), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 30%, rgba(139, 92, 246, 0.25), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 90%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(236, 72, 153, 0.14), transparent 60%),
    linear-gradient(135deg, #050714 0%, #0a0e1f 50%, #060920 100%);
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent-lt); text-decoration: none; transition: color 0.2s; }
a:hover { color: #fff; }

img, svg { display: block; }

/* ─── 3. TYPOGRAPHY ────────────────────────────────── */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -0.02em;
}
h1 { font-size: var(--f3xl); }
h2 { font-size: var(--f2xl); }
h3 { font-size: var(--flg); }
h4 { font-size: var(--fmd); }
p  { color: var(--tx-2); }

.label {
  display: block;
  font-size: var(--fsm);
  font-weight: 500;
  color: var(--tx-2);
  margin-bottom: var(--s2);
}

.text-xs  { font-size: var(--fxs); }
.text-sm  { font-size: var(--fsm); }
.text-muted { color: var(--tx-3); }

/* ─── 4. LAYOUT HELPERS ────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--s4);
}

.main-content {
  flex: 1;
  padding: var(--s5) var(--s4);
  max-width: var(--page-max);
  margin: 0 auto;
  width: 100%;
}

.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.flex-between{ display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-end    { display: flex; align-items: center; justify-content: flex-end; gap: var(--s2); }
.items-center{ align-items: center; }
.gap-1 { gap: var(--s1); }
.gap-2 { gap: var(--s2); }
.gap-3 { gap: var(--s3); }
.gap-4 { gap: var(--s4); }

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: var(--s4);
}
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--s2);
}

/* Spacing utilities */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--s1); }
.mb-2 { margin-bottom: var(--s2); }
.mb-3 { margin-bottom: var(--s3); }
.mb-4 { margin-bottom: var(--s4); }
.mb-5 { margin-bottom: var(--s5); }
.mb-6 { margin-bottom: var(--s6); }
.mt-2 { margin-top: var(--s2); }
.mt-3 { margin-top: var(--s3); }
.mt-4 { margin-top: var(--s4); }
.mt-auto { margin-top: auto; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

/* ─── 5. NAVBAR ────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(8, 12, 30, 0.80);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border);
}
.navbar-inner {
  height: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--s4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--flg);
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.navbar-brand .brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--rsm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.navbar-brand:hover { color: var(--tx-1); }

.navbar-right {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s3);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--rxl);
  font-size: var(--fsm);
  color: var(--tx-2);
}
.navbar-user .user-dot {
  width: 8px; height: 8px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--success);
}
.navbar-user .user-name { font-weight: 600; color: var(--tx-1); }

/* Subscription expiry banner */
.subscription-banner {
  background: var(--danger);
  color: #fff;
  text-align: center;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  position: sticky;
  top: var(--nav-h);
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.btn-pay-banner {
  background: var(--glass-2);
  color: var(--tx-1);
  border: 1px solid var(--glass-border-md);
  backdrop-filter: blur(8px);
  padding: 0 var(--s3);
  height: 30px;
  border-radius: var(--rmd);
  font-size: var(--fsm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.btn-pay-banner:hover {
  background: var(--glass-3);
  border-color: var(--glass-border-str);
}

/* Mobile menu button */
.nav-menu-btn {
  display: none;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--rsm);
  width: 40px; height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--tx-1);
  font-size: 20px;
  transition: background var(--t-base);
}
.nav-menu-btn:hover { background: var(--glass-3); }

/* ─── 6. PAGE HEADER ───────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s5);
  flex-wrap: wrap;
}
.page-header-left { flex: 1; min-width: 0; }
.page-header h1   { margin-bottom: var(--s1); color: var(--tx-1); }
.page-header p    { color: var(--tx-2); }
.page-header h2   { color: var(--tx-1); }
.page-header h3   { color: var(--tx-1); }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fsm);
  color: var(--tx-3);
}
.breadcrumb a { color: var(--tx-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-lt); }
.breadcrumb-sep { color: var(--tx-3); }

/* ─── 7. GLASS PANELS ──────────────────────────────── */
.panel {
  background: var(--glass-2);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--rlg);
  padding: var(--s4);
  box-shadow: var(--sh-md);
  position: relative;
  overflow: hidden;
}
/* subtle inner top highlight */
.panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
}

.panel-sm { padding: var(--s3); border-radius: var(--rmd); }
.panel-lg { padding: var(--s5); border-radius: var(--rxl); }

/* Card (clickable panel) */
.card {
  background: var(--glass-2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--rlg);
  padding: var(--s4);
  box-shadow: var(--sh-sm);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
}
.card:hover {
  border-color: var(--glass-border-md);
  box-shadow: var(--sh-md), var(--sh-glow);
  transform: translateY(-2px);
}

/* Upload card */
.card-upload {
  border: 2px dashed var(--glass-border-md);
  background: var(--glass-1);
}
.card-upload:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.card-upload .upload-zone {
  border: none;
  background: none;
  padding: var(--s3);
}
.card-upload .upload-zone:hover {
  background: none;
}

/* Stat card */
.stat-card {
  background: var(--glass-1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--rmd);
  padding: var(--s2) var(--s3);
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.stat-icon {
  width: 32px; height: 32px;
  border-radius: var(--rsm);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.stat-icon.accent { background: var(--accent-bg); color: var(--accent-lt); }
.stat-icon.success { background: var(--success-bg); color: var(--success); }
.stat-icon.danger  { background: var(--danger-bg);  color: var(--danger); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-value { font-size: var(--flg); font-weight: 700; line-height: 1; color: var(--tx-1); }
.stat-label { font-size: var(--fxs); color: var(--tx-3); margin-top: 2px; white-space: nowrap; }

/* ─── DROPDOWN ─────────────────────────────────────── */
.dropdown {
  position: relative;
}
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 180px;
  background: rgba(8, 12, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border-md);
  border-radius: var(--rmd);
  padding: var(--s1) 0;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  z-index: 100;
}
.dropdown.open .dropdown-menu {
  display: block;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  background: none;
  border: none;
  color: var(--tx-2);
  font-size: var(--fsm);
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.dropdown-item:hover {
  background: var(--glass-1);
  color: var(--tx-1);
}

/* ─── 8. FORMS ─────────────────────────────────────── */
.form-group  { margin-bottom: var(--s3); }
.form-row    { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.form-inline { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"],
select,
textarea {
  display: block;
  width: 100%;
  height: var(--input-h);
  padding: 0 var(--s3);
  background-color: rgba(0, 0, 0, 0.25);
  background-image: none;
  background-repeat: no-repeat;
  border: 1px solid var(--glass-border-md);
  border-radius: var(--rmd);
  color: var(--tx-1);
  font-size: var(--fmd);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  padding-right: 36px;
  cursor: pointer;
}
textarea {
  height: auto;
  padding: var(--s3);
  resize: vertical;
  line-height: 1.5;
}
input::placeholder, textarea::placeholder { color: var(--tx-3); }
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
  color-scheme: dark;
  min-width: 200px;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  letter-spacing: 0.02em;
}
input[type="datetime-local"] { min-width: 240px; }
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="datetime-local"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="month"],
[data-theme="light"] input[type="week"] { color-scheme: light; }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
input[type="week"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  width: 18px;
  height: 18px;
  padding: 6px;
  margin-right: -6px;
  border-radius: var(--rsm);
  opacity: 0.85;
  /* Tint the native icon to the project accent (#6366f1) */
  filter: invert(40%) sepia(96%) saturate(2000%) hue-rotate(230deg) brightness(95%) contrast(95%);
  transition: all 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
input[type="week"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background: var(--glass-2);
}
[data-theme="light"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="time"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="month"]::-webkit-calendar-picker-indicator,
[data-theme="light"] input[type="week"]::-webkit-calendar-picker-indicator {
  filter: invert(35%) sepia(85%) saturate(1800%) hue-rotate(225deg) brightness(90%) contrast(95%);
}

/* Numeric fields inside date/time inputs (spinners in some browsers) */
input[type="date"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit,
input[type="month"]::-webkit-datetime-edit,
input[type="week"]::-webkit-datetime-edit {
  color: var(--tx-1);
  font-size: var(--fmd);
  font-family: inherit;
  padding: 0;
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper,
input[type="datetime-local"]::-webkit-datetime-edit-fields-wrapper,
input[type="time"]::-webkit-datetime-edit-fields-wrapper,
input[type="month"]::-webkit-datetime-edit-fields-wrapper,
input[type="week"]::-webkit-datetime-edit-fields-wrapper {
  color: var(--tx-1);
}
input[type="date"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="time"]::-webkit-datetime-edit-text,
input[type="month"]::-webkit-datetime-edit-text,
input[type="week"]::-webkit-datetime-edit-text {
  color: var(--tx-3);
  padding: 0 2px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  background-color: rgba(0, 0, 0, 0.30);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
input:hover:not(:focus),
select:hover:not(:focus) {
  border-color: var(--glass-border-str);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='rgba(255,255,255,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: #111827; color: #fff; }

/* File drag-drop upload zone */
.upload-zone {
  position: relative;
  border: 2px dashed var(--glass-border-md);
  border-radius: var(--rlg);
  padding: var(--s6) var(--s4);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--glass-1);
}
.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.upload-zone input[type="file"] {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
  height: 100%;
  width: 100%;
  border: none;
  background: none;
  box-shadow: none;
}
.upload-zone-wrapper { position: relative; }
.upload-icon { font-size: 36px; margin-bottom: var(--s3); line-height: 1; }
.upload-title { font-size: var(--flg); font-weight: 600; color: var(--tx-1); margin-bottom: var(--s1); }
.upload-sub   { font-size: var(--fsm); color: var(--tx-3); }
.upload-filename {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s3);
  padding: var(--s1) var(--s3);
  background: var(--accent-bg);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: var(--rxl);
  font-size: var(--fsm);
  color: var(--accent-lt);
  font-weight: 500;
}

/* ─── 9. BUTTONS ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: var(--input-h);
  padding: 0 var(--s4);
  border-radius: var(--rmd);
  font-weight: 600;
  font-size: var(--fsm);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.01em;
  line-height: 1;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-sm {
  height: var(--input-hsm);
  padding: 0 var(--s3);
  font-size: var(--fxs);
  border-radius: var(--rsm);
}
.btn-lg {
  height: 52px;
  padding: 0 var(--s5);
  font-size: var(--fmd);
  border-radius: var(--rlg);
}

/* Primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(99,102,241,0.35);
}
.btn-primary:hover {
  background: #7577f3;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(99,102,241,0.45);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

/* Secondary */
.btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  color: var(--tx-1);
  border-color: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(8px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--tx-1);
}
.btn-secondary.active,
.btn-secondary.active:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  pointer-events: none;
}

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.35);
}
.btn-danger:hover {
  background: #f87171;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.45);
  color: #fff;
}
.btn-danger:active { transform: translateY(0); box-shadow: none; }

/* Success */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.35);
}
.btn-success:hover {
  background: #4ade80;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.45);
  color: #fff;
}
.btn-success:active { transform: translateY(0); box-shadow: none; }

.btn:disabled, .btn[disabled] {
  background: var(--glass-1);
  color: var(--tx-3);
  cursor: not-allowed;
  opacity: 0.5;
}
.btn:disabled:hover, .btn[disabled]:hover {
  background: var(--glass-1);
  color: var(--tx-3);
  transform: none;
  box-shadow: none;
}

/* Icon button */
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--rsm);
  flex-shrink: 0;
}

/* ─── 10. BADGES ───────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.40);
}
.badge-pending .badge-dot { background: var(--warning); }

.badge-success {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.40);
}
.badge-success .badge-dot { background: var(--success); }

.badge-danger {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.40);
}
.badge-danger .badge-dot { background: var(--danger); }

.badge-info {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.40);
}
.badge-info .badge-dot { background: #3b82f6; }

.badge-accent {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.40);
}

/* AMD hint tooltip */
.amd-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--glass-border-md);
  font-size: 10px;
  font-weight: 700;
  color: var(--tx-3);
  cursor: pointer;
  position: relative;
  vertical-align: middle;
  margin-left: 4px;
  transition: border-color 0.15s, color 0.15s;
}
.amd-hint:hover {
  border-color: var(--accent);
  color: var(--accent-lt);
}
.amd-hint .amd-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-3);
  border: 1px solid var(--glass-border-md);
  backdrop-filter: blur(12px);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 400;
  color: var(--tx-2);
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
.amd-hint:hover .amd-tooltip,
.amd-hint.active .amd-tooltip {
  display: block;
}

/* ─── 11. TABLES ───────────────────────────────────── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--rlg);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 480px;
  font-size: var(--fsm);
}

thead tr {
  background: rgba(255, 255, 255, 0.03);
}
thead th {
  padding: var(--s3) var(--s3);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--glass-border-md);
  background: transparent;
}
tbody td {
  padding: var(--s3);
  font-size: var(--fsm);
  color: var(--tx-1);
  border-bottom: 1px solid var(--glass-border);
  vertical-align: middle;
  line-height: 1.4;
}
tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 0.15s;
}
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] thead tr {
  background: rgba(0, 0, 0, 0.025);
}
[data-theme="light"] tbody tr:hover td {
  background: rgba(0, 0, 0, 0.03);
}

.td-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s2);
}
/* Fixed-width buttons inside table actions for vertical alignment */
.td-actions > .btn {
  flex-shrink: 0;
}
.td-actions > .btn-sm:not(.btn-icon) {
  min-width: 80px;
}
.td-actions > .btn-icon {
  width: 36px;
  min-width: 36px;
}
/* Empty placeholder slot (when a row has fewer buttons) */
.td-actions .btn-placeholder {
  display: inline-block;
  visibility: hidden;
  pointer-events: none;
}

/* ─── 12. PAGINATION ───────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  padding-top: var(--s4);
  margin-top: var(--s4);
  border-top: 1px solid var(--glass-border);
  flex-wrap: wrap;
}
.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--s2);
  border-radius: var(--rsm);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  color: var(--tx-2);
  font-size: var(--fsm);
  font-weight: 500;
  transition: all 0.18s;
}
.page-link:hover { background: var(--glass-3); border-color: var(--glass-border-md); color: var(--tx-1); }
.page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px var(--accent-glow);
}

/* ─── 13. MODAL ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--s4);
}
.modal-overlay.show { display: flex; }

.modal {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - var(--s4) * 2);
  overflow-y: auto;
  animation: modal-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s4);
}
.modal-header h2 { margin-bottom: 0; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--rsm);
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  color: var(--tx-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--glass-3); color: var(--tx-1); }

/* Button loading state */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  top: 50%; left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--s6);
  color: var(--tx-3);
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--s3);
  opacity: 0.5;
}

/* ─── CUSTOM DIALOG (alert/confirm replacement) ────── */
#app-dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
#app-dialog-overlay.show { display: flex; }
#app-dialog {
  width: 100%;
  max-width: 400px;
  background: rgba(8, 12, 30, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border-md);
  border-radius: var(--rlg);
  box-shadow: 0 16px 48px rgba(0,0,0,.5);
  padding: var(--s5);
  text-align: center;
  animation: modal-in 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dialog-icon { font-size: 40px; margin-bottom: var(--s3); }
.dialog-title { font-size: var(--flg); font-weight: 700; color: var(--tx-1); margin-bottom: var(--s2); }
.dialog-message { font-size: var(--fsm); color: var(--tx-3); margin-bottom: var(--s4); line-height: 1.5; }
.dialog-buttons { display: flex; gap: var(--s2); justify-content: center; }
.dialog-buttons .btn { min-width: 100px; }

/* ─── 14. ALERTS / FLASH ───────────────────────────── */
.alert {
  padding: var(--s3);
  border-radius: var(--rmd);
  font-size: var(--fsm);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s4);
}
.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-bd);
  color: #fca5a5;
}
.alert-success {
  background: var(--success-bg);
  border: 1px solid var(--success-bd);
  color: #86efac;
}

/* ─── 15. EMPTY STATE ──────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--s8) var(--s4);
}
.empty-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--s3);
  opacity: 0.4;
}
.empty-state p { font-size: var(--fsm); color: var(--tx-3); max-width: 280px; margin: 0 auto; }

/* ─── 16. LOGIN PAGE ───────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  margin-bottom: var(--s5);
}
.login-logo-icon {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  border-radius: var(--rmd);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(99,102,241,0.4);
}
.login-logo-text {
  font-size: var(--f2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--tx-1);
}
.login-tagline {
  text-align: center;
  color: var(--tx-3);
  font-size: var(--fsm);
  margin-bottom: var(--s5);
  margin-top: calc(-1 * var(--s3));
}

/* ─── 17. SECTION HEADERS ──────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s4);
  flex-wrap: wrap;
}
.section-header h2,
.section-header h3 { margin-bottom: 0; }

/* ─── 18. FILTER BAR ───────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--s2);
  align-items: center;
  flex-wrap: wrap;
}
.filter-bar input,
.filter-bar select {
  height: var(--input-hsm);
  font-size: var(--fsm);
  border-radius: var(--rsm);
}
.filter-bar .filter-search { flex: 1; min-width: 200px; }
.filter-bar .filter-status { width: 160px; flex-shrink: 0; }

/* ─── THEME TOGGLE COMPONENT ──────────────────────── */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--glass-2);
  border: 1px solid var(--glass-border-md);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
  padding: 0;
  display: flex;
  align-items: center;
}
.theme-toggle:hover {
  border-color: var(--glass-border-str);
}
.theme-toggle-thumb {
  position: absolute;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tx-1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(20px);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  font-size: 12px;
  line-height: 1;
  transition: opacity 0.2s;
}
.theme-toggle .icon-moon {
  left: 5px;
  opacity: 0.5;
}
.theme-toggle .icon-sun {
  right: 4px;
  opacity: 0.3;
}
[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 0.8;
}
[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0.2;
}

/* ─── LIGHT THEME ─────────────────────────────────── */
[data-theme="light"] {
  --bg-base:    #f0f2f5;
  --bg-surface: #e8eaef;

  --glass-1:           rgba(255, 255, 255, 0.60);
  --glass-2:           rgba(255, 255, 255, 0.70);
  --glass-3:           rgba(255, 255, 255, 0.80);
  --glass-hover:       rgba(255, 255, 255, 0.65);
  --glass-border:      rgba(0, 0, 0, 0.10);
  --glass-border-md:   rgba(0, 0, 0, 0.15);
  --glass-border-str:  rgba(0, 0, 0, 0.22);

  --accent:      #4338ca;
  --accent-lt:   #4f46e5;
  --accent-glow: rgba(67, 56, 202, 0.22);
  --accent-bg:   rgba(67, 56, 202, 0.10);

  --success:     #15803d;
  --success-bg:  rgba(22, 163, 74, 0.14);
  --success-bd:  rgba(22, 163, 74, 0.35);
  --danger:      #dc2626;
  --danger-bg:   rgba(220, 38, 38, 0.12);
  --danger-bd:   rgba(220, 38, 38, 0.30);
  --warning:     #b45309;
  --warning-bg:  rgba(217, 119, 6, 0.12);
  --warning-bd:  rgba(217, 119, 6, 0.30);

  --tx-1: #0f172a;
  --tx-2: #334155;
  --tx-3: #475569;

  --bg-2: rgba(0, 0, 0, 0.04);
  --bg-3: rgba(0, 0, 0, 0.06);
  --bd: rgba(0, 0, 0, 0.08);

  --sh-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --sh-md: 0 8px 28px rgba(0, 0, 0, 0.10);
  --sh-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --sh-glow: 0 0 32px rgba(79, 70, 229, 0.12);
}

/* Light theme gradient backdrop */
[data-theme="light"] body {
  background: #f0f2f7;
}
[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(99, 102, 241, 0.20), transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 30%, rgba(168, 85, 247, 0.16), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 90%, rgba(56, 189, 248, 0.18), transparent 60%),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(236, 72, 153, 0.12), transparent 60%),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f0f9ff 100%);
}

/* Light: links */
[data-theme="light"] a:hover {
  color: var(--accent);
}

/* Light: navbar */
[data-theme="light"] .navbar {
  background: rgba(255, 255, 255, 0.75);
}

/* Light: panels & cards shimmer */
[data-theme="light"] .panel::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.60), transparent);
}
[data-theme="light"] .card::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.50), transparent);
}

/* Light: dropdown */
[data-theme="light"] .dropdown-menu,
[data-theme="light"] .crm-dropdown-menu {
  background: rgba(255, 255, 255, 0.90);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Light: form inputs */
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="search"],
[data-theme="light"] input[type="url"],
[data-theme="light"] select,
[data-theme="light"] textarea {
  background-color: rgba(255, 255, 255, 0.50);
}
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus {
  background-color: rgba(255, 255, 255, 0.70);
}
[data-theme="light"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='rgba(15,23,42,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
[data-theme="light"] select option {
  background: #ffffff;
  color: #1e293b;
}

/* Light: buttons */
[data-theme="light"] .btn-danger {
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
[data-theme="light"] .btn-success {
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25);
}
[data-theme="light"] .btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  color: #1e293b;
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .btn-secondary:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.25);
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}
[data-theme="light"] .btn-primary {
  box-shadow: 0 2px 12px rgba(67, 56, 202, 0.30);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 4px 20px rgba(67, 56, 202, 0.40);
}
[data-theme="light"] .crm-user-btn {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1e293b;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
[data-theme="light"] .crm-user-btn:hover {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.20);
}
[data-theme="light"] .theme-toggle {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .dropdown-menu,
[data-theme="light"] .crm-dropdown-menu {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
[data-theme="light"] .dropdown-item {
  color: #334155;
}
[data-theme="light"] .dropdown-item:hover,
[data-theme="light"] .crm-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #0f172a;
}
[data-theme="light"] .modal {
  background: #ffffff;
}
[data-theme="light"] .modal-close {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.10);
  color: #475569;
}
[data-theme="light"] .modal-close:hover {
  background: rgba(0, 0, 0, 0.10);
  color: #0f172a;
}

/* Light: badges */
[data-theme="light"] .badge-pending {
  background: rgba(245, 158, 11, 0.18);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.40);
}
[data-theme="light"] .badge-success {
  background: rgba(34, 197, 94, 0.18);
  color: #15803d;
  border-color: rgba(34, 197, 94, 0.40);
}
[data-theme="light"] .badge-danger {
  background: rgba(239, 68, 68, 0.16);
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.35);
}
[data-theme="light"] .badge-info {
  background: rgba(59, 130, 246, 0.16);
  color: #1d4ed8;
  border-color: rgba(59, 130, 246, 0.35);
}
[data-theme="light"] .badge-accent {
  background: rgba(67, 56, 202, 0.14);
  color: #3730a3;
  border-color: rgba(67, 56, 202, 0.35);
}
[data-theme="light"] .pill {
  background: rgba(0, 0, 0, 0.07);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1e293b;
}
[data-theme="light"] .breadcrumb,
[data-theme="light"] .breadcrumb a {
  color: #475569;
}
[data-theme="light"] .breadcrumb a:hover {
  color: var(--accent);
}

/* Light: modals & dialogs */
[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.30);
}
[data-theme="light"] #app-dialog-overlay {
  background: rgba(15, 23, 42, 0.25);
}
[data-theme="light"] #app-dialog {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* Light: alerts */
[data-theme="light"] .alert-error {
  color: #991b1b;
}
[data-theme="light"] .alert-success {
  color: #166534;
}

/* Light: upload preloader */
[data-theme="light"] .upload-preloader {
  background: rgba(240, 242, 245, 0.70);
}
[data-theme="light"] .upload-preloader-box::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.50), transparent);
}

/* Light: scrollbar */
[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.22);
}

/* Light: selection */
[data-theme="light"] ::selection {
  color: var(--tx-1);
}

/* ─── 19. RESPONSIVE ───────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --nav-h: 56px;
  }

  h1 { font-size: var(--f2xl); }
  h2 { font-size: var(--fxl); }

  .main-content { padding: var(--s4) var(--s3); }

  .navbar-user .user-name { display: none; }

  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header > * { width: 100%; }

  .grid-cards { grid-template-columns: 1fr; }
  .grid-stats  { grid-template-columns: repeat(2, 1fr); }

  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .form-group,
  .form-inline select,
  .form-inline input { width: 100%; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .filter-search,
  .filter-bar .filter-status { width: 100%; }

  /* Stack table actions on mobile */
  .section-header { flex-direction: column; align-items: flex-start; }

  .panel, .panel-lg { padding: var(--s3); }

  /* Hide less important columns on mobile */
  .hide-mobile { display: none !important; }

  /* Modal responsive */
  .modal { max-width: calc(100vw - var(--s4) * 2); }

  /* Table font size on mobile */
  table { font-size: var(--fsm); }
  .pill { font-size: 11px; padding: 2px 8px; }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr; }
  .flex.gap-3 { gap: 8px; }
  .modal { max-width: calc(100vw - 16px); }
  h1 { font-size: var(--fxl); }
}

/* View toggle group */
.view-toggle {
  display: inline-flex;
  gap: 2px;
  background: var(--glass-1);
  border-radius: var(--rmd);
  padding: 2px;
}
.view-toggle .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: calc(var(--rmd) - 2px);
}

/* CRM sidebar layout */
.page-crm .page-wrap { display: none; }

.crm-layout {
  display: flex;
  min-height: calc(100vh - var(--nav-h));
}

.crm-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--glass-1);
  border-right: 1px solid var(--glass-border);
  padding: var(--s4) 0;
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: width 0.2s, transform 0.2s;
  overflow-y: auto;
}
.crm-sidebar.collapsed {
  width: 56px;
}
.crm-sidebar.collapsed .crm-nav-item {
  justify-content: center;
  padding: var(--s2);
}
.crm-sidebar.collapsed .crm-nav-item span,
.crm-sidebar.collapsed .crm-nav-badge {
  display: none;
}
.crm-sidebar.collapsed .crm-nav-item svg {
  flex-shrink: 0;
}

.crm-main {
  flex: 1;
  padding: var(--s5) var(--s6);
  margin-left: 220px;
  transition: margin-left 0.2s;
  min-width: 0;
}
.crm-sidebar.collapsed + .crm-main {
  margin-left: 56px;
}

.crm-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--s2);
}

.crm-nav-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--rmd);
  color: var(--tx-2);
  font-size: var(--fsm);
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.crm-nav-item:hover {
  background: var(--glass-2);
  color: var(--tx-1);
}
.crm-nav-item.active {
  background: var(--accent);
  color: #fff;
}
.crm-nav-item.active:hover {
  background: #7577f3;
  color: #fff;
}
.crm-nav-item.active svg,
.crm-nav-item.active:hover svg {
  stroke: #fff;
}

.crm-nav-badge {
  margin-left: auto;
  background: var(--glass-2);
  color: var(--tx-3);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  line-height: 1.4;
}
.crm-nav-item.active .crm-nav-badge {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* Nav groups & sub-items */
.crm-nav-group {
  margin-top: var(--s2);
}
.crm-nav-label {
  padding: var(--s2) var(--s3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tx-3);
  opacity: 0.7;
}
.crm-nav-sub {
  padding-left: var(--s4);
  font-size: 13px;
}
.crm-sidebar.collapsed .crm-nav-label {
  display: none;
}
.crm-sidebar.collapsed .crm-nav-sub {
  padding-left: var(--s3);
}

.crm-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--s2) var(--s3);
}
.crm-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--glass-border);
  border-radius: var(--rsm);
  background: var(--glass-2);
  color: var(--tx-2);
  cursor: pointer;
  transition: all 0.15s;
}
.crm-sidebar-toggle:hover {
  background: var(--glass-3);
  color: var(--tx-1);
}

/* User dropdown */
.crm-user-dropdown {
  position: relative;
}
.crm-user-btn {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--glass-border);
  border-radius: var(--rmd);
  background: var(--glass-2);
  color: var(--tx-1);
  font-size: var(--fsm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.crm-user-btn:hover {
  background: var(--glass-3);
  border-color: var(--glass-border-md);
}
.crm-user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.crm-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: rgba(8, 12, 30, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border-md);
  border-radius: var(--rmd);
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  padding: var(--s1) 0;
  z-index: 200;
}
.crm-dropdown-menu.show { display: block; }
.crm-dropdown-label {
  padding: var(--s1) var(--s3);
}
.crm-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
  padding: var(--s2) var(--s3);
  border: none;
  background: none;
  color: var(--tx-2);
  font-size: var(--fsm);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.1s;
}
.crm-dropdown-item:hover {
  background: var(--glass-2);
  color: var(--tx-1);
}
.crm-dropdown-danger { color: #fca5a5; }
.crm-dropdown-danger:hover { background: var(--danger-bg); color: #fca5a5; }
.crm-dropdown-divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--s1) 0;
}

@media (max-width: 768px) {
  .crm-sidebar {
    width: 220px;
    transform: translateX(-100%);
  }
  .crm-sidebar.mobile-open {
    transform: translateX(0);
  }
  .crm-main {
    margin-left: 0;
    padding: var(--s4) var(--s3);
  }
}

/* Full-width layout */
.page-wide .navbar-inner,
.page-wide .main-content {
  max-width: none;
  padding-left: var(--s6);
  padding-right: var(--s6);
}
@media (max-width: 768px) {
  .page-wide .navbar-inner,
  .page-wide .main-content {
    padding-left: var(--s3);
    padding-right: var(--s3);
  }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr 1fr; }

  .btn-full-mobile { width: 100%; }

  .navbar-right .navbar-user { display: none; }
  .nav-menu-btn { display: flex; }
}

/* ─── 20. UPLOAD PRELOADER ─────────────────────────── */
.upload-preloader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 24, 0.75);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  animation: preloader-in 0.25s ease forwards;
}
.upload-preloader.show { display: flex; }

@keyframes preloader-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.upload-preloader-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s4);
  padding: var(--s6) var(--s8);
  background: var(--glass-2);
  border: 1px solid var(--glass-border-md);
  border-radius: var(--rxl);
  box-shadow: var(--sh-lg), var(--sh-glow);
  position: relative;
  overflow: hidden;
  animation: preloader-box-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes preloader-box-in {
  from { opacity: 0; transform: scale(0.88) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.upload-preloader-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
}

/* Spinner ring */
.spinner {
  width: 56px;
  height: 56px;
  position: relative;
}
.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2.5px solid transparent;
}
.spinner-ring:nth-child(1) {
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
.spinner-ring:nth-child(2) {
  inset: 8px;
  border-top-color: rgba(139, 92, 246, 0.6);
  animation: spin 1.3s linear infinite reverse;
}
.spinner-ring:nth-child(3) {
  inset: 16px;
  border-top-color: rgba(99, 102, 241, 0.35);
  animation: spin 1.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.upload-preloader-title {
  font-size: var(--fxl);
  font-weight: 700;
  color: var(--tx-1);
  letter-spacing: -0.02em;
}
.upload-preloader-sub {
  font-size: var(--fsm);
  color: var(--tx-3);
  margin-top: calc(-1 * var(--s2));
}

/* Progress bar */
.upload-progress-wrap {
  width: 220px;
  height: 3px;
  background: var(--glass-3);
  border-radius: 3px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #8b5cf6);
  border-radius: 3px;
  width: 0%;
  animation: progress-indeterminate 1.6s ease-in-out infinite;
}
@keyframes progress-indeterminate {
  0%   { width: 0%;   margin-left: 0%; }
  50%  { width: 60%;  margin-left: 20%; }
  100% { width: 0%;   margin-left: 100%; }
}

/* Filename chip inside preloader */
.upload-preloader-file {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fsm);
  color: var(--tx-2);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-preloader-file span {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── 21. MISC UTILITIES ───────────────────────────── */
.divider {
  height: 1px;
  background: var(--glass-border);
  margin: var(--s4) 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: var(--s1) var(--s2);
  border-radius: var(--rxl);
  font-size: var(--fxs);
  font-weight: 600;
  background: var(--glass-3);
  border: 1px solid var(--glass-border-md);
  color: var(--tx-1);
}

/* Scroll bar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 6px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.20); }

/* Selection */
::selection { background: var(--accent-glow); color: #fff; }

/* ─── WEBHOOK HELP ────────────────────────────────── */
.webhook-help {
  margin-top: var(--s2);
  font-size: var(--fsm);
  color: var(--tx-3);
}
.webhook-help summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  user-select: none;
}
.webhook-help summary:hover { text-decoration: underline; }
.webhook-help ol {
  margin: var(--s2) 0 0;
  padding-left: 1.4em;
  display: flex; flex-direction: column; gap: var(--s1);
  color: var(--tx-2);
  line-height: 1.6;
}
.webhook-help pre {
  margin: var(--s1) 0 0;
  padding: var(--s3);
  background: var(--glass-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r2);
  font-size: 11px;
  line-height: 1.4;
  overflow: auto;
  max-height: 200px;
  color: var(--tx-2);
  white-space: pre;
}
