/* ============================================================
   GS Residency System — app.css  (Light Theme)
   Font: Inter (loaded by header). Layout: unchanged.
   Only colors shifted from dark → light.
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --bg-main:        #f0f4f8;
  --bg-card:        #ffffff;
  --bg-secondary:   #f8fafc;
  --bg-sidebar:     #1a2236;
  --bg-sidebar-h:   #243047;
  --bg-topbar:      #ffffff;

  --text-primary:   #1e293b;
  --text-secondary: #475569;
  --text-muted:     #64748b;
  --text-sidebar:   #cbd5e1;
  --text-sidebar-h: #ffffff;

  --border:         #e2e8f0;
  --border-light:   #f1f5f9;

  --accent-blue:    #2563eb;
  --accent-blue-l:  #3b82f6;
  --accent-green:   #16a34a;
  --accent-amber:   #d97706;
  --accent-red:     #dc2626;
  --accent-purple:  #7c3aed;
  --accent-cyan:    #0891b2;

  --radius-sm:      8px;
  --radius:         12px;
  --radius-lg:      16px;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:         0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.1), 0 4px 8px rgba(0,0,0,.06);
  --sidebar-width:  240px;
  --topbar-h:       60px;
}

/* ── 4E: Dark theme (resident platform; toggled via data-theme on <html>) ── */
:root[data-theme="dark"] {
  --bg-main:        #0f141b;
  --bg-card:        #1a222e;
  --bg-secondary:   #222c3a;
  --bg-topbar:      #1a222e;
  --text-primary:   #e6edf3;
  --text-secondary: #b9c2cf;
  --text-muted:     #8b97a7;
  --border:         #2b3647;
  --border-light:   #232d3b;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.4);
  --shadow:         0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.6);
}
:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] textarea.form-control {
  background: #222c3a; color: var(--text-primary); border-color: var(--border);
}
:root[data-theme="dark"] .form-control::placeholder { color: #6b7685; }
:root[data-theme="dark"] .alert-success { background:#15351f; color:#a7f3c0; border-color:#1e6b3a; }
:root[data-theme="dark"] .alert-danger  { background:#3a1a1d; color:#f7b4ba; border-color:#7f1d1d; }
:root[data-theme="dark"] .alert-warning { background:#3a2f12; color:#fde3a7; border-color:#92700e; }

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

/* ── Admin Layout ──────────────────────────────────────────── */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg-main);
}

.page-content {
  flex: 1;
  padding: 24px;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  font-weight: 700;
  font-size: 13.5px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.07);
  letter-spacing: .01em;
}

.badge-version {
  font-size: 10px;
  padding: 2px 7px;
  background: rgba(255,255,255,.12);
  border-radius: 20px;
  color: rgba(255,255,255,.6);
  font-weight: 600;
  margin-left: auto;
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
}

.nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.3);
  padding: 16px 8px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all .15s ease;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: var(--bg-sidebar-h);
  color: var(--text-sidebar-h);
}

.sidebar-nav a.active {
  background: var(--accent-blue);
  color: #fff;
  font-weight: 600;
}

.sidebar-nav a i { width: 16px; text-align: center; font-size: 13px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent-blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: #fff;
  flex-shrink: 0;
}

.sidebar-username { font-weight: 600; font-size: 13px; color: #fff; }
.sidebar-role     { font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-user a {
  color: rgba(255,255,255,.35);
  margin-left: auto;
  transition: color .15s;
  text-decoration: none;
}
.sidebar-user a:hover { color: #f87171; }

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

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-toggle {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 18px; padding: 4px;
}

.topbar-title    { font-weight: 700; font-size: 16px; color: var(--text-primary); }
.topbar-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-actions  { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* ── Cards ─────────────────────────────────────────────────── */
.rt-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.rt-card-sm { padding: 14px 18px; }

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  text-decoration: none;
  color: inherit;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  color: inherit;
  text-decoration: none;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: var(--accent-blue); }
.stat-icon.green  { background: #f0fdf4; color: var(--accent-green); }
.stat-icon.amber  { background: #fffbeb; color: var(--accent-amber); }
.stat-icon.red    { background: #fef2f2; color: var(--accent-red); }
.stat-icon.purple { background: #faf5ff; color: var(--accent-purple); }
.stat-icon.cyan   { background: #ecfeff; color: var(--accent-cyan); }

.stat-value { font-size: 44px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 16px; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary   { background: var(--accent-blue); border-color: var(--accent-blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.3); }

.btn-success   { background: var(--accent-green); border-color: var(--accent-green); color: #fff; }
.btn-success:hover { background: #15803d; border-color: #15803d; color: #fff; }

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-main); color: var(--text-primary); border-color: #cbd5e1; }

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

.btn-icon { padding: 6px 8px; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  font-weight: 600;
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 20px;
}

.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-green  { background: #f0fdf4; color: #15803d; }
.badge-amber  { background: #fffbeb; color: #b45309; }
.badge-red    { background: #fef2f2; color: #b91c1c; }
.badge-purple { background: #faf5ff; color: #6d28d9; }
.badge-gray   { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }

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

.rt-table thead tr { background: #f8fafc; border-bottom: 2px solid var(--border); }

.rt-table th {
  padding: 11px 14px;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.rt-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.rt-table tbody tr:hover { background: #fafbfd; }
.rt-table tbody tr:last-child td { border-bottom: none; }

/* ── Rota Table ────────────────────────────────────────────── */
.rota-table-wrap { overflow-x: auto; }
.rota-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.rota-table th {
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 2px solid var(--border);
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); text-align: left;
}

.rota-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-primary);
}

.rota-table tr:hover td { background: #fafbfd; }

.rota-cell {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-control,
.form-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--text-primary);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  outline: none;
}

.form-control::placeholder { color: var(--text-muted); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); font-size: 13.5px; border-width: 1.5px; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

/* ── Progress ──────────────────────────────────────────────── */
.progress { background: #e2e8f0; border-radius: 20px; }
.progress-bar { border-radius: 20px; }
.progress-bar.green  { background: linear-gradient(90deg, #22c55e, #16a34a); }
.progress-bar.amber  { background: linear-gradient(90deg, #fbbf24, #d97706); }
.progress-bar.red    { background: linear-gradient(90deg, #f87171, #dc2626); }

/* ── Nav Tabs ──────────────────────────────────────────────── */
.nav-tabs { border-bottom: 2px solid var(--border); }

.nav-tabs .nav-link {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  border: 1.5px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 8px 18px;
  transition: color .15s;
}

.nav-tabs .nav-link:hover { color: var(--text-primary); background: #f8fafc; }

.nav-tabs .nav-link.active {
  color: var(--accent-blue);
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
  margin-bottom: -2px;
}

/* ── Permissions Table ─────────────────────────────────────── */
.perm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.perm-table th,
.perm-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  white-space: nowrap;
}

.perm-table th {
  background: #f8fafc;
  font-weight: 700; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted);
}

.perm-table th:first-child,
.perm-table td:first-child { text-align: left; }
.perm-table tr:hover td { background: #fafbfd; }

.perm-edit { color: #15803d; font-weight: 600; font-size: 12px; }
.perm-view { color: #1d4ed8; font-weight: 600; font-size: 12px; }
.perm-none { color: #cbd5e1; font-size: 12px; }

/* ── Color Swatch / Dot ────────────────────────────────────── */
.color-swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-amber { background: var(--accent-amber); }

.dot-live {
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,.25); }
  50%       { box-shadow: 0 0 0 6px rgba(34,197,94,.1); }
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state i { font-size: 2.5rem; margin-bottom: 14px; display: block; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ── Quick Actions ─────────────────────────────────────────── */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 26px 14px;
  height: 100%;
  min-height: 132px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 18px;
  font-weight: 700;
  transition: all .15s;
  box-shadow: var(--shadow-sm);
}
.quick-action i { font-size: 38px; }
.quick-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  text-decoration: none;
}
.quick-action.highlight { border-color: #bfdbfe; background: #eff6ff; color: var(--accent-blue); }
.quick-action.disabled  { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ── Rotation Chip ─────────────────────────────────────────── */
.rotation-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: 700;
}

/* ── Resident Layout ───────────────────────────────────────── */
.resident-wrapper {
  min-height: 100vh;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  font-size: 20px;   /* 2× base for mobile readability */
}

.resident-topnav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}

.resident-topnav-brand {
  font-weight: 700; font-size: 24px;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}

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

.resident-content { flex: 1; padding: 22px; padding-bottom: 110px; }

.resident-bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%; max-width: 640px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -4px 24px rgba(0,0,0,.08);
  z-index: 50;
  height: 84px;
}

.resident-bottom-nav a {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px; padding: 10px 6px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px; font-weight: 700;
  transition: color .15s;
  letter-spacing: .01em;
}
.resident-bottom-nav a.active,
.resident-bottom-nav a:hover { color: var(--accent-blue); }
.resident-bottom-nav a i { font-size: 28px; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eff6ff 0%, #f0f4f8 50%, #faf5ff 100%);
  padding: 20px;
}

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

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-top: 10px; }
.login-logo p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Modals ────────────────────────────────────────────────── */
.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card);
  color: var(--text-primary);
}
.modal-header { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-title  { font-size: 16px; font-weight: 700; }
.btn-close-white { filter: none; }

/* ── QR Screen ─────────────────────────────────────────────── */
.qr-screen {
  min-height: 100vh; background: var(--bg-main);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.qr-wrap        { text-align: center; max-width: 360px; width: 100%; }
.qr-event-name  { font-size: 20px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.qr-event-meta  { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.qr-ring-wrap   { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 24px; }
.qr-ring-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* ── Misc ──────────────────────────────────────────────────── */
.divider      { height: 1px; background: var(--border); margin: 16px 0; }
.flex-1       { flex: 1 1 0; }
.mb-24        { margin-bottom: 24px !important; }
.text-muted   { color: var(--text-muted) !important; }

.alert-auto-dismiss { animation: fadeSlide .3s ease; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-overlay.open { display: block; }
  .main-content  { margin-left: 0; }
  .topbar-toggle { display: block; }
  .page-content  { padding: 16px; }
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
/* ============================================================
   v4.1 ADDITIONS — appended to original, nothing overridden
   ============================================================ */

/* ── Sidebar overlay visibility (fix .visible class used by JS) */
.sidebar-overlay.visible { display: block; }

/* ── Sidebar desktop collapse (optional, triggered by JS) ───── */
.sidebar.collapsed { width: 60px; overflow: hidden; }
.sidebar.collapsed .badge-version,
.sidebar.collapsed .sidebar-nav a span,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .sidebar-username,
.sidebar.collapsed .sidebar-role,
.sidebar.collapsed .sidebar-nav a .badge,
.sidebar.collapsed .sidebar-brand span { display: none; }
.sidebar.collapsed .sidebar-brand { padding: 18px 14px; justify-content: center; }
.sidebar.collapsed .sidebar-brand img { margin: 0; }
.sidebar.collapsed .sidebar-nav a { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed ~ .main-content { margin-left: 60px; }

/* ── Topbar sidebar toggle (desktop collapse) ───────────────── */
.sidebar-collapse-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; padding: 4px 6px;
  transition: color .15s;
}
.sidebar-collapse-btn:hover { color: var(--text-primary); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  text-decoration: none; color: inherit;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); color: inherit; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: var(--accent-blue); }
.stat-icon.green  { background: #f0fdf4; color: var(--accent-green); }
.stat-icon.amber  { background: #fffbeb; color: var(--accent-amber); }
.stat-icon.red    { background: #fef2f2; color: var(--accent-red); }
.stat-icon.purple { background: #faf5ff; color: var(--accent-purple); }
.stat-icon.cyan   { background: #ecfeff; color: var(--accent-cyan); }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 16px; color: var(--text-muted); margin-top: 5px; font-weight: 600; }

/* ── Academic year schedule grid ────────────────────────────── */
.sched-year-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sched-year-table { border-collapse: collapse; font-size: 11.5px; min-width: 1100px; width: 100%; }
.sched-year-table .col-fixed {
  position: sticky; left: 0; z-index: 3;
  background: #1e293b; color: #e2e8f0;
  font-weight: 700; min-width: 130px; max-width: 155px;
  padding: 6px 10px; border: 1px solid #334155;
}
.sched-year-table .qrow th {
  background: #0f172a; color: #7dd3fc;
  padding: 5px 4px; border: 1px solid #1e3a5f;
  font-size: 10px; font-weight: 700; text-align: center;
  letter-spacing: .5px; text-transform: uppercase;
}
.sched-year-table .mrow th {
  background: #1e293b; color: #e2e8f0;
  padding: 6px 4px; border: 1px solid #334155;
  font-size: 11px; font-weight: 700; text-align: center; white-space: nowrap;
}
.sched-year-table .mrow th.cur-month { background: var(--accent-blue); color: #fff; }
.sched-year-table td {
  padding: 5px 4px; border: 1px solid var(--border);
  text-align: center; vertical-align: middle;
  font-size: 11px; min-width: 80px;
}
.sched-year-table td.qborder-right { border-right: 3px solid var(--accent-amber) !important; }
.sched-year-table .group-header td {
  background: linear-gradient(90deg,#1e293b,#2d3f55);
  color: #e2e8f0; font-weight: 700; font-size: 12px;
  padding: 7px 10px; border: 1px solid #334155;
}
.day-badge {
  display: inline-block; padding: 2px 7px; border-radius: 12px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
  background: rgba(37,99,235,.12); color: var(--accent-blue);
}
.day-badge.er   { background: rgba(220,38,38,.12);  color: #ef4444; }
.day-badge.ward { background: rgba(217,119,6,.12);  color: var(--accent-amber); }
.day-badge.sr   { background: rgba(124,58,237,.12); color: var(--accent-purple); }

/* ── Rotation schedule grid ─────────────────────────────────── */
.rot-grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rot-grid { border-collapse: collapse; font-size: 11px; width: 100%; }
.rot-grid .col-res {
  position: sticky; left: 0; z-index: 4;
  min-width: 120px; max-width: 145px;
  background: #1e293b; color: #e2e8f0;
  font-weight: 700; padding: 6px 8px;
  border: 1px solid #334155; white-space: nowrap;
}
.rot-grid .qrow th {
  background: #0f172a; color: #7dd3fc;
  padding: 5px 8px; border: 1px solid #1e3a5f;
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-align: center; text-transform: uppercase;
}
.rot-grid .mrow th {
  background: #1e293b; color: #e2e8f0;
  padding: 6px 6px; border: 1px solid #334155;
  font-size: 11px; font-weight: 700; text-align: center;
  white-space: nowrap; min-width: 72px;
}
.rot-grid .mrow th.cur-month { background: var(--accent-blue); color: #fff; }
.rot-grid td {
  padding: 4px 3px; border: 1px solid var(--border);
  text-align: center; vertical-align: middle; font-size: 10.5px; min-width: 68px;
}
.rot-grid td.qborder-right { border-right: 3px solid var(--accent-amber) !important; }
.rot-cell {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 8px; border-radius: 14px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
  width: 100%; min-height: 22px;
}
.rot-grid .group-banner td {
  background: linear-gradient(90deg,#2c3e50,#4b6cb7);
  color: #fff; font-weight: 700; font-size: 12px;
  padding: 7px 10px; border: 1px solid #334155;
}
.rot-grid .stats-row td { background: #f8fafc; font-size: 10px; color: var(--text-muted); }
.rot-stats-pill {
  display: inline-block; padding: 1px 5px; border-radius: 9px;
  font-size: 9.5px; font-weight: 700; margin: 1px;
}

/* ── Login privilege chooser ─────────────────────────────────── */
.priv-chooser { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.priv-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); background: var(--bg-card);
  cursor: pointer; transition: all .15s;
  text-align: left; color: var(--text-primary);
  font-family: 'Inter', sans-serif; width: 100%;
}
.priv-btn:hover  { border-color: var(--accent-blue); background: #eff6ff; }
.priv-btn.selected { border-color: var(--accent-blue); background: #eff6ff; }
.priv-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.priv-label { font-weight: 700; font-size: 14px; }
.priv-sub   { font-size: 11px; color: var(--text-muted); }

/* ── rt-card (standalone definition if not in original) ─────── */
.rt-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.rt-card-sm { padding: 14px 18px; }

/* ── Login page (dark variant for index.php) ──────────────────*/
.login-page-dark {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 20px;
}

/* ── Perm table select ──────────────────────────────────────── */
.perm-select { width: 70px; font-size: 11px; padding: 2px 4px; border-radius: 4px; }
.perm-table td.perm-edit { background: #f0fdf4; }
.perm-table td.perm-view { background: #eff6ff; }
.perm-table td.perm-none { background: transparent; }

/* ── btn-xs ─────────────────────────────────────────────────── */
.btn-xs { font-size: 11px !important; padding: 3px 8px !important; border-radius: 5px !important; }
.btn-warning { background: var(--accent-amber); border-color: var(--accent-amber); color: #fff; }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }

/* ── Badge cyan ──────────────────────────────────────────────── */
.badge-cyan   { background: #ecfeff; color: var(--accent-cyan); }

/* ── QR display ──────────────────────────────────────────────── */
#qrcode-wrap {
  background: #fff; padding: 20px; border-radius: 20px;
  border: 4px solid var(--accent-blue);
  box-shadow: 0 0 60px rgba(37,99,235,.3);
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 240px; min-height: 240px;
  transition: opacity .25s, transform .25s;
}
#qrcode canvas { display: block !important; }
#qrcode img    { display: none !important; }

/* ── Print ───────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .modal, .alert { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0; }
  body { background: #fff; }
}