/* layout.css — Modern Sidebar, Navbar, Responsive — FULLY FIXED */

/* ─── CSS VARIABLES ──────────────────────────────────────────── */
:root {
  --bg-base: #f5f7fb;
  --bg-surface: #ffffff;
  --bg-elevated: #f8fafc;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --text-primary: #0a0f1c;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --accent: #3b82f6;
  --accent-dark: #2563eb;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59,130,246,0.08);
  --accent-soft: rgba(59,130,246,0.12);

  --green: #10b981;
  --green-soft: rgba(16,185,129,0.1);
  --red: #ef4444;
  --red-soft: rgba(239,68,68,0.1);
  --yellow: #f59e0b;
  --yellow-soft: rgba(245,158,11,0.1);
  --purple: #8b5cf6;
  --purple-soft: rgba(139,92,246,0.1);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6,182,212,0.1);
  --orange: #f97316;
  --orange-soft: rgba(249,115,22,0.1);

  --sidebar-width: 260px;
  --navbar-height: 64px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 24px rgba(0,0,0,0.1);
  --shadow-elevated: 0 20px 40px rgba(0,0,0,0.12);
  --shadow-glow: 0 0 0 3px rgba(59,130,246,0.15);

  --transition-fast: 150ms cubic-bezier(0.4,0,0.2,1);
  --transition-base: 200ms cubic-bezier(0.4,0,0.2,1);
  --transition-slow: 300ms cubic-bezier(0.4,0,0.2,1);
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-base: #0a0f1c;
  --bg-surface: #111827;
  --bg-elevated: #1f2937;
  --bg-card: #1e293b;
  --bg-hover: #2d3a4f;
  --border: #2d3a4f;
  --border-light: #1f2937;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #9ca3af;
  --accent: #60a5fa;
  --accent-dark: #3b82f6;
}

/* ─── GLOBAL RESETS ──────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

#app { display: contents; }

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-elevated); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow);
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* ─── LOGO ───────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}

.sidebar-logo-text {
  display: flex; flex-direction: column; line-height: 1.2;
  overflow: hidden;
}
.sidebar-logo-text span:first-child {
  font-size: 0.9rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap;
}
.sidebar-logo-text span:last-child {
  font-size: 0.65rem; color: var(--text-muted); font-weight: 500;
  white-space: nowrap;
}

/* ─── NAV ────────────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 0.65rem; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin: 2px 0;
  border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  border-left: 3px solid var(--accent);
}
.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }

/* ─── SIDEBAR FOOTER ─────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 16px;
  margin-top: auto;
  flex-shrink: 0;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-name {
  font-size: 0.8rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  font-size: 0.65rem; color: var(--accent);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}

.logout-btn {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  padding: 7px; border-radius: var(--radius-sm);
  display: flex; align-items: center;
  transition: all var(--transition-fast); flex-shrink: 0;
}
.logout-btn:hover { background: var(--red-soft); color: var(--red); }

/* ─── NAVBAR ─────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--navbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.navbar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nav-icon-btn {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
  background: transparent;
  border: none;
  flex-shrink: 0;
}
.nav-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

#refresh-btn:hover svg { animation: spin-once 0.5s ease; }
@keyframes spin-once {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.notif-dot {
  position: absolute;
  top: 9px; right: 9px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.7; transform: scale(1.2); }
}

.hamburger {
  display: none;
  background: none; border: none;
  cursor: pointer; color: var(--text-secondary);
  padding: 8px; border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.hamburger:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  min-height: calc(100vh - var(--navbar-height));
  background: var(--bg-base);
  padding: 24px;
}

/* ─── NOTIFICATION DROPDOWN ──────────────────────────────────── */
.notif-dropdown {
  position: fixed;
  top: var(--navbar-height);
  right: 12px;
  width: 360px;
  max-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-elevated);
  z-index: 95;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notif-dropdown.hidden { display: none; }

.notif-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem; font-weight: 600;
  flex-shrink: 0;
}
.notif-list { overflow-y: auto; flex: 1; }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 12px;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--accent-glow); border-left: 3px solid var(--accent); }

.notif-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.notif-message {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  word-break: break-word;
}

.notif-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.notif-delete {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.notif-item:hover .notif-delete {
  opacity: 1;
}
.notif-delete:hover {
  background: var(--red-soft);
  color: var(--red);
}

.notif-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.mark-all-read {
  font-size: 0.7rem;
  padding: 4px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
}
.mark-all-read:hover {
  text-decoration: underline;
}

/* ─── BADGES ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-active  { background: var(--green-soft); color: var(--green); }
.badge-expired { background: var(--red-soft);   color: var(--red);   }
.badge-red     { background: var(--red-soft);   color: var(--red);   }
.badge-expiring,
.badge-warning { background: var(--yellow-soft); color: var(--yellow); }
.badge-paid,
.badge-success,
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-purple  { background: var(--purple-soft); color: var(--purple); }
.badge-gray,
.badge-info { background: var(--bg-elevated); color: var(--text-secondary); }
.badge-muted   { background: var(--bg-elevated); color: var(--text-muted); }

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.8125rem; font-weight: 500;
  cursor: pointer; border: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff; box-shadow: var(--shadow-sm);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-secondary {
  background: var(--bg-elevated); color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-ghost {
  background: transparent; color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-danger {
  background: var(--red-soft); color: var(--red);
  border: 1px solid rgba(239,68,68,.25);
}
.btn-danger:hover { background: var(--red); color: #fff; transform: translateY(-1px); }
.btn-success {
  background: var(--green-soft); color: var(--green);
  border: 1px solid rgba(16,185,129,.25);
}
.btn-success:hover { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 0.75rem; }
.btn-lg { padding: 11px 22px; font-size: 0.9375rem; }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* ─── TABLE ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.data-table thead { background: var(--bg-elevated); border-bottom: 1px solid var(--border); }
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ─── FORM ───────────────────────────────────────────────────── */
.form-group {
  display: flex; flex-direction: column; gap: 7px;
  margin-bottom: 18px;
}
.form-group label {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.875rem;
  padding: 10px 13px;
  transition: all var(--transition-fast);
  width: 100%; outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: 0.875rem; font-weight: 500;
  color: var(--text-primary);
  text-transform: none; letter-spacing: 0;
}
.form-group input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.form-group textarea { resize: vertical; min-height: 80px; }

/* ─── SEARCH BAR ─────────────────────────────────────────────── */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: all var(--transition-fast);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.search-bar input {
  background: none; border: none; outline: none;
  font-size: 0.8125rem; color: var(--text-primary);
  width: 200px;
}
.search-bar svg { color: var(--text-muted); flex-shrink: 0; width: 14px; height: 14px; }

/* ─── TABS ───────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}
.tabs::-webkit-scrollbar { height: 0; }
.tab {
  padding: 9px 16px;
  font-size: 0.8125rem; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ─── CARD ───────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* ─── SECTION HEADER ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* ─── MODAL ──────────────────────────────────────────────────── */
.modal {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-elevated);
  animation: modal-in 0.2s ease;
}
@keyframes modal-in {
  from { opacity:0; transform: translateY(20px) scale(0.97); }
  to   { opacity:1; transform: translateY(0)    scale(1);    }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg-card); z-index: 1;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 600; }
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 1.2rem;
  transition: all var(--transition-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--red); }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  position: sticky; bottom: 0;
}

/* ─── SPINNER ────────────────────────────────────────────────── */
.spinner-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 22px; right: 22px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1100;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 260px; max-width: 380px;
  animation: toast-in 0.2s ease;
  border-left: 4px solid;
}
@keyframes toast-in {
  from { opacity:0; transform: translateX(80px); }
  to   { opacity:1; transform: translateX(0); }
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red);   }
.toast.warning { border-left-color: var(--yellow); }
.toast.info    { border-left-color: var(--accent); }
.toast-message { flex: 1; font-size: 0.8125rem; }
.toast-icon svg { width: 16px; height: 16px; }

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

/* ─── STATS GRID — Fixed 3-column layout ────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  border-color: var(--accent-light);
}

.stat-card:hover::before { opacity: 1; }

.stat-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--text-muted);
  line-height: 1.3;
}

.stat-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon { transform: scale(1.1) rotate(-4deg); }

.stat-icon.blue   { background: var(--accent-soft);  color: var(--accent);  }
.stat-icon.green  { background: var(--green-soft);   color: var(--green);   }
.stat-icon.red    { background: var(--red-soft);     color: var(--red);     }
.stat-icon.purple { background: var(--purple-soft);  color: var(--purple);  }
.stat-icon.yellow { background: var(--yellow-soft);  color: var(--yellow);  }
.stat-icon.cyan   { background: var(--cyan-soft);    color: var(--cyan);    }
.stat-icon.orange { background: var(--orange-soft);  color: var(--orange);  }

.stat-value {
  font-size: 2rem; font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em; line-height: 1;
  margin-bottom: 6px;
}

.stat-sub {
  font-size: 0.72rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}

/* ─── CHARTS ─────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 0.875rem; font-weight: 600;
  margin-bottom: 16px; color: var(--text-primary);
}

/* ─── REMINDER ITEM ──────────────────────────────────────────── */
.reminder-item {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-left: 3px solid var(--border);
}
.reminder-item.high   { border-left-color: var(--red);    background: var(--red-soft); }
.reminder-item.medium { border-left-color: var(--yellow); background: var(--yellow-soft); }
.reminder-item.low    { border-left-color: var(--green);  background: var(--green-soft); }

/* ─── EXPORT FORMAT CARDS ────────────────────────────────────── */
.export-grid { display: grid; gap: 16px; }
.export-format-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 20px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-base);
  text-align: center;
}
.export-format-card:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}
.export-format-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.export-format-label { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); }
.export-format-sub   { font-size: 0.7rem; color: var(--text-muted); }

/* ─── PINCODE ────────────────────────────────────────────────── */
.pincode-success { border-color: var(--green) !important; background: var(--green-soft) !important; }
.pincode-error   { border-color: var(--red) !important; background: var(--red-soft) !important; }

/* ─── ACTION BUTTONS ─────────────────────────────────────────── */
.action-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.btn-icon.danger:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* ─── USER MANAGEMENT SPECIFIC ───────────────────────────────── */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar-small {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}
.role-admin {
  background: var(--purple-soft);
  color: var(--purple);
}
.role-user {
  background: var(--accent-soft);
  color: var(--accent);
}
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}
.status-badge:hover {
  opacity: 0.8;
}
.status-active {
  background: var(--green-soft);
  color: var(--green);
}
.status-inactive {
  background: var(--red-soft);
  color: var(--red);
}
.error-text {
  color: var(--red);
  text-align: center;
  padding: 20px;
}
.empty-state-text {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ─── UTILITIES ──────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-4  { gap: 4px;  }
.gap-8  { gap: 8px;  }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.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-left     { text-align: left; }
.text-right    { text-align: right; }
.text-muted    { color: var(--text-muted); }
.text-accent   { color: var(--accent); }
.text-success  { color: var(--green); }
.text-danger   { color: var(--red); }
.text-warning  { color: var(--yellow); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.mono {
  font-family: 'JetBrains Mono', 'SF Mono', 'Courier New', monospace;
  font-size: 0.85em;
  letter-spacing: -0.01em;
}
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.hidden { display: none !important; }

/* ─── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stat-card  { animation: fadeUp 0.3s ease backwards; }
.stat-card:nth-child(1) { animation-delay: 0.04s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.12s; }
.stat-card:nth-child(4) { animation-delay: 0.16s; }
.stat-card:nth-child(5) { animation-delay: 0.20s; }
.stat-card:nth-child(6) { animation-delay: 0.24s; }

/* ─── RESPONSIVE — TABLET (≤1024px) ─────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
  .stats-grid  { grid-template-columns: repeat(3, 1fr); }
  .charts-row  { grid-template-columns: 1fr; }
  .main-content { padding: 20px; }
  .export-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

/* ─── RESPONSIVE — TABLET SMALL (≤900px) ────────────────────── */
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── RESPONSIVE — MOBILE (≤768px) ──────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-elevated);
  }
  .sidebar-overlay.open { display: block; }

  .hamburger { display: flex; }

  .navbar { left: 0; padding: 0 14px; gap: 8px; }
  .navbar-title { font-size: 0.9rem; }

  .main-content { margin-left: 0; padding: 14px; }

  .notif-dropdown { left: 10px; right: 10px; width: auto; top: var(--navbar-height); }

  .section-header { flex-direction: column; align-items: flex-start; }
  .section-header > div:last-child { flex-wrap: wrap; width: 100%; gap: 8px; }

  .search-bar { flex: 1; min-width: 0; }
  .search-bar input { width: 100%; }

  .form-grid { grid-template-columns: 1fr !important; gap: 14px; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-content { border-radius: 20px 20px 0 0; max-width: 100%; max-height: 90vh; }

  .toast-container { left: 12px; right: 12px; bottom: 14px; }
  .toast { min-width: 0; max-width: 100%; width: 100%; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-value { font-size: 1.5rem; }
  
  .export-grid { grid-template-columns: 1fr; }
}

/* ─── RESPONSIVE — SMALL MOBILE (≤480px) ────────────────────── */
@media (max-width: 480px) {
  html { font-size: 14px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 1.35rem; }
  .stat-card { padding: 14px 15px; }

  .nav-icon-btn { width: 34px; height: 34px; }
  .navbar-title { font-size: 0.85rem; max-width: 140px; }

  .btn { padding: 7px 12px; font-size: 0.75rem; }
  .btn-sm { padding: 4px 9px; font-size: 0.7rem; }

  .data-table th,
  .data-table td { padding: 9px 10px; font-size: 0.75rem; }

  .badge { padding: 2px 7px; font-size: 0.64rem; }

  .card { padding: 14px; }
  .section-title { font-size: 1.1rem; }
  .main-content { padding: 10px; }

  .modal-header, .modal-body, .modal-footer { padding: 14px; }
  .tabs .tab { padding: 8px 12px; font-size: 0.75rem; }
}

/* ─── RESPONSIVE — TINY (≤380px) ────────────────────────────── */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .navbar-title { max-width: 100px; }
  .navbar-actions { gap: 2px; }
  .nav-icon-btn { width: 30px; height: 30px; }
}

/* ─── PRINT ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .navbar, .btn, .modal, .toast-container, .spinner-overlay,
  .action-buttons, .nav-icon-btn, .hamburger, .notif-dropdown {
    display: none !important;
  }
  .main-content { margin: 0 !important; padding: 0 !important; }
  body { background: white; color: black; }
  .stat-card { animation: none; box-shadow: none; border: 1px solid #ddd; }
  .data-table { border: 1px solid #ddd; }
}