/* BillTracker - Main Stylesheet */

/* ===== CSS VARIABLES / THEME ===== */
:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --border-light: #475569;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: rgba(99,102,241,0.15);
  --success: #22c55e;
  --success-light: rgba(34,197,94,0.15);
  --danger: #ef4444;
  --danger-light: rgba(239,68,68,0.15);
  --warning: #f59e0b;
  --warning-light: rgba(245,158,11,0.15);
  --info: #06b6d4;
  --info-light: rgba(6,182,212,0.15);
  --income-color: #22c55e;
  --bill-color: #ef4444;
  --nav-width: 260px;
  --header-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --transition: 0.18s ease;
}

[data-theme="light"] {
  --bg-primary: #f1f5f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99,102,241,0.1);
  --success-light: rgba(34,197,94,0.1);
  --danger-light: rgba(239,68,68,0.1);
  --warning-light: rgba(245,158,11,0.1);
  --info-light: rgba(6,182,212,0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; }

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

.main-content {
  flex: 1;
  margin-left: var(--nav-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
}

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

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo .logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sidebar-logo .logo-text span { color: var(--accent); }

.nav-section {
  padding: 12px 12px 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
}

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

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

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

.sidebar-bottom {
  margin-top: auto;
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
}

.user-avatar {
  width: 32px; height: 32px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.user-role { font-size: 0.75rem; color: var(--text-muted); }

/* ===== HEADER ===== */
.page-header {
  padding: 20px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 2px;
}

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

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-value.income { color: var(--income-color); }
.stat-value.expense { color: var(--bill-color); }
.stat-value.neutral { color: var(--accent); }

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { opacity: 0.88; color: #fff; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { opacity: 0.88; color: #fff; }

.btn-warning {
  background: var(--warning);
  color: #000;
  border-color: var(--warning);
}
.btn-warning:hover { opacity: 0.88; }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover {
  background: var(--accent-light);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--accent-light); color: var(--text-primary); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 1rem; }
.btn-icon { padding: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M8 10.5l-4-4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-check-label { font-size: 0.875rem; color: var(--text-secondary); }

.freq-value-group {
  display: none;
}
.freq-value-group.visible { display: block; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

tbody tr:hover { background: var(--accent-light); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 12px 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

tbody td .cell-primary,
td.cell-primary { color: var(--text-primary); font-weight: 500; }
tbody td .cell-sub,
td.cell-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 1px; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-income   { background: var(--success-light); color: var(--success); }
.badge-bill     { background: var(--danger-light);  color: var(--danger); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-info     { background: var(--info-light);    color: var(--info); }
.badge-default  { background: var(--bg-primary);    color: var(--text-muted); border: 1px solid var(--border); }
.badge-success  { background: var(--success-light); color: var(--success); }
.badge-danger   { background: var(--danger-light);  color: var(--danger); }
.badge-accent   { background: var(--accent-light);  color: var(--accent); }

/* ===== ALERTS / FLASH ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert-success { background: var(--success-light); color: var(--success); border-color: rgba(34,197,94,0.3); }
.alert-danger   { background: var(--danger-light);  color: var(--danger);  border-color: rgba(239,68,68,0.3); }
.alert-warning  { background: var(--warning-light); color: var(--warning); border-color: rgba(245,158,11,0.3); }
.alert-info     { background: var(--info-light);    color: var(--info);    border-color: rgba(6,182,212,0.3); }

/* ===== MODAL ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition);
}

.modal-backdrop.open .modal {
  transform: translateY(0);
}

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

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== AMOUNT COLORS ===== */
.amount-income { color: var(--income-color); font-weight: 600; }
.amount-bill   { color: var(--bill-color);   font-weight: 600; }
.amount-neutral { color: var(--text-primary); font-weight: 600; }

/* ===== CALENDAR ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-header {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
}

.cal-day {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 90px;
  padding: 6px;
  vertical-align: top;
  transition: background var(--transition);
}

.cal-day:hover { background: var(--accent-light); }

.cal-day.other-month { opacity: 0.35; }

.cal-day.today {
  border-color: var(--accent);
  background: var(--accent-light);
}

.cal-day-number {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.cal-day.today .cal-day-number { color: var(--accent); }

.cal-event {
  font-size: 0.7rem;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.cal-event.income { background: var(--success-light); color: var(--success); }
.cal-event.bill   { background: var(--danger-light);  color: var(--danger); }
.cal-event.due-soon { background: var(--warning-light); color: var(--warning); }
.cal-event.paid   { background: var(--bg-primary); color: var(--text-muted); text-decoration: line-through; }

/* ===== FORECAST TABLE ===== */
.forecast-table tr.income-row { background: rgba(34,197,94,0.04); }
.forecast-table tr.bill-row   { background: rgba(239,68,68,0.04); }
.balance-positive { color: var(--success); font-weight: 700; }
.balance-negative { color: var(--danger);  font-weight: 700; }
.balance-warning  { color: var(--warning); font-weight: 700; }

/* ===== TIMELINE / ACTIVITY FEED ===== */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-dot {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.timeline-dot.income { background: var(--success-light); color: var(--success); }
.timeline-dot.bill   { background: var(--danger-light);  color: var(--danger); }
.timeline-dot.due-soon { background: var(--warning-light); color: var(--warning); }

.timeline-content { flex: 1; }

.timeline-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.timeline-amount {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ===== PROGRESS BARS ===== */
.progress { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-bar.income { background: var(--income-color); }
.progress-bar.bill { background: var(--bill-color); }
.progress-bar.accent { background: var(--accent); }

/* ===== EMPTY STATES ===== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; max-width: 320px; margin: 0 auto 16px; }

/* ===== SEARCH / FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-input-wrap .search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-input-wrap input {
  padding-left: 32px;
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding-top: 16px;
}

.page-link {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
}

.page-link:hover, .page-link.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ===== CHARTS ===== */
.chart-container { position: relative; width: 100%; }

/* ===== NOTIFICATIONS ===== */
.notification-list { display: flex; flex-direction: column; gap: 8px; }

.notification-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  align-items: flex-start;
}

.notification-item.overdue   { background: var(--danger-light);  border-color: rgba(239,68,68,0.2);  }
.notification-item.due-soon  { background: var(--warning-light); border-color: rgba(245,158,11,0.2); }
.notification-item.income-soon { background: var(--success-light); border-color: rgba(34,197,94,0.2); }

.notification-icon { font-size: 1.1rem; margin-top: 1px; flex-shrink: 0; }
.notification-title { font-size: 0.875rem; font-weight: 600; }
.notification-body  { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ===== TOPBAR (mobile) ===== */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 150;
}

.topbar-logo { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.topbar-logo span { color: var(--accent); }

.mobile-menu-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--text-primary); }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}

.login-logo .logo-icon {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.login-logo .logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
}

.login-logo .logo-text span { color: var(--accent); }

.login-title {
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

/* ===== INSTALL WIZARD ===== */
.wizard-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg-primary);
}

.wizard-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
}

.wizard-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 28px;
}

.wizard-step-dot {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
}
.wizard-step-dot.active { background: var(--accent); }
.wizard-step-dot.done   { background: var(--success); }

/* ===== CATEGORY COLOR DOTS ===== */
.color-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding-top: var(--header-height); }
  .topbar { display: flex; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .cal-day { min-height: 60px; }
  .cal-event { display: none; }
  .cal-day.has-events::after {
    content: '•';
    display: block;
    text-align: center;
    color: var(--accent);
  }
  .login-card { padding: 24px 20px; }
  .modal { margin: 0 8px; }
  .page-header { padding: 12px 16px 0; }
  .page-title { font-size: 1.3rem; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
}

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

.sidebar-overlay.open { display: block; }

/* ===== UTILITY ===== */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent  { color: var(--accent); }
.text-sm { font-size: 0.82rem; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-100 { width: 100%; }
.overflow-auto { overflow: auto; }
.hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.rounded { border-radius: var(--radius-sm); }
.p-0 { padding: 0 !important; }
