/* ================================================================
   DistributorBooks — Main Stylesheet
   Theme: Deep Navy + Gold Accent / Professional Financial
   Font: Outfit (display) + JetBrains Mono (numbers)
   ================================================================ */

:root {
  --bg-900:    #0a0f1e;
  --bg-800:    #111827;
  --bg-700:    #1a2235;
  --bg-600:    #243048;
  --bg-panel:  #162032;
  --border:    rgba(255,255,255,0.07);
  --border-lg: rgba(255,255,255,0.12);

  --gold:      #d4a853;
  --gold-lt:   #e8c17a;
  --gold-dk:   #b8902a;
  --teal:      #22c4a0;
  --teal-lt:   #3dd9b8;
  --red:       #ef4444;
  --red-lt:    #fca5a5;
  --green:     #22c55e;
  --green-lt:  #86efac;
  --blue:      #3b82f6;
  --orange:    #f97316;

  --text-primary:   #f0f4ff;
  --text-secondary: #8fa3c1;
  --text-muted:     #4a6080;

  --sidebar-w: 240px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,0.6);

  --font-main: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --transition: 0.2s ease;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-main);
  background: var(--bg-900);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}


/* ================================================================
   LIGHT THEME — data-theme="light" on <html>
   ================================================================ */
[data-theme="light"] {
  --bg-900:  #f0f4f8;  --bg-800:  #ffffff;  --bg-700:  #f5f7fa;
  --bg-600:  #e8edf3;  --bg-panel:#ffffff;
  --border:  rgba(0,0,0,0.09);  --border-lg:rgba(0,0,0,0.15);
  --gold:    #b8860b;  --gold-lt: #9a6f00;  --gold-dk: #8b6914;
  --teal:    #0d9e81;  --teal-lt: #0b8a70;
  --red:     #dc2626;  --red-lt:  #b91c1c;
  --green:   #16a34a;  --green-lt:#15803d;
  --orange:  #ea580c;
  --text-primary:   #0f172a;
  --text-secondary: #374151;
  --text-muted:     #6b7280;
  --shadow:  0 2px 12px rgba(0,0,0,0.10);
  --shadow-lg:0 8px 32px rgba(0,0,0,0.15);
}
[data-theme="light"] body { background:var(--bg-900); color:var(--text-primary); }
[data-theme="light"] .sidebar { background:#fff; border-right:1px solid var(--border); box-shadow:2px 0 12px rgba(0,0,0,0.06); }
[data-theme="light"] .sidebar-brand { border-bottom:1px solid var(--border); }
[data-theme="light"] .brand-name { color:#0f172a; }
[data-theme="light"] .brand-sub  { color:#6b7280; }
[data-theme="light"] .nav-item   { color:#374151; }
[data-theme="light"] .nav-item:hover { background:#f0f4f8; color:#0f172a; }
[data-theme="light"] .nav-item.active { background:rgba(184,134,11,0.10); color:#92670a; border-color:rgba(184,134,11,0.25); }
[data-theme="light"] .sidebar-user { border-top:1px solid var(--border); }
[data-theme="light"] .user-name  { color:#0f172a; }
[data-theme="light"] .user-role  { color:#6b7280; }
[data-theme="light"] .logout-btn { color:#6b7280; }
[data-theme="light"] .logout-btn:hover { color:var(--red); }
[data-theme="light"] .page-header { background:#fff; border-bottom:1px solid var(--border); }
[data-theme="light"] .page-title  { color:#0f172a; }
[data-theme="light"] .current-date{ color:#6b7280; }
[data-theme="light"] .card { background:#fff; border:1px solid var(--border); box-shadow:0 1px 4px rgba(0,0,0,0.06); }
[data-theme="light"] .card-title  { color:#374151; }
[data-theme="light"] .stat-card   { background:#fff; border:1px solid var(--border); }
[data-theme="light"] .stat-label  { color:#6b7280; }
[data-theme="light"] .stat-value  { color:#0f172a; }
[data-theme="light"] .stat-value.gold  { color:#92670a; }
[data-theme="light"] .stat-value.teal  { color:#0b8a70; }
[data-theme="light"] .stat-value.red   { color:#b91c1c; }
[data-theme="light"] .stat-value.green { color:#15803d; }
[data-theme="light"] .table-wrap  { border:1px solid var(--border); }
[data-theme="light"] thead th { background:#f8fafc; color:#6b7280; border-bottom:1px solid var(--border); }
[data-theme="light"] tbody tr:hover { background:#f8fafc; }
[data-theme="light"] tbody td  { color:#0f172a; }
[data-theme="light"] tbody tr  { border-bottom:1px solid var(--border); }
[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="email"],
[data-theme="light"] input[type="password"],
[data-theme="light"] input[type="number"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="tel"],
[data-theme="light"] input[type="month"],
[data-theme="light"] input[type="time"],
[data-theme="light"] select,
[data-theme="light"] textarea { background:#fff; border:1px solid #d1d5db; color:#0f172a; }
[data-theme="light"] input:focus,
[data-theme="light"] select:focus,
[data-theme="light"] textarea:focus { border-color:#b8860b; box-shadow:0 0 0 3px rgba(184,134,11,0.15); }
[data-theme="light"] .btn-secondary { background:#f0f4f8; color:#0f172a; border:1px solid #d1d5db; }
[data-theme="light"] .btn-secondary:hover { background:#e5eaf0; }
[data-theme="light"] .btn-danger { background:rgba(220,38,38,0.08); color:#b91c1c; border:1px solid rgba(220,38,38,0.20); }
[data-theme="light"] .flash-success { background:rgba(22,163,74,0.08);  border-color:rgba(22,163,74,0.25);  color:#15803d; }
[data-theme="light"] .flash-error   { background:rgba(220,38,38,0.08);  border-color:rgba(220,38,38,0.25);  color:#b91c1c; }
[data-theme="light"] .flash-warning { background:rgba(234,88,12,0.08);  border-color:rgba(234,88,12,0.25);  color:#c2410c; }
[data-theme="light"] .flash-info    { background:rgba(37,99,235,0.08);  border-color:rgba(37,99,235,0.25);  color:#1d4ed8; }
[data-theme="light"] .badge-green   { background:rgba(22,163,74,0.12);  color:#15803d; }
[data-theme="light"] .badge-red     { background:rgba(220,38,38,0.12);  color:#b91c1c; }
[data-theme="light"] .badge-gold    { background:rgba(184,134,11,0.12); color:#92670a; }
[data-theme="light"] .badge-teal    { background:rgba(13,158,129,0.12); color:#0b8a70; }
[data-theme="light"] .badge-gray    { background:rgba(0,0,0,0.06);      color:#6b7280; }
[data-theme="light"] .badge-blue    { background:rgba(37,99,235,0.12);  color:#1d4ed8; }
[data-theme="light"] .text-muted    { color:#6b7280; }
[data-theme="light"] .font-mono     { color:#374151; }
[data-theme="light"] td.money.positive { color:#15803d; }
[data-theme="light"] td.money.negative { color:#b91c1c; }
[data-theme="light"] .filter-bar    { background:#f8fafc; border:1px solid var(--border); }
[data-theme="light"] .tabs          { background:#f0f4f8; }
[data-theme="light"] .tab-btn.active{ background:#fff; color:#92670a; }
[data-theme="light"] .tab-btn       { color:#6b7280; }
[data-theme="light"] .sidebar-bottom-nav { border-top:1px solid var(--border); }
[data-theme="light"] .mobile-nav-toggle  { background:#fff; border:1px solid var(--border); color:#374151; }

/* ========== LAYOUT ========== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ========== SIDEBAR ========== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-800);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dk));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #0a0f1e;
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(212,168,83,0.4);
}

.brand-text { flex: 1; min-width: 0; }
.brand-name { display: block; font-weight: 700; font-size: 13px; color: var(--text-primary); }
.brand-sub  { display: block; font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; }

/* ── Main nav (scrollable top section) ── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

/* ── Bottom nav (above user/logout) ── */
.sidebar-bottom-nav {
  padding: 8px 12px 4px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
}

.nav-item:hover {
  background: var(--bg-700);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(212,168,83,0.15), rgba(212,168,83,0.05));
  color: var(--gold-lt);
  border: 1px solid rgba(212,168,83,0.2);
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}

.user-avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--teal), #1a8a70);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: white;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.logout-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 18px;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition);
}
.logout-btn:hover { color: var(--red); }

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
  background: var(--bg-800);
  position: sticky; top: 0; z-index: 50;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.current-date {
  font-size: 12px;
  color: var(--text-muted);
}

.content-area {
  padding: 28px 32px;
  flex: 1;
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========== STATS GRID ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: var(--border-lg);
  transform: translateY(-2px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}

.stat-card.gold::before  { background: linear-gradient(90deg, var(--gold), var(--gold-lt)); }
.stat-card.teal::before  { background: linear-gradient(90deg, var(--teal), var(--teal-lt)); }
.stat-card.red::before   { background: linear-gradient(90deg, var(--red), #f87171); }
.stat-card.green::before { background: linear-gradient(90deg, var(--green), var(--green-lt)); }
.stat-card.blue::before  { background: linear-gradient(90deg, var(--blue), #93c5fd); }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-value.gold  { color: var(--gold-lt); }
.stat-value.teal  { color: var(--teal-lt); }
.stat-value.red   { color: var(--red-lt); }
.stat-value.green { color: var(--green-lt); }

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========== TABLES ========== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  background: var(--bg-700);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.03); }

tbody td {
  padding: 11px 16px;
  color: var(--text-primary);
  vertical-align: middle;
}

td.money {
  font-family: var(--font-mono);
  font-weight: 500;
}
td.money.positive { color: var(--green-lt); }
td.money.negative { color: var(--red-lt); }

/* ========== FORMS ========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
select,
textarea {
  background: var(--bg-700);
  border: 1px solid var(--border-lg);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  padding: 10px 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,168,83,0.15);
}

textarea { min-height: 90px; resize: vertical; }

select option { background: var(--bg-700); }

.input-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dk));
  color: #0a0f1e;
  box-shadow: 0 2px 12px rgba(212,168,83,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-lt), var(--gold));
  box-shadow: 0 4px 20px rgba(212,168,83,0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-600);
  color: var(--text-primary);
  border: 1px solid var(--border-lg);
}
.btn-secondary:hover { background: var(--bg-700); }

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

.btn-teal {
  background: linear-gradient(135deg, var(--teal), #1a8a70);
  color: white;
  box-shadow: 0 2px 12px rgba(34,196,160,0.3);
}
.btn-teal:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ========== BADGES ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.badge-green  { background: rgba(34,197,94,0.15);  color: var(--green-lt); }
.badge-red    { background: rgba(239,68,68,0.15);  color: var(--red-lt); }
.badge-gold   { background: rgba(212,168,83,0.15); color: var(--gold-lt); }
.badge-teal   { background: rgba(34,196,160,0.15); color: var(--teal-lt); }
.badge-gray   { background: rgba(255,255,255,0.07); color: var(--text-muted); }
.badge-blue   { background: rgba(59,130,246,0.15); color: #93c5fd; }

/* ========== FLASH MESSAGES ========== */
.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 500;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.25); color: var(--green-lt); }
.flash-error   { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.25); color: var(--red-lt); }
.flash-warning { background: rgba(249,115,22,0.12); border: 1px solid rgba(249,115,22,0.25); color: #fdba74; }
.flash-info    { background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.25); color: #93c5fd; }

/* ========== LOGIN PAGE ========== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-900);
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(212,168,83,0.06) 0%, transparent 70%);
  top: -200px; right: -200px;
  pointer-events: none;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34,196,160,0.05) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  pointer-events: none;
}

.login-card {
  background: var(--bg-800);
  border: 1px solid var(--border-lg);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}

.login-brand { text-align: center; margin-bottom: 36px; }

.login-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dk));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #0a0f1e;
  margin: 0 auto 16px;
  box-shadow: 0 4px 24px rgba(212,168,83,0.35);
}

.login-title { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.login-sub   { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-700);
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}

.tab-btn {
  padding: 8px 20px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--bg-panel);
  color: var(--gold-lt);
  box-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ========== FILTER BAR ========== */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 20px;
  background: var(--bg-panel);
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-bar .form-group {
  min-width: 140px;
  flex: 1;
}

/* ========== REPORT STYLES ========== */
.report-header { text-align: center; padding: 24px; border-bottom: 2px solid var(--gold); margin-bottom: 24px; }
.report-title  { font-size: 22px; font-weight: 800; color: var(--gold-lt); }
.report-subtitle { font-size: 13px; color: var(--text-secondary); }
.report-section { margin-bottom: 28px; }
.report-section h3 { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.report-totals { background: var(--bg-700); border-radius: var(--radius); padding: 16px 20px; }
.report-totals .total-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.report-totals .total-row.grand { border-top: 1px solid var(--border-lg); margin-top: 8px; padding-top: 12px; font-weight: 700; font-size: 16px; }

.ssa-box {
  background: rgba(212,168,83,0.08);
  border: 1px solid rgba(212,168,83,0.25);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}
.ssa-box h3 { color: var(--gold-lt); margin-bottom: 10px; font-size: 14px; }

/* ========== PAGINATION ========== */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 20px; }

.page-link {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
  text-decoration: none; color: var(--text-secondary);
  background: var(--bg-panel); border: 1px solid var(--border);
  transition: all var(--transition);
}
.page-link:hover { border-color: var(--gold); color: var(--gold-lt); }
.page-link.active { background: var(--gold); color: #0a0f1e; border-color: var(--gold); }

/* ========== UTILITIES ========== */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.text-gold    { color: var(--gold-lt); }
.text-green   { color: var(--green-lt); }
.text-red     { color: var(--red-lt); }
.text-teal    { color: var(--teal-lt); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 16px; }
.font-mono { font-family: var(--font-mono); }
.small { font-size: 12px; }

/* ========== MOBILE NAV TOGGLE ========== */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  background: var(--bg-700);
  border: 1px solid var(--border-lg);
  border-radius: 8px;
  width: 42px; height: 42px;
  align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
  color: var(--text-primary);
  box-shadow: var(--shadow);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
  .content-area { padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid  { grid-template-columns: repeat(2, 1fr); }
  tbody td, thead th { padding: 9px 10px; font-size: 13px; }
}

@media (max-width: 768px) {
  html { font-size: 14px; }
  .mobile-nav-toggle { display: flex; }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }

  .page-header { padding: 14px 16px 14px 64px; position: sticky; top: 0; z-index: 50; }
  .page-title  { font-size: 17px; }
  .current-date { display: none; }
  .content-area { padding: 16px 12px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card  { padding: 14px; }
  .stat-value { font-size: 20px; }
  .stat-label { font-size: 10px; }
  .stat-sub   { font-size: 10px; }

  .card { padding: 16px; margin-bottom: 14px; }
  .card-title { font-size: 12px; margin-bottom: 12px; }
  .form-grid  { grid-template-columns: 1fr !important; gap: 12px; }
  .form-group.full { grid-column: 1; }

  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], input[type="tel"],
  select, textarea { font-size: 16px; padding: 12px 14px; }

  .btn    { padding: 11px 16px; font-size: 13px; }
  .btn-sm { padding: 8px 12px;  font-size: 12px; }
  .btn-row { gap: 8px; }
  .btn-row .btn { flex: 1; justify-content: center; }

  .filter-bar { flex-direction: column; gap: 10px; padding: 12px; }
  .filter-bar .form-group { min-width: unset; width: 100%; }

  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
  table       { min-width: 500px; font-size: 12px; }
  thead th    { padding: 10px 10px; font-size: 10px; }
  tbody td    { padding: 9px 10px; }

  .hide-mobile { display: none !important; }

  .flex-between { flex-direction: column; align-items: flex-start; gap: 10px; }
  .flex-between .btn { width: 100%; justify-content: center; }

  .login-card { margin: 16px; padding: 32px 24px; }

  div[style*="grid-template-columns:1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr;gap:20px"] {
    display: flex !important;
    flex-direction: column !important;
  }

  div[style*="grid-template-columns:repeat(3,1fr)"],
  div[style*="grid-template-columns:repeat(4,1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  div[id^="avail-"] { min-width: unset !important; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:repeat(2,1fr)"] { grid-template-columns: 1fr !important; }
  .login-card { padding: 24px 16px; }
  .page-title { font-size: 15px; }
}

/* ========== PRINT (for reports) ========== */
@media print {
  .sidebar, .page-header, .btn, .filter-bar, .no-print,
  .mobile-nav-toggle, .sidebar-overlay { display: none !important; }
  .main-content { margin-left: 0; }
  body { background: white; color: black; }
  .card     { border: 1px solid #ccc; background: white; }
  .stat-card { border: 1px solid #ccc; background: white; }
  .stat-value { color: black; }
  .stat-label { color: #555; }
  table { font-size: 12px; }
  thead th { background: #f0f0f0; color: black; }
}
