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

/**
 * style.css
 * ─────────────────────────────────────────────────────────────
 * Main SPA shell stylesheet (sidebar, dashboard, and every
 * app.js-rendered page). This file is fully self-contained and
 * deliberately does NOT load theme.css.
 *
 * theme.css (used by forgot_password.html, change_password.html,
 * reset_password.html, register.html, license.html, sysadmin.html)
 * uses the exact same token NAMES and VALUES as this file, so the
 * whole product reads as one consistent design system — but the
 * two files are never loaded on the same page. That's a deliberate
 * choice, not an oversight: this file's .btn-primary, .form-control,
 * and .form-select are small inline-button/dashboard-form styles
 * used by hundreds of elements across the live app; theme.css's
 * versions of those same class names are styled for full-width
 * auth-card CTAs and Bootstrap-based admin forms. Loading both
 * files on one page would mean whichever loads second wins for
 * every property it declares — and silently leaves the other
 * file's declarations in place for anything it doesn't override.
 * Tested this directly: it would have made every button in the
 * live dashboard stretch to full width. Kept separate on purpose.
 *
 * If you ever change a brand color, change it in BOTH this file's
 * :root block and theme.css's :root block — that manual sync step
 * is the accepted tradeoff for avoiding the collision above.
 * ─────────────────────────────────────────────────────────────
 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --sidebar-w:          240px;
  --header-h:           60px;
  --sidebar-bg:         #0c1220;
  --sidebar-text:       #8b99b5;
  --sidebar-hover:      rgba(255,255,255,.05);
  --sidebar-active-bg:  rgba(242,101,42,.15);
  --sidebar-active-text:#f2652a;
  --sidebar-border:     rgba(255,255,255,.06);
  --primary:            #f2652a;
  --primary-dark:       #d1491a;
  --success:            #22c55e;
  --warning:            #f59e0b;
  --danger:             #ef4444;
  --info:               #06b6d4;
  --bg:                 #f0f4f8;
  --card:               #ffffff;
  --text:               #0f172a;
  --text-2:             #475569;
  --text-3:             #94a3b8;
  --border:             #e2e8f0;
  --border-2:           #f1f5f9;
  --shadow-xs:          0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:          0 1px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.03);
  --shadow-md:          0 4px 16px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
  --shadow-lg:          0 8px 32px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  --radius:             12px;
  --radius-sm:          8px;
  --radius-xs:          6px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

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

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; bottom: 0;
  z-index: 200; overflow: hidden;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 11px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo > div:last-child { min-width: 0; flex: 1; }
.logo-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, #f2652a 0%, #d1491a 100%);
  border-radius: 9px; display: flex; align-items: center;
  justify-content: center; font-size: 17px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(242,101,42,.4);
}
.logo-text { color: #f0f6ff; font-weight: 700; font-size: 14.5px; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }
.logo-sub  { color: var(--sidebar-text); font-size: 10.5px; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }

.sidebar-nav { flex: 1; padding: 8px 10px 12px; overflow-y: auto; }
.nav-section-label {
  padding: 12px 10px 4px;
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #3d4f6e;
}
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s;
  user-select: none; position: relative;
}
.nav-item:hover  { background: var(--sidebar-hover); color: #c8d4ea; }
.nav-item.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-item.active i { color: var(--sidebar-active-text); }
.nav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; opacity: .85; }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700; padding: 1px 5px;
  border-radius: 99px; min-width: 17px; text-align: center; line-height: 14px;
}

.sidebar-footer { padding: 10px 12px; border-top: 1px solid var(--sidebar-border); }
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: var(--radius-sm); cursor: pointer; transition: background .12s;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.s-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, #f2652a, #d1491a);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.s-name { color: #dde8f8; font-size: 12.5px; font-weight: 600; }
.s-role { color: var(--sidebar-text); font-size: 11px; text-transform: capitalize; }
.s-signout { margin-left: auto; color: #3d4f6e; font-size: 15px; cursor: pointer; transition: color .15s; }
.s-signout:hover { color: var(--danger); }
.ver-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 8px; margin-top: 5px; border-radius: var(--radius-sm);
  font-size: 10px; font-weight: 500; color: #3a526e; cursor: pointer;
  transition: background .14s, color .14s; user-select: none; letter-spacing: .1px;
}
.ver-chip:hover { background: var(--sidebar-hover); color: #6b8fb5; }
.ver-chip i { font-size: 11px; }
.ver-sep { opacity: .3; }

/* ── Sidebar ambient glow ──────────────────────────────────────────────────
   Pure addition — no existing sidebar rule above is modified. Same drifting
   two-glow treatment as license.html/sysadmin.html, scaled down for a
   240px-wide column. .sidebar already has overflow:hidden and is the
   positioned ancestor, so this just needs to sit behind the real content;
   .sidebar-logo/.sidebar-nav/.sidebar-footer get z-index:1 below so there's
   no ambiguity about paint order (rather than relying on default stacking
   behavior for position:auto elements, which is correct but not obvious
   to a future reader of this file).
   ──────────────────────────────────────────────────────────────────────── */
.sidebar-ambient {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none; overflow: hidden;
}
.sidebar-ambient::before {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 22px 22px;
}
.sidebar-glow {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(242,101,42,.28) 0%, transparent 70%);
  will-change: transform, opacity;
}
.sidebar-glow-a { width: 260px; height: 260px; top: -60px;  left: -90px;  animation: sbglow-a 19s ease-in-out infinite; }
.sidebar-glow-b { width: 220px; height: 220px; bottom: -50px; right: -80px; animation: sbglow-b 27s ease-in-out infinite; }
@keyframes sbglow-a {
  0%   { transform: translate(0,0)      scale(1);   opacity: .6; }
  22%  { transform: translate(14%,10%)  scale(1.1);  opacity: 1;  }
  48%  { transform: translate(-8%,20%)  scale(.9);   opacity: .5; }
  74%  { transform: translate(10%,6%)   scale(1.05); opacity: .85;}
  100% { transform: translate(0,0)      scale(1);   opacity: .6; }
}
@keyframes sbglow-b {
  0%   { transform: translate(0,0)       scale(1);   opacity: .55;}
  30%  { transform: translate(-12%,-14%) scale(1.12); opacity: .9; }
  58%  { transform: translate(10%,12%)   scale(.9);   opacity: .5; }
  82%  { transform: translate(-6%,-8%)   scale(1.04); opacity: 1;  }
  100% { transform: translate(0,0)       scale(1);   opacity: .55;}
}
@media (prefers-reduced-motion: reduce) {
  .sidebar-glow-a, .sidebar-glow-b { animation: none; opacity: .7; }
}
.sidebar-logo, .sidebar-nav, .sidebar-footer { position: relative; z-index: 1; }

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

/* ── Header ────────────────────────────────────────────────────────────────── */
.top-header {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 10px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 var(--border);
}
.page-title { font-size: 15px; font-weight: 700; flex: 1; letter-spacing: -.015em; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 6px; }

.header-btn {
  width: 34px; height: 34px; border: none; background: transparent;
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; cursor: pointer; color: var(--text-2);
  font-size: 16px; transition: background .12s, color .12s; position: relative;
}
.header-btn:hover { background: var(--bg); color: var(--text); }
.header-notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; background: var(--danger);
  border-radius: 50%; border: 2px solid var(--card);
}

.ws-pill {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 5px 10px; border-radius: 99px;
  background: #f1f5f9; color: var(--text-2); transition: all .3s;
}
.ws-pill.live         { background: #dcfce7; color: #15803d; }
.ws-pill.reconnecting { background: #fef9c3; color: #854d0e; }
.ws-pill .ws-dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.ws-pill.live .ws-dot { animation: pulse-dot 2s infinite; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.35} }

.header-clock { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }

/* ── Pages ─────────────────────────────────────────────────────────────────── */
.page-content { flex: 1; padding: 22px; }
.page { display: none; animation: fadeIn .18s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ── Stat cards ────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 18px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px;
  transition: box-shadow .2s, transform .2s;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; border-radius: 3px 0 0 3px;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-card.sc-blue::before   { background: #3b82f6; }
.stat-card.sc-green::before  { background: #22c55e; }
.stat-card.sc-amber::before  { background: #f59e0b; }
.stat-card.sc-red::before    { background: #ef4444; }
.stat-card.sc-teal::before   { background: #06b6d4; }
.stat-card.sc-purple::before { background: #8b5cf6; }
.stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.si-blue   { background: #dbeafe; color: #1d4ed8; }
.si-green  { background: #dcfce7; color: #15803d; }
.si-amber  { background: #fef3c7; color: #92400e; }
.si-red    { background: #fee2e2; color: #991b1b; }
.si-teal   { background: #cffafe; color: #155e75; }
.stat-val   { font-size: 26px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.stat-label { font-size: 11.5px; color: var(--text-2); margin-top: 3px; font-weight: 500;width: max-content; }
.stat-body  { flex: 1; min-width: 0; }

/* ── Panels / Cards ────────────────────────────────────────────────────────── */
.panel {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-hdr {
  padding: 12px 16px; font-size: 13.5px; font-weight: 700;
  border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 8px;
  background: #fafbfd;
}
.panel-hdr .hdr-link {
  margin-left: auto; font-size: 12px; color: var(--primary); font-weight: 600; cursor: pointer;
}
.panel-hdr .hdr-link:hover { text-decoration: underline; }

/* ── Map ───────────────────────────────────────────────────────────────────── */
/* Container sizing (#map, #alertsPanel, #map-live, #map-geo, #map-route-mini)
   now lives in the "Mapbox GL JS" section below — these were the original
   Leaflet-era rules and are fully superseded there (width/border-radius/
   overflow/calc-based heights), so keeping both was pure dead code. */
.student-label {
  font-size: 11px; font-weight: 700;
  background: white; border: none; padding: 2px 5px;
  box-shadow: 0 1px 6px rgba(0,0,0,.25);
  border-radius: 4px; white-space: nowrap;
}
.leaflet-control-zoom { border: none !important; box-shadow: var(--shadow-md) !important; }
.leaflet-control-zoom a {
  border: 1px solid var(--border) !important; color: var(--text) !important;
  background: var(--card) !important; font-size: 16px !important;
}

/* ── Alert feed (dashboard panel) ──────────────────────────────────────────── */
.alert-feed-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-2);
  transition: background .1s; position: relative;
}
.alert-feed-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px;
}
.alert-feed-item.sev-critical::before { background: var(--danger); }
.alert-feed-item.sev-warning::before  { background: var(--warning); }
.alert-feed-item.sev-info::before     { background: var(--info); }
.alert-feed-item:hover { background: #f8fafc; }
.alert-feed-item:last-child { border-bottom: none; }
.a-icon {
  width: 30px; height: 30px; border-radius: var(--radius-xs); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.a-icon.critical { background: #fee2e2; color: #dc2626; }
.a-icon.warning  { background: #fef3c7; color: #d97706; }
.a-icon.info     { background: #dbeafe; color: #1d4ed8; }
.a-type { font-size: 12.5px; font-weight: 700; }
.a-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.btn-sm-resolve {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: var(--radius-xs); border: 1px solid #22c55e;
  background: transparent; color: #15803d; cursor: pointer; transition: background .1s;
  white-space: nowrap;
}
.btn-sm-resolve:hover { background: #dcfce7; }

/* ── Severity badges ───────────────────────────────────────────────────────── */
.badge-sev {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px;
  letter-spacing: .02em; text-transform: uppercase;
}
.badge-sev.critical { background: #fee2e2; color: #dc2626; }
.badge-sev.warning  { background: #fef3c7; color: #d97706; }
.badge-sev.info     { background: #dbeafe; color: #1d4ed8; }

/* ── Data table ────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f8fafc; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--text-3);
  padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-2); font-size: 13px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* ── Avatar chips ──────────────────────────────────────────────────────────── */
.av-chip {
  display: inline-flex; align-items: center; gap: 7px;
}
.av {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
}
.av-name { font-weight: 600; font-size: 13px; }

/* ── Status dot ────────────────────────────────────────────────────────────── */
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 2px rgba(34,197,94,.2); }
.status-dot.offline { background: #cbd5e1; }
.status-dot.alert   { background: var(--danger); box-shadow: 0 0 0 2px rgba(239,68,68,.2); animation: pulse-alert 1.5s infinite; }
@keyframes pulse-alert { 0%,100%{box-shadow:0 0 0 2px rgba(239,68,68,.2)} 50%{box-shadow:0 0 0 5px rgba(239,68,68,.05)} }

/* ── Live tracking layout ──────────────────────────────────────────────────── */
.live-layout { display: flex; gap: 14px; align-items: flex-start; height: calc(100vh - var(--header-h) - 44px); }
.live-sidebar {
  width: 260px; flex-shrink: 0;
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  height: 100%; display: flex; flex-direction: column;
}
.live-sidebar-hdr {
  padding: 12px 14px; font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.live-search {
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--border-2);
}
.live-search input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 6px 10px; font-size: 12.5px; background: var(--bg); outline: none;
  transition: border-color .15s;
}
.live-search input:focus { border-color: var(--primary); }
.live-sidebar-list { flex: 1; overflow-y: auto; }
.student-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-bottom: 1px solid var(--border-2);
  cursor: pointer; transition: background .1s;
}
.student-chip:hover  { background: #f8fafc; }
.student-chip.active { background: #fef2ea; }
.chip-av {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white; position: relative;
}
.chip-av-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  border: 2px solid var(--card); background: #cbd5e1;
}
.chip-av-dot.on  { background: var(--success); }
.chip-name { font-size: 12.5px; font-weight: 600; }
.chip-meta { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }
.chip-status { margin-left: auto; flex-shrink: 0; }
.chip-online {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 99px;
}
.chip-online.on  { background: #dcfce7; color: #15803d; }
.chip-online.off { background: #f1f5f9; color: #64748b; }
.live-map-wrap { flex: 1; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }

/* ── Filter tabs ───────────────────────────────────────────────────────────── */
.filter-tabs {
  display: flex; gap: 2px; background: var(--bg);
  border-radius: var(--radius-sm); padding: 3px;
}
.filter-tab {
  padding: 5px 12px; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--text-2); transition: all .15s; border: none; background: transparent;
}
.filter-tab.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-xs); }
.filter-tab:hover:not(.active) { color: var(--text); }

/* ── Simulation controls ───────────────────────────────────────────────────── */
.sim-tabs {
  display: flex; border-bottom: 1px solid var(--border); padding: 0 18px; gap: 0;
}
.sim-tab {
  padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s; margin-bottom: -1px;
}
.sim-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.sim-tab:hover:not(.active) { color: var(--text-2); }

.sim-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; border: none;
  transition: filter .15s, transform .1s;
}
.sim-btn:hover  { filter: brightness(.93); }
.sim-btn:active { transform: scale(.97); }
.sim-btn.s-green  { background: #dcfce7; color: #166534; }
.sim-btn.s-amber  { background: #fef3c7; color: #92400e; }
.sim-btn.s-red    { background: #fee2e2; color: #991b1b; }
.sim-btn.s-blue   { background: #dbeafe; color: #1e40af; }
.sim-btn.s-dark   { background: #1e293b; color: #e2e8f0; }

/* ── Route plan cards ──────────────────────────────────────────────────────── */
.route-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; position: relative; transition: box-shadow .15s;
}
.route-card:hover { box-shadow: var(--shadow-md); }
.route-card-color {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0;
}
.route-student-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 99px; padding: 2px 8px; font-size: 11px; font-weight: 500;
}

/* ── Wizard / multi-step modal ─────────────────────────────────────────────── */
.wizard-steps {
  display: flex; gap: 0; margin-bottom: 24px; position: relative;
}
.wizard-steps::before {
  content: ''; position: absolute; top: 14px; left: 14px; right: 14px;
  height: 2px; background: var(--border); z-index: 0;
}
.wizard-step {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  flex: 1; position: relative; z-index: 1;
}
.wizard-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  background: var(--card); border: 2px solid var(--border); color: var(--text-3);
  transition: all .25s;
}
.wizard-step.done  .wizard-step-dot { background: var(--success); border-color: var(--success); color: white; }
.wizard-step.active .wizard-step-dot { background: var(--primary); border-color: var(--primary); color: white; }
.wizard-step-label { font-size: 10.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; }
.wizard-step.active .wizard-step-label { color: var(--primary); font-weight: 700; }
.wizard-step.done  .wizard-step-label { color: var(--success); }

.wizard-pane { display: none; }
.wizard-pane.active { display: block; animation: fadeIn .15s ease; }

/* ── Form elements ─────────────────────────────────────────────────────────── */
.form-section { margin-bottom: 20px; }
.form-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 10px;
}
.form-grid { display: grid; gap: 12px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
/* Grid items default to min-width:auto, letting content (a <select> with
   long options, an unbreakable long word) force a column wider than its
   fr share. Covers every .form-grid usage app-wide, including the
   #geofenceNameModal override below. */
.form-grid > * { min-width: 0; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 7px 10px; font-size: 13px; outline: none; font-family: inherit;
  background: var(--card); color: var(--text); transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(242,101,42,.12); }
.form-control::placeholder { color: var(--text-3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 72px; }
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.form-check label { font-size: 13px; cursor: pointer; }
.form-check-input:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    accent-color: var(--primary) !important;
}

/* ── Alert highlight bar (top) ─────────────────────────────────────────────── */
.alert-topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; z-index: 999;
  background: var(--danger); color: white;
  padding: 8px 20px; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(239,68,68,.4);
  animation: slideDown .3s ease;
}
.alert-topbar.warning { background: var(--warning); }
@keyframes slideDown { from{transform:translateY(-100%)} to{transform:translateY(0)} }
.alert-topbar-close { margin-left: auto; cursor: pointer; font-size: 18px; opacity: .8; }
.alert-topbar-close:hover { opacity: 1; }

/* ── Settings panel (floating draggable dialog) ─────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 500; display: none; animation: fadeIn .18s;
}
.settings-overlay.open { display: block; }

.settings-panel {
  position: fixed;
  /* default: centred — JS will override with pixel coords after dragging */
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(.95);
  width: 640px;
  max-width: calc(100vw - 32px);
  height: calc(100vh - 100px);
  max-height: 760px;
  min-height: 400px;
  background: var(--card);
  z-index: 501;
  box-shadow: 0 24px 72px rgba(0,0,0,.28), 0 4px 20px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  will-change: transform, opacity;
  /* when dragged, transition is removed via JS */
}
.settings-panel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: all;
}
/* When position has been manually set by dragging, override centering transform */
.settings-panel.dragged {
  transform: none !important;
}

.settings-hdr {
  padding: 14px 18px; font-size: 15px; font-weight: 700;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  cursor: grab; user-select: none; flex-shrink: 0;
  background: var(--card);
}
.settings-hdr:active { cursor: grabbing; }
.settings-close { cursor: pointer; color: var(--text-3); font-size: 20px; line-height: 1; padding: 2px 4px; border-radius: 4px; }
.settings-close:hover { color: var(--text); background: rgba(0,0,0,.06); }
.settings-body { flex: 1; overflow-y: auto; padding: 18px; }
.settings-section { margin-bottom: 22px; }
.settings-section-title {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .09em; color: var(--text-3); margin-bottom: 12px;
}
.settings-ftr { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }

/* ── Settings tabs ────────────────────────────────────────────────────────── */
.sett-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 12px; font-size: 12px; font-weight: 600; color: var(--text-3);
  cursor: pointer; transition: color .15s, border-color .15s; white-space: nowrap; flex-shrink: 0;
}
.sett-tab:hover  { color: var(--text-2); }
.sett-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.sett-tab-pane   { overflow-y: auto; }
/* override body padding since tabs have their own pane padding */
.settings-body   { padding: 0; }

/* ── Role row in settings ─────────────────────────────────────────────────── */
.role-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--border-2);
}
.role-row:last-child { border-bottom: none; }

/* ── Page permission checkboxes ──────────────────────────────────────────── */
.page-perm-check {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; cursor: pointer;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: background .15s, border-color .15s;
  user-select: none;
}
.page-perm-check:hover                     { background: #e8f0fe; border-color: var(--primary); }
.page-perm-check input[type="checkbox"]    { margin: 0; accent-color: var(--primary); }
.page-perm-check:has(input:checked)        { background: rgba(242,101,42,.1); border-color: var(--primary); color: var(--primary); }

/* ── Primary action button ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary); color: white; border: none;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s, box-shadow .15s;
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(242,101,42,.35); }
.btn-secondary {
  background: var(--bg); color: var(--text-2); border: 1px solid var(--border);
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--border); }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-3);
}
.empty-state i { font-size: 36px; margin-bottom: 12px; display: block; opacity: .4; }
.empty-state p { font-size: 14px; font-weight: 500; color: var(--text-2); }
.empty-state small { font-size: 12px; display: block; margin-top: 4px; }

/* ── Geofence list items ───────────────────────────────────────────────────── */
.geofence-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-2);
  transition: background .15s;
}
.geofence-item:hover { background: var(--bg); }
.geofence-item:last-child { border-bottom: none; }
.geo-icon { width: 30px; height: 30px; background: #fee2e2; color: #dc2626; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* ── Notification dropdown ─────────────────────────────────────────────────── */
.notif-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 320px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 999;
  display: none; overflow: hidden;
}
.notif-dropdown.open { display: block; animation: fadeIn .15s; }
.notif-dropdown-hdr {
  padding: 12px 14px; font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between;
}
.notif-item {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border-2);
  transition: background .15s; cursor: pointer;
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-item-icon { width: 28px; height: 28px; border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.notif-item-text { font-size: 12.5px; font-weight: 600; }
.notif-item-meta { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.notif-wrap { position: relative; }

/* ── Phase 5 additions ─────────────────────────────────────────────────────── */

/* Alert pulse — Leaflet circle marker animation */
@keyframes alertPulse {
  0%   { stroke-width: 3; stroke-opacity: 1;  r: 18; }
  70%  { stroke-width: 6; stroke-opacity: .4; r: 26; }
  100% { stroke-width: 3; stroke-opacity: 1;  r: 18; }
}
.alert-pulse { animation: alertPulse 1.4s ease-in-out infinite; }
.alert-tip { background: #ef4444 !important; color: #fff !important; border: none !important; font-size: 11px !important; font-weight: 700 !important; padding: 2px 7px !important; border-radius: 4px !important; }

/* Stat card clickable */
.stat-clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat-clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* Monitoring banner */
.monitoring-banner {
  padding: 5px 20px; font-size: 12px; font-weight: 600;
  text-align: center; letter-spacing: .02em;
}
.monitoring-banner.active   { background: rgba(34,197,94,.12); color: #15803d; }
.monitoring-banner.inactive { background: rgba(239,68,68,.1);  color: #b91c1c; }

/* Geofence label tooltip */
.geo-label { background: rgba(239,68,68,.85) !important; color: #fff !important; border: none !important; font-size: 11px !important; font-weight: 600 !important; }

/* Assign student option */
.assign-student-opt {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; transition: background .1s, border-color .1s;
}
.assign-student-opt:hover   { background: var(--bg); }
.assign-student-opt.selected { background: rgba(242,101,42,.08); border-color: var(--primary); }
.assign-ep-name { font-size: 13px; font-weight: 600; }

/* Settings tabs / role rows / page perms — defined above (lines ~508–520) */

/* Smooth marker movement on Leaflet maps */
.leaflet-marker-icon,
.leaflet-marker-shadow {
  transition: transform 700ms cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* ── Satellite toggle button (live map) ─────────────────────────────────────── */
.satellite-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}
.satellite-toggle-btn:hover  { background: var(--border-2); }
.satellite-toggle-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.live-map-wrap { position: relative; }

/* ── Historical Playback page ───────────────────────────────────────────────── */
.playback-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 24px);
  gap: 0;
}
.playback-controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}
.pb-ctrl-group { display: flex; flex-direction: column; gap: 4px; }
.pb-ctrl-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }
.playback-map  { flex: 1; min-height: 300px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.pb-legend {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 6px 16px;
  background: var(--card);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}
.pb-leg-item { display: flex; align-items: center; gap: 5px; }
.pb-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.playback-timeline-bar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 10px 16px;
}
.pb-timeline-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.pb-time-label { font-size: 11px; color: var(--text-3); white-space: nowrap; min-width: 120px; }
.pb-time-label:last-child { text-align: right; }
.pb-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.pb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.pb-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pb-speed-btns { display: flex; gap: 4px; }
.pb-speed-btn {
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
}
.pb-speed-btn:hover  { background: var(--border-2); color: var(--text); }
.pb-speed-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Reports page ───────────────────────────────────────────────────────────── */
/* uses existing .panel / .data-table / .btn-* styles */

/* ── Audit Log page ─────────────────────────────────────────────────────────── */
.audit-action-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.audit-action-enroll    { background: rgba(34,197,94,.12);  color: #15803d; }
.audit-action-offboard  { background: rgba(239,68,68,.12);  color: #b91c1c; }
.audit-action-pause     { background: rgba(245,158,11,.12); color: #b45309; }
.audit-action-resume    { background: rgba(59,130,246,.12); color: #1d4ed8; }
.audit-action-resolve_alert       { background: rgba(34,197,94,.12);  color: #15803d; }
.audit-action-assign_geofence_group   { background: rgba(6,182,212,.12);  color: #0e7490; }
.audit-action-unassign_geofence_group { background: rgba(239,68,68,.12);  color: #b91c1c; }

/* ── Geofence group assignment section ──────────────────────────────────────── */
.gfa-assigned-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--border-2);
  margin-bottom: 6px;
  font-size: 12px;
}
.gfa-assigned-item .gfa-name { font-weight: 600; color: var(--text); }
.gfa-remove-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  line-height: 1;
}
.gfa-remove-btn:hover { opacity: .7; }

/* ── Offline device pin (grey) ──────────────────────────────────────────────── */
.device-offline-marker { filter: grayscale(100%) opacity(0.55); }

/* ── Pager controls ─────────────────────────────────────────────────────────── */
.pager-btn {
  padding: 5px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s;
}
.pager-btn:hover    { background: var(--border-2); }
.pager-btn.active   { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Alert row highlight (click-to-navigate) ────────────────────────────────── */
@keyframes alertRowPop {
  0%   { background: rgba(242,101,42,.22); box-shadow: 0 0 0 3px rgba(242,101,42,.35); }
  60%  { background: rgba(242,101,42,.12); }
  100% { background: transparent; box-shadow: none; }
}
.alert-row-highlight {
  animation: alertRowPop 3s ease forwards;
  border-radius: 6px;
}

/* ── Notification dropdown clickable items ──────────────────────────────────── */

/* ── Live tracking movement trail tooltip ───────────────────────────────────── */
.pb-tooltip {
  background: rgba(15,23,42,.9); color: #f8fafc;
  border: none; border-radius: 6px;
  font-size: 11px; padding: 4px 8px; font-weight: 500;
}

/* ── Satellite geofence outline (high contrast on dark imagery) ─────────────── */
.leaflet-interactive[stroke="#fbbf24"] {
  filter: drop-shadow(0 0 3px rgba(251,191,36,.8));
}

/* ── Geofence list edit/delete button layout ────────────────────────────────── */

/* ── Proximity simulation status ────────────────────────────────────────────── */
#proxStatus { min-height: 20px; }

/* ── User profile modal avatar colour ───────────────────────────────────────── */
#upAvatar {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
}

/* ── Alert-type badge in alerts table (pulse on new) ────────────────────────── */
@keyframes alertPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.alert-table-row.alert-row-highlight td:first-child .badge-sev {
  animation: alertPulse .5s ease 3;
}

/* ── Settings trail inputs ───────────────────────────────────────────────────── */
#settLiveTrail, #settDashTrail {
  font-variant-numeric: tabular-nums;
}

/* ── btn-danger small ────────────────────────────────────────────────────────── */
.btn-danger {
  padding: 7px 16px; border-radius: var(--radius-sm);
  background: var(--danger); color: #fff; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-danger:hover  { background: #dc2626; }
.btn-danger:active { transform: scale(.97); }

/* ── Student Groups page ────────────────────────────────────────────────────── */
.group-card {
  transition: transform .15s, box-shadow .15s;
}
.group-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

/* ── Edit Student modal tabs ─────────────────────────────────────────────────── */
#editStudentModal .sett-tab {
  padding: 10px 16px;
  font-size: 12px;
}

/* ── Reports KPI strip ───────────────────────────────────────────────────────── */
#rptKpiStrip > div {
  transition: transform .15s;
}
#rptKpiStrip > div:hover {
  transform: translateY(-2px);
}

/* ── Reports daily timeline bars ─────────────────────────────────────────────── */
#rptDailyTimeline > div > div:hover {
  opacity: 1 !important;
}

/* ── Geofence name modal type/buffer row ─────────────────────────────────────── */
#geofenceNameModal .form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Notification sound mute switch ──────────────────────────────────────────── */
#settMuteAlerts:checked { background-color: var(--danger); border-color: var(--danger); }

/* ── KPI tile hover animation ────────────────────────────────────────────────── */
.kpi-tile {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  border-radius: var(--radius, 8px);
}
.kpi-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.15);
}


/* ── Page activity loaders ───────────────────────────────────────────────────── */

/* Top progress bar */
#pageProgressBar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w, 240px);
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #f2652a 0%, #ff8552 55%, #06b6d4 100%);
  z-index: 9999;
  width: 0%;
  opacity: 0;
  transition: width 0.35s cubic-bezier(.4,0,.2,1), opacity 0.25s;
  box-shadow: 0 0 12px 1px rgba(242,101,42,.55);
  pointer-events: none;
}

/* ── Full-screen blur overlay ─────────────────────────────────────────────────
   Positioned fixed, covers the content area (right of sidebar, below header).
   backdrop-filter blurs everything behind it.                                */
#globalPageLoader {
  position: fixed;
  top: var(--header-h, 60px);
  left: var(--sidebar-w, 240px);
  right: 0;
  bottom: 0;
  z-index: 8000;
  display: none;                          /* shown by JS */
  align-items: center;
  justify-content: center;
  background: rgba(240, 244, 248, 0.55);  /* light tint */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: opacity 0.2s ease;
}

/* Spinner card — centred in the overlay */
#globalPageLoader .pl-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(242,101,42,0.15);
  border-radius: 16px;
  padding: 36px 48px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(242,101,42,.1);
}

#globalPageLoader .pl-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(242,101,42,.15);
  border-top-color:  #f2652a;
  border-right-color: #06b6d4;
  animation: pl-spin .75s linear infinite;
}

#globalPageLoader .pl-label {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  letter-spacing: .3px;
}

#globalPageLoader .pl-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: -10px;
}

@keyframes pl-spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer rows */
.skel-row td { padding: 11px 14px !important; }
.skel-cell {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    #f1f5f9 25%,
    rgba(148,163,184,.18) 50%,
    #f1f5f9 75%
  );
  background-size: 300% 100%;
  animation: pl-shimmer 1.5s ease infinite;
}
@keyframes pl-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Chart container loading state */
.chart-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  color: #94a3b8;
  font-size: 12px;
  gap: 12px;
}
.chart-loading .pl-ring {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(242,101,42,.15);
  border-top-color: #f2652a;
  border-right-color: #06b6d4;
  animation: pl-spin .75s linear infinite;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Mapbox GL JS — custom control styles
═══════════════════════════════════════════════════════════════ */

/* Map containers — ensure they fill their parent */
#map {
  width: 100%;
  height: calc(100vh - 260px);
  min-height: 480px;
  border-radius: 12px;
  overflow: hidden;
}
#alertsPanel {
  max-height: calc(100vh - 260px);
  min-height: 480px;
}
#map-live {
  width: 100%;
  height: calc(100vh - 180px);
  min-height: 500px;
  border-radius: 12px;
  overflow: hidden;
}
#map-geo {
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 480px;
  border-radius: 12px;
  overflow: hidden;
}
#map-playback {
  width: 100%;
  height: calc(100vh - 320px);
  min-height: 400px;
  border-radius: 12px;
  overflow: hidden;
}
#map-route-mini {
  width: 100%;
  height: 320px;
  border-radius: 12px;
  overflow: hidden;
}

/* Style switcher control */
.mb-style-switcher {
  position: relative;
}
.mb-style-toggle {
  width: 29px;
  height: 29px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  border-radius: 4px;
}
.mb-style-toggle:hover { background: #f4f7ff; }
.mb-style-panel {
  position: absolute;
  left: 33px;
  top: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  min-width: 138px;
  z-index: 200;
  overflow: hidden;
}
.mb-style-opt {
  display: block;
  width: 100%;
  padding: 8px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12.5px;
  white-space: nowrap;
  color: #1e293b;
  transition: background .12s;
}
.mb-style-opt:hover { background: #fef2ea; color: #f2652a; }

/* Mapbox popup */
.mb-popup .mapboxgl-popup-content {
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
  font-family: Inter, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  min-width: 160px;
}
.mb-popup .mapboxgl-popup-tip { border-top-color: #fff; }
.mb-popup-body { line-height: 1.65; }
.mb-popup-body strong { font-size: 14px; display: block; margin-bottom: 2px; }
.mb-popup-body small  { font-size: 11px; color: #94a3b8; }

/* Navigation + scale controls — dark-friendly */
.mapboxgl-ctrl-group {
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0,0,0,.18) !important;
}
.mapboxgl-ctrl button { border-radius: 6px !important; }

/* Attribution compact */
.mapboxgl-ctrl-attrib.mapboxgl-compact { opacity: .6; }
.mapboxgl-ctrl-attrib.mapboxgl-compact:hover { opacity: 1; }

/* ── Date preset buttons ──────────────────────────────────────────────────── */
.date-preset-btn {
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 5px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s, transform .08s;
  white-space: nowrap;
  line-height: 1.6;
}
.date-preset-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
}
.date-preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(242,101,42,.35), 0 2px 6px rgba(242,101,42,.25);
}
.date-preset-btn.active:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   UI ENHANCEMENT PASS — professional polish
══════════════════════════════════════════════════════════════════════════════ */

/* ── Document Library ───────────────────────────────────────────────────────── */
.doc-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 14px 14px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.doc-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(242,101,42,.1); }
.doc-card-icon {
  flex-shrink: 0; width: 40px; height: 40px;
  background: rgba(242,101,42,.1); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--primary);
}
.doc-card-body { flex: 1; min-width: 0; }
.doc-card-name {
  font-size: 13px; font-weight: 700; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.doc-card-desc {
  font-size: 11.5px; color: var(--text-2); margin-top: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-card-actions {
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; margin-left: 4px;
}
.doc-action-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--border);
  background: transparent; color: var(--text-2); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center; transition: all .13s;
}
.doc-action-btn:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.doc-action-delete:hover { background: var(--danger) !important; border-color: var(--danger) !important; }
.si-purple { background: rgba(139,92,246,.15); color: #a78bfa; }
.sc-purple .stat-icon { background: rgba(139,92,246,.15); color: #a78bfa; }

/* ── App footer ─────────────────────────────────────────────────────────────── */
.app-footer {
  padding: 11px 22px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: .025em;
  background: var(--card);
  user-select: none;
  flex-shrink: 0;
}
.app-footer .f-sep { margin: 0 8px; opacity: .45; }
.app-footer .f-brand { font-weight: 700; color: var(--text-2); }

/* ── Panel hover lift (non-interactive panels keep it subtle) ───────────────── */
.panel {
  transition: box-shadow .22s ease, transform .22s ease;
}
.panel:not(.panel-no-hover):hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── Table improvements: zebra + blue-accent hover ──────────────────────────── */
.data-table tbody tr:nth-child(even) td { background: #fafbfd; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: #fef2ea !important; }
.data-table tbody tr:hover td:first-child {
  border-left: 3px solid var(--primary);
  padding-left: 11px;
}

/* ── Status pill badges ─────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 99px; letter-spacing: .01em; white-space: nowrap;
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
}
.status-pill.active   { background: #dcfce7; color: #15803d; }
.status-pill.active::before   { background: #22c55e; }
.status-pill.paused   { background: #fef3c7; color: #92400e; }
.status-pill.paused::before   { background: #f59e0b; animation: pulse-dot 2s infinite; }
.status-pill.offline  { background: #f1f5f9; color: #64748b; }
.status-pill.offline::before  { background: #94a3b8; }
.status-pill.critical { background: #fee2e2; color: #991b1b; }
.status-pill.critical::before { background: #ef4444; animation: pulse-alert 1.5s infinite; }
.status-pill.enrolled { background: #dbeafe; color: #1e40af; }
.status-pill.enrolled::before { background: #3b82f6; }

/* ── Header avatar pill ─────────────────────────────────────────────────────── */
.header-user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  user-select: none;
}
.header-user-pill:hover { background: var(--border-2); box-shadow: var(--shadow-xs); }
.header-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, #f2652a, #d1491a);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ── Sidebar branding: school sub-label ─────────────────────────────────────── */
.sidebar-logo .logo-school {
  font-size: 9.5px; color: #3d5a80; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 145px;
}

/* ── Custom toast notification system ──────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
  align-items: flex-end; pointer-events: none;
  max-width: 360px;
}
.toast-card {
  pointer-events: auto; min-width: 300px; max-width: 360px;
  background: #1e293b;
  border-radius: 13px; overflow: hidden;
  box-shadow: 0 10px 36px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.25),
              inset 0 1px 0 rgba(255,255,255,.05);
  transform: translateX(115%); opacity: 0;
  transition: transform .38s cubic-bezier(.34,1.4,.64,1), opacity .25s ease;
}
.toast-card.toast-in  { transform: translateX(0); opacity: 1; }
.toast-card.toast-out {
  transform: translateX(115%); opacity: 0;
  transition: transform .24s ease-in, opacity .2s ease-in;
}
.toast-body {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 13px 14px 11px;
}
.toast-icon  { font-size: 17px; flex-shrink: 0; margin-top: 1px; line-height: 1; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 700; color: #f1f5f9; line-height: 1.3; }
.toast-sub   { font-size: 11.5px; color: #94a3b8; margin-top: 2px; line-height: 1.4; }
.toast-close {
  flex-shrink: 0; color: #475569; cursor: pointer; font-size: 13px;
  line-height: 1; padding: 2px 0; background: none; border: none;
  transition: color .15s;
}
.toast-close:hover { color: #94a3b8; }
.toast-progress {
  height: 3px; transform-origin: left center;
  animation: toast-drain linear forwards;
}
@keyframes toast-drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── Refined button primary hover glow ─────────────────────────────────────── */
.btn-primary:active { transform: scale(.97); }
.btn-secondary:active { transform: scale(.97); }

/* ── Dark mode ──────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:      #0f172a;
  --card:    #1e293b;
  --text:    #e2e8f0;
  --text-2:  #94a3b8;
  --text-3:  #64748b;
  --border:  #334155;
  --border-2: #1e293b;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }

/* Panels, cards */
[data-theme="dark"] .panel,
[data-theme="dark"] .card-panel,
[data-theme="dark"] .settings-panel,
[data-theme="dark"] .settings-section,
[data-theme="dark"] .app-footer,
[data-theme="dark"] .page-header-bar { background: var(--card); }

/* Panel header — override the hardcoded #fafbfd */
[data-theme="dark"] .panel-hdr { background: rgba(255,255,255,.03); border-bottom-color: var(--border); color: var(--text); }

/* Alert feed — fix hover on dark background */
[data-theme="dark"] .alert-feed-item         { border-bottom-color: rgba(255,255,255,.06); }
[data-theme="dark"] .alert-feed-item:hover   { background: rgba(255,255,255,.05); }
[data-theme="dark"] .alert-feed-item .a-type { color: var(--text); }
[data-theme="dark"] .alert-feed-item .a-meta { color: var(--text-3); }

/* Live tracking student list — dark mode hover/active/badge fixes */
[data-theme="dark"] .student-chip:hover  { background: rgba(255,255,255,.05); }
[data-theme="dark"] .student-chip.active { background: rgba(242,101,42,.14); }
[data-theme="dark"] .chip-online.on  { background: rgba(34,197,94,.18);  color: #86efac; }
[data-theme="dark"] .chip-online.off { background: rgba(148,163,184,.12); color: var(--text-3); }

/* Header */
[data-theme="dark"] .main-header { background: var(--card); border-bottom-color: var(--border); }

/* Modals */
[data-theme="dark"] .modal-content { background: var(--card); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .modal-header  { background: #0c1220; border-bottom-color: var(--border); }
[data-theme="dark"] .modal-footer  { background: var(--card); border-top-color: var(--border); }
[data-theme="dark"] .modal-body    { background: var(--card); }

/* Form inputs */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] select.form-control,
[data-theme="dark"] input.form-control,
[data-theme="dark"] textarea.form-control {
  background: #0f172a; color: var(--text); border-color: var(--border);
}
[data-theme="dark"] .form-control:focus {
  background: #0f172a; color: var(--text); border-color: var(--primary);
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-3); }

/* Tables */
[data-theme="dark"] .data-table th { background: #0f172a; color: var(--text-2); border-bottom-color: var(--border); }
[data-theme="dark"] .data-table td { border-bottom-color: var(--border); color: var(--text); }
[data-theme="dark"] .data-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.03); }
[data-theme="dark"] .data-table tbody tr:hover td { background: rgba(242,101,42,.08) !important; color: var(--text) !important; }

/* Summary cards */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .summary-card { background: var(--card); border-color: var(--border); }

/* Badges */
[data-theme="dark"] .badge-secondary { background: #334155; color: var(--text-2); }

/* Settings panel specifics */
[data-theme="dark"] .settings-hdr   { background: #0c1220; border-bottom-color: var(--border); }
[data-theme="dark"] .sett-tab       { color: var(--text-2); }
[data-theme="dark"] .sett-tab:hover { background: rgba(255,255,255,.05); }
[data-theme="dark"] .sett-tab.active {
  color: var(--primary); border-bottom-color: var(--primary);
}

/* Dropdowns */
[data-theme="dark"] .dropdown-menu {
  background: var(--card); border-color: var(--border); color: var(--text);
}
[data-theme="dark"] .dropdown-item:hover { background: rgba(255,255,255,.06); }

/* Theme toggle active state */
[data-theme="light"] #themeLight { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══ Enhancement block: Group-Geofence Mapping, enhanced pages ═══════════ */

/* Nav attention badge (amber) */
.nav-attention {
  background: var(--warning, #f59e0b) !important;
  color: #1a1a1a !important;
  font-weight: 800;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  margin-left: 4px;
  animation: attentionPulse 2s ease-in-out infinite;
}

@keyframes attentionPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .75; transform: scale(1.15); }
}

/* Student pending row */
.student-row-pending { background: rgba(245,158,11,.06) !important; }
.student-row-pending td:first-child { border-left: 3px solid var(--warning, #f59e0b); }
[data-theme="dark"] .student-row-pending { background: rgba(245,158,11,.08) !important; }

/* Pending dot on student name */
.stu-pending-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--warning, #f59e0b);
  display: inline-block;
  margin-left: 4px;
  flex-shrink: 0;
  animation: attentionPulse 2s ease-in-out infinite;
}

/* Group card attention strip — dark mode override */
[data-theme="dark"] .grp-attention-strip {
  background: rgba(245,158,11,.12) !important;
  border-bottom-color: rgba(245,158,11,.3) !important;
  color: #fbbf24 !important;
}
[data-theme="dark"] .grp-attention-strip button {
  background: #f59e0b !important;
  color: #1a1a1a !important;
}

/* GGM mapping table — active row highlight */
.ggm-row-active { background: rgba(16,185,129,.05) !important; }
[data-theme="dark"] .ggm-row-active { background: rgba(16,185,129,.07) !important; }

/* btn-warning utility */
.btn-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-warning:hover { background: #fde68a; }
[data-theme="dark"] .btn-warning {
  background: rgba(245,158,11,.18);
  color: #fbbf24;
  border-color: rgba(245,158,11,.35);
}
[data-theme="dark"] .btn-warning:hover { background: rgba(245,158,11,.28); }

/* Draw config panel inside geofence page */
#geoDrawConfig {
  border: 1px solid var(--warning, #f59e0b);
  border-radius: 10px;
  margin: 0 16px 12px;
  background: rgba(245,158,11,.05);
}
[data-theme="dark"] #geoDrawConfig { background: rgba(245,158,11,.08); }

/* GGM pending banner */
#ggmPendingBanner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}
[data-theme="dark"] #ggmPendingBanner {
  background: rgba(245,158,11,.12);
  color: #fbbf24;
  border-color: rgba(245,158,11,.3);
}
[data-theme="dark"]  #themeDark  { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Bypass Mode Map Banner ───────────────────────────────────────────────── */
@keyframes bypassBannerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
  50%       { box-shadow: 0 0 0 8px rgba(239,68,68,0.22); }
}

/* ── Breach monitoring disabled warning banner ───────────────────────────── */
.breach-monitor-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  color: #92400e;
  border-bottom: 1.5px solid rgba(245,158,11,.35);
  animation: breachWarnPulse 2s ease-in-out infinite;
  transition: filter .15s;
}
.breach-monitor-warning:hover { filter: brightness(0.93); }
.breach-monitor-warning__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #f59e0b; flex-shrink: 0;
  animation: breachDotPulse 1.4s ease-in-out infinite;
}
@keyframes breachWarnPulse {
  0%, 100% { background: rgba(245,158,11,.12); }
  50%       { background: rgba(245,158,11,.24); }
}
@keyframes breachDotPulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.7); opacity: .35; }
}
@keyframes bypassDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.6); opacity: 0.35; }
}
.bypass-map-banner {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(127, 0, 0, 0.88);
  color: #fff;
  padding: 8px 18px 8px 14px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,0.18);
  animation: bypassBannerPulse 2.5s ease-in-out infinite;
  letter-spacing: .02em;
  pointer-events: none;
  user-select: none;
}
.bypass-map-banner strong { font-weight: 800; letter-spacing: .05em; }
.bypass-map-banner__pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff6b6b;
  display: inline-block;
  flex-shrink: 0;
  animation: bypassDot 1.4s ease-in-out infinite;
}
.bypass-map-banner__sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.35);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Unassigned group link ────────────────────────────────────────────────── */
.unassigned-link {
  color: var(--warning);
  font-size: 12px;
  cursor: pointer;
  border-bottom: 1px dashed currentColor;
  padding-bottom: 1px;
  transition: color .15s;
}
.unassigned-link:hover { color: #d97706; }

/* ── Bypass Mode Card ─────────────────────────────────────────────────────── */
.bypass-mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.bypass-mode-card--active {
  border-color: #ef4444;
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(239,68,68,.08);
}
[data-theme="dark"] .bypass-mode-card--active {
  background: rgba(239,68,68,.08);
}
.bypass-mode-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.bypass-mode-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: #dcfce7;
  color: #16a34a;
  transition: background .25s, color .25s;
}
.bypass-mode-card--active .bypass-mode-icon {
  background: #fee2e2;
  color: #dc2626;
}
.bypass-mode-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.bypass-mode-desc {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Bypass Toggle Switch ─────────────────────────────────────────────────── */
.bypass-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
}
.bypass-toggle-wrap input { opacity: 0; width: 0; height: 0; }
.bypass-toggle-slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  transition: background .25s;
}
.bypass-toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.bypass-toggle-wrap input:checked + .bypass-toggle-slider { background: #ef4444; }
.bypass-toggle-wrap input:checked + .bypass-toggle-slider::before { transform: translateX(22px); }

/* ── Primary Geofence Badge ───────────────────────────────────────────────── */
.geo-primary-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: .02em;
}
[data-theme="dark"] .geo-primary-badge {
  background: rgba(245,158,11,.15);
  color: #fbbf24;
  border-color: rgba(245,158,11,.3);
}

/* ── Primary geofence sidebar glow ────────────────────────────────────────── */
.geo-item--primary {
  background: linear-gradient(90deg, rgba(245,158,11,.07) 0%, transparent 100%);
}
@keyframes primaryGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); }
  50%       { box-shadow: 0 0 0 4px rgba(245,158,11,.25); }
}
.geo-item--primary {
  animation: primaryGlow 2.8s ease-in-out infinite;
  border-radius: 8px;
}

/* ── License status: sidebar Trial badge + header days-remaining chip ────── */
.trial-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  background: rgba(245, 158, 11, .14);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, .3);
}
.trial-badge.expiring {
  background: rgba(239, 68, 68, .14);
  color: var(--danger);
  border-color: rgba(239, 68, 68, .3);
}
#trialChip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  margin-right: 2px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(245, 158, 11, .1);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, .25);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease;
}
#trialChip:hover { background: rgba(245, 158, 11, .18); }
#trialChip.expiring {
  background: rgba(239, 68, 68, .12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, .3);
}

/* ══════════════════════════════════════════════════════════════════════════
   HELP & SUPPORT PAGE  (#page-helpdesk — see pages/helpdesk.js)
   Built entirely from the existing design tokens so the page reads as part
   of the app rather than as a bolt-on. Translucent badge fills mean the
   same rules work on both the light and dark themes.
   ══════════════════════════════════════════════════════════════════════════ */

#page-helpdesk .table-wrap { overflow-x: auto; }

.hd-ticket-no {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ── Status / priority pills ─────────────────────────────────────────────── */
.hd-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px;
  border-radius: 6px; white-space: nowrap; text-transform: capitalize;
}
.hd-badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.hd-badge.badge-info   { background: rgba(6, 182, 212, .14);  color: #0891b2; }
.hd-badge.badge-muted  { background: rgba(100, 116, 139, .16); color: #64748b; }
.hd-badge.badge-amber  { background: rgba(245, 158, 11, .16); color: #b45309; }
.hd-badge.badge-purple { background: rgba(139, 92, 246, .16); color: #7c3aed; }
.hd-badge.badge-green  { background: rgba(34, 197, 94, .16);  color: #15803d; }
.hd-badge.badge-danger { background: rgba(239, 68, 68, .15);  color: #dc2626; }

/* Lift the text on the dark theme, where the mid-tones lose contrast.
   The app stamps data-theme on the root (app.js), so key off that — the
   legacy body.dark selector is kept as a belt-and-braces fallback. */
[data-theme="dark"] .hd-badge.badge-amber,  body.dark .hd-badge.badge-amber  { color: #fbbf24; }
[data-theme="dark"] .hd-badge.badge-green,  body.dark .hd-badge.badge-green  { color: #4ade80; }
[data-theme="dark"] .hd-badge.badge-info,   body.dark .hd-badge.badge-info   { color: #22d3ee; }
[data-theme="dark"] .hd-badge.badge-purple, body.dark .hd-badge.badge-purple { color: #a78bfa; }
[data-theme="dark"] .hd-badge.badge-danger, body.dark .hd-badge.badge-danger { color: #f87171; }
[data-theme="dark"] .hd-badge.badge-muted,  body.dark .hd-badge.badge-muted  { color: #94a3b8; }

/* ── Conversation thread ─────────────────────────────────────────────────── */
.hd-thread { display: flex; flex-direction: column; gap: 12px; }
.hd-msg {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--card);
}
.hd-msg-support { background: rgba(242, 101, 42, .05); border-color: rgba(242, 101, 42, .28); }
.hd-msg-head { display: flex; align-items: center; margin-bottom: 6px; font-size: 13px; }
.hd-msg-body { white-space: pre-wrap; font-size: 13.5px; }

/* ── Detail meta list ────────────────────────────────────────────────────── */
.hd-meta { display: grid; gap: 10px; font-size: 13px; }
.hd-meta > div { display: flex; flex-direction: column; gap: 2px; }
.hd-meta span {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700;
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
.hd-timeline { list-style: none; margin: 0; padding: 0; }
.hd-timeline li {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0; font-size: 12.5px;
  border-bottom: 1px dashed var(--border);
}
.hd-timeline li:last-child { border-bottom: 0; }

/* ── Rating stars ────────────────────────────────────────────────────────── */
.hd-stars { display: flex; gap: 5px; }
.hd-stars button {
  background: none; border: 0; cursor: pointer; padding: 0;
  font-size: 26px; line-height: 1; color: var(--border);
  transition: color .12s ease;
}
.hd-stars button:hover, .hd-stars button.on { color: var(--warning); }


/* ══════════════════════════════════════════════════════════════════════════
   LICENSE PAGE  (#page-license — see pages/license-page.js)
   Reuses the .hd-badge pills defined above for the Help & Support page, so
   status colours stay consistent across the two commercial screens.
   ══════════════════════════════════════════════════════════════════════════ */

#page-license .table-wrap { overflow-x: auto; }

.lic-blocked {
  display: flex; align-items: center; gap: 10px;
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .35);
  color: var(--danger);
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 14px;
}

.lic-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.lic-card:last-child { margin-bottom: 0; }
.lic-card-hdr {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}

.lic-lbl {
  font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-3); font-weight: 700;
}
.lic-plan-name {
  font-size: 24px; font-weight: 800; letter-spacing: -.02em;
  display: flex; align-items: center; gap: 10px; margin: 4px 0 2px;
}
.lic-sub { font-size: 12px; color: var(--text-3); }

.lic-code {
  font-size: 30px; font-weight: 900; letter-spacing: 3px;
  color: var(--primary); margin: 4px 0 6px;
  font-variant-numeric: tabular-nums;
}

/* ── Usage meters ────────────────────────────────────────────────────────── */
.lic-meters { display: grid; gap: 14px; margin-top: 18px; }
.lic-meter-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px; margin-bottom: 5px;
}
.lic-meter-top strong { font-variant-numeric: tabular-nums; }
.lic-bar {
  height: 6px; border-radius: 4px; overflow: hidden;
  background: var(--border);
}
.lic-bar > i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark, #d1491a));
  transition: width .35s ease;
}

/* ── Modules ─────────────────────────────────────────────────────────────── */
.lic-modules { display: flex; flex-wrap: wrap; gap: 6px; }
.lic-module {
  font-size: 11px; font-weight: 600; text-transform: capitalize;
  padding: 4px 9px; border-radius: 6px;
  background: rgba(242, 101, 42, .1);
  color: var(--primary);
  border: 1px solid rgba(242, 101, 42, .22);
}

/* ── Plan cards ──────────────────────────────────────────────────────────── */
.lic-note {
  background: rgba(6, 182, 212, .08);
  border: 1px solid rgba(6, 182, 212, .28);
  border-radius: 9px; padding: 10px 14px;
  font-size: 12px; color: var(--text-2, var(--text-3));
  margin-bottom: 14px; line-height: 1.6;
}

.lic-plan-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.lic-plan {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 16px;
  display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .15s ease;
}
.lic-plan:hover { border-color: var(--primary); transform: translateY(-2px); }
.lic-plan.current { border-color: var(--primary); border-width: 2px; }
.lic-plan-nm {
  font-weight: 700; font-size: 15px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.lic-plan-price {
  font-size: 28px; font-weight: 800; letter-spacing: -.02em;
  margin: 8px 0 6px; font-variant-numeric: tabular-nums;
}
.lic-plan-price small { font-size: 12px; font-weight: 600; color: var(--text-3); }
.lic-plan-meta { font-size: 11.5px; color: var(--text-3); line-height: 1.75; flex: 1; }

.lic-empty { text-align: center; padding: 50px 20px; color: var(--text-3); font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .lic-plan, .lic-bar > i { transition: none; }
}
