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

/* ── Database Loading Overlay ────────────────────────────────── */
.db-loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.db-loading-overlay.visible {
  display: flex;
}
.db-loading-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  min-width: 260px;
}
.db-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: db-spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes db-spin { to { transform: rotate(360deg); } }
.db-loading-text {
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
}
.db-loading-sub {
  font-size: 0.85rem;
  color: #64748b;
}

body {
  font-family: Arial, sans-serif;
  font-size: 15px;
  background: #f0f2f5;
  color: #222;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ══════════════════════════════════════════
   LOGIN PAGE — Full-screen unified background
   ══════════════════════════════════════════ */
#login-page {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  /* One unified background */
  background: linear-gradient(135deg, #060d1f 0%, #0b1d4a 35%, #0f2760 55%, #0a1830 100%);
}

/* Full-width grid overlay */
#login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(79,142,247,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,142,247,0.04) 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
}

/* Radial glow left */
#login-page::after {
  content: '';
  position: absolute;
  left: 0; top: 10%;
  width: 45%; height: 80%;
  background: radial-gradient(ellipse, rgba(30,80,200,0.14) 0%, transparent 70%);
  pointer-events: none;
}

body.not-logged-in #login-page { display: flex; }
body.not-logged-in #sidebar,
body.not-logged-in #main { display: none; }

/* ── Decorative dots ── */
.lp-dots {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}
.lp-dots::before {
  content: '';
  display: block;
  background-image: radial-gradient(circle, rgba(79,142,247,0.45) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
}
.lp-dots-tl { top: 28px; left: 28px; width: 120px; height: 96px; }
.lp-dots-tl::before { width: 120px; height: 96px; }
.lp-dots-tr { top: 28px; right: 28px; width: 96px; height: 72px; }
.lp-dots-tr::before { width: 96px; height: 72px; }

/* Decorative circles */
.lp-circle-br {
  position: absolute;
  bottom: -70px; right: -70px;
  width: 260px; height: 260px;
  border-radius: 50%;
  border: 32px solid rgba(37,99,200,0.2);
  pointer-events: none;
  z-index: 1;
}
.lp-circle-r {
  position: absolute;
  bottom: -40px; right: 60px;
  width: 140px; height: 140px;
  border-radius: 50%;
  border: 18px solid rgba(59,130,246,0.12);
  pointer-events: none;
  z-index: 0;
}

/* ══ LEFT — Branding ══ */
.lp-left {
  flex: 0 0 50%;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 56px 64px 80px;
  position: relative;
  z-index: 2;
}

.lp-left-inner {
  max-width: 480px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Logo ── */
.lp-brand { margin-bottom: 36px; }

.lp-seal {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  padding: 10px;
  border: 2px solid rgba(255,255,255,0.18);
  box-shadow: 0 0 60px rgba(79,142,247,0.45), 0 0 100px rgba(79,142,247,0.18);
  display: block;
}

/* ── Hero ── */
.lp-hero { margin-bottom: 48px; }

.lp-lgu-label {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #4f8ef7;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.lp-lgu-sub {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.lp-hero-title {
  font-size: 52px;
  font-weight: 800;
  color: #fff;
  line-height: 1.08;
  margin-bottom: 18px;
  letter-spacing: -1.5px;
}

.lp-blue { color: #4f8ef7; }

.lp-divider {
  width: 48px;
  height: 3px;
  background: #4f8ef7;
  border-radius: 2px;
  margin-bottom: 22px;
}

.lp-hero-sub {
  font-size: 15px;
  color: rgba(255,255,255,0.48);
  line-height: 1.8;
}

/* ── Security badge card ── */
.lp-badge-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 20px 24px;
  max-width: 420px;
  backdrop-filter: blur(8px);
}

.lp-badge-icon {
  font-size: 26px;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(59,130,246,0.4);
}

.lp-badge-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 5px;
}

.lp-badge-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  line-height: 1.55;
}

/* ── Version & Copyright ── */
.lp-copyright {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.25);
  flex-wrap: wrap;
}

.lp-version {
  background: rgba(79,142,247,0.15);
  border: 1px solid rgba(79,142,247,0.25);
  color: #4f8ef7;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.lp-copy-divider { color: rgba(255,255,255,0.2); }

/* ══ RIGHT — Floating card ══ */
.lp-right {
  flex: 0 0 50%;
  width: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px;
  position: relative;
  z-index: 2;
}

/* ── Big floating white card ── */
.lp-card {
  width: 100%;
  max-width: 720px;
  background: #fff;
  border-radius: 28px;
  padding: 64px 60px 56px;
  box-shadow:
    0 40px 100px rgba(0,0,0,0.6),
    0 12px 40px rgba(0,0,0,0.35),
    0 0 0 1px rgba(255,255,255,0.07);
  position: relative;
  z-index: 3;
}

/* ── Card header ── */
.lp-card-header { text-align: center; margin-bottom: 40px; }

.lp-shield-wrap {
  width: 100px;
  height: 100px;
  background: #eef3ff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 46px;
  box-shadow: 0 6px 28px rgba(59,130,246,0.2);
}

.lp-shield-icon { line-height: 1; }

.lp-welcome {
  font-size: 32px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.lp-card-sub {
  font-size: 15px;
  color: #94a3b8;
  line-height: 1.5;
}

/* ── Role selection cards ── */
.lp-role-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 20px;
}
.lp-role-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 20px;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
}
.lp-role-card:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(59,130,246,0.12);
}
.lp-role-card.lp-role-admin:hover {
  border-color: #1e40af;
  background: #eff6ff;
}
.lp-role-card-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #e0e7ff;
  flex-shrink: 0;
}
.lp-role-admin .lp-role-card-icon {
  background: #dbeafe;
}
.lp-role-card-body {
  flex: 1;
}
.lp-role-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}
.lp-role-card-sub {
  font-size: 0.78rem;
  color: #64748b;
}
.lp-role-card-arrow {
  font-size: 1.1rem;
  color: #94a3b8;
  transition: transform 0.18s ease, color 0.18s ease;
}
.lp-role-card:hover .lp-role-card-arrow {
  color: #3b82f6;
  transform: translateX(4px);
}

/* ── Role pill (shown in step 2 above the form) ── */
.lp-role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 18px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.lp-role-pill.admin {
  background: #eef2ff;
  color: #3730a3;
  border-color: #c7d2fe;
}

/* ── Credentials step actions (Back + Sign In) ── */
.lp-creds-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
.lp-back-btn {
  flex: 0 0 auto;
  padding: 12px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.lp-back-btn:hover {
  border-color: #94a3b8;
  color: #334155;
  background: #f1f5f9;
}
.lp-creds-actions .lp-login-btn {
  flex: 1;
  margin-top: 0;
}

/* ── Login form ── */
.lp-login-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 28px;
}

.lp-form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 18px;
}

.lp-label {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  letter-spacing: 0.3px;
}

.lp-field-wrap {
  position: relative;
}

.lp-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
  z-index: 1;
}

.lp-field-wrap input {
  width: 100%;
  padding: 14px 14px 14px 46px;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  background: #f8faff;
  color: #1e293b;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.lp-field-wrap input::placeholder { color: #94a3b8; }

.lp-field-wrap input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.14);
  background: #fff;
}

.login-error-msg {
  color: #ef4444;
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 10px;
  padding-left: 2px;
  font-weight: 500;
}

.lp-login-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #1a3a5c 0%, #1d4ed8 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 6px 24px rgba(29,78,216,0.35);
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
}

.lp-login-btn:hover {
  opacity: 0.93;
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(29,78,216,0.4);
}

/* ── Footer notice ── */
.lp-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 22px;
  line-height: 1.5;
}

.lp-notice-icon { font-size: 14px; }

/* ── Role-based access control ── */
body.role-user .btn-add,
body.role-user .btn-edit,
body.role-user .btn-delete,
body.role-user .action-col { display: none !important; }

body.role-user a[data-page="admin"] { display: none !important; }

/* ── Logout button ── */
.logout-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.sidebar-role-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
}

/* ── Sidebar ── */
#sidebar {
  width: 250px;
  min-width: 250px;
  background: #1a3a5c;
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#sidebar-header {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 10px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  padding: 4px;
}

#sidebar-header .org-name {
  font-size: 13px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.6);
  margin-bottom: 4px;
}

#sidebar-header h1 {
  font-size: 16px;
  font-weight: bold;
  line-height: 1.3;
}

#sidebar nav {
  flex: 1;
  padding: 10px 0;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

#sidebar nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

#sidebar nav a.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: #4da6ff;
}

#sidebar nav a .icon {
  font-size: 19px;
  width: 22px;
  text-align: center;
}

#sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ── Sidebar group / sub-menu ── */
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  color: rgba(255,255,255,0.75);
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-group-toggle:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-group-toggle.open {
  color: #fff;
}

.nav-group-toggle .icon {
  font-size: 19px;
  width: 22px;
  text-align: center;
}

.nav-group-toggle .nav-arrow {
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.2s;
  opacity: 0.6;
}

.nav-group-toggle.open .nav-arrow {
  transform: rotate(90deg);
}

.nav-submenu {
  display: none;
  background: rgba(0,0,0,0.15);
}

.nav-submenu.open {
  display: block;
}

.nav-submenu a {
  padding-left: 44px !important;
  font-size: 14px !important;
  border-left: 3px solid transparent;
}

.nav-submenu a.active {
  border-left-color: #4da6ff;
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ── Main Content ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Page Header ── */
#page-header {
  background: #fff;
  border-bottom: 1px solid #dde1e7;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

#page-header h2 {
  font-size: 20px;
  font-weight: bold;
  color: #1a3a5c;
}

#page-header .record-count {
  font-size: 14px;
  color: #666;
  margin-top: 2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Search */
.search-wrap {
  position: relative;
}

.search-wrap input {
  padding: 9px 12px 9px 36px;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  font-size: 15px;
  width: 260px;
  background: #f7f8fa;
  outline: none;
  transition: border-color 0.15s;
}

.search-wrap input:focus {
  border-color: #1a3a5c;
  background: #fff;
}

.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 16px;
}

/* Filter dropdowns */
select.filter-select {
  padding: 9px 12px;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  font-size: 15px;
  background: #f7f8fa;
  outline: none;
  cursor: pointer;
  max-width: 180px;
}

select.filter-select:focus {
  border-color: #1a3a5c;
}

select.year-select {
  font-weight: 700;
  color: #1a3a5c;
  border-color: #1a3a5c;
  background: #eef3f8;
  min-width: 90px;
}

/* Month picker (Birthday > This Month) */
.month-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 2px solid #1a3a5c;
  border-radius: 8px;
  padding: 6px 12px 6px 10px;
  cursor: pointer;
}

.month-picker-wrap .mp-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.month-picker-wrap select {
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  font-weight: 700;
  color: #1a3a5c;
  cursor: pointer;
  padding: 0;
  min-width: 110px;
  appearance: auto;
}

/* Birthday filter */
#birthday-month-filter {
  padding: 9px 12px;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  font-size: 15px;
  background: #f7f8fa;
  outline: none;
  cursor: pointer;
}

/* ── Table Container ── */
#table-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 16px 22px;
  gap: 14px;
  min-height: 0;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.stat-card {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 7px;
  padding: 10px 16px;
  min-width: 130px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: bold;
  color: #1a3a5c;
  margin-top: 2px;
}

/* ── Enhanced stat cards (Employee Records) ── */
.estat-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.estat-card {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 10px;
  padding: 14px 20px;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  flex: 1;
}

.estat-card.total   { border-left: 4px solid #1a3a5c; }
.estat-card.type-jo { border-left: 4px solid #8b5cf6; }
.estat-card.type-rg { border-left: 4px solid #16a34a; }
.estat-card.type-cs { border-left: 4px solid #f59e0b; }
.estat-card.type-co { border-left: 4px solid #0ea5e9; }
.estat-card.type-other { border-left: 4px solid #94a3b8; }

/* ── Birthday stat cards ── */
.bstat-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
  margin-bottom: 4px;
}

.bstat-card {
  flex: 1;
  min-width: 160px;
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  color: #fff;
}

.bstat-card::after {
  content: '';
  position: absolute;
  right: -14px;
  top: -14px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
}

.bstat-card.bd-total    { background: linear-gradient(135deg, #1a3a5c 0%, #2563a8 100%); }
.bstat-card.bd-upcoming { background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); }
.bstat-card.bd-today    { background: linear-gradient(135deg, #be185d 0%, #ec4899 100%); }
.bstat-card.bd-month    { background: linear-gradient(135deg, #0369a1 0%, #38bdf8 100%); }
.bstat-card.bd-week     { background: linear-gradient(135deg, #166534 0%, #22c55e 100%); }
.bstat-card.bd-filtered { background: linear-gradient(135deg, #5b21b6 0%, #a78bfa 100%); }

.bstat-icon {
  font-size: 32px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.bstat-value {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  letter-spacing: -1px;
}

.bstat-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.85);
}

.bstat-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.estat-icon {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.estat-info { display: flex; flex-direction: column; }

.estat-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.estat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1a3a5c;
  line-height: 1.1;
}

.estat-sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 1px;
}

/* ── Table ── */
.table-wrapper {
  background: #fff;
  border: 1px solid #dde1e7;
  border-radius: 7px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #1a3a5c;
  color: #fff;
  padding: 11px 13px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: normal;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
}

thead th:hover {
  background: #243f63;
}

thead th.sort-asc::after {
  content: ' \25B2';
  font-size: 9px;
}

thead th.sort-desc::after {
  content: ' \25BC';
  font-size: 9px;
}

tbody tr {
  border-bottom: 1px solid #edf0f4;
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: #f4f7fb;
}

tbody td {
  padding: 10px 13px;
  color: #333;
  white-space: nowrap;
}

/* Row number column */
td.col-no, th.col-no {
  color: #aaa;
  font-size: 13px;
  width: 36px;
  text-align: center;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: bold;
}

.badge-employed {
  background: #e6f4ea;
  color: #256029;
}

.badge-regular {
  background: #e3eef9;
  color: #1a3a5c;
}

.badge-casual {
  background: #fef3e2;
  color: #7a4f00;
}

.badge-jo {
  background: #f3e8fd;
  color: #5a1f8a;
}

.badge-cos {
  background: #fde8ef;
  color: #8a1f3c;
}

.badge-national {
  background: #e3f7f5;
  color: #0d5c52;
}

/* Alert: near retirement / upcoming birthday */
.highlight-warning {
  background: #fff8e1 !important;
}

.highlight-danger {
  background: #fdecea !important;
}

/* At maximum step */
.max-step {
  color: #888;
  font-style: italic;
  font-size: 13px;
}

/* Awards pages – source badges */
.source-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.source-officials { background: #e8eaf6; color: #3949ab; }
.source-regular   { background: #e8f5e9; color: #2e7d32; }
.source-casual    { background: #fff8e1; color: #f57f17; }

/* Awards pages – overdue row highlight */
tr.overdue-row td { background: #fff3f3; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #aaa;
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

/* Birthday highlight */
.birthday-today {
  background: #fff8e1 !important;
  font-weight: bold;
}

.birthday-month {
  background: #f0f9ff !important;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 14px;
  color: #666;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-controls button {
  padding: 7px 13px;
  border: 1px solid #cdd1d8;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: background 0.15s;
}

.pagination-controls button:hover:not(:disabled) {
  background: #f0f4fa;
}

.pagination-controls button:disabled {
  opacity: 0.4;
  cursor: default;
}

.page-size-select {
  padding: 6px 10px;
  border: 1px solid #cdd1d8;
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
  outline: none;
  cursor: pointer;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f0f2f5;
}

::-webkit-scrollbar-thumb {
  background: #bcc3cd;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ba3ae;
}

/* ── Action Buttons ── */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: #1a3a5c;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-add:hover { background: #24527f; }

.btn-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: #fff;
  color: #666;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-reset:hover { background: #f0f2f5; }

.action-col {
  white-space: nowrap;
  width: 90px;
}

.btn-edit, .btn-delete {
  border: none;
  background: none;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 17px;
  transition: background 0.12s;
}

.btn-edit { color: #1a3a5c; }
.btn-edit:hover { background: #e3eef9; }

.btn-delete { color: #b91c1c; }
.btn-delete:hover { background: #fdecea; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 10px;
  width: 640px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}

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

.modal-header h3 {
  font-size: 17px;
  color: #1a3a5c;
  font-weight: bold;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

.modal-close:hover { background: #f0f2f5; color: #333; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: bold;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.form-group input,
.form-group select {
  padding: 9px 12px;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
  width: 100%;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #1a3a5c;
  box-shadow: 0 0 0 2px rgba(26,58,92,0.1);
}

.form-group input.error { border-color: #b91c1c; }

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid #dde1e7;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-cancel {
  padding: 10px 22px;
  border: 1px solid #cdd1d8;
  border-radius: 5px;
  background: #fff;
  font-size: 15px;
  cursor: pointer;
  color: #444;
}

.btn-cancel:hover { background: #f5f5f5; }

.btn-save {
  padding: 10px 24px;
  border: none;
  border-radius: 5px;
  background: #1a3a5c;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  font-weight: bold;
}

.btn-save:hover { background: #24527f; }

/* ── Confirm dialog ── */
.confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.confirm-overlay.open { display: flex; }

.confirm-box {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  width: 340px;
  max-width: 92vw;
  box-shadow: 0 6px 24px rgba(0,0,0,0.2);
  text-align: center;
}

.confirm-box .confirm-icon { font-size: 32px; margin-bottom: 10px; }
.confirm-box h4 { font-size: 17px; color: #1a3a5c; margin-bottom: 8px; }
.confirm-box p { font-size: 15px; color: #555; margin-bottom: 20px; }

.confirm-actions { display: flex; gap: 10px; justify-content: center; }

.btn-confirm-delete {
  padding: 10px 24px;
  border: none;
  border-radius: 5px;
  background: #b91c1c;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  font-weight: bold;
}

.btn-confirm-delete:hover { background: #991b1b; }

/* ══════════════════════════════
   DASHBOARD — Professional Design
   ══════════════════════════════ */
.dashboard-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 28px;
  background: #f0f4f8;
}

/* ── Section header ── */
.dash-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.dash-section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ── KPI Overview cards ── */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.dash-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid #e8edf3;
  box-shadow: 0 2px 8px rgba(15,40,100,0.06);
  position: relative;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}

.dash-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15,40,100,0.1);
}

/* Decorative corner circle */
.dash-card::after {
  content: '';
  position: absolute;
  right: -18px; top: -18px;
  width: 70px; height: 70px;
  border-radius: 50%;
  opacity: 0.06;
  background: currentColor;
}

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

.dash-card-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
}

.dash-card-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Card color themes */
.dash-card-primary .dash-card-icon { background: #e8f0fb; }
.dash-card-primary .dash-card-value { color: #1a3a5c; }
.dash-card-primary { border-top: 3px solid #1a3a5c; }

.dash-card-blue .dash-card-icon { background: #dbeafe; }
.dash-card-blue .dash-card-value { color: #1d4ed8; }
.dash-card-blue { border-top: 3px solid #3b82f6; }

.dash-card-teal .dash-card-icon { background: #ccfbf1; }
.dash-card-teal .dash-card-value { color: #0f766e; }
.dash-card-teal { border-top: 3px solid #14b8a6; }

.dash-card-amber .dash-card-icon { background: #fef3c7; }
.dash-card-amber .dash-card-value { color: #b45309; }
.dash-card-amber { border-top: 3px solid #f59e0b; }

.dash-card-green .dash-card-icon { background: #dcfce7; }
.dash-card-green .dash-card-value { color: #15803d; }
.dash-card-green { border-top: 3px solid #22c55e; }

.dash-card-gray .dash-card-icon { background: #f1f5f9; }
.dash-card-gray .dash-card-value { color: #475569; }
.dash-card-gray { border-top: 3px solid #94a3b8; }

/* ── Alert / KPI highlight cards ── */
.dash-alerts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.dash-alert {
  border-radius: 14px;
  padding: 22px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* Glow circle */
.dash-alert::before {
  content: '';
  position: absolute;
  right: -24px; bottom: -24px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.dash-alert::after {
  content: '';
  position: absolute;
  right: 12px; bottom: 12px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.dash-alert-icon {
  font-size: 28px;
  margin-bottom: 10px;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.dash-alert-num {
  font-size: 48px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.dash-alert-label {
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  opacity: 0.88;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.4;
}

.dash-alert-red    { background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%); }
.dash-alert-orange { background: linear-gradient(135deg, #c2410c 0%, #f97316 100%); }
.dash-alert-blue   { background: linear-gradient(135deg, #1d4ed8 0%, #60a5fa 100%); }
.dash-alert-purple { background: linear-gradient(135deg, #6d28d9 0%, #a78bfa 100%); }

/* ── Chart cards ── */
.dash-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.dash-chart-card {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  padding: 22px 22px 18px;
  box-shadow: 0 2px 8px rgba(15,40,100,0.05);
}

.dash-chart-full { width: 100%; }

.dash-chart-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-chart-title::before {
  content: '';
  width: 3px; height: 16px;
  background: #1a3a5c;
  border-radius: 2px;
  flex-shrink: 0;
}

.dash-chart-wrap {
  position: relative;
  height: 260px;
}

.dash-chart-wrap canvas { max-height: 260px; }

/* Upcoming events mini-table */
.dash-event-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dash-event-table th {
  background: #1a3a5c;
  color: #fff;
  padding: 10px 13px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: normal;
}

.dash-event-table td {
  padding: 9px 13px;
  border-bottom: 1px solid #edf0f4;
}

.dash-event-table tr:last-child td { border-bottom: none; }
.dash-event-table tr:nth-child(even) td { background: #f9fafc; }
.dash-event-table tr.urgent td { background: #fff8e1; }

/* ── Login — Policy links ── */
.lp-policy-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 12.5px;
}
.lp-policy-links a {
  color: #3b82f6;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.15s;
}
.lp-policy-links a:hover { color: #1d4ed8; text-decoration: underline; }
.lp-policy-sep { color: #cbd5e1; }

/* ── Privacy Policy / System Use Agreement Modal ── */
.policy-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.policy-overlay.open { display: flex; }

.policy-modal {
  background: #fff;
  border-radius: 20px;
  width: min(860px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 32px 96px rgba(0,0,0,0.35);
}

.policy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 0 0;
  border-bottom: 1px solid #e8edf3;
  flex-shrink: 0;
  background: #f8faff;
}

.policy-tabs {
  display: flex;
  gap: 0;
}

.policy-tab {
  padding: 18px 26px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.policy-tab:hover { color: #1a3a5c; }
.policy-tab.active { color: #1a3a5c; border-bottom-color: #1a3a5c; }

.policy-close {
  background: #f1f5f9;
  border: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.policy-close:hover { background: #e2e8f0; color: #1a3a5c; }

.policy-modal-body {
  overflow-y: auto;
  padding: 0;
  flex: 1;
}

/* ── Policy document content ── */
.policy-doc {
  padding: 36px 44px 48px;
  max-width: 740px;
  margin: 0 auto;
}

.policy-doc-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 2px solid #e8edf3;
}

.policy-doc-seal {
  font-size: 48px;
  flex-shrink: 0;
  line-height: 1;
}

.policy-doc-org {
  font-size: 12px;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.policy-doc-title {
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}

.policy-doc-meta {
  font-size: 12px;
  color: #94a3b8;
}

.policy-section {
  margin-bottom: 28px;
}

.policy-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1a3a5c;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.policy-section p {
  font-size: 14px;
  color: #374151;
  line-height: 1.75;
  margin-bottom: 8px;
}

.policy-section ul {
  padding-left: 20px;
  margin: 6px 0 10px;
}

.policy-section ul li {
  font-size: 14px;
  color: #374151;
  line-height: 1.7;
  margin-bottom: 4px;
}

.policy-contact-card {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 14px 18px;
  margin-top: 10px;
  font-size: 13.5px;
  color: #1e3a5f;
  line-height: 1.7;
}

.policy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin: 10px 0 8px;
}
.policy-table th {
  background: #1a3a5c;
  color: #fff;
  padding: 9px 13px;
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}
.policy-table td {
  padding: 9px 13px;
  border-bottom: 1px solid #e8edf3;
  color: #374151;
  line-height: 1.5;
}
.policy-table tr:last-child td { border-bottom: none; }
.policy-table tr:nth-child(even) td { background: #f8faff; }

.policy-note {
  font-size: 12.5px !important;
  color: #64748b !important;
  font-style: italic;
}

.policy-acceptance-section {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 16px 20px;
}
.policy-acceptance-section h4 { border-bottom-color: #fcd34d; }

/* ── First-session Consent Modal ── */
.consent-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 10001;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}
.consent-overlay.open { display: flex; }

.consent-box {
  background: #fff;
  border-radius: 20px;
  padding: 44px 44px 36px;
  width: min(540px, 96vw);
  box-shadow: 0 32px 96px rgba(0,0,0,0.35);
  text-align: center;
}

.consent-icon {
  font-size: 52px;
  margin-bottom: 18px;
  display: block;
}

.consent-box h3 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 10px;
  letter-spacing: -0.3px;
}

.consent-intro {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.6;
}

.consent-points {
  list-style: none;
  padding: 0;
  text-align: left;
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 22px;
  margin-bottom: 18px;
}

.consent-points li {
  font-size: 13.5px;
  color: #374151;
  line-height: 1.6;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
}
.consent-points li:last-child { border-bottom: none; }

.consent-policy-links {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 24px;
}
.consent-policy-links a {
  color: #3b82f6;
  cursor: pointer;
  font-weight: 600;
  text-decoration: underline;
}
.consent-policy-links a:hover { color: #1d4ed8; }

.consent-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.consent-actions .btn-cancel {
  padding: 13px 24px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8faff;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.consent-actions .btn-cancel:hover { background: #e2e8f0; }
.consent-actions .btn-save {
  padding: 13px 32px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #1a3a5c, #1d4ed8);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(29,78,216,0.3);
  transition: opacity 0.2s, transform 0.15s;
}
.consent-actions .btn-save:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Privacy & Legal Page ── */
.privacy-page-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #f0f4f8;
  min-height: 100%;
}

.privacy-tabs-bar {
  display: flex;
  gap: 0;
  background: #fff;
  border-bottom: 2px solid #e8edf3;
  padding: 0 28px;
  flex-shrink: 0;
}

.privacy-pg-tab {
  padding: 16px 28px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.privacy-pg-tab:hover { color: #1a3a5c; }
.privacy-pg-tab.active { color: #1a3a5c; border-bottom-color: #1a3a5c; }

.privacy-pg-content {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  margin: 20px;
  border-radius: 14px;
  border: 1px solid #e8edf3;
  box-shadow: 0 2px 8px rgba(15,40,100,0.05);
}

/* ── Idle / Auto-logout Warning ── */
.idle-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.idle-overlay.open { display: flex; }

.idle-box {
  background: #fff;
  border-radius: 20px;
  padding: 44px 40px 36px;
  width: 380px;
  max-width: 94vw;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
  text-align: center;
}

.idle-icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

.idle-box h3 {
  font-size: 22px;
  font-weight: 800;
  color: #1a3a5c;
  margin-bottom: 10px;
}

.idle-box p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin-bottom: 0;
}

.idle-countdown {
  font-size: 64px;
  font-weight: 800;
  color: #dc2626;
  line-height: 1;
  margin: 18px 0 4px;
  letter-spacing: -2px;
}

.idle-countdown-label {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 28px !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.idle-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.idle-actions .btn-cancel {
  padding: 12px 22px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8faff;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.idle-actions .btn-cancel:hover { background: #e2e8f0; }

.idle-actions .btn-save {
  padding: 12px 28px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #1a3a5c, #1d4ed8);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(29,78,216,0.3);
  transition: opacity 0.2s, transform 0.15s;
}
.idle-actions .btn-save:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Password Prompt ── */
.pw-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.pw-overlay.open { display: flex; }

.pw-box {
  background: #fff;
  border-radius: 10px;
  padding: 36px 32px 28px;
  width: 360px;
  max-width: 94vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  text-align: center;
}
.pw-icon { font-size: 36px; margin-bottom: 10px; }
.pw-box h3 { font-size: 18px; color: #1a3a5c; margin-bottom: 6px; }
.pw-box p  { font-size: 14px; color: #666; margin-bottom: 18px; }

.pw-box input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cdd1d8;
  border-radius: 6px;
  font-size: 15px;
  outline: none;
  text-align: center;
  letter-spacing: 3px;
}
.pw-box input:focus { border-color: #1a3a5c; }

.pw-error {
  font-size: 13px;
  color: #dc2626;
  min-height: 20px;
  margin-top: 8px;
}
.pw-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

/* ── Data Management Tab ── */
.datamgmt-wrap {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.datamgmt-alert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #fff8e1;
  border: 1px solid #fcd34d;
  border-radius: 12px;
  padding: 16px 20px;
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.6;
}
.datamgmt-alert span { font-size: 22px; flex-shrink: 0; }

.datamgmt-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.datamgmt-card {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 16px;
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(15,40,100,0.05);
}

.datamgmt-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.datamgmt-card p {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.65;
}

.datamgmt-card code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: #1a3a5c;
}

.datamgmt-card-icon {
  font-size: 36px;
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
}
.dm-export { background: #dbeafe; }
.dm-import { background: #dcfce7; }

.datamgmt-summary {
  background: #f8faff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
}
.dm-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
}
.dm-summary-row:last-child { border-bottom: none; }
.dm-total { font-weight: 700; background: #f0f4f8; color: #1a3a5c; }
.dm-count {
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
}
.dm-total .dm-count { background: #1a3a5c; color: #fff; }

.datamgmt-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: #9f1239;
  line-height: 1.6;
}
.datamgmt-warning span { font-size: 18px; flex-shrink: 0; }

.dm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.2s, transform 0.15s;
  margin-top: auto;
  text-decoration: none;
}
.dm-btn:hover { opacity: 0.9; transform: translateY(-1px); }

.dm-btn-export {
  background: linear-gradient(135deg, #1a3a5c, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 16px rgba(29,78,216,0.3);
}

.dm-btn-import {
  background: linear-gradient(135deg, #065f46, #10b981);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}

.datamgmt-howto {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 2px 8px rgba(15,40,100,0.05);
}
.datamgmt-howto h4 {
  font-size: 14px;
  font-weight: 700;
  color: #1a3a5c;
  margin-bottom: 16px;
}
.datamgmt-howto ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.datamgmt-howto li {
  font-size: 13.5px;
  color: #374151;
  line-height: 1.6;
}

/* ── Admin Page ── */
.admin-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #dde1e7;
  background: #fff;
  flex-shrink: 0;
}

.admin-tab {
  padding: 13px 26px;
  font-size: 14px;
  font-weight: bold;
  color: #888;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}
.admin-tab:hover { color: #1a3a5c; }
.admin-tab.active { color: #1a3a5c; border-bottom-color: #1a3a5c; }

.admin-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
}

/* Documentation / Workflow cards */
.doc-section { margin-bottom: 28px; }
.doc-section h3 {
  font-size: 15px;
  font-weight: bold;
  color: #1a3a5c;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #edf0f4;
}
.doc-section p, .doc-section li {
  font-size: 14px;
  color: #444;
  line-height: 1.7;
}
.doc-section ul { padding-left: 20px; }
.doc-section li { margin-bottom: 4px; }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}
.doc-card {
  background: #f7f9fc;
  border: 1px solid #dde1e7;
  border-radius: 7px;
  padding: 16px;
}
.doc-card .doc-card-icon { font-size: 22px; margin-bottom: 8px; }
.doc-card h4 { font-size: 13px; font-weight: bold; color: #1a3a5c; margin-bottom: 5px; }
.doc-card p  { font-size: 13px; color: #666; line-height: 1.5; }

.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.formula-table th {
  background: #1a3a5c;
  color: #fff;
  padding: 9px 13px;
  text-align: left;
  font-weight: normal;
  font-size: 12px;
  text-transform: uppercase;
}
.formula-table td {
  padding: 9px 13px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: top;
}
.formula-table tr:last-child td { border-bottom: none; }
.formula-table tr:nth-child(even) td { background: #f7f9fc; }

/* Changelog entries */
.cl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.cl-entry {
  background: #fff;
  border: 1px solid #dde1e7;
  border-left: 5px solid #1a3a5c;
  border-radius: 7px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.cl-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cl-version {
  font-size: 17px;
  font-weight: bold;
  color: #1a3a5c;
}
.cl-date {
  font-size: 13px;
  color: #888;
  margin-left: 10px;
}
.cl-desc {
  font-size: 14px;
  color: #555;
  margin-bottom: 10px;
}
.cl-items { padding-left: 18px; }
.cl-items li {
  font-size: 14px;
  color: #444;
  line-height: 1.7;
}
.cl-actions { display: flex; gap: 6px; }

/* Workflow steps */
.workflow-steps { counter-reset: step; }
.workflow-step {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.workflow-step-num {
  counter-increment: step;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: #1a3a5c;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.workflow-step-body h4 { font-size: 14px; font-weight: bold; color: #1a3a5c; margin-bottom: 4px; }
.workflow-step-body p  { font-size: 14px; color: #555; line-height: 1.6; }

/* ══════════════════════════════
   RESPONSIVE — Tablet & Mobile
   ══════════════════════════════ */

/* ── Tablet (≤ 900px): sidebar collapses to icon-only ── */
@media (max-width: 900px) {
  #sidebar {
    width: 52px;
    min-width: 52px;
  }
  #sidebar-header,
  #sidebar nav a span.label,
  #sidebar-footer {
    display: none;
  }
  #sidebar nav a {
    justify-content: center;
    padding: 14px 0;
  }
  #sidebar nav a .icon {
    width: auto;
    font-size: 22px;
    margin: 0 auto;
  }

  /* Dashboard: 3-col KPI grid on tablet */
  .dash-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Dashboard alerts: 2x2 on tablet */
  .dash-alerts {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Login card less padding */
  .lp-card {
    padding: 48px 40px 40px;
  }
}

/* ── Mobile (≤ 600px): single-column layout ── */
@media (max-width: 600px) {

  /* ── Login page: hide branding panel, card goes full-width ── */
  .lp-left { display: none; }
  .lp-right {
    flex: 1;
    width: 100%;
    padding: 20px 16px;
    align-items: flex-start;
  }
  .lp-card {
    padding: 32px 22px 28px;
    border-radius: 18px;
    max-width: 100%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  }
  .lp-shield-wrap {
    width: 68px;
    height: 68px;
    font-size: 30px;
    margin-bottom: 14px;
  }
  .lp-welcome { font-size: 22px; }
  .lp-card-sub { font-size: 13px; }
  .lp-card-header { margin-bottom: 22px; }
  .lp-role-card { padding: 14px 14px; gap: 12px; }
  .lp-role-card-icon { width: 38px; height: 38px; font-size: 1.3rem; }
  .lp-role-card-title { font-size: 0.88rem; }
  .lp-role-card-sub { font-size: 0.72rem; }
  .lp-creds-actions { flex-direction: column-reverse; gap: 8px; }
  .lp-back-btn,
  .lp-creds-actions .lp-login-btn { width: 100%; justify-content: center; }

  /* ── Sidebar: slim icon rail ── */
  #sidebar {
    width: 48px;
    min-width: 48px;
  }
  #sidebar nav a { padding: 12px 0; }

  /* ── Page header: stack title + controls ── */
  #page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px 14px 8px;
  }
  .page-header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .page-controls {
    flex-wrap: wrap;
    gap: 6px;
  }
  .page-controls input[type="text"],
  .page-controls select {
    flex: 1 1 130px;
    min-width: 100px;
    font-size: 13px;
  }
  .btn-add {
    width: 100%;
    justify-content: center;
  }

  /* ── Table: horizontal scroll ── */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table { min-width: 560px; }
  th, td { padding: 10px 10px; font-size: 13px; }

  /* ── Pagination bar ── */
  .pagination-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    font-size: 12px;
  }

  /* ── Dashboard KPI cards: 2-col grid ── */
  .dash-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .dash-card { padding: 16px 14px; }
  .dash-card-value { font-size: 26px; }
  .dash-card-icon { width: 36px; height: 36px; font-size: 18px; }

  /* ── Dashboard alert cards: 2-col grid ── */
  .dash-alerts {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .dash-alert { padding: 16px 14px; }
  .dash-alert-num { font-size: 36px; }
  .dash-alert-icon { font-size: 22px; margin-bottom: 6px; }
  .dash-alert-label { font-size: 10px; }

  /* ── Dashboard charts: single column ── */
  .dash-charts-row {
    grid-template-columns: 1fr;
  }
  .dash-chart-wrap { height: 200px; }
  .dash-chart-wrap canvas { max-height: 200px; }

  /* ── Modals: full-width with margin ── */
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 18px 18px 12px 12px;
  }
  .modal-body { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr !important; }
  .modal-footer { padding: 12px 16px; gap: 8px; }
  .modal-footer .btn-cancel,
  .modal-footer .btn-save {
    flex: 1;
    text-align: center;
  }

  /* ── Confirm dialog ── */
  .confirm-overlay { padding: 16px; }
  .confirm-box {
    width: 100%;
    padding: 28px 20px 22px;
  }

  /* ── Idle overlay ── */
  .idle-box { width: calc(100vw - 48px); padding: 28px 20px; }

  /* ── Consent modal ── */
  .consent-box {
    width: 100%;
    padding: 28px 20px 24px;
    border-radius: 18px;
  }
  .consent-overlay { padding: 16px; align-items: flex-end; }

  /* ── Policy modal ── */
  .policy-modal {
    width: 100%;
    height: 100%;
    border-radius: 0;
    max-height: 100vh;
  }
  .policy-overlay { padding: 0; }

  /* ── Privacy page tabs ── */
  .privacy-tabs-bar { flex-wrap: wrap; }
  .privacy-pg-tab { flex: 1; text-align: center; font-size: 12px; padding: 8px 6px; }

  /* ── Birthday stat cards ── */
  .bday-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* ── Data management ── */
  .datamgmt-cards { grid-template-columns: 1fr; }
}
