/* ============================================================
   ACKMORRE Design System
   Mobile-first, Android-compatible, CSS variables
   ============================================================ */

:root {
  --primary:        #1a56db;
  --primary-dark:   #1440a8;
  --primary-light:  #ebf0ff;
  --secondary:      #6b7280;
  --success:        #057a55;
  --success-light:  #def7ec;
  --danger:         #e02424;
  --danger-light:   #fde8e8;
  --warning:        #c27803;
  --warning-light:  #fdf6b2;
  --info:           #0e9f6e;
  --bg:             #f3f4f6;
  --surface:        #ffffff;
  --surface-2:      #f9fafb;
  --border:         #e5e7eb;
  --border-dark:    #d1d5db;
  --text:           #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --sidebar-bg:     #1e2538;
  --sidebar-text:   #cbd5e1;
  --sidebar-active: #ffffff;
  --sidebar-hover:  rgba(255,255,255,.08);
  --sidebar-accent: #1a56db;
  --sidebar-w:      248px;
  --topbar-h:       60px;
  --radius:         10px;
  --radius-lg:      14px;
  --shadow:         none;
  --shadow-md:      0 8px 24px rgba(17,24,39,.10);
  --transition:     .16s ease;
  --font:           'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Dark mode variables ─────────────────────────────────────── */
[data-theme="dark"] {
  --primary:        #3b82f6;
  --primary-dark:   #2563eb;
  --primary-light:  #1e3a5f;
  --secondary:      #9ca3af;
  --success:        #10b981;
  --success-light:  #064e3b;
  --danger:         #f87171;
  --danger-light:   #4c1111;
  --warning:        #fbbf24;
  --warning-light:  #451a03;
  --info:           #34d399;
  --bg:             #0f1117;
  --surface:        #1a1d2e;
  --surface-2:      #1f2235;
  --border:         #2d3148;
  --border-dark:    #3a3f5c;
  --text:           #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --sidebar-bg:     #12151f;
  --sidebar-text:   #94a3b8;
  --sidebar-active: #f1f5f9;
  --sidebar-hover:  rgba(255,255,255,.06);
  --sidebar-accent: #3b82f6;
  --shadow:         none;
  --shadow-md:      0 8px 24px rgba(0,0,0,.35);
}

/* ── Dark mode badge/status overrides ────────────────────────── */
[data-theme="dark"] .badge-success  { background: #064e3b; color: #10b981; }
[data-theme="dark"] .badge-danger   { background: #4c1111; color: #f87171; }
[data-theme="dark"] .badge-warning  { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .badge-info     { background: #0c2d48; color: #38bdf8; }
[data-theme="dark"] .badge-secondary{ background: #1f2235; color: #94a3b8; }
[data-theme="dark"] .badge-primary  { background: #1e3a5f; color: #3b82f6; }

[data-theme="dark"] .status-accepted   { background: #1f2235; color: #94a3b8; }
[data-theme="dark"] .status-placed     { background: #0c2d48; color: #38bdf8; }
[data-theme="dark"] .status-processing { background: #451a03; color: #fbbf24; }
[data-theme="dark"] .status-delivered  { background: #064e3b; color: #10b981; }
[data-theme="dark"] .status-failed     { background: #4c1111; color: #f87171; }
[data-theme="dark"] .status-refunded   { background: #2d1b69; color: #a78bfa; }
[data-theme="dark"] .status-cancelled  { background: #292b38; color: #9ca3af; }

[data-theme="dark"] .alert-success { background: #064e3b; border-color: #10b981; color: #6ee7b7; }
[data-theme="dark"] .alert-danger  { background: #4c1111; border-color: #f87171; color: #fca5a5; }
[data-theme="dark"] .alert-warning { background: #451a03; border-color: #fbbf24; color: #fde68a; }
[data-theme="dark"] .alert-info    { background: #0c2d48; border-color: #38bdf8; color: #7dd3fc; }

[data-theme="dark"] select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%2394a3b8' d='m7 10 5 5 5-5z'/%3E%3C/svg%3E");
}

/* ── 20 Theme CSS variables ──────────────────────────────────── */
[data-theme="light"] {
  --primary:#1a56db;--primary-dark:#1440a8;--primary-light:#ebf0ff;
  --bg:#f3f4f6;--surface:#ffffff;--surface-2:#f9fafb;
  --border:#e5e7eb;--border-dark:#d1d5db;
  --text:#111827;--text-secondary:#6b7280;--text-muted:#9ca3af;
}
[data-theme="dark"] {
  --primary:#3b82f6;--primary-dark:#2563eb;--primary-light:#1e3a5f;
  --bg:#0f1117;--surface:#1a1d2e;--surface-2:#1f2235;
  --border:#2d3148;--border-dark:#3a3f5c;
  --text:#f1f5f9;--text-secondary:#94a3b8;--text-muted:#64748b;
}
[data-theme="gold"] {
  --primary:#c9a227;--primary-dark:#a07d10;--primary-light:#3a2e00;
  --bg:#0f0b00;--surface:#1a1200;--surface-2:#201600;
  --border:#3a2e00;--border-dark:#5a4800;
  --text:#f5e6a3;--text-secondary:#c9a84c;--text-muted:#7a6520;
}
[data-theme="ocean"] {
  --primary:#38bdf8;--primary-dark:#0ea5e9;--primary-light:#082f49;
  --bg:#060e1c;--surface:#0c1a2e;--surface-2:#0f2244;
  --border:#0f2a44;--border-dark:#1e4a6e;
  --text:#e0f2fe;--text-secondary:#7dd3fc;--text-muted:#38657a;
}
[data-theme="classic-blue"] {
  --primary:#3b82f6;--primary-dark:#2563eb;--primary-light:#1e3a5f;
  --bg:#0f2744;--surface:#1e3a5f;--surface-2:#162d4a;
  --border:#1e3a5f;--border-dark:#2a5080;
  --text:#dbeafe;--text-secondary:#93c5fd;--text-muted:#3b6aab;
}
[data-theme="dark-blue"] {
  --primary:#818cf8;--primary-dark:#6366f1;--primary-light:#1e1b4b;
  --bg:#06061a;--surface:#0e0e2c;--surface-2:#13133a;
  --border:#1e1b4b;--border-dark:#2d2b6e;
  --text:#c7d2fe;--text-secondary:#818cf8;--text-muted:#3730a3;
}
[data-theme="white"] {
  --primary:#374151;--primary-dark:#1f2937;--primary-light:#f3f4f6;
  --bg:#f3f4f6;--surface:#ffffff;--surface-2:#f9fafb;
  --border:#e5e7eb;--border-dark:#d1d5db;
  --text:#111827;--text-secondary:#6b7280;--text-muted:#9ca3af;
}
[data-theme="midnight"] {
  --primary:#a855f7;--primary-dark:#7c3aed;--primary-light:#2e1065;
  --bg:#050508;--surface:#0d0d14;--surface-2:#12121e;
  --border:#1f1933;--border-dark:#2d2148;
  --text:#e9d5ff;--text-secondary:#c084fc;--text-muted:#581c87;
}
[data-theme="emerald"] {
  --primary:#34d399;--primary-dark:#059669;--primary-light:#022c22;
  --bg:#010f0b;--surface:#022c22;--surface-2:#04341e;
  --border:#064e3b;--border-dark:#065f46;
  --text:#d1fae5;--text-secondary:#6ee7b7;--text-muted:#065f46;
}
[data-theme="rose"] {
  --primary:#fb7185;--primary-dark:#e11d48;--primary-light:#4c0519;
  --bg:#0f0508;--surface:#1f0a0d;--surface-2:#2a0d12;
  --border:#4c0519;--border-dark:#6b0720;
  --text:#fce7f3;--text-secondary:#f9a8d4;--text-muted:#831843;
}
[data-theme="amber"] {
  --primary:#fbbf24;--primary-dark:#d97706;--primary-light:#451a03;
  --bg:#0d0600;--surface:#1c0f00;--surface-2:#221300;
  --border:#451a03;--border-dark:#6b2a05;
  --text:#fef3c7;--text-secondary:#fcd34d;--text-muted:#92400e;
}
[data-theme="slate"] {
  --primary:#94a3b8;--primary-dark:#64748b;--primary-light:#0f172a;
  --bg:#0f172a;--surface:#1e293b;--surface-2:#263042;
  --border:#334155;--border-dark:#475569;
  --text:#e2e8f0;--text-secondary:#94a3b8;--text-muted:#475569;
}
[data-theme="teal"] {
  --primary:#2dd4bf;--primary-dark:#0d9488;--primary-light:#011c1b;
  --bg:#011c1b;--surface:#042f2e;--surface-2:#063a38;
  --border:#0d4e4c;--border-dark:#0f6460;
  --text:#ccfbf1;--text-secondary:#5eead4;--text-muted:#0d7a72;
}
[data-theme="crimson"] {
  --primary:#ef4444;--primary-dark:#dc2626;--primary-light:#450000;
  --bg:#0d0000;--surface:#1a0000;--surface-2:#200505;
  --border:#450000;--border-dark:#660000;
  --text:#fee2e2;--text-secondary:#fca5a5;--text-muted:#991b1b;
}
[data-theme="forest"] {
  --primary:#65a30d;--primary-dark:#4d7c0f;--primary-light:#0a1a04;
  --bg:#040e02;--surface:#0a1a04;--surface-2:#0f2208;
  --border:#1a3a0a;--border-dark:#264d12;
  --text:#ecfccb;--text-secondary:#a3e635;--text-muted:#365314;
}
[data-theme="ice"] {
  --primary:#0369a1;--primary-dark:#075985;--primary-light:#bae6fd;
  --bg:#bae6fd;--surface:#e0f2fe;--surface-2:#f0f9ff;
  --border:#bae6fd;--border-dark:#7dd3fc;
  --text:#0c4a6e;--text-secondary:#0369a1;--text-muted:#0284c7;
}
[data-theme="mono"] {
  --primary:#525252;--primary-dark:#404040;--primary-light:#171717;
  --bg:#0a0a0a;--surface:#171717;--surface-2:#1f1f1f;
  --border:#262626;--border-dark:#404040;
  --text:#f5f5f5;--text-secondary:#a3a3a3;--text-muted:#525252;
}
[data-theme="sunset"] {
  --primary:#f97316;--primary-dark:#ea580c;--primary-light:#431407;
  --bg:#0e0500;--surface:#1c0a00;--surface-2:#241000;
  --border:#431407;--border-dark:#63200c;
  --text:#ffedd5;--text-secondary:#fb923c;--text-muted:#9a3412;
}
[data-theme="indigo"] {
  --primary:#6366f1;--primary-dark:#4338ca;--primary-light:#1e1b4b;
  --bg:#03050f;--surface:#080b24;--surface-2:#0e1230;
  --border:#1e1b4b;--border-dark:#2d2b6e;
  --text:#e0e7ff;--text-secondary:#818cf8;--text-muted:#3730a3;
}
[data-theme="lavender"] {
  --primary:#c084fc;--primary-dark:#9333ea;--primary-light:#3b0764;
  --bg:#080410;--surface:#120820;--surface-2:#180c2a;
  --border:#3b0764;--border-dark:#581c87;
  --text:#f3e8ff;--text-secondary:#d8b4fe;--text-muted:#7e22ce;
}

/* ── Theme toggler button & dropdown ──────────────────────────── */
.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--border-dark);
  border-radius: 50px;
  background: none;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); border-color: var(--primary); }
.theme-toggle .tt-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,.3); }
.theme-toggle .tt-chev { width: 12px; height: 12px; flex-shrink: 0; transition: transform .2s; }
.theme-toggle.tt-open .tt-chev { transform: rotate(180deg); }

.tt-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 270px;
  background: var(--surface);
  border: 1px solid var(--border-dark);
  border-radius: 12px;
  padding: 8px;
  z-index: 9999;
  display: none;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
}
.tt-dropdown.tt-open { display: block; }
.tt-dd-label {
  font-size: .62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
  padding: 4px 8px 6px;
}
.tt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.tt-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 8px; cursor: pointer;
  font-size: .78rem; font-weight: 500; color: var(--text);
  transition: background .12s; border: 1.5px solid transparent;
  background: none; font-family: inherit; text-align: left; width: 100%;
}
.tt-opt:hover { background: var(--surface-2); }
.tt-opt.tt-active { border-color: var(--primary); background: var(--primary-light); color: var(--text); }
.tt-opt .tt-swatch { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; border: 1.5px solid rgba(255,255,255,.25); }

/* legacy compat — hide old sun/moon icons if still present */
.theme-toggle .icon-sun, .theme-toggle .icon-moon { display: none !important; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); font-weight: 700; }
h2 { font-size: clamp(1.2rem, 3vw, 1.5rem); font-weight: 600; }
h3 { font-size: 1.1rem; font-weight: 600; }
h4 { font-size: 1rem;   font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  border: 1px solid transparent; transition: var(--transition);
  white-space: nowrap; text-decoration: none; line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-primary   { background: var(--primary);  color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.btn-success   { background: var(--success);  color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(1.08); text-decoration: none; }
.btn-danger    { background: var(--danger);   color: #fff; border-color: var(--danger); }
.btn-danger:hover  { filter: brightness(1.08); text-decoration: none; }
.btn-secondary { background: var(--surface-2);  color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-dark); text-decoration: none; }
.btn-outline   { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: var(--primary-light); text-decoration: none; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 8px; border-radius: var(--radius); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .4rem; color: var(--text); }
.form-label .req { color: var(--danger); margin-left: 2px; }

.form-control {
  display: block; width: 100%;
  padding: 9px 13px; border-radius: var(--radius);
  border: 1px solid var(--border-dark);
  background: var(--surface); color: var(--text);
  font-size: .9rem; font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none; appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--bg); cursor: not-allowed; }

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='m7 10 5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }

textarea.form-control { resize: vertical; min-height: 100px; }

.form-hint  { font-size: .78rem; color: var(--text-muted); margin-top: .25rem; }
.form-error { font-size: .78rem; color: var(--danger); margin-top: .25rem; }

.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type=checkbox],
.form-check input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  background: var(--surface);
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-body  { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-card {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-dark); }
.stat-card .stat-label { font-size: .78rem; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 700; color: var(--text); line-height: 1.2; letter-spacing: -.01em; }
.stat-card .stat-sub   { font-size: .8rem; color: var(--text-muted); }
.stat-card .stat-icon  { font-size: 1.4rem; margin-bottom: 4px; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-lg); }
.table {
  width: 100%; border-collapse: collapse; font-size: .875rem;
  min-width: 540px;
}
.table th {
  background: var(--surface-2); color: var(--text-secondary);
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 11px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; text-align: left;
}
.table td {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table-sm th, .table-sm td { padding: 8px 12px; }

/* ── Badges / Status ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 50px; font-size: .72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: #e0f2fe; color: #0369a1; }
.badge-secondary{ background: #f3f4f6; color: var(--secondary); }
.badge-primary  { background: var(--primary-light); color: var(--primary); }

/* Status map */
.status-accepted   { background: #f3f4f6; color: var(--secondary); }
.status-placed     { background: #e0f2fe; color: #0369a1; }
.status-processing { background: var(--warning-light); color: var(--warning); }
.status-delivered  { background: var(--success-light); color: var(--success); }
.status-failed     { background: var(--danger-light);  color: var(--danger); }
.status-refunded   { background: #f5f3ff; color: #6d28d9; }
.status-cancelled  { background: #f3f4f6; color: #6b7280; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px; border-radius: var(--radius);
  border-left: 4px solid; font-size: .875rem;
  display: flex; align-items: flex-start; gap: 10px;
  position: relative;
}
.alert-close { position: absolute; top: 10px; right: 12px; background: none; border: none; cursor: pointer; font-size: 1.1rem; color: inherit; opacity: .6; }
.alert-close:hover { opacity: 1; }
.alert-success { background: var(--success-light); border-color: var(--success); color: var(--success); }
.alert-danger  { background: var(--danger-light);  border-color: var(--danger);  color: var(--danger); }
.alert-warning { background: var(--warning-light); border-color: var(--warning); color: var(--warning); }
.alert-info    { background: #e0f2fe; border-color: #0ea5e9; color: #0369a1; }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 10px;
  border-radius: var(--radius); border: 1px solid var(--border);
  font-size: .85rem; color: var(--text); transition: var(--transition);
  text-decoration: none;
}
.page-link:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); text-decoration: none; }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 1000; display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); width: 100%; max-width: 500px;
  max-height: calc(100vh - 40px); overflow-y: auto;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 1rem; font-weight: 600; }
.modal-close  { background: none; border: none; cursor: pointer; font-size: 1.3rem; color: var(--text-muted); line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Admin Layout ────────────────────────────────────────────── */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--sidebar-bg); color: var(--sidebar-text);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200; transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar-brand {
  padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 6px; object-fit: contain; }
.sidebar-brand .brand-name { font-size: 1rem; font-weight: 700; color: #fff; }

.sidebar-nav { padding: 12px 12px 32px; flex: 1; }
.nav-section-label {
  padding: 14px 8px 6px; font-size: .66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.32);
}
.sidebar a.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; color: var(--sidebar-text); border-radius: var(--radius);
  font-size: .875rem; transition: var(--transition); text-decoration: none;
  margin-bottom: 1px;
}
.sidebar a.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-active); }
.sidebar a.nav-link.active { background: var(--sidebar-accent); color: #fff; }
.sidebar a.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }

.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border); padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 6px; border-radius: var(--radius); color: var(--text);
}
.hamburger:hover { background: var(--bg); }
.hamburger svg { width: 22px; height: 22px; display: block; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user  { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }

.page-content { padding: 24px; flex: 1; }
.page-header  { margin-bottom: 20px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.page-title   { font-size: 1.3rem; font-weight: 700; }

/* Sidebar overlay for mobile */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 199; }

/* ── Client Layout ───────────────────────────────────────────── */
.client-wrap { display: flex; flex-direction: column; min-height: 100vh; }

.client-nav {
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100;
}
.client-nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  height: var(--topbar-h); display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
}
.client-nav .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1rem; color: var(--text); text-decoration: none; }
.client-nav .brand img { height: 32px; width: auto; object-fit: contain; }
.client-nav .brand:hover { text-decoration: none; }

.client-nav-links { display: flex; align-items: center; gap: 4px; }
.client-nav-links a {
  padding: 7px 13px; border-radius: var(--radius);
  font-size: .875rem; color: var(--text-secondary); transition: var(--transition);
  text-decoration: none; white-space: nowrap;
}
.client-nav-links a:hover  { background: var(--bg); color: var(--text); text-decoration: none; }
.client-nav-links a.active { background: var(--primary-light); color: var(--primary); font-weight: 500; }

.client-main  { flex: 1; max-width: 1200px; margin: 0 auto; padding: 28px 20px; width: 100%; }
.client-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 16px 20px; text-align: center;
  font-size: .78rem; color: var(--text-muted);
}

/* Balance chip */
.balance-chip {
  background: var(--primary-light); color: var(--primary);
  padding: 5px 12px; border-radius: 50px; font-size: .82rem;
  font-weight: 600; white-space: nowrap;
}

/* Mobile hamburger for client nav */
.client-hamburger { display: none; }
.client-nav-mobile {
  display: none; flex-direction: column;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 8px 0;
}
.client-nav-mobile.open { display: flex; }
.client-nav-mobile a { padding: 11px 20px; font-size: .9rem; color: var(--text-secondary); text-decoration: none; border-left: 3px solid transparent; }
.client-nav-mobile a:hover  { background: var(--bg); color: var(--text); }
.client-nav-mobile a.active { color: var(--primary); border-left-color: var(--primary); background: var(--primary-light); }

/* ── Auth pages ──────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-side {
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; display: flex; flex-direction: column; justify-content: center;
  padding: 56px; position: relative; overflow: hidden;
}
.auth-side::after { content: ""; position: absolute; top: -20%; right: -10%; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.06); }
.auth-side::before { content: ""; position: absolute; bottom: -25%; left: -15%; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.05); }
.auth-side-mark { width: 46px; height: 46px; border-radius: 13px; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; margin-bottom: 28px; position: relative; }
.auth-side-mark i { font-size: 22px; }
.auth-side h2 { font-size: 1.7rem; font-weight: 700; line-height: 1.3; max-width: 380px; position: relative; }
.auth-side p { font-size: .9rem; opacity: .82; margin-top: 14px; max-width: 340px; line-height: 1.6; position: relative; }
.auth-side-points { margin-top: 32px; display: flex; flex-direction: column; gap: 14px; position: relative; }
.auth-side-point { display: flex; align-items: center; gap: 10px; font-size: .85rem; opacity: .95; }
.auth-side-point i { font-size: 14px; flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; background: rgba(255,255,255,.14); display: flex; align-items: center; justify-content: center; }
.auth-form-pane { display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-md); padding: 40px 32px 32px; width: 100%; max-width: 400px; position: relative; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), color-mix(in srgb, var(--primary) 40%, #fff)); }
.auth-card::after { content: ""; position: absolute; top: -40%; right: -30%; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 70%); pointer-events: none; }
.auth-logo  { text-align: center; margin-bottom: 26px; }
.auth-logo img { height: 44px; margin: 0 auto 10px; }
.auth-logo .site-name { font-size: 1.15rem; font-weight: 700; letter-spacing: -.01em; }
.auth-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 22px; text-align: center; color: var(--text-secondary); }
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

/* ── Public marketing nav (Home / About / Contact / Login / Register) ── */
.pub-nav {
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.pub-nav-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 20px;
  height: 64px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px;
}
.pub-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--text); text-decoration: none; flex-shrink: 0; }
.pub-brand img { height: 30px; width: auto; object-fit: contain; }
.pub-brand:hover { text-decoration: none; }

.pub-nav-desktop { display: flex; align-items: center; gap: 26px; }

.pub-nav-links { position: relative; display: flex; align-items: center; gap: 2px; }
.pub-nav-links a {
  position: relative; padding: 9px 16px; font-size: .875rem; font-weight: 500;
  color: var(--text-secondary); text-decoration: none; white-space: nowrap;
  border-radius: var(--radius); z-index: 1; transition: color .2s;
}
.pub-nav-links a:hover, .pub-nav-links a.active { color: var(--primary); text-decoration: none; }
.pub-nav-indicator {
  position: absolute; bottom: 0; height: 2px; background: var(--primary);
  border-radius: 2px; left: 0; width: 0; opacity: 0;
  transition: left .28s cubic-bezier(.4,0,.2,1), width .28s cubic-bezier(.4,0,.2,1), opacity .2s;
}

.pub-nav-cta { display: flex; align-items: center; gap: 10px; }
.pub-nav-cta .btn { padding: 8px 18px; font-size: .85rem; }

.pub-hamburger {
  display: none; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}
.pub-hamburger i { font-size: 19px; color: var(--text); }

.pub-nav-mobile {
  display: none; flex-direction: column;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 20px 18px; max-height: 0; overflow: hidden;
  transition: max-height .3s ease;
}
.pub-nav-mobile.open { display: flex; max-height: 400px; }
.pub-nav-mobile a {
  padding: 13px 2px; font-size: .92rem; color: var(--text-secondary);
  text-decoration: none; border-bottom: 1px solid var(--border);
}
.pub-nav-mobile a.active { color: var(--primary); font-weight: 600; }
.pub-nav-mobile .pub-nav-cta { margin-top: 14px; flex-direction: column; }
.pub-nav-mobile .pub-nav-cta .btn { width: 100%; text-align: center; }

@media (max-width: 860px) {
  .pub-nav-desktop { display: none; }
  .pub-hamburger   { display: flex; }
}

/* ── Public marketing pages (Home / About) ─────────────────────── */
.pub-hero {
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; padding: 76px 20px 90px; text-align: center; position: relative; overflow: hidden;
}
.pub-hero::after  { content: ""; position: absolute; top: -25%; right: -8%;  width: 420px; height: 420px; border-radius: 50%; background: rgba(255,255,255,.07); }
.pub-hero::before { content: ""; position: absolute; bottom: -30%; left: -12%; width: 360px; height: 360px; border-radius: 50%; background: rgba(255,255,255,.05); }
.pub-hero-inner { max-width: 720px; margin: 0 auto; position: relative; }
.pub-hero-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px;
  border-radius: 50px; background: rgba(255,255,255,.16); font-size: .78rem;
  font-weight: 600; letter-spacing: .02em; margin-bottom: 20px;
}
.pub-hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 16px; }
.pub-hero p  { font-size: 1.05rem; opacity: .9; line-height: 1.6; max-width: 560px; margin: 0 auto 30px; }
.pub-hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.pub-hero-cta .btn { padding: 12px 26px; font-size: .95rem; font-weight: 700; }
.pub-hero-cta .btn-secondary { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.35); color: #fff; }
.pub-hero-cta .btn-secondary:hover { background: rgba(255,255,255,.2); }

.pub-section { max-width: 1100px; margin: 0 auto; padding: 64px 20px; }
.pub-section-head { text-align: center; max-width: 560px; margin: 0 auto 40px; }
.pub-eyebrow { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); margin-bottom: 8px; }
.pub-section-head h2 { font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.pub-section-head p  { font-size: .95rem; color: var(--text-secondary); line-height: 1.6; }

.pub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.pub-feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 26px 22px; transition: border-color .2s, transform .2s;
}
.pub-feature:hover { border-color: var(--primary); transform: translateY(-2px); }
.pub-feature-icon {
  width: 44px; height: 44px; border-radius: 12px; background: var(--primary-light);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.pub-feature h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.pub-feature p  { font-size: .85rem; color: var(--text-secondary); line-height: 1.55; margin: 0; }

.pub-stats {
  background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 44px 20px;
}
.pub-stats-inner {
  max-width: 900px; margin: 0 auto; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; text-align: center;
}
.pub-stat-num { font-size: 1.9rem; font-weight: 800; color: var(--primary); letter-spacing: -.02em; }
.pub-stat-label { font-size: .8rem; color: var(--text-secondary); margin-top: 4px; }

.pub-cta-band {
  max-width: 1100px; margin: 0 auto 64px; padding: 40px 32px; border-radius: var(--radius-lg);
  background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.pub-cta-band h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.pub-cta-band p  { font-size: .88rem; opacity: .88; margin: 0; }
.pub-cta-band .btn { padding: 12px 24px; font-weight: 700; flex-shrink: 0; }

.pub-about-story {
  max-width: 760px; margin: 0 auto; padding: 8px 20px 0; font-size: .95rem;
  color: var(--text-secondary); line-height: 1.75;
}
.pub-about-story p { margin-bottom: 16px; }

.pub-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

@media (max-width: 640px) {
  .pub-hero { padding: 54px 18px 64px; }
  .pub-hero h1 { font-size: 1.85rem; }
  .pub-section { padding: 46px 18px; }
  .pub-cta-band { flex-direction: column; text-align: center; }
}

/* ── Grid helpers ────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ── Utilities ───────────────────────────────────────────────── */
.d-flex    { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-small   { font-size: .82rem; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.fw-600 { font-weight: 600; }
.w-100  { width: 100%; }
.mono   { font-family: ui-monospace, monospace; font-size: .85rem; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar { transform: translateX(-250px); width: 250px; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .admin-main { margin-left: 0; }
  .hamburger  { display: flex; }

  .page-content { padding: 16px; }
  .topbar       { padding: 0 16px; }

  .client-nav-links { display: none; }
  .client-hamburger { display: flex; }

  .auth-card { padding: 24px 18px; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .btn { padding: 10px 16px; }
  .btn-sm { padding: 7px 12px; }
  .modal { max-width: 100%; }

  .table th, .table td { padding: 9px 10px; font-size: .82rem; }

  .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .auth-card  { padding: 20px 14px; }
  .card-body  { padding: 14px; }
  .card-header{ padding: 12px 14px; }
  .stat-card  { padding: 14px; }
  .stat-card .stat-value { font-size: 1.4rem; }
}