/* =============================================
   Smart Attendance — ComLab
   Design system v2 (lively edition)

   Every original class name is preserved, so no PHP
   markup needed to change. The previous stylesheet is
   kept as style.legacy.css — copy it over this file to
   go back to the old look.
   ============================================= */

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

/* ── Reset ────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

/* ── Tokens ───────────────────────────────── */
:root {
  /* Brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a8a;

  /* Neutrals */
  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Semantic */
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;

  --yellow-50:  #fefce8;
  --yellow-100: #fef9c3;
  --yellow-600: #ca8a04;
  --yellow-700: #a16207;
  --yellow-800: #854d0e;

  --orange-50:  #fff7ed;
  --orange-100: #ffedd5;
  --orange-600: #ea580c;
  --orange-800: #9a3412;

  --red-50:  #fef2f2;
  --red-100: #fee2e2;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-800: #991b1b;

  /* Layout */
  --sidebar-w: 220px;
  --topbar-h:  62px;
  --radius:    10px;
  --radius-lg: 14px;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', sans-serif;
  --font-body:    'Inter', sans-serif;

  /* Effects */
  --ring: 0 0 0 3px rgba(59, 130, 246, .16);
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, .09);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, .14);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --grad-brand: linear-gradient(135deg, #2563eb 0%, #4f46e5 55%, #7c3aed 100%);
  --grad-soft:  linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

/* ── Base ─────────────────────────────────── */
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-800);
  background-color: var(--gray-50);
  /* soft light wash so the page isn't a flat grey */
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(37, 99, 235, .07), transparent 60%),
    radial-gradient(800px 460px at 92% 0%, rgba(124, 58, 237, .06), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--blue-600); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--blue-700); }

::selection { background: rgba(37, 99, 235, .16); }

:focus-visible {
  outline: 2px solid rgba(37, 99, 235, .55);
  outline-offset: 2px;
  border-radius: 5px;
}

/* ── LOGIN PAGE ───────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background-color: var(--gray-50);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  overflow: hidden;
}

/* Blur overlay (keeps uploaded background readable) */
.login-page::before {
  content: '';
  position: fixed;
  inset: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(8, 15, 35, .38);
  z-index: 0;
}

/* Slowly drifting colour wash on top of the blur */
.login-page::after {
  content: '';
  position: fixed;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(closest-side, rgba(56, 189, 248, .30), transparent 70%) 18% 22% / 55% 55% no-repeat,
    radial-gradient(closest-side, rgba(129, 140, 248, .30), transparent 70%) 82% 28% / 50% 50% no-repeat,
    radial-gradient(closest-side, rgba(167, 139, 250, .26), transparent 70%) 50% 88% / 60% 60% no-repeat;
  animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  50%  { transform: translate3d(2%, 2%, 0) scale(1.06); }
  100% { transform: translate3d(-1%, 3%, 0) scale(1.02); }
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 18px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(2, 6, 23, .35), 0 2px 0 rgba(255, 255, 255, .6) inset;
  animation: popIn .5s var(--ease) both;
  backdrop-filter: blur(2px);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

/* Logo plate above the card: sits on the blurred background so the card
   itself stays clean and the mark gets room to breathe. */
.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.login-logo-mark {
  width: clamp(116px, 30vw, 156px);
  height: clamp(116px, 30vw, 156px);
  border-radius: 50%;
  background: #fff;
  padding: clamp(6px, 1.6vw, 10px);
  overflow: hidden; /* keep a square source image inside the round plate */
  display: grid;
  place-items: center;
  box-shadow:
    0 18px 44px rgba(2, 6, 23, .38),
    0 0 0 6px rgba(255, 255, 255, .16),
    0 1px 0 rgba(255, 255, 255, .8) inset;
  animation: popIn .5s var(--ease) both;
}

.login-logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* short screens (small laptops, landscape phones) */
@media (max-height: 760px) {
  .login-shell { gap: 12px; }
  .login-logo-mark { width: 86px; height: 86px; padding: 6px; }
  .login-card { padding: 28px 26px; }
}

.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }

.login-logo-icon {
  width: 44px; height: 44px;
  background: var(--grad-brand);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}

.login-logo-text h1 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  color: var(--gray-900); line-height: 1.2;
}

.login-logo-text p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.login-card h1 {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 6px;
  text-align: center;
  padding-bottom: 0;
}
/* no accent bar on the login form */
.login-card h1::after { content: none; }

.login-card .sub {
  font-size: 13px;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 24px;
}

.login-card .alert { margin-bottom: 16px; }
.login-card .field { margin-bottom: 16px; }

.login-card .field label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  text-transform: none; letter-spacing: 0;
}

.login-card .field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--gray-800);
  background: #fff;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
  appearance: none; -webkit-appearance: none;
  display: block;
}

.login-card .field input:hover { border-color: var(--gray-400); }

.login-card .field input:focus {
  border-color: var(--blue-500);
  box-shadow: var(--ring);
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 12px;
  background: var(--grad-brand);
  background-size: 160% 160%;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .28);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), background-position .5s var(--ease);
}

.login-card button[type="submit"]:hover {
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .36);
}

.login-card button[type="submit"]:active { transform: translateY(0); }

/* ── LAYOUT ───────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 9999;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03), 0 6px 20px rgba(15, 23, 42, .04);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--blue-800);
  white-space: nowrap;
  margin-right: auto;
  pointer-events: none;
}

/* accent dot before the wordmark */
.brand::before {
  content: '';
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

/* wrapper holding the links plus the account actions (hamburger target on phones) */
.nav-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

/* hamburger button — hidden on desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 40px;
  height: 40px;
  padding: 9px;
  /* !important: the generic button rule is more specific than .nav-toggle */
  background: var(--gray-100) !important;
  border: 1px solid var(--gray-200) !important;
  border-radius: 9px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: none !important;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--gray-700);
  border-radius: 2px;
  transition: transform .22s var(--ease), opacity .18s var(--ease);
}

.nav-toggle:hover { background: var(--gray-200) !important; transform: none; box-shadow: none !important; }

/* the dark-mode button lives in header.php; pin its quiet look here */
.dm-toggle {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  color: #475569 !important;
  box-shadow: none !important;
}
.dm-toggle:hover { background: #e2e8f0 !important; transform: none !important; }
html.dark .dm-toggle {
  background: #273549 !important;
  border-color: #334155 !important;
  color: #fbbf24 !important;
}
html.dark .dm-toggle:hover { background: #334155 !important; }

.nav-toggle.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

nav { display: flex; align-items: center; gap: 4px; }

nav a {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  white-space: nowrap;
  position: relative;
  z-index: 1001;
  transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}

nav a:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  transform: translateY(-1px);
}

nav a.active {
  background: linear-gradient(180deg, rgba(37, 99, 235, .10), rgba(37, 99, 235, .06));
  color: var(--blue-700);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .14);
}

/* animated underline on the active item */
nav a.active::after {
  content: '';
  position: absolute;
  left: 13px; right: 13px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad-brand);
  animation: growBar .35s var(--ease) both;
}

@keyframes growBar {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

.who {
  font-size: 13px;
  color: var(--gray-500);
  padding: 0 8px;
  white-space: nowrap;
}

.logout {
  padding: 6px 14px !important;
  background: var(--red-50) !important;
  color: var(--red-600) !important;
  border-radius: 9px !important;
  font-weight: 600 !important;
  transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}

.logout:hover {
  background: var(--red-100) !important;
  color: var(--red-800) !important;
  transform: translateY(-1px);
}

.container {
  margin-top: var(--topbar-h);
  padding: 30px 28px 56px;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* ── TYPOGRAPHY ───────────────────────────── */
h1 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--gray-900);
  margin-bottom: 22px;
  padding-bottom: 10px;
  position: relative;
  animation: fadeIn .4s var(--ease) both;
}

/* short gradient accent under page titles */
h1::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 46px; height: 3px;
  border-radius: 3px;
  background: var(--grad-brand);
}

h2 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 14px;
}

h3 { font-family: var(--font-display); font-weight: 700; }

/* ── CARDS ────────────────────────────────── */
.card {
  background: var(--grad-soft);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
  animation: cardIn .45s var(--ease) both;
  transition: box-shadow .25s var(--ease), border-color .25s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--gray-300);
}

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

/* gentle stagger for grids of cards */
.row > .col:nth-child(1) .card,
.row > .col:nth-child(1).card { animation-delay: .02s; }
.row > .col:nth-child(2) .card,
.row > .col:nth-child(2).card { animation-delay: .07s; }
.row > .col:nth-child(3) .card,
.row > .col:nth-child(3).card { animation-delay: .12s; }
.row > .col:nth-child(4) .card,
.row > .col:nth-child(4).card { animation-delay: .17s; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── STAT CARDS ───────────────────────────── */
.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.col { flex: 1; min-width: 160px; }
.col.card { margin-bottom: 0; }

.stat-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin-bottom: 10px;
  transition: transform .25s var(--ease);
}

.card:hover .stat-icon { transform: translateY(-2px) scale(1.06); }

.stat-icon.blue   { background: var(--blue-50);   color: var(--blue-600); }
.stat-icon.green  { background: var(--green-50);  color: var(--green-600); }
.stat-icon.yellow { background: var(--yellow-50); color: var(--yellow-600); }
.stat-icon.red    { background: var(--red-50);    color: var(--red-600); }
.stat-icon.orange { background: var(--orange-50); color: var(--orange-600); }

.stat-val {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 800;
  color: var(--gray-900);
  line-height: 1.1;
  letter-spacing: -.02em;
}

.stat-lbl { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* dashboard stat tiles (inline-styled in the dashboards) get a hover lift */
.container > .card[style*="text-align:center"]:hover,
.container div.card[style*="text-align:center"]:hover {
  transform: translateY(-2px);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

/* ── TABLES ───────────────────────────────── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

thead th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  white-space: nowrap;
}

thead th:first-child { border-radius: 9px 0 0 9px; }
thead th:last-child  { border-radius: 0 9px 9px 0; }

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
  transition: background .14s var(--ease);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(37, 99, 235, .035); }

code {
  font-family: 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  background: var(--gray-100);
  color: var(--blue-700);
  padding: 2px 6px;
  border-radius: 5px;
}

/* scrollable student list */
.student-scroll {
  max-height: calc(100vh - 280px);
  min-height: 300px;
  overflow-y: auto;
  overflow-x: auto;
}

.student-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  box-shadow: 0 1px 0 #e2e8f0;
}

/* ── FORMS ────────────────────────────────── */
.field { margin-bottom: 16px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* input:not([type]) catches inputs written without a type attribute —
   they default to text, but without this they keep the browser's native box. */
input[type="text"],
input:not([type]),
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--gray-800);
  background: #fff;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
  appearance: none;
  -webkit-appearance: none;
}

input:hover, select:hover, textarea:hover { border-color: var(--gray-400); }

input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500);
  box-shadow: var(--ring);
}

::placeholder { color: var(--gray-400); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}

textarea { resize: vertical; min-height: 80px; }

input[type="checkbox"] {
  width: auto;
  accent-color: var(--blue-600);
  cursor: pointer;
}

/* text-like inputs only — checkboxes excluded */
.field input:not([type="checkbox"]),
.field select,
.field textarea { width: 100%; display: block; }

/* multi-day schedule picker (admin → assign subjects) */
.day-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.day-chip {
  position: relative;
  display: inline-flex;
  /* reset the .field label styling (uppercase, margins) */
  margin: 0;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--gray-700);
}

.day-chip input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}

.day-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 9px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease);
}

.day-chip span:hover { border-color: var(--blue-400); color: var(--blue-600); }

.day-chip input:checked + span {
  background: var(--blue-600);
  border-color: var(--blue-600);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .3);
}

.day-chip input:focus-visible + span { box-shadow: var(--ring); }

.hint { font-size: 11px; color: var(--gray-500); margin-top: 6px; }

/* shared start/end pair */
.time-pair { display: flex; align-items: center; gap: 8px; }
.time-pair input[type="time"] { flex: 1; }
.time-sep { font-size: 12px; color: var(--gray-500); }

/* one row per ticked weekday, shown only when hours differ */
.day-time {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.day-time[hidden] { display: none; }

.day-time-label {
  width: 38px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
}

.day-time input[type="time"] { flex: 1; max-width: 132px; }

/* schedule column in the assignment list */
.slot-time { font-size: 11px; color: var(--gray-500); margin-right: 10px; }

.day-tag {
  display: inline-block;
  padding: 2px 8px;
  margin: 1px 2px 1px 0;
  border-radius: 999px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 11px;
  font-weight: 600;
}

/* checkbox rows for subjects */
.subject-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 8px 0;
  font-size: 12px;
  color: var(--gray-600);
  cursor: pointer;
  line-height: 1.4;
}

.subject-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px; height: 16px;
  margin: 0;
  accent-color: var(--blue-600);
  cursor: pointer;
}

.subject-option span { flex: 1; }

.subject-option input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* RFID row stays horizontal */
.rfid-row input,
#rfid { flex: 1; width: auto; min-width: 0; }

/* ── BUTTONS ──────────────────────────────── */
button,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
  transition: background .16s var(--ease), color .16s var(--ease),
              transform .16s var(--ease), box-shadow .16s var(--ease);
}

/* shine sweep on primary buttons */
button[type="submit"]::after,
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.32), transparent);
  transform: skewX(-18deg);
  transition: left .55s var(--ease);
  pointer-events: none;
}

button[type="submit"]:hover::after,
.btn-primary:hover::after { left: 130%; }

/* NOTE: keep this selector free of :not(#id) — an ID inside :not() raises its
   specificity above the plain .class rules for the icon buttons. */
button[type="submit"],
button:not(.btn-secondary):not(.btn-danger) {
  background: var(--blue-600);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25);
}

button[type="submit"]:hover,
button:not(.btn-secondary):not(.btn-danger):hover {
  background: var(--blue-700);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, .30);
}

button:active { transform: translateY(0) scale(.99); }

.btn-secondary,
button.btn-secondary,
.btn.btn-secondary {
  background: var(--gray-100) !important;
  color: var(--gray-700) !important;
  border: 1px solid var(--gray-200) !important;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary:hover,
button.btn-secondary:hover,
.btn.btn-secondary:hover {
  background: var(--gray-200) !important;
  color: var(--gray-900) !important;
}

.btn-danger,
button.btn-danger,
.btn.btn-danger {
  background: var(--red-50);
  color: var(--red-600);
  border: 1px solid var(--red-100);
}

.btn-danger:hover,
button.btn-danger:hover,
.btn.btn-danger:hover {
  background: var(--red-100);
  color: var(--red-800);
}

/* capture button keeps its quiet look */
#captureBtn {
  padding: 8px 14px;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

#captureBtn:hover {
  background: var(--gray-200);
  border-color: var(--gray-300);
  transform: none;
  box-shadow: none;
}

/* ── BADGES ───────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .15s var(--ease);
}

.badge.green,
.badge.success  { background: var(--green-100);  color: var(--green-800); }
.badge.yellow,
.badge.warn     { background: var(--yellow-100); color: var(--yellow-800); }
.badge.orange   { background: var(--orange-100); color: var(--orange-800); }
.badge.red,
.badge.fda      { background: var(--red-100);    color: var(--red-800); }
.badge.blue     { background: var(--blue-100);   color: var(--blue-800); }
.badge.gray     { background: var(--gray-100);   color: var(--gray-700); }

/* ── ALERTS ───────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 3px solid transparent;
  animation: alertIn .35s var(--ease) both;
}

@keyframes alertIn {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

.alert.success { background: var(--green-50);  color: var(--green-700);  border: 1px solid var(--green-100); border-left-color: var(--green-600); }
.alert.error   { background: var(--red-50);    color: var(--red-700);    border: 1px solid var(--red-100);   border-left-color: var(--red-600); }
.alert.warn    { background: var(--yellow-50); color: var(--yellow-700); border: 1px solid var(--yellow-100); border-left-color: var(--yellow-600); }
.alert.fda     { background: var(--red-50);    color: var(--red-800);    border: 1px solid #fecaca; border-left-color: var(--red-600); font-weight: 600; }

/* FDA alerts get a slow pulse to draw the eye */
.alert.fda { animation: alertIn .35s var(--ease) both, fdaPulse 2.6s ease-in-out 1s infinite; }

@keyframes fdaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(220, 38, 38, .10); }
}

/* ── LIVE FEED ────────────────────────────── */
.live-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.row-scan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  border-left: 3px solid var(--blue-400);
  animation: slideIn .28s var(--ease);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}

.row-scan:hover { transform: translateX(2px); box-shadow: var(--shadow-sm); }

.row-scan.new {
  border-left-color: var(--green-600);
  background: var(--green-50);
  border-color: var(--green-100);
  animation: slideIn .28s var(--ease), flash 1.4s ease-out 1;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes flash {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, .35); }
  100% { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}

/* small live "listening" dot inside the badge */
#live-status::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 5px;
  animation: blink 1.6s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}

/* ── PROGRESS BARS ────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .5s var(--ease);
}

/* ── FOOTER ───────────────────────────────── */
.footbar {
  text-align: center;
  padding: 22px;
  font-size: 12px;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-200);
  margin-top: 44px;
}

/* ── SCROLLBAR ────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); background-clip: content-box; }

/* ── UTILITIES ────────────────────────────── */
.text-muted  { color: var(--gray-500); font-size: 12px; }
.text-small  { font-size: 12px; }
.fw-600      { font-weight: 600; }
.mt-4        { margin-top: 4px; }
.mt-8        { margin-top: 8px; }
.mb-0        { margin-bottom: 0; }
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.w-full      { width: 100%; }

/* ── NOTIFICATION BADGE ───────────────────── */
nav .notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  background: var(--red-600);
  color: #fff;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 4px;
}

/* ── RESPONSIVE ───────────────────────────── */
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  /* hamburger navigation: the panel holds every link plus Logout */
  .nav-toggle { display: inline-flex; }

  .nav-wrap {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    z-index: 9998;
  }

  .nav-wrap.open { display: flex; animation: menuIn .18s var(--ease) both; }

  .nav-wrap nav { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav-wrap nav a { padding: 12px 14px; font-size: 14px; border-radius: 10px; }
  .nav-wrap nav a.active::after { left: 14px; right: 14px; bottom: 6px; }

  .nav-wrap .who {
    padding: 10px 4px 2px;
    margin-top: 6px;
    border-top: 1px solid var(--gray-100);
    font-size: 13px;
  }

  .nav-wrap .logout {
    display: inline-flex;
    justify-content: center;
    padding: 11px 14px !important;
  }

  .nav-wrap .dm-toggle { align-self: flex-end; }

  html.dark .nav-wrap { background: #1e293b; border-color: #334155; }
  html.dark .nav-wrap .who { border-color: #334155; }
  html.dark .nav-toggle { background: #273549 !important; border-color: #334155 !important; }
  html.dark .nav-toggle span { background: #e2e8f0; }
}

@media (max-width: 768px) {
  .container { padding: 16px; }
  nav a { padding: 6px 9px; font-size: 12px; }
  .row  { flex-direction: column; }
  .col  { min-width: unset; }
  h1    { font-size: 19px; }
  .who  { display: none; }
  .login-card { padding: 30px 22px; }
}

/* ── PRINT ────────────────────────────────── */
@media print {
  .topbar, .footbar, button, .btn { display: none; }
  .container { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; animation: none; }
  body { background: #fff; }
}

/* ── REDUCED MOTION ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── MOBILE: tame the inline grids ──────────
   The dashboards write grid-template-columns inline, so they need
   attribute selectors to collapse on a phone. */
@media (max-width: 860px) {
  [style*="grid-template-columns:repeat(5,1fr)"],
  [style*="grid-template-columns:repeat(6,1fr)"],
  [style*="grid-template-columns:repeat(4,1fr)"],
  [style*="grid-template-columns:repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* let long live-feed rows wrap instead of pushing the page wide */
  .row-scan { flex-wrap: wrap; }

  /* charts can't stay at a fixed pixel width */
  canvas { max-width: 100%; height: auto; }
}

@media (max-width: 620px) {
  .container { padding: 14px 12px 44px; }
  h1 { font-size: 18px; }
  .card { padding: 16px; border-radius: 12px; }
  table { font-size: 12px; }
  thead th, tbody td { padding: 9px 10px; }
}

@media (max-width: 420px) {
  /* keep the wordmark next to the burger; just tighten it a little */
  .brand { font-size: 13.5px; gap: 8px; }
  .brand::before { width: 7px; height: 7px; box-shadow: none; }
}

/* =============================================
   DARK MODE
   (the toggle adds .dark to <html>; these rules
   also neutralise the colours written inline in
   the PHP pages)
   ============================================= */
html.dark body {
  background-color: #0f172a;
  background-image:
    radial-gradient(900px 500px at 12% -8%, rgba(59, 130, 246, .16), transparent 60%),
    radial-gradient(800px 460px at 92% 0%, rgba(124, 58, 237, .14), transparent 62%);
  color: #e2e8f0;
}

html.dark .topbar {
  background: rgba(30, 41, 59, .88);
  border-color: #334155;
}

html.dark .card { color: #e2e8f0; }

html.dark nav a { color: #94a3b8; }
html.dark nav a:hover { background: #273549; color: #e2e8f0; }
html.dark nav a.active { background: rgba(37, 99, 235, .2); color: #60a5fa; }

html.dark table thead th { background: #273549; color: #94a3b8; border-color: #334155; }
html.dark table tbody td { border-color: #334155; color: #e2e8f0; }
html.dark table tbody tr:hover td { background: #273549; }

html.dark input,
html.dark select,
html.dark textarea { background: #1e293b; border-color: #334155; color: #e2e8f0; }
html.dark input:focus,
html.dark select:focus,
html.dark textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .2); }

html.dark .alert.success { background: rgba(22, 163, 74, .15);  color: #4ade80; border-color: rgba(22, 163, 74, .3); }
html.dark .alert.error   { background: rgba(220, 38, 38, .15);  color: #f87171; border-color: rgba(220, 38, 38, .3); }
html.dark .alert.warn    { background: rgba(202, 138, 4, .15);  color: #fbbf24; border-color: rgba(202, 138, 4, .3); }
html.dark .alert.fda     { background: rgba(220, 38, 38, .15);  color: #f87171; border-color: rgba(220, 38, 38, .3); }

html.dark .row-scan { background: #273549; border-color: #334155; }
html.dark .row-scan.new { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .3); }

html.dark code { background: rgba(59, 130, 246, .15); color: #93c5fd; }
html.dark h1, html.dark h2 { color: #e2e8f0; }
html.dark .brand { color: #60a5fa; }
html.dark .who { color: #94a3b8; }
html.dark .logout { background: rgba(220, 38, 38, .15) !important; color: #f87171 !important; }
html.dark .footbar { background: transparent; border-color: #334155; color: #94a3b8; }

html.dark .badge.green  { background: rgba(22, 163, 74, .2);   color: #4ade80; }
html.dark .badge.yellow { background: rgba(202, 138, 4, .2);   color: #fbbf24; }
html.dark .badge.red    { background: rgba(220, 38, 38, .2);   color: #f87171; }
html.dark .badge.blue   { background: rgba(59, 130, 246, .2);  color: #93c5fd; }
html.dark .badge.orange { background: rgba(234, 88, 12, .2);   color: #fb923c; }
html.dark .badge.gray   { background: rgba(100, 116, 139, .2); color: #94a3b8; }

/* neutralise inline colours used across the pages */
html.dark [style*="color:#1e293b"],
html.dark [style*="color: #1e293b"] { color: #e2e8f0 !important; }
html.dark [style*="color:#166534"] { color: #4ade80 !important; }
html.dark [style*="color:#854d0e"] { color: #fbbf24 !important; }
html.dark [style*="color:#9a3412"] { color: #fb923c !important; }
html.dark [style*="color:#991b1b"] { color: #f87171 !important; }
html.dark [style*="color:#94a3b8"] { color: #64748b !important; }
html.dark [style*="color:#374151"] { color: #cbd5e1 !important; }
html.dark [style*="color:#64748b"] { color: #94a3b8 !important; }
html.dark [style*="color:#1e40af"] { color: #93c5fd !important; }
html.dark [style*="color:#1d4ed8"] { color: #93c5fd !important; }

html.dark [style*="background:#dcfce7"] { background: rgba(22, 163, 74, .15) !important; }
html.dark [style*="background:#fef9c3"] { background: rgba(202, 138, 4, .15) !important; }
html.dark [style*="background:#ffedd5"] { background: rgba(234, 88, 12, .15) !important; }
html.dark [style*="background:#fee2e2"] { background: rgba(220, 38, 38, .15) !important; }
html.dark [style*="background:#f8fafc"] { background: #1e293b !important; }
html.dark [style*="background:#f1f5f9"] { background: #273549 !important; }
html.dark [style*="background:#eff6ff"] { background: rgba(37, 99, 235, .15) !important; }
html.dark [style*="background:#dbeafe"] { background: rgba(37, 99, 235, .2) !important; }
html.dark [style*="background:#fce7f3"] { background: rgba(190, 24, 93, .15) !important; }
html.dark [style*="background:#fff"]    { background: #1e293b !important; }
html.dark [style*="background:#ffffff"] { background: #1e293b !important; }
html.dark [style*="background:white"]   { background: #1e293b !important; }

html.dark .card [style*="font-family:'Plus Jakarta Sans'"],
html.dark .card [style*='font-family:"Plus Jakarta Sans"'] { color: #e2e8f0 !important; }

html.dark [style*="border-top:3px solid"] { border-color: inherit !important; }
html.dark [style*="background:#e2e8f0"] { background: #334155 !important; }
html.dark [style*="background:#f8fafc;border-radius:8px"] { background: #273549 !important; }

html.dark [style*="background:#fff;border-radius:12px"],
html.dark [style*="background:#fff;border-radius:10px"] {
  background: #1e293b !important;
  border: 0.5px solid #334155;
  color: #e2e8f0 !important;
}

html.dark [style*="background:#f8fafc;border-radius:8px;border"] {
  background: #273549 !important;
  border-color: #334155 !important;
}

html.dark .student-scroll thead th {
  background: #273549;
  box-shadow: 0 1px 0 #334155;
}

/* Obra icons (inlined SVGs) sit on the text baseline like the emoji did */
.oi { vertical-align: -0.15em; flex: 0 0 auto; }
button .oi { pointer-events: none; }

/* ── LOGIN: forgot / reset password pages ─── */
.login-links { margin-top: 14px; text-align: center; font-size: 13px; }
.login-links a { color: var(--blue-600); font-weight: 600; }
.login-links a:hover { color: var(--blue-700); text-decoration: underline; }

.login-card .hint {
  font-size: 12px;
  line-height: 1.55;
  color: var(--gray-500);
  text-align: center;
  margin: 14px 0 0;
}
.login-card .hint a { color: var(--blue-600); font-weight: 600; }
.login-card .hint code { font-size: 11px; }

.login-card .btn {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 4px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
}

/* ── LOADING INDICATOR (slow connections) ────────────────────
   Shown by includes/loader.php. The bar appears on any internal link
   click or form submit; the overlay only joins in when the wait passes
   a second, so quick loads never flash it. */
#pageProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  box-shadow: 0 0 8px rgba(37, 99, 235, .45);
  transition: width .25s ease, opacity .2s ease;
}
#pageProgress.on {
  opacity: 1;
  width: 82%;
  transition: width 8s cubic-bezier(.08, .6, .15, 1), opacity .15s ease;
}
#pageProgress.done {
  opacity: 0;
  width: 100%;
  transition: width .2s ease, opacity .35s ease .1s;
}

#pageLoader {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, .35);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, visibility .18s;
}
#pageLoader.show { opacity: 1; visibility: visible; }

.page-loader-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 24px;
  border-radius: 14px;
  background: #fff;
  color: #334155;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .25);
}
html.dark .page-loader-box {
  background: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .5);
}

.sa-spinner {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 3px solid #dbeafe;
  border-top-color: #2563eb;
  animation: sa-spin .7s linear infinite;
}
html.dark .sa-spinner { border-color: #334155; border-top-color: #60a5fa; }

/* The button that sent the form: spinner instead of a second click */
.is-busy {
  pointer-events: none;
  opacity: .8;
  cursor: progress;
}
button.is-busy .sa-spinner {
  width: 13px;
  height: 13px;
  border-width: 2px;
  margin-right: 7px;
  vertical-align: -2px;
}

@keyframes sa-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sa-spinner { animation-duration: 1.8s; } }

/* ── SHOW / HIDE PASSWORD ────────────────────────────────────
   Added by includes/password_toggle.php: each password box gets wrapped
   and an eye button sits inside the field on the right. */
.pw-field { position: relative; }

/* room for the eye button; the login card sets its own input padding */
.pw-field input[type="password"],
.pw-field input[type="text"],
.pw-field input:not([type]) { padding-right: 42px !important; }

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  line-height: 0;
  cursor: pointer;
}
.pw-toggle:hover { background: #f1f5f9; color: #1e293b; }
.pw-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 1px; }
html.dark .pw-toggle { color: #94a3b8; }
html.dark .pw-toggle:hover { background: #334155; color: #e2e8f0; }

/* ── CHART SIZE ──────────────────────────────────────────────
   A donut canvas left free in a flex row grows to the card width and, being
   1:1, gets taller than the card. Bounding it in a fixed box keeps the same
   size on a wide screen and shrinks it on a phone, where the legend moves
   underneath instead of being squeezed beside it. */
.chart-panel { display: flex; align-items: center; gap: 20px; }
.chart-panel-body { flex: 1 1 auto; min-width: 0; }

.chart-donut {
  position: relative;
  flex: 0 0 170px;
  width: 170px;
  height: 170px;
  max-width: 100%;
}
.chart-donut canvas { display: block; width: 100% !important; height: 100% !important; }

@media (max-width: 860px) {
  .chart-panel { flex-direction: column; align-items: stretch; gap: 14px; }
  .chart-donut { flex: none; width: 150px; height: 150px; margin: 0 auto; }
}

/* ── MOBILE TOPBAR ───────────────────────────────────────────
   On a phone the bar used to hold the burger alone, which left the rest
   of it empty. The burger moves to the left edge and the wordmark sits
   right beside it; the nav-wrap is fixed there, so it takes no space. */
@media (max-width: 900px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .nav-toggle { order: 1; }
  .brand { order: 2; margin-right: auto; }
  .nav-wrap { order: 3; }
}

/* ── MOBILE FILTER FORMS ─────────────────────────────────────
   On a wide screen a .row lines its buttons up with the inputs via an
   inline "align-items:end". On a phone the same .row is a column, so
   that value starts working on the horizontal axis and pushes every
   field to the right edge, shrunk to the width of its own text.
   Stretching puts each label and input back at full width. */
@media (max-width: 768px) {
  .row[style*="align-items:end"] { align-items: stretch !important; }
  .row > .col { width: 100%; }
}

/* Quick-range chips: two per row instead of a ragged wrap that leaves
   the last one alone on its own line. */
@media (max-width: 620px) {
  .quick-ranges {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .quick-ranges > span { grid-column: 1 / -1; }
  .quick-ranges > a { text-align: center; }
}

/* Detailed / Summary tabs: equal halves, equal height, centered text,
   so the longer label no longer wraps taller than the other one. */
@media (max-width: 620px) {
  .view-toggle { display: grid !important; grid-template-columns: 1fr 1fr; }
  .view-toggle > a {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
}
