﻿/* ============================================================
   AEIRCAS ERP — Design System
   Production CSS  |  Inter + Font Awesome 6
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
  --brand-primary:        #2563EB;
  --brand-primary-dark:   #1d4ed8;
  --brand-secondary:      #0ea5e9;
  --sidebar-bg:           #0B1628;
  --sidebar-text:         #94a3b8;
  --sidebar-text-hover:   #f1f5f9;
  --sidebar-active-bg:    rgba(37,99,235,0.15);
  --sidebar-active-text:  #60a5fa;
  --sidebar-active-border:#2563EB;
  --sidebar-section:      #475569;
  --sidebar-width:        260px;
  --topbar-height:        60px;
  --surface-0:            #ffffff;
  --surface-1:            #f8fafc;
  --surface-2:            #f1f5f9;
  --surface-3:            #e2e8f0;
  --border:               #e2e8f0;
  --border-strong:        #cbd5e1;
  --text-primary:         #0f172a;
  --text-secondary:       #475569;
  --text-muted:           #94a3b8;
  --success:              #10b981;
  --success-bg:           #ecfdf5;
  --success-text:         #065f46;
  --danger:               #ef4444;
  --danger-bg:            #fef2f2;
  --danger-text:          #991b1b;
  --warning:              #f59e0b;
  --warning-bg:           #fffbeb;
  --warning-text:         #92400e;
  --info:                 #3b82f6;
  --info-bg:              #eff6ff;
  --info-text:            #1e40af;
  --radius-sm:            6px;
  --radius:               10px;
  --radius-lg:            14px;
  --shadow-sm:            0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:               0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg:            0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --transition:           0.18s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ── Custom Scrollbar ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── App Shell ───────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563EB, #0ea5e9);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sidebar-brand-name { font-size: 15px; font-weight: 700; color: #f1f5f9; line-height: 1.2; }
.sidebar-brand-sub  { font-size: 10px; color: var(--sidebar-section); letter-spacing: 0.5px; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--sidebar-section); font-weight: 600;
  padding: 20px 20px 6px; display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; margin: 2px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-text-hover); }
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto; padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 12px; flex-shrink: 0;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  cursor: pointer; transition: background var(--transition);
}
.user-chip:hover { background: rgba(255,255,255,0.08); }
.user-chip-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-size: 13px; color: #e2e8f0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 11px; color: var(--sidebar-section); }
.sidebar-logout { margin-top: 8px; }
.sidebar-logout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: transparent; border: none;
  border-radius: var(--radius-sm);
  color: var(--sidebar-section); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: background var(--transition), color var(--transition);
  text-align: left;
}
.sidebar-logout-btn:hover { background: rgba(239,68,68,0.1); color: #f87171; }

/* ── Main ────────────────────────────────────────────────── */
.main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; }

/* ── Top Bar ─────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm); flex-shrink: 0;
}
.topbar-menu-btn {
  display: none; width: 36px; height: 36px;
  border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--text-secondary);
  cursor: pointer; align-items: center; justify-content: center;
  transition: background var(--transition); flex-shrink: 0;
}
.topbar-menu-btn:hover { background: var(--surface-2); }
.topbar-page-info { flex: 1; min-width: 0; }
.topbar-title { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.topbar-breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.topbar-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: none; background: transparent; color: var(--text-secondary);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition); position: relative;
}
.topbar-btn:hover { background: var(--surface-2); color: var(--text-primary); }
.topbar-btn .badge-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%;
  border: 2px solid var(--surface-0);
}

/* ── Flash Messages ──────────────────────────────────────── */
.flash-container { padding: 12px 28px 0; }
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; margin-bottom: 16px; transition: opacity 0.4s;
}
.alert.fade-out { opacity: 0; }
.alert i { flex-shrink: 0; font-size: 15px; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fde68a; }
.alert-info    { background: var(--info-bg);    color: var(--info-text);    border: 1px solid #bfdbfe; }
.alert-close { margin-left: auto; background: transparent; border: none; cursor: pointer; color: inherit; opacity: 0.6; font-size: 13px; padding: 0 2px; flex-shrink: 0; }
.alert-close:hover { opacity: 1; }

/* ── Page Content ────────────────────────────────────────── */
.page-content { padding: 28px; flex: 1; }

/* ── Page Header ─────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header-text h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.page-header-text p  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Cards ───────────────────────────────────────────────── */
.card { background: var(--surface-0); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; }
.card-header-actions { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-1); }

/* ── Stats Grid ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface-0); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 22px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #ecfdf5; color: #059669; }
.stat-icon.orange { background: #fff7ed; color: #d97706; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }
.stat-icon.cyan   { background: #ecfeff; color: #0891b2; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-change { font-size: 12px; font-weight: 500; display: flex; align-items: center; gap: 3px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ── Filter Bar ──────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.search-wrap input { padding-left: 36px; width: 100%; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px; text-align: left;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-muted); background: var(--surface-1);
  border-bottom: 2px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.12s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-1); }
tbody td { padding: 13px 16px; font-size: 13.5px; color: var(--text-secondary); vertical-align: middle; }
.td-user { display: flex; align-items: center; gap: 10px; }
.td-user-info .td-user-name  { font-size: 13.5px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.td-user-info .td-user-email { font-size: 12px; color: var(--text-muted); }
.td-actions { display: flex; align-items: center; gap: 6px; }
code.code-pill {
  display: inline-block; padding: 2px 8px;
  background: var(--surface-2); border-radius: var(--radius-sm);
  font-family: 'Courier New', Courier, monospace; font-size: 12px;
  color: var(--brand-primary); border: 1px solid var(--border);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; transition: all var(--transition);
  white-space: nowrap; text-decoration: none; line-height: 1.4;
}
.btn:active { transform: scale(0.98); }
.btn-primary   { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-danger    { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-success   { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.btn-success:hover { background: #d1fae5; }
.btn-ghost     { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }
.btn-icon.btn-sm { width: 28px; height: 28px; padding: 5px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; }
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary); background: var(--surface-0);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; appearance: none;
}
.form-control:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.form-select {
  width: 100%; padding: 9px 36px 9px 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary);
  background: var(--surface-0) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; transition: border-color var(--transition), box-shadow var(--transition);
  outline: none; cursor: pointer;
}
.form-select:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-select:disabled { background-color: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
.form-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  padding-bottom: 8px; margin-bottom: 16px; margin-top: 8px;
}
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-size: 12.5px; color: var(--text-secondary);
}
.checkbox-item:hover { background: var(--surface-1); border-color: var(--brand-primary); }
.checkbox-item input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--brand-primary); cursor: pointer; flex-shrink: 0; }
.password-wrap { position: relative; }
.password-wrap .form-control { padding-right: 40px; }
.password-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); padding: 0; font-size: 14px; display: flex; align-items: center;
}
.password-toggle:hover { color: var(--text-secondary); }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.6); backdrop-filter: blur(4px);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s; padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface-0); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-height: 90vh; overflow-y: auto;
  transform: scale(0.97) translateY(-8px);
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
  width: 520px; max-width: 100%; position: relative;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-lg { width: 680px; }
.modal-xl { width: 820px; }
.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; background: var(--surface-0); z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary); flex: 1; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: transparent; cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0; font-size: 13px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-1); position: sticky; bottom: 0;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-info    { background: var(--info-bg);    color: var(--info-text);    }
.badge-neutral { background: var(--surface-2);  color: var(--text-secondary);}
.badge-primary { background: rgba(37,99,235,0.1); color: var(--brand-primary); }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-primary); color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; text-transform: uppercase; }
.avatar-sm  { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg  { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl  { width: 64px; height: 64px; font-size: 22px; border-radius: var(--radius-lg); }
.avatar.teal    { background: #0d9488; }
.avatar.purple  { background: #7c3aed; }
.avatar.amber   { background: #d97706; }
.avatar.rose    { background: #e11d48; }
.avatar.emerald { background: #059669; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-link {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-0);
  color: var(--text-secondary); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  font-weight: 500;
}
.page-link:hover { background: var(--surface-2); border-color: var(--border-strong); }
.page-link.active { background: var(--brand-primary); color: #fff; border-color: var(--brand-primary); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }
.pagination-info { font-size: 12.5px; color: var(--text-muted); margin-left: 8px; }

/* ── Role Chips ──────────────────────────────────────────── */
.role-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.role-chip.role-super-admin    { background: #1e1b4b; color: #818cf8; }
.role-chip.role-province-head  { background: #164e63; color: #67e8f9; }
.role-chip.role-platform-staff { background: #1c1917; color: #a8a29e; }
.role-chip.role-school-admin   { background: #1e3a5f; color: #60a5fa; }
.role-chip.role-teacher        { background: #14532d; color: #86efac; }
.role-chip.role-staff          { background: #1c1917; color: #a8a29e; }

/* ── Dropdown ────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface-0); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 180px; z-index: 200;
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
}
.dropdown-menu.open { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item { padding: 9px 14px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-secondary); transition: background var(--transition), color var(--transition); text-decoration: none; }
.dropdown-item:hover { background: var(--surface-1); color: var(--text-primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-bg); }
.dropdown-item i { width: 16px; text-align: center; font-size: 13px; }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Info List ───────────────────────────────────────────── */
.info-list { display: flex; flex-direction: column; }
.info-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.info-item:last-child { border-bottom: none; }
.info-key { width: 140px; flex-shrink: 0; color: var(--text-muted); font-size: 12.5px; font-weight: 500; padding-top: 1px; }
.info-value { color: var(--text-primary); font-weight: 500; flex: 1; }

/* ── Back Link ───────────────────────────────────────────── */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 20px; font-weight: 500; transition: color var(--transition); }
.back-link:hover { color: var(--brand-primary); }

/* ── Entity Header ───────────────────────────────────────── */
.entity-header-card {
  background: var(--surface-0); border-radius: var(--radius-lg);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  padding: 24px; display: flex; align-items: center; gap: 20px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.entity-header-info { flex: 1; min-width: 0; }
.entity-header-info h1 { font-size: 20px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.entity-header-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.entity-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ── Grid Layouts ────────────────────────────────────────── */
.two-col-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.three-col-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--surface-2); display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-size: 24px; color: var(--text-muted); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

/* ── Province Banner ─────────────────────────────────────── */
.province-banner {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  border-radius: var(--radius-lg); padding: 24px 28px; color: #fff;
  margin-bottom: 24px; display: flex; align-items: center; gap: 16px;
}
.province-banner-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,0.15);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.province-banner h2 { font-size: 18px; font-weight: 700; line-height: 1.3; }
.province-banner p  { font-size: 13px; opacity: 0.8; margin-top: 2px; }

/* ── Login Page ──────────────────────────────────────────── */
.login-page { min-height: 100vh; background: linear-gradient(135deg, #0B1628 0%, #1e2d45 50%, #0B1628 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 420px; max-width: 100%; background: var(--surface-0); border-radius: 20px; padding: 44px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, #2563EB, #0ea5e9); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; font-size: 22px; font-weight: 700; color: #fff; }
.login-title    { font-size: 22px; font-weight: 700; text-align: center; color: var(--text-primary); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 32px; }
.login-footer-text { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 28px; }

/* ── Error / Access Denied Page ──────────────────────────── */
.error-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-1); padding: 20px; }
.error-card { text-align: center; max-width: 440px; background: var(--surface-0); border-radius: var(--radius-lg); padding: 52px 44px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.error-icon-wrap { width: 80px; height: 80px; border-radius: 50%; background: var(--danger-bg); display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; font-size: 32px; color: var(--danger); }
.error-code { font-size: 72px; font-weight: 800; color: var(--surface-3); line-height: 1; margin-bottom: 8px; letter-spacing: -2px; }
.error-title { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 12px; }
.error-desc  { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; line-height: 1.6; }

/* ── Utility Classes ─────────────────────────────────────── */
.flex            { display: flex; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-col        { flex-direction: column; }
.flex-1          { flex: 1; }
.flex-wrap       { flex-wrap: wrap; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.text-xs  { font-size: 11px; }
.text-sm  { font-size: 12.5px; }
.text-muted     { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-brand     { color: var(--brand-primary); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full   { width: 100%; }
.ml-auto  { margin-left: auto; }
.mr-auto  { margin-right: auto; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.hidden      { display: none !important; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 0 100vw rgba(15,23,42,0.5); }
  .main { margin-left: 0; }
  .topbar-menu-btn { display: flex !important; }
  .two-col-grid { grid-template-columns: 1fr; }
  .three-col-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .flash-container { padding: 8px 16px 0; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .modal { width: 100%; }
  .login-card { padding: 32px 24px; }
  .entity-header-card { flex-direction: column; align-items: flex-start; }
}
@media print {
  .sidebar, .topbar, .topbar-actions, .modal-overlay { display: none !important; }
  .main { margin-left: 0; }
  .page-content { padding: 0; }
}
