/* =============================================
   LEDGERPRO — PROFESSIONAL ACCOUNTING SOFTWARE
   Premium Dark Fintech UI
   ============================================= */

:root {
  --bg: #080c14;
  --surface: #0e1420;
  --card: #131b2a;
  --card2: #1a2438;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(245,158,11,0.2);
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #475569;
  --accent: #f59e0b;
  --accent2: #d97706;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.3);
  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Playfair Display', serif;
  --transition: 0.2s ease;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(245,158,11,0.3);
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-card: 0 2px 16px rgba(0,0,0,0.06);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ========================
   AUTH SCREEN
   ======================== */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}

.auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
}
.orb1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #f59e0b, transparent 70%);
  top: -150px; left: -150px;
  animation: float 8s ease-in-out infinite;
}
.orb2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #3b82f6, transparent 70%);
  bottom: -100px; right: -100px;
  animation: float 10s ease-in-out infinite reverse;
}

.auth-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 50px 50px;
}

@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.05); }
}

.auth-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 40px; height: 40px;
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.brand-icon.sm { width: 32px; height: 32px; border-radius: 8px; }

.brand-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-header h1 {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-header p { color: var(--text2); font-size: 13px; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}
.form-input::placeholder { color: var(--text3); }

.input-wrap { position: relative; }
.input-wrap .form-input { padding-right: 44px; }
.eye-btn {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 16px;
  padding: 4px;
  opacity: 0.6;
  transition: var(--transition);
}
.eye-btn:hover { opacity: 1; }

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  cursor: pointer;
}
.link-text {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  transition: var(--transition);
}
.link-text:hover { color: var(--accent2); }

.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(245,158,11,0.3);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary.sm { padding: 8px 14px; font-size: 13px; }
.btn-full { width: 100%; }

.btn-ghost {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: var(--transition);
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--red);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,0.25); }

.btn-edit {
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.2);
  color: var(--blue);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
}
.btn-edit:hover { background: rgba(59,130,246,0.2); }

.auth-switch {
  text-align: center;
  font-size: 13px;
  color: var(--text2);
}
.auth-switch a { color: var(--accent); font-weight: 600; }

.demo-hint {
  background: rgba(245,158,11,0.08);
  border: 1px dashed rgba(245,158,11,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--accent);
  font-family: var(--mono);
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-close {
  display: none;
  color: var(--text2);
  font-size: 18px;
  padding: 4px;
  transition: var(--transition);
}
.sidebar-close:hover { color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text3);
  padding: 12px 10px 6px;
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}
.nav-item:hover {
  background: var(--card);
  color: var(--text);
}
.nav-item.active {
  background: rgba(245,158,11,0.1);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: #000;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text3); }

.logout-btn {
  color: var(--text3);
  font-size: 16px;
  padding: 4px;
  transition: var(--transition);
}
.logout-btn:hover { color: var(--red); }

.theme-toggle {
  background: var(--card2);
  border: 1px solid var(--border);
  color: var(--text2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: var(--transition);
  width: 100%;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

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

.top-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.hamburger {
  display: none;
  color: var(--text2);
  font-size: 20px;
  padding: 4px;
  transition: var(--transition);
}
.hamburger:hover { color: var(--text); }

.page-title {
  flex: 1;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
}

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-heading {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.page-sub { font-size: 13px; color: var(--text2); }

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

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.credit::before { background: var(--green); }
.stat-card.debit::before { background: var(--red); }
.stat-card.balance::before { background: var(--accent); }
.stat-card.emi::before { background: var(--purple); }

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

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.credit .stat-icon { background: rgba(16,185,129,0.1); color: var(--green); }
.debit .stat-icon { background: rgba(239,68,68,0.1); color: var(--red); }
.balance .stat-icon { background: rgba(245,158,11,0.1); color: var(--accent); }
.emi .stat-icon { background: rgba(139,92,246,0.1); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; gap: 2px; }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text2); }
.stat-value { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--text); }
.stat-change { font-size: 11px; color: var(--text3); }

/* DASHBOARD GRID */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dash-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.dash-card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.recent-list { display: flex; flex-direction: column; gap: 1px; }

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }

.recent-type {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.recent-type.credit { background: rgba(16,185,129,0.1); color: var(--green); }
.recent-type.debit { background: rgba(239,68,68,0.1); color: var(--red); }

.recent-info { flex: 1; min-width: 0; }
.recent-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-desc { font-size: 11px; color: var(--text3); }
.recent-amount { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }

.account-summary-list { display: flex; flex-direction: column; gap: 8px; }

.acc-sum-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card2);
  border-radius: var(--radius-sm);
}
.acc-sum-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.acc-sum-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); }
.acc-sum-bal { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.acc-sum-bal.pos { color: var(--green); }
.acc-sum-bal.neg { color: var(--red); }

/* TABLES */
.table-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text3); }

.filter-select {
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font);
}
.filter-select:focus { border-color: var(--accent); }

.summary-strip {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.sum-item { display: flex; flex-direction: column; gap: 2px; }
.sum-lbl { font-size: 11px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px; }
.sum-val { font-family: var(--mono); font-size: 15px; font-weight: 600; color: var(--text); }
.sum-val.green { color: var(--green); }
.sum-val.red { color: var(--red); }
.sum-val.amber { color: var(--accent); }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--card2);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}
.data-table th:hover { color: var(--accent); }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-credit { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-debit { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.badge-emi { background: rgba(139,92,246,0.12); color: var(--purple); border: 1px solid rgba(139,92,246,0.2); }
.badge-paid { background: rgba(16,185,129,0.12); color: var(--green); border: 1px solid rgba(16,185,129,0.2); }
.badge-pending { background: rgba(245,158,11,0.12); color: var(--accent); border: 1px solid rgba(245,158,11,0.2); }
.badge-overdue { background: rgba(239,68,68,0.12); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }

.mono-val { font-family: var(--mono); }

.actions-wrap { display: flex; gap: 6px; align-items: center; }

.pagination {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}

/* EMI STATS */
.emi-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.emi-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 160px;
}

/* REPORT OUTPUT */
.report-filters {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  align-items: center;
}

#report-output { display: flex; flex-direction: column; gap: 20px; }

.report-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.report-section-header {
  padding: 14px 20px;
  background: var(--card2);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* EXPORT */
.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.export-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.export-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245,158,11,0.1);
}
.export-icon { font-size: 36px; margin-bottom: 4px; }
.export-card h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.export-card p { font-size: 12px; color: var(--text2); }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  animation: slideUp 0.3s ease;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}
.modal-header h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
}
.modal-close {
  color: var(--text2);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: var(--transition);
}
.modal-close:hover { background: var(--card2); color: var(--text); }

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body .form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-body select.form-input option {
  background: var(--card);
  color: var(--text);
}

.emi-section {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toggle-label { font-size: 13px; font-weight: 600; color: var(--text); }

.toggle {
  width: 40px; height: 22px;
  background: var(--border);
  border-radius: 11px;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  top: 3px; left: 3px;
  transition: var(--transition);
}
.toggle.on::after { transform: translateX(18px); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}
.toast.success { background: #065f46; border: 1px solid var(--green); }
.toast.error { background: #7f1d1d; border: 1px solid var(--red); }
.toast.info { background: #1e3a5f; border: 1px solid var(--blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* OVERLAY */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

/* HELPERS */
.hidden { display: none !important; }
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text3);
  font-size: 13px;
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
  .top-bar { padding: 14px 16px; }
  .table-toolbar.multi { flex-direction: column; }
  .section-header { flex-direction: column; }
  .auth-card { padding: 24px; }
  .modal-body .form-row-2 { grid-template-columns: 1fr; }
}

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

/* PRINT STYLES */
@media print {
  .sidebar, .top-bar, .table-toolbar, .pagination, .actions-wrap { display: none !important; }
  .main-content { margin-left: 0; }
  body { background: #fff; color: #000; }
  .data-table { border: 1px solid #ddd; }
  .data-table th, .data-table td { border: 1px solid #ddd; color: #000; }
}
