:root {
  --navy: #002147;
  --navy-mid: #0a2f5c;
  --gold: #ffb606;
  --gold-soft: #fff4d4;
  --bg: #f4f6f9;
  --sidebar: #00152c;
  --sidebar-w: 236px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;
  --text: #2c3340;
  --muted: #6c757d;
  --radius: 10px;
  --shadow: 0 10px 28px rgba(0, 33, 71, 0.08);
  --font: "Open Sans", sans-serif;
  --display: "Montserrat", sans-serif;
}

* { box-sizing: border-box; }
html, body.admin-body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0, 33, 71, 0.08);
}

/* Themed scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0, 33, 71, 0.08);
}
*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
*::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #eef1f6 0%, #e4e9f0 100%);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold) 0%, #e0a000 100%);
  border-radius: 999px;
  border: 2px solid #eef1f6;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffc933 0%, var(--gold) 100%);
}
*::-webkit-scrollbar-corner { background: transparent; }

.admin-shell {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--navy) 100%);
  color: #fff;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: width 0.22s ease, transform 0.22s ease;
  overflow: hidden;
}

.admin-body.sidebar-collapsed .admin-sidebar {
  width: var(--sidebar-w-collapsed);
}
.admin-body.sidebar-collapsed .sidebar-brand .brand-text,
.admin-body.sidebar-collapsed .nav-label,
.admin-body.sidebar-collapsed .badge-count,
.admin-body.sidebar-collapsed .nav-group-toggle {
  display: none !important;
}
.admin-body.sidebar-collapsed .nav-group-links {
  display: flex !important;
  flex-direction: column;
  gap: 0.1rem;
}
.admin-body.sidebar-collapsed .sidebar-brand,
.admin-body.sidebar-collapsed .sidebar-nav a,
.admin-body.sidebar-collapsed .sidebar-footer a {
  justify-content: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  gap: 0;
}
.admin-body.sidebar-collapsed .sidebar-nav a.active,
.admin-body.sidebar-collapsed .sidebar-footer a.active {
  box-shadow: inset 3px 0 0 var(--gold);
  background: rgba(255, 182, 6, 0.18);
}
.admin-body.sidebar-collapsed .sidebar-nav a.nav-sub {
  padding-left: 0.35rem;
}

.sidebar-brand {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--topbar-h);
  flex-shrink: 0;
}
.sidebar-brand img {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid var(--gold); object-fit: cover; flex-shrink: 0;
}
.sidebar-brand strong {
  display: block; font-family: var(--display); font-size: 0.82rem; line-height: 1.15;
}
.sidebar-brand small { color: var(--gold); font-size: 0.68rem; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.45rem 0.45rem 0.55rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(255, 255, 255, 0.08);
}
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}
.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 999px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold) 0%, #e0a000 100%);
  border-radius: 999px;
  border: 1px solid transparent;
  background-clip: padding-box;
}

.sidebar-nav a,
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: rgba(255,255,255,0.84);
  text-decoration: none;
  padding: 0.42rem 0.6rem;
  border-radius: 7px;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.2;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  position: relative;
}
.sidebar-nav a i,
.sidebar-footer a i {
  width: 16px;
  text-align: center;
  color: var(--gold);
  flex-shrink: 0;
  font-size: 0.86rem;
}
.sidebar-nav a:hover,
.sidebar-footer a:hover,
.sidebar-nav a.active {
  background: rgba(255, 182, 6, 0.15);
  color: #fff;
}
.sidebar-nav a.active {
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-nav a.nav-sub {
  padding-left: 1.55rem;
  font-size: 0.76rem;
  opacity: 0.95;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.42);
  padding: 0.45rem 0.6rem 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: inherit;
}
.nav-group-toggle:hover { color: rgba(255,255,255,0.7); }
.nav-group-chevron {
  font-size: 0.58rem;
  transition: transform 0.18s ease;
  opacity: 0.7;
}
.nav-group.open .nav-group-chevron { transform: rotate(180deg); }
.nav-group-links {
  display: none;
  flex-direction: column;
  gap: 0.1rem;
}
.nav-group.open .nav-group-links { display: flex; }
.nav-group:first-child .nav-group-toggle { padding-top: 0.15rem; }

.nav-section-label {
  padding: 0.45rem 0.6rem 0.15rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.42);
}
.nav-section-label:first-child { padding-top: 0.15rem; }

.badge-count {
  margin-left: auto;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0.1rem 0.38rem;
  line-height: 1.2;
}
.badge-count.badge-on { background: #198754; color: #fff; }
.badge-count.badge-lock {
  background: #6c757d;
  color: #fff;
  padding: 0.15rem 0.35rem;
}
.badge-count.badge-lock i { color: #fff; width: auto; font-size: 0.58rem; }

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  background: rgba(0, 0, 0, 0.22);
  flex-shrink: 0;
  flex-grow: 0;
  position: relative;
  z-index: 2;
}
.sidebar-footer a.nav-logout:hover {
  background: rgba(220, 53, 69, 0.22);
  color: #fff;
}

/* Tooltip when collapsed */
.admin-body.sidebar-collapsed .sidebar-nav a:hover::after,
.admin-body.sidebar-collapsed .sidebar-footer a:hover::after {
  content: attr(data-title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #111827;
  color: #fff;
  font-size: 0.75rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* ---------- Main ---------- */
.admin-main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: margin-left 0.22s ease;
}
.admin-body.sidebar-collapsed .admin-main {
  margin-left: var(--sidebar-w-collapsed);
}

.admin-topbar {
  background: #fff;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 12px rgba(0,33,71,0.05);
  z-index: 50;
  min-height: var(--topbar-h);
  flex-shrink: 0;
}
.admin-topbar h1 {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0;
  color: var(--navy);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(42vw, 16rem);
}
.admin-topbar-title {
  min-width: 0;
  flex: 1 1 auto;
}
#sidebarToggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e9f0;
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  flex-shrink: 0;
  cursor: pointer;
}
#sidebarToggle:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
}
.topbar-user {
  margin-left: auto;
  display: flex; align-items: center; gap: 0.55rem;
  font-weight: 600; color: var(--navy); font-size: 0.86rem;
  flex-shrink: 0;
}
.topbar-user .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gold-soft); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
}

.admin-content {
  padding: 0.9rem 1rem 1.35rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) rgba(0, 33, 71, 0.06);
}
.admin-content::-webkit-scrollbar {
  width: 9px;
}
.admin-content::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #eef1f6 0%, #e4e9f0 100%);
  border-radius: 999px;
}
.admin-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold) 0%, #e0a000 100%);
  border-radius: 999px;
  border: 2px solid #eef1f6;
  background-clip: padding-box;
}
.admin-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ffc933 0%, var(--gold) 100%);
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  height: 100%;
  border-top: 4px solid var(--gold);
}
.stat-card .icon {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; margin-bottom: 0.65rem;
}
.stat-card h3 {
  font-family: var(--display);
  font-size: 1.55rem;
  margin: 0;
  color: var(--navy);
}
.stat-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* Dashboard KPI cards */
.dash-kpi-row { --dash-delay: 0s; }
.dash-kpi {
  --dash-accent: var(--navy);
  --dash-soft: rgba(0, 33, 71, 0.08);
  --dash-ink: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  height: 100%;
  min-height: 5.5rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, #fff 48%, var(--dash-soft) 160%),
    #fff;
  border: 1px solid rgba(0, 33, 71, 0.06);
  box-shadow: 0 8px 22px rgba(0, 33, 71, 0.06);
  position: relative;
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  animation: dashKpiIn 0.45s ease both;
  animation-delay: var(--dash-delay, 0s);
}
.dash-kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--dash-accent);
  border-radius: 14px 0 0 14px;
}
.dash-kpi::after {
  content: "";
  position: absolute;
  right: -18%;
  top: -40%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--dash-soft);
  pointer-events: none;
  transition: transform 0.35s ease;
}
.dash-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 33, 71, 0.12);
  border-color: color-mix(in srgb, var(--dash-accent) 28%, transparent);
  color: inherit;
}
.dash-kpi:hover::after { transform: scale(1.18) translate(-6%, 8%); }
.dash-kpi:focus-visible {
  outline: 2px solid var(--dash-accent);
  outline-offset: 2px;
}

.dash-kpi__body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.dash-kpi__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}
.dash-kpi__value {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--dash-ink);
  letter-spacing: -0.02em;
}
.dash-kpi__meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-kpi__icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.15rem;
  color: var(--dash-accent);
  background: var(--dash-soft);
  position: relative;
  z-index: 1;
  transition: transform 0.22s ease, background 0.22s ease;
}
.dash-kpi:hover .dash-kpi__icon {
  transform: scale(1.06);
  background: color-mix(in srgb, var(--dash-accent) 18%, #fff);
}

.dash-kpi--navy { --dash-accent: #002147; --dash-soft: rgba(0, 33, 71, 0.1); }
.dash-kpi--gold { --dash-accent: #c99200; --dash-soft: rgba(255, 182, 6, 0.22); --dash-ink: #002147; }
.dash-kpi--teal { --dash-accent: #0b7a75; --dash-soft: rgba(11, 122, 117, 0.12); }
.dash-kpi--rose { --dash-accent: #b4233c; --dash-soft: rgba(180, 35, 60, 0.1); }
.dash-kpi--sky { --dash-accent: #1a6bb5; --dash-soft: rgba(26, 107, 181, 0.12); }

.dash-kpi--compact {
  min-height: 4.25rem;
  padding: 0.8rem 0.9rem;
  gap: 0.7rem;
  justify-content: flex-start;
}
.dash-kpi--compact .dash-kpi__icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  font-size: 0.95rem;
}
.dash-kpi--compact .dash-kpi__value {
  font-size: 1.25rem;
}
.dash-kpi--compact .dash-kpi__label {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.8rem;
}
.dash-kpi--compact::after { width: 72px; height: 72px; }

.dash-kpi-link {
  color: var(--navy-mid);
  font-weight: 600;
  text-decoration: none;
}
.dash-kpi-link:hover { color: var(--navy); text-decoration: underline; }

@keyframes dashKpiIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .dash-kpi { animation: none; }
  .dash-kpi:hover { transform: none; }
  .dash-kpi:hover .dash-kpi__icon,
  .dash-kpi:hover::after { transform: none; }
}

@media (max-width: 575.98px) {
  .dash-kpi--primary {
    min-height: 4.75rem;
    padding: 0.85rem 0.9rem;
  }
  .dash-kpi__value { font-size: 1.4rem; }
  .dash-kpi__icon { width: 40px; height: 40px; border-radius: 12px; font-size: 1rem; }
}

.panel-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.panel-card h2, .panel-card .panel-title {
  font-family: var(--display);
  font-size: 1rem;
  color: var(--navy);
  margin-bottom: 0.75rem;
}

.btn-gold {
  background: var(--gold); border-color: var(--gold); color: var(--navy); font-weight: 700;
}
.btn-gold:hover { background: #e0a000; border-color: #e0a000; color: var(--navy); }
.btn-navy {
  background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700;
}
.btn-navy:hover { background: var(--navy-mid); border-color: var(--navy-mid); color: #fff; }

.table-sortable .sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.table-sortable .sortable-th::after {
  content: " ↕";
  opacity: 0.35;
  font-size: 0.7em;
}
.table-sortable .sortable-th.sort-asc::after { content: " ↑"; opacity: 0.85; }
.table-sortable .sortable-th.sort-desc::after { content: " ↓"; opacity: 0.85; }

/* Image zoom lightbox */
.admin-img-zoom {
  position: fixed; inset: 0; z-index: 2200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.admin-img-zoom[hidden] { display: none !important; }
.admin-img-zoom-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 15, 30, 0.82);
  backdrop-filter: blur(6px);
}
.admin-img-zoom-toolbar {
  position: relative; z-index: 2;
  display: flex; gap: 0.4rem; align-items: center;
  background: #fff; border-radius: 999px;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
.admin-img-zoom-toolbar button {
  border: 0; background: #f0f3f8; color: var(--navy);
  width: 34px; height: 34px; border-radius: 50%;
  font-weight: 700; cursor: pointer;
}
.admin-img-zoom-toolbar button[data-zoom-reset] {
  width: auto; border-radius: 999px; padding: 0 0.65rem; font-size: 0.75rem;
}
.admin-img-zoom-toolbar [data-zoom-label] {
  min-width: 48px; text-align: center; font-weight: 700; font-size: 0.8rem;
}
.admin-img-zoom-stage {
  position: relative; z-index: 2;
  max-width: 92vw; max-height: 78vh;
  overflow: auto; text-align: center;
}
.admin-img-zoom-stage img {
  max-width: 90vw; max-height: 75vh;
  transform-origin: center center;
  transition: transform 0.15s ease;
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}
body.admin-img-zoom-open { overflow: hidden; }
.modal img, .admin-preview-media img, .img-zoomable {
  cursor: zoom-in;
}
.sent-mail-row { cursor: pointer; }
.sent-mail-row:hover { background: #f8fafc; }

.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #0a3a6e 55%, #00152c 100%);
  padding: 1.5rem;
  overflow: auto;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  padding: 2rem;
}
.login-card .brand { text-align: center; margin-bottom: 1.5rem; }
.login-card .brand img {
  width: 64px; height: 64px; border-radius: 50%;
  border: 3px solid var(--gold); margin-bottom: 0.75rem;
}
.login-card h1 {
  font-family: var(--display); font-size: 1.4rem;
  color: var(--navy); margin: 0;
}
.login-card .hint {
  background: var(--gold-soft);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

.mail-item {
  display: block;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid #eef1f6;
  text-decoration: none;
  color: inherit;
}
.mail-item:hover { background: #f8fafc; }
.mail-item.unread { background: #fffaf0; font-weight: 600; }
.mail-item .subject { color: var(--navy); }
.mail-item .meta { font-size: 0.78rem; color: var(--muted); }

/* ---------- Elegant compact forms & modals ---------- */
.admin-body .modal-backdrop.show {
  opacity: 0.48;
  backdrop-filter: blur(3px);
}
.admin-body .modal .modal-dialog {
  margin: 0.65rem auto;
  max-width: min(560px, 94vw);
}
.admin-body .modal .modal-dialog.modal-sm {
  max-width: min(380px, 92vw);
}
.admin-body .modal .modal-dialog.modal-lg,
.admin-body .modal .modal-dialog.modal-xl {
  max-width: min(720px, 96vw);
}
.admin-body .modal .modal-content {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 60px rgba(0, 20, 40, 0.28);
  max-height: calc(100vh - 1.3rem);
  display: flex;
  flex-direction: column;
  background: #fff;
}
.admin-body .modal .modal-header {
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid, #0a2f5c) 100%);
  color: #fff;
  border-bottom: 0;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}
.admin-body .modal .modal-header .modal-title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1.25;
}
.admin-body .modal .modal-header .modal-title .small,
.admin-body .modal .modal-header .small.text-muted,
.admin-body .modal .modal-header p {
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 0.72rem !important;
  font-weight: 500;
  margin: 0.15rem 0 0;
}
.admin-body .modal .modal-header .btn-close {
  filter: invert(1) brightness(1.4);
  opacity: 0.85;
  padding: 0.45rem;
  margin: 0;
  background-size: 0.7em;
}
.admin-body .modal .modal-header .btn-close:hover { opacity: 1; }
.admin-body .modal .modal-body {
  padding: 0.85rem 1rem;
  overflow-y: auto;
  flex: 1 1 auto;
  background: #fcfdff;
}
.admin-body .modal .modal-footer {
  padding: 0.55rem 1rem;
  flex-shrink: 0;
  background: #f4f7fb;
  border-top: 1px solid #e6edf5;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.admin-body .modal .modal-footer .btn {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.38rem 0.85rem;
  border-radius: 8px;
  white-space: nowrap;
  min-height: 34px;
}
.admin-body .modal .modal-footer .btn-gold,
.admin-body .modal .modal-footer .btn-navy,
.admin-body .modal .modal-footer .btn-primary {
  margin-left: auto;
}

/* Compact form controls — modals + panel forms */
.admin-body .modal .form-label,
.admin-form .form-label,
.panel-card form .form-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.22rem;
  color: #3d4f66;
}
.admin-body .modal .form-control,
.admin-body .modal .form-select,
.admin-form .form-control,
.admin-form .form-select,
.panel-card form .form-control,
.panel-card form .form-select {
  padding: 0.38rem 0.65rem;
  font-size: 0.84rem;
  min-height: 34px;
  border-radius: 8px;
  border-color: #d5dee9;
  background: #fff;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-body .modal .form-control:focus,
.admin-body .modal .form-select:focus,
.admin-form .form-control:focus,
.admin-form .form-select:focus,
.panel-card form .form-control:focus,
.panel-card form .form-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 182, 6, 0.18);
}
.admin-body .modal textarea.form-control,
.admin-form textarea.form-control,
.panel-card form textarea.form-control {
  min-height: 64px;
  resize: vertical;
  line-height: 1.45;
}
.admin-body .modal .form-control-sm,
.admin-form .form-control-sm,
.panel-card form .form-control-sm,
.admin-body .modal .form-select-sm,
.panel-card form .form-select-sm {
  min-height: 30px;
  padding: 0.28rem 0.55rem;
  font-size: 0.8rem;
  border-radius: 7px;
}
.admin-body .modal .form-text,
.admin-form .form-text,
.panel-card form .form-text {
  font-size: 0.7rem;
  margin-top: 0.2rem;
  color: #7a8798;
}
.admin-body .modal .form-check-label,
.admin-form .form-check-label,
.panel-card form .form-check-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}
.admin-body .modal .form-check-input,
.panel-card form .form-check-input {
  width: 1.05em;
  height: 1.05em;
  margin-top: 0.18em;
  border-color: #c5d0de;
}
.admin-body .modal .form-check-input:checked,
.panel-card form .form-check-input:checked {
  background-color: var(--navy);
  border-color: var(--navy);
}
.admin-body .modal .form-switch .form-check-input {
  width: 2.1em;
  height: 1.15em;
}
.admin-body .modal .row.g-3 {
  --bs-gutter-y: 0.65rem;
  --bs-gutter-x: 0.65rem;
}
.admin-body .modal .row.g-2 {
  --bs-gutter-y: 0.45rem;
  --bs-gutter-x: 0.5rem;
}
.admin-body .modal .input-group-sm > .form-control,
.admin-body .modal .input-group-sm > .btn {
  min-height: 30px;
  font-size: 0.8rem;
}

/* Soft field groups inside modals */
.admin-body .modal .form-section {
  background: #fff;
  border: 1px solid #e8eef5;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.65rem;
}
.admin-body .modal .form-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0 0 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #eef2f7;
}

/* Keep legacy modal-compact hooks aligned */
.modal-compact .modal-dialog {
  max-width: min(720px, 96vw);
  margin: 0.65rem auto;
}
.modal-compact .modal-content {
  max-height: calc(100vh - 1.3rem);
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
}
.modal-compact .modal-header {
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid, #0a2f5c) 100%);
  color: #fff;
  flex-shrink: 0;
}
.modal-compact .modal-header .modal-title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
}
.modal-compact .modal-header .btn-close { filter: invert(1) brightness(1.4); }
.modal-compact .modal-body {
  padding: 0.85rem 1rem;
  overflow-y: auto;
  flex: 1 1 auto;
  background: #fcfdff;
}
.modal-compact .modal-footer {
  padding: 0.55rem 1rem;
  flex-shrink: 0;
  background: #f4f7fb;
  border-top: 1px solid #e6edf5;
}
.modal-compact .form-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.22rem;
  color: #3d4f66;
}
.modal-compact .form-control,
.modal-compact .form-select {
  padding: 0.38rem 0.65rem;
  font-size: 0.84rem;
  min-height: 34px;
  border-radius: 8px;
}
.modal-compact textarea.form-control {
  min-height: 64px;
  resize: vertical;
}
.modal-compact .row.g-2 > [class*="col-"] { margin-bottom: 0; }
.modal-compact .form-text { font-size: 0.7rem; }
.modal-compact .photo-box {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold);
  display: block;
  margin: 0 auto 0.4rem;
}
.modal-compact .img-preview-rect {
  width: 100%;
  max-height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e9f0;
}

/* Compact panel forms */
.panel-card form .row.g-3 {
  --bs-gutter-y: 0.7rem;
  --bs-gutter-x: 0.7rem;
}
.panel-card .form-control-sm,
.panel-card .form-select-sm {
  border-radius: 7px;
}

.media-tile {
  background: #fff;
  border: 1px solid #e8ecf2;
  border-radius: 10px;
  padding: 0.75rem;
  height: 100%;
}
.media-tile img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #f0f3f8;
}
.media-tile h6 {
  font-size: 0.85rem;
  margin: 0.55rem 0 0.25rem;
  color: var(--navy);
}

/* Status pill in topbar */
.status-pill {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  text-decoration: none;
  color: #fff !important;
}
.status-pill.status-live { background: #198754; }
.status-pill.status-standby { background: #d97706; }
.status-pill.status-maintenance { background: #dc3545; }

/* Admin notifications dropdown */
.admin-notif-wrap {
  position: relative;
}
.admin-notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e9f0;
  background: #fff;
  color: var(--navy);
  border-radius: 8px;
  cursor: pointer;
}
.admin-notif-btn:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
}
.admin-notif-badge {
  position: absolute !important;
  top: -2px;
  right: -2px;
  margin-left: 0 !important;
  font-size: 0.62rem !important;
}
.admin-notif-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(340px, 92vw);
  max-width: calc(100vw - 1.5rem);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 33, 71, 0.18);
  border: 1px solid #e8ecf2;
  z-index: 400;
  overflow: hidden;
}
.admin-notif-dropdown[hidden] { display: none !important; }
@media (max-width: 767.98px) {
  .admin-topbar {
    overflow: visible;
    position: relative;
    z-index: 120;
  }
  .topbar-user {
    position: static;
  }
  .admin-notif-wrap {
    position: static;
  }
  .admin-notif-dropdown {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: calc(var(--topbar-h) + 0.35rem);
    width: auto;
    max-width: none;
    max-height: min(70dvh, calc(100dvh - var(--topbar-h) - 1.5rem));
    display: flex;
    flex-direction: column;
  }
  .admin-notif-dropdown[hidden] { display: none !important; }
  .admin-notif-list {
    max-height: none;
    flex: 1;
    min-height: 0;
  }
}
.admin-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #eef1f5;
  background: #fafbfc;
}
.admin-notif-head strong {
  font-size: 0.85rem;
  color: var(--navy);
}
.admin-notif-head-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.admin-notif-close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: #eef1f5;
  color: var(--navy);
  cursor: pointer;
}
.admin-notif-list {
  max-height: 320px;
  overflow: auto;
  scrollbar-width: none;
}
.admin-notif-list::-webkit-scrollbar { display: none; }
.admin-notif-item {
  display: block;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid #f1f3f5;
}
.admin-notif-item.unread { background: #fff8e8; }
.admin-notif-item strong {
  display: block;
  font-size: 0.82rem;
  color: var(--navy);
}
.admin-notif-item span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.15rem;
}
.admin-notif-item small {
  display: block;
  font-size: 0.68rem;
  color: #9aa3af;
  margin-top: 0.2rem;
}
.admin-notif-foot {
  padding: 0.55rem 0.85rem;
  border-top: 1px solid #eef1f5;
  text-align: center;
}
.admin-notif-foot a {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
}

/* Preview overlay — fit one screen */
body.admin-preview-open { overflow: hidden; }
.admin-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
}
.admin-preview-overlay[hidden] { display: none !important; }
.admin-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 15, 30, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.admin-preview-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(92dvh, 920px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  animation: adminPreviewIn 0.22s ease;
}
@keyframes adminPreviewIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.admin-preview-x {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
}
.admin-preview-media {
  flex: 0 0 auto;
  background: #0b1e36;
}
.admin-preview-media img {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
  background: #f0f3f8;
}
.admin-preview-overlay.is-image-only .admin-preview-card {
  width: min(360px, 100%);
  max-height: min(88dvh, 720px);
}
.admin-preview-overlay.is-image-only .admin-preview-media img {
  max-height: min(72dvh, 560px);
  object-fit: contain;
  background: #0b1e36;
}
.admin-preview-overlay.is-image-only .admin-preview-body {
  padding: 0.65rem 0.85rem 0.85rem;
}
.admin-preview-overlay.is-image-only .admin-preview-body.is-compact h2,
.admin-preview-overlay.is-image-only .admin-preview-body.is-compact .admin-preview-meta {
  display: none;
}
.admin-preview-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.admin-preview-body h2 {
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--navy);
  margin: 0 0 0.4rem;
  padding-right: 2rem;
  flex: 0 0 auto;
}
.admin-preview-meta {
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}
.admin-preview-meta .meta-row {
  margin-bottom: 0.2rem;
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.35rem;
  line-height: 1.35;
}
.admin-preview-meta .meta-row strong { color: #334155; font-weight: 600; }
.admin-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 0 0 auto;
  padding-top: 0.15rem;
  border-top: 1px solid #eef2f7;
}
.admin-preview-overlay.is-idcard .admin-preview-card {
  width: min(340px, 100%);
  max-height: min(94dvh, 860px);
  background: transparent;
  box-shadow: none;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.admin-preview-overlay.is-idcard .admin-preview-body {
  padding: 0;
  background: transparent;
  overflow: visible;
  width: 100%;
  align-items: center;
}
.admin-preview-overlay.is-idcard .admin-preview-meta {
  overflow: visible;
  margin: 0;
  flex: 0 0 auto;
  width: 100%;
}
.admin-preview-overlay.is-idcard .admin-preview-actions {
  margin-top: 0.65rem;
  padding: 0.55rem 0.4rem 0;
  border-top: none;
  justify-content: center;
  background: transparent;
  width: 100%;
}
.admin-preview-overlay.is-idcard .admin-preview-actions:empty,
.admin-preview-overlay.is-idcard .admin-preview-actions[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
}
.admin-preview-overlay.is-idcard .admin-preview-x {
  background: rgba(0, 20, 40, 0.55);
  top: 0.35rem;
  right: 0.35rem;
}

/* Identity card — compact theme layout */
.id-card {
  --id-primary: var(--navy, #002147);
  --id-primary-mid: var(--navy-mid, #0a2f5c);
  --id-accent: var(--gold, #ffb606);
  --id-accent-soft: var(--gold-soft, #fff4d4);
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0, 33, 71, 0.28);
  font-family: "Open Sans", sans-serif;
  display: flex;
  flex-direction: column;
  max-height: min(86dvh, 640px);
}
.id-card-top {
  position: relative;
  background: linear-gradient(160deg, var(--id-primary) 0%, var(--id-primary-mid) 70%, var(--sidebar, var(--id-primary)) 100%);
  padding: 0.7rem 0.65rem 2.35rem;
  text-align: center;
  flex: 0 0 auto;
}
.id-card-brand {
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1.25;
  padding: 0 0.5rem;
}
.id-card-wave-svg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  width: 100%;
  height: 26px;
  display: block;
  z-index: 1;
}
.id-card-photo {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid var(--id-accent);
  background: var(--id-accent-soft);
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 33, 71, 0.22);
  z-index: 2;
}
.id-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.id-card-mid {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 1.55rem;
  background: #fff;
}
.id-card-label {
  margin: 0 auto 0.3rem;
  width: fit-content;
  background: var(--id-primary);
  color: var(--id-accent);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0.22rem 0.65rem;
  border-radius: 4px;
  flex: 0 0 auto;
}
.id-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  padding: 0 0.65rem 0.3rem;
  flex: 0 0 auto;
}
.id-badge {
  font-size: 0.54rem;
  font-weight: 700;
  padding: 0.14rem 0.35rem;
  border-radius: 999px;
  background: #e8eef7;
  color: var(--id-primary);
  text-transform: capitalize;
}
.id-badge-dur { background: var(--id-accent-soft); color: #7a5800; }
.id-badge-course { background: #e8eef7; color: var(--id-primary-mid); }
.id-badge-grade { background: #d1e7dd; color: #0f5132; }
.id-card-fields {
  padding: 0.05rem 0.85rem 0.45rem;
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
  -webkit-overflow-scrolling: touch;
}
.id-field {
  display: grid;
  grid-template-columns: 4.6rem 0.4rem 1fr;
  gap: 0.12rem;
  align-items: baseline;
  font-size: 0.68rem;
  line-height: 1.25;
  margin-bottom: 0.12rem;
}
.id-k { color: #64748b; font-weight: 600; }
.id-sep { color: #94a3b8; }
.id-v { color: #0f172a; font-weight: 600; word-break: break-word; }
.id-card-foot {
  flex: 0 0 auto;
  position: relative;
  background: var(--id-primary);
  padding: 0.55rem 0.55rem 0.65rem;
}
.id-card-foot-wave {
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 16px;
  background: #fff;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  pointer-events: none;
}
.id-card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
}
.id-card-actions .btn {
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
}
.id-card-actions .btn-outline-primary,
.id-card-actions .btn-outline-danger {
  background: #fff;
}
.id-card-actions .btn-navy {
  background: var(--id-accent);
  border-color: var(--id-accent);
  color: var(--id-primary);
}

@media (max-width: 575.98px) {
  .admin-preview-overlay.is-idcard {
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
  }
  .admin-preview-overlay.is-idcard .admin-preview-card {
    width: min(340px, 100%);
  }
  .id-card { max-height: min(78dvh, 680px); }
}

/* Compact admin tables on phones — secondary cols use Bootstrap d-none d-md/lg */
.admin-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: flex-end;
  align-items: center;
}
.admin-actions .btn-icon,
.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}
.admin-stack {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}
.admin-stack-line1 {
  font-weight: 700;
  color: #002147;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-stack-line2 {
  font-size: 0.72rem;
  color: #6c757d;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.admin-stack-media {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  min-width: 0;
}
.admin-stack-media > img,
.admin-stack-media .admin-thumb {
  flex-shrink: 0;
}

@media (max-width: 767.98px) {
  .panel-card .table-responsive {
    margin-left: -0.25rem;
    margin-right: -0.25rem;
  }
  .panel-card .table {
    font-size: 0.82rem;
  }
  .panel-card .table th,
  .panel-card .table td {
    padding: 0.5rem 0.35rem;
    vertical-align: middle;
  }
  .panel-card .table thead th:not(:first-child):not(:last-child) {
    /* keep first (main) + last (actions) readable */
  }
  .panel-card .table td:last-child,
  .panel-card .table th:last-child {
    width: 1%;
    white-space: nowrap;
  }
  .admin-stack-line1 { font-size: 0.86rem; }
  .admin-stack-line2 {
    font-size: 0.68rem;
    -webkit-line-clamp: 2;
  }
  .admin-actions {
    flex-direction: row;
    max-width: 6.5rem;
  }
  .admin-actions .btn-icon {
    width: 30px;
    height: 30px;
  }
  /* Hide long button labels if any remain */
  .admin-actions .btn-label-text { display: none; }
}

/* Upload loading (admin) */
.ma-upload-loading {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 20, 40, 0.55);
  backdrop-filter: blur(4px);
}
.ma-upload-loading[hidden] { display: none !important; }
.ma-upload-loading-card {
  background: #002147;
  color: #fff;
  border-radius: 14px;
  padding: 1.35rem 1.6rem;
  text-align: center;
  min-width: 220px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.3);
}
.ma-upload-loading-text {
  margin-top: 0.75rem;
  font-weight: 700;
  font-size: 0.92rem;
}
.ma-upload-loading-sub {
  font-size: 0.75rem;
  opacity: 0.75;
  margin-top: 0.2rem;
}
body.ma-upload-loading-open { overflow: hidden; }

/* Master Insert FAB */
.master-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 1040;
}
body.modal-open .master-fab {
  display: none !important;
}
.fab-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: var(--navy);
  font-size: 1.35rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.fab-main:hover { transform: scale(1.06); }
.master-fab.open .fab-main {
  background: var(--navy);
  color: var(--gold);
  transform: rotate(45deg);
}
.fab-grid {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 220px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 33, 71, 0.2);
  border: 1px solid rgba(0, 33, 71, 0.08);
}
.fab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.4rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg);
  transition: background 0.15s ease, color 0.15s ease;
}
.fab-item i { font-size: 1.05rem; color: var(--gold); }
.fab-item:hover {
  background: var(--navy);
  color: #fff;
}
.fab-item:hover i { color: var(--gold); }

.phone-input-group .phone-cc {
  font-weight: 700;
  color: var(--navy);
  background: var(--gold-soft, #fff4d4);
  min-width: 3.5rem;
  justify-content: center;
}
.admin-device-warn .modal-title {
  font-family: var(--display);
  font-weight: 700;
  color: var(--navy);
  font-size: 1.05rem;
}
.admin-device-warn .alert-warning {
  border-left: 4px solid #ffb606;
}
.password-strength { margin-top: 0.45rem; }
.password-strength-bar {
  height: 6px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}
.password-strength-bar span {
  display: block;
  height: 100%;
  width: 20%;
  border-radius: 999px;
  transition: width 0.2s ease, background 0.2s ease;
}
.password-strength-label {
  display: block;
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Admin live chat */
.admin-chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0.85rem;
  height: calc(100dvh - var(--topbar-h) - 2.2rem);
  min-height: 420px;
}
.admin-chat-list,
.admin-chat-pane {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.admin-chat-threads { overflow: auto; flex: 1; }
.admin-thread-item {
  display: block;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eef1f5;
  text-decoration: none;
  color: inherit;
}
.admin-thread-item:hover,
.admin-thread-item.active { background: var(--gold-soft, #fff4d4); }
.admin-chat-messages {
  overflow: auto;
  padding: 1rem;
  background: #f0f2f5;
}
.admin-msg { display: flex; margin-bottom: 0.55rem; }
.admin-msg.mine { justify-content: flex-end; }
.admin-msg .bubble {
  max-width: 75%;
  background: #fff;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.admin-msg.mine .bubble { background: #dcf8c6; }
.admin-msg .txt { white-space: pre-wrap; word-break: break-word; font-size: 0.9rem; }
.admin-msg .meta { font-size: 0.7rem; color: #6c757d; margin-top: 0.25rem; display: flex; gap: 0.4rem; align-items: center; justify-content: flex-end; }
.admin-chat-direct {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.admin-chat-direct .chat-direct-btn {
  flex: 1;
  min-width: 6.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.admin-chat-direct .chat-direct-btn.call { background: #002147; color: #fff; }
.admin-chat-direct .chat-direct-btn.call:hover { background: #0a2f5c; color: #fff; }
.admin-chat-direct .chat-direct-btn.wa { background: #25D366; color: #fff; }
.admin-chat-direct .chat-direct-btn.wa:hover { background: #1ebe57; color: #fff; }
.admin-chat-direct .chat-direct-btn.wa-call { background: #128C7E; color: #fff; }
.admin-chat-direct .chat-direct-btn.wa-call:hover { background: #0e7368; color: #fff; }
@media (max-width: 991.98px) {
  .admin-chat-layout { grid-template-columns: 1fr; height: auto; }
  .admin-chat-list { max-height: 220px; }
  .admin-chat-pane { min-height: 420px; }
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-105%);
    width: min(280px, 86vw) !important;
    max-height: 100dvh;
    height: 100dvh;
    box-shadow: 8px 0 28px rgba(0,0,0,0.28);
  }
  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }
  .admin-body.sidebar-collapsed .admin-sidebar {
    width: min(280px, 86vw) !important;
  }
  .admin-body.sidebar-collapsed .sidebar-brand .brand-text,
  .admin-body.sidebar-collapsed .nav-label,
  .admin-body.sidebar-collapsed .badge-count,
  .admin-body.sidebar-collapsed .nav-group-toggle {
    display: flex !important;
  }
  .admin-body.sidebar-collapsed .nav-group:not(.open) .nav-group-links {
    display: none !important;
  }
  .admin-body.sidebar-collapsed .nav-group.open .nav-group-links {
    display: flex !important;
  }
  .admin-body.sidebar-collapsed .sidebar-brand,
  .admin-body.sidebar-collapsed .sidebar-nav a,
  .admin-body.sidebar-collapsed .sidebar-footer a {
    justify-content: flex-start;
    padding: 0.42rem 0.6rem;
    gap: 0.55rem;
  }
  .admin-body.sidebar-collapsed .sidebar-nav a.nav-sub {
    padding-left: 1.55rem;
  }
  .admin-body.sidebar-collapsed .sidebar-nav a:hover::after,
  .admin-body.sidebar-collapsed .sidebar-footer a:hover::after {
    content: none;
  }
  .admin-main,
  .admin-body.sidebar-collapsed .admin-main {
    margin-left: 0;
  }
  body.sidebar-open::after {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 150;
  }

  /* Topbar — compact on tablets/phones */
  .admin-topbar {
    padding: 0.45rem 0.65rem;
    gap: 0.45rem;
  }
  .admin-topbar h1 {
    font-size: 0.95rem;
    max-width: min(38vw, 11rem);
  }
  .topbar-user {
    gap: 0.3rem;
  }
  .topbar-user .badge {
    display: none !important;
  }
  .topbar-user .status-pill {
    font-size: 0.62rem;
    padding: 0.2rem 0.4rem;
  }
  .sidebar-footer {
    padding: 0.4rem 0.45rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }
  .sidebar-footer a {
    padding: 0.5rem 0.6rem;
  }
}

@media (max-width: 575.98px) {
  .admin-topbar h1 {
    font-size: 0.88rem;
    max-width: min(42vw, 9.5rem);
  }
  .topbar-user .status-pill {
    display: none !important;
  }
  .topbar-user .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.8rem;
  }
  .admin-content {
    padding: 0.7rem 0.65rem 1.1rem;
  }
  #sidebarToggle {
    width: 34px;
    height: 34px;
  }
}

/* Admin toast */
.admin-toast {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 4000;
  min-width: 180px;
  max-width: min(90vw, 360px);
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: var(--navy, #002147);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 12px 32px rgba(0, 33, 71, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.22s ease;
}
.admin-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.admin-toast.is-success {
  background: var(--navy, #002147);
  border: 1px solid var(--gold, #ffb606);
}
.admin-toast.is-error {
  background: #842029;
  border: 1px solid #f1aeb5;
}

/* Admin setup wizard */
.admin-setup-progress {
  height: 6px;
  background: #e8eef5;
  border-radius: 999px;
  overflow: hidden;
}
.admin-setup-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--gold));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.admin-setup-step h6 {
  color: var(--navy);
  font-weight: 700;
}

/* ---------- Course picker (offers / link courses) ---------- */
.course-picker {
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.course-picker-search {
  position: relative;
  border-bottom: 1px solid #e8eef5;
  background: #f8fafc;
}
.course-picker-search i {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: #8a97a8;
  font-size: 0.75rem;
  pointer-events: none;
}
.course-picker-search .form-control {
  border: 0;
  border-radius: 0;
  padding-left: 2rem;
  background: transparent;
  box-shadow: none !important;
  min-height: 34px;
}
.course-picker-list {
  max-height: 168px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.course-picker-item {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  padding: 0.42rem 0.7rem;
  border-bottom: 1px solid #f0f3f7;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--navy);
}
.course-picker-item:last-child {
  border-bottom: 0;
}
.course-picker-item:hover {
  background: #f4f7fb;
}
.course-picker-item.is-selected {
  background: rgba(255, 182, 6, 0.12);
}
.course-picker-item input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}
.course-picker-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.course-picker-title {
  line-height: 1.3;
  word-break: break-word;
}
.course-picker-cat {
  font-size: 0.7rem;
  color: #6b7785;
  font-weight: 500;
}
.course-picker-item.is-hidden {
  display: none;
}
.course-picker-empty {
  text-align: center;
}

#offerModal .modal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
#offerModal .modal-footer .btn {
  white-space: nowrap;
}
#offerModal .modal-footer .btn-gold {
  margin-left: auto;
  min-width: 7.5rem;
}
