/* LIGTAS-ROXAS - shared styles
   Design tokens ported from the IANsmart admin suite design system
   (colors, radii, shadows, card/button/badge/table language), rebranded. */

/* Scan QR kiosk view (admin/scan.php) - meant to run full-screen on a TV
   mounted at the entrance, so it deliberately skips the sidebar/topbar
   chrome (its own standalone <body>, not routed through admin_header.php)
   and just centers a big title + camera feed in the viewport. */
.kiosk-scan {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: #fff;
}
/* Same type treatment as the evacuation plan: heavy caps, gold ROXAS, indigo title. */
.kiosk-scan { background: #f7f8fb; gap: 10px; }
.kiosk-brand { display: flex; align-items: center; gap: 18px; }
.kiosk-logo { width: clamp(56px, 8vh, 90px); height: clamp(56px, 8vh, 90px); object-fit: contain; }
.kiosk-school { font-size: clamp(1.2rem, 3.2vh, 2.2rem); font-weight: 800; letter-spacing: .04em; color: #3b3f4a; line-height: 1.1; }
.kiosk-school span, .kiosk-footer span { color: #b8862b; }
.kiosk-address { margin-top: 4px; font-size: clamp(.7rem, 1.7vh, 1.1rem); font-weight: 600; letter-spacing: .03em; color: #5a5f6b; text-transform: uppercase; }
.kiosk-title {
  font-size: clamp(2rem, 7vh, 4.5rem);
  font-weight: 800;
  letter-spacing: .06em;
  margin: 6px 0 0;
  text-align: center;
  color: #14314f;
  animation: kiosk-status-blink 1.4s ease-in-out infinite;
}
.kiosk-footer { font-size: clamp(.7rem, 1.6vh, 1rem); font-weight: 800; letter-spacing: .18em; color: #3b3f4a; }

/* Clock-focused idle layout -- the time/date is the dominant visual on the
   kiosk (like digital signage) while no camera scan is running, instead of
   a big placeholder/camera box. */
.kiosk-clock-main { text-align: center; line-height: 1.15; margin: 4px 0; }
.kiosk-time-big {
  font-size: clamp(3rem, 15vh, 8rem);
  font-weight: 800;
  color: #14314f;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
.kiosk-date-big {
  font-size: clamp(1rem, 3vh, 1.6rem);
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #b8862b;
  margin-top: 2px;
}

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

/* Camera reader (opt-in via "Use camera instead") -- a fixed 16:9 box since
   html5-qrcode doesn't stretch its own <video> to fill a wider container on
   its own; the video/canvas are forced to fill it below via object-fit.
   Kept moderate rather than near-fullscreen: displayed too large, ordinary
   focus softness reads as "can't focus". */
.kiosk-reader-wrap {
  position: relative;
  width: min(52vw, 64vh);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
}
.kiosk-reader-wrap #reader video,
.kiosk-reader-wrap #reader canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
.kiosk-reader { width: 100%; height: 100%; margin: 0 auto; }

/* Purely a visual guide -- scanning covers the whole camera frame (no
   qrbox passed to html5-qrcode), so this corner-bracket frame is just
   decoration layered on top of the video. */
.scan-frame-overlay { position: absolute; inset: 6%; pointer-events: none; }
.scan-corner {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 5px solid #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.5));
}
.scan-corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; border-radius: 10px 0 0 0; }
.scan-corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; border-radius: 0 10px 0 0; }
.scan-corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; border-radius: 0 0 0 10px; }
.scan-corner-br { bottom: 0; right: 0; border-left: none; border-top: none; border-radius: 0 0 10px 0; }

.kiosk-camera-link {
  background: #fff;
  border: 1px solid #e3e6ec;
  border-radius: 999px;
  padding: 7px 18px;
  font-size: clamp(.75rem, 1.6vh, .9rem);
  font-weight: 600;
  color: #5a5f6b;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.kiosk-camera-link:hover { color: var(--color-primary); border-color: var(--color-primary); }

/* QR badge print page (qr/generate.php): a plain, no-background, uppercase
   text button on screen -- and on paper, the #qrPrintCard image (the exact
   same school-header+name+Grade&Section+framed-QR card the Download button
   saves, see render_qr_card_png()) prints alone, with everything else on the
   page hidden. */
.print-btn {
  background: none;
  border: none;
  box-shadow: none;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .75rem 1rem;
  cursor: pointer;
}
.print-btn:hover, .print-btn:focus { color: var(--color-primary-hover); text-decoration: underline; }

/* Only ever shown for print (see @media print below) -- never on screen,
   where the lighter name+QR view (#idCardPrint) already covers this. */
#qrPrintCard { display: none; }

@media print {
  body * { visibility: hidden; }
  #qrPrintCard, #qrPrintCard * { visibility: visible; }
  /* visibility:hidden alone still reserves layout space -- harmless on
     screen, but the extra height from the on-screen-only elements
     (header, buttons, the hidden download form) pushed the printed
     document past one small @page, producing a blank second page.
     display:none removes them from layout entirely instead of just
     hiding them. */
  .idcard-header, #idCardPrint, #qrActionButtons, #downloadCardForm { display: none !important; }
  /* Sized as large as it can be while still fitting on one page and
     centered, instead of a fixed physical size -- a fixed inch size only
     fills the page when the print dialog's own Paper size is left on
     "Default"; picking Letter/A4/etc. there would otherwise leave the
     card small in one corner with the rest of the (differently-shaped)
     page blank. */
  #qrPrintCard {
    display: block !important;
    position: fixed;
    inset: 0;
    margin: auto;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
  }
  @page { margin: 0; }
}

/* QR scanner (admin/scan.php): on some laptops the browser's own camera
   capture path (getUserMedia) returns a horizontally mirrored frame for the
   built-in webcam, even though the OS's native Camera app shows it the
   right way round (different capture backend). html5-qrcode itself applies
   no transform here, so the fix is to flip the *display* back ourselves --
   this is purely cosmetic (for lining the code up by eye); decoding already
   tolerates a mirrored frame either way (disableFlip:false, the default).
   !important guards against the library re-touching the video's style. */
#reader video {
  transform: scaleX(-1) !important;
  -webkit-transform: scaleX(-1) !important;
}

:root {
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  /* The school's own navy + gold (the "LIGTAS-ROXAS" wordmark colors),
     system-wide -- replaces iansmart's blue everywhere var(--color-primary)
     etc. are used, admin and student side alike (one shared stylesheet). */
  --color-border: #d8dee6;
  --color-text: #1a1a2e;
  --color-text-muted: #5d6b7a;
  --color-primary: #14314f;
  --color-primary-hover: #b8862b;
  --color-primary-soft: #fbf3e2;
  --color-success: #059669;
  --color-success-soft: #ecfdf5;
  --color-danger: #dc2626;
  --color-danger-soft: #fef2f2;
  --color-warning: #d97706;
  --color-warning-soft: #fffbeb;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --focus-ring: 0 0 0 3px rgba(20, 49, 79, 0.28);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 76px;
  --topbar-height: 64px;

  /* legacy aliases kept so older markup still resolves */
  --lr-blue: var(--color-primary);
  --lr-blue-dark: var(--color-primary-hover);
  --lr-red: var(--color-danger);
  --lr-green: var(--color-success);
  --lr-navy: #14314f;
  --lr-yellow: #ffc93c;
  --lr-bg: #f9fafb;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.citizen-body {
  background: #fff;
  min-height: 100vh;
  margin: 0;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; }

/* ---------- Citizen "phone app" shell ---------- */

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
}

.app-card {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.app-body {
  flex: 1 1 auto;
  padding: 1.25rem;
}

/* Student app pages: the same card look as the login page. */

.auth-page.student-page { align-items: flex-start; padding: 24px 16px; }
.student-card { max-width: 460px; padding: 28px 22px; }
.student-card .auth-title { margin-bottom: 1rem; }
.student-card .auth-subtitle { margin-top: -.5rem; margin-bottom: 1.25rem; }

.student-card .btn-lg { font-size: 1rem; padding: .7rem 1rem; }

.student-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .75rem;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.student-back:hover { color: var(--color-primary); }

.student-footer {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Feature tiles (My Profile / Emergency Numbers / Location / Guided Materials) */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}

.tile-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  min-height: 118px;
  padding: 1rem .5rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  transition: border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}

.tile-btn:hover, .tile-btn:focus {
  color: var(--color-text);
  border-color: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.tile-btn svg {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.tile-profile svg   { color: var(--color-primary); }
.tile-emergency svg { color: var(--color-danger); }
.tile-location svg  { color: var(--color-success); }
.tile-materials svg { color: var(--color-text-muted); }

/* Generic touch-friendly buttons everywhere */
.btn, .form-control, .form-select {
  min-height: 44px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
a.btn:hover, a.btn:focus { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { flex-shrink: 0; }

/* Login forms (admin + student): "Remember me" / "Forgot password?" row -- iansmart recipe. */
.checkbox-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-size: 13px; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--color-text-muted); cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--color-primary); }

/* Bootstrap's own checked-checkbox color is its blue, not this app's theme --
   overridden site-wide (table row-select checkboxes, section-picker, etc.). */
.form-check-input:checked { background-color: var(--color-primary) !important; border-color: var(--color-primary) !important; }
.form-check-input:focus { border-color: var(--color-primary); box-shadow: var(--focus-ring); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--color-primary); }
.checkbox-row a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.checkbox-row a:hover { text-decoration: underline; }

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}

.btn-brand { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-brand:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.auth-card .btn { width: 100%; }

/* iansmart's actual "Add X" / "Filter" buttons: plain white/bordered at
   rest (same as .btn-secondary), a blue tint only on hover -- not a
   solid dark fill. Opt-in per button via .btn-hover-blue. */
.btn-hover-blue:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline-primary {
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline-primary:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-success { background: var(--color-success); border-color: var(--color-success); }
.btn-success:hover { background: #047857; border-color: #047857; }

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

/* iansmart's actual .btn-danger recipe: a soft-fill pink/red pill, not a
   red outline -- reused here under the "outline-danger" name we already
   had in markup (e.g. Delete Selected) rather than the solid-red
   .btn-danger above, which stays solid for the citizen app's emergency
   call button where a bold, high-visibility action is the right call. */
/* Bootstrap's real "pressed" selector is a compound one -- roughly
   `:not(.btn-check) + .btn:active` -- which outranks a plain
   `.btn-outline-danger:active` on specificity alone, so it kept winning
   and filling solid red no matter what was overridden here. !important
   is the only reliable way to beat a Bootstrap selector we don't fully
   control the shape of; safe here since this button is entirely
   custom-styled (a plain text link), nothing else should ever need to
   out-rank it. Covers :hover/:focus/:focus-visible/:active/.active all
   the same way since Bootstrap's focus ring and active fill are separate
   properties (box-shadow vs background) each needing their own reset. */
.btn-outline-danger,
.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:focus-visible,
.btn-outline-danger:active,
.btn-outline-danger.active {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  outline: none !important;
  font-weight: 600;
}
.btn-outline-danger {
  color: var(--color-danger) !important;
}
.btn-outline-danger:hover, .btn-outline-danger:focus, .btn-outline-danger:focus-visible, .btn-outline-danger:active {
  color: #b91c1c !important;
  text-decoration: underline;
}
.btn-outline-danger:disabled, .btn-outline-danger.disabled {
  background: transparent !important;
  color: var(--color-text-muted) !important;
  border: none !important;
  box-shadow: none !important;
  opacity: 1;
}

.btn-outline-secondary { color: var(--color-text-muted); border-color: var(--color-border); }

/* .btn-secondary is a native Bootstrap variant (solid gray bg, white hover
   text via --bs-btn-hover-color) that we're repurposing as a white/bordered
   neutral button -- Bootstrap's own hover rule still reads that unchanged
   white-hover-text variable, so without overriding color here too, hover
   silently renders white text on our light gray hover background (the
   label effectively disappears). */
.btn-secondary { background: #fff; border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover, .btn-secondary:focus, .btn-secondary:active, .btn-secondary.active {
  background: #eceef1;
  border-color: var(--color-border);
  color: var(--color-text);
}

.btn-warning { background: var(--color-warning); border-color: var(--color-warning); color: #fff; }
.btn-warning:hover { background: #b45309; border-color: #b45309; color: #fff; }

.form-control, .form-select {
  border-radius: var(--radius-md);
  border-color: var(--color-border);
}
.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

/* input[type=file]'s "Choose File" pill is OS-native chrome (gray on every
   browser) and ignores normal button CSS -- restyle it via the
   ::file-selector-button pseudo-element to match .btn-hover-blue. */
input[type="file"] { padding: 8px 12px; color: var(--color-text-muted); font-size: 14px; }
input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 12px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
input[type="file"]::file-selector-button:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* Small hint line under a label (e.g. Full Name's "Surname, First Name,
   M.I." format). Given its own line rather than appended inline so a
   field paired beside it in the same row (e.g. Gender) can reserve the
   same height with an empty/&nbsp; hint and keep both inputs lined up,
   instead of one input sitting higher because its label happened to be
   shorter and never wrapped. */
.form-field-hint {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--color-text-muted);
}

/* QR badge print page (qr/generate.php): on-screen header above the card
   preview, same layout/typography as the evacuation plan's school header
   (logo + bold navy title with gold ROXAS + uppercase address). */
.idcard-header { display: flex; align-items: center; gap: 12px; margin: 0 auto 1.25rem; max-width: 320px; text-align: left; }
.idcard-logo { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.idcard-school { font-size: 14px; font-weight: 800; letter-spacing: .02em; color: #3b3f4a; line-height: 1.15; }
.idcard-school span { color: #b8862b; }
.idcard-address { margin-top: 2px; font-size: 9.5px; font-weight: 600; letter-spacing: .02em; color: #5a5f6b; text-transform: uppercase; line-height: 1.3; }

.qr-frame {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.qr-frame img, .qr-frame canvas {
  max-width: 100%;
  height: auto;
}

/* ---------- Student Location screen: full-width map + bottom sheet ---------- */

body.loc-body { margin: 0; background: linear-gradient(160deg, #f9fafb 0%, var(--color-primary-soft) 100%); }

.loc-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 460px;
  margin: 0 auto;
  background: #fff;
}

.loc-bar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; flex-shrink: 0; height: 56px; padding: 0 8px; background: #fff; }
.loc-bar h1 { margin: 0; font-size: 15px; font-weight: 500; text-align: center; }
.loc-bar-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; color: var(--color-text); background: none; border: 0; text-decoration: none; }
.loc-bar-btn svg { width: 22px; height: 22px; }
.loc-menu-wrap { position: relative; }
.loc-menu { position: absolute; top: 48px; right: 0; z-index: 1000; min-width: 200px; padding: 6px; background: #fff; border: 1px solid var(--color-border); border-radius: 10px; box-shadow: var(--shadow-md); }
.loc-menu a { display: block; padding: 9px 12px; font-size: 14px; color: var(--color-text); text-decoration: none; border-radius: 6px; }
.loc-menu a:hover { background: #eef1f5; }
.loc-menu-logout { display: block; width: 100%; padding: 9px 12px; font: inherit; font-size: 14px; color: var(--color-text); text-align: left; background: none; border: 0; border-radius: 6px; }
.loc-menu-logout:hover { background: #eef1f5; }

/* A soft gray map, so the pin and the red call button are what stand out. */
.loc-map { flex: 1 1 300px; min-height: 300px; background: #eceff1; isolation: isolate; }
.loc-map .leaflet-tile-pane { filter: grayscale(1) contrast(.8) brightness(1.12); }

.loc-sheet {
  position: relative;
  z-index: 500;
  flex-shrink: 0;
  margin-top: -24px;
  padding: 10px 20px 24px;
  background: #fff;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -6px 24px rgba(17, 24, 39, .12);
}
.loc-handle { width: 40px; height: 4px; margin: 0 auto 14px; background: #d9dce1; border-radius: 999px; }

.loc-saved { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.4; color: var(--color-success); background: var(--color-success-soft); border-radius: var(--radius-md); }
.loc-saved svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.loc-person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #eef1f5; border-radius: 12px; }
.loc-avatar { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 42px; height: 42px; font-size: 14px; font-weight: 600; color: var(--color-primary); background: #fff; border-radius: 50%; }
.loc-person-text { min-width: 0; }
.loc-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.loc-badge { display: inline-block; margin-top: 3px; padding: 2px 8px; font-size: 10px; font-weight: 600; color: #fff; border-radius: 3px; }
.loc-badge.tone-safe    { background: var(--color-success); }
.loc-badge.tone-help    { background: var(--color-danger); }
.loc-badge.tone-unknown { background: var(--color-text-muted); }

.loc-status-title { margin: 22px 0 6px; font-size: 22px; font-weight: 500; text-align: center; }
.loc-status-title.tone-safe    { color: var(--color-success); }
.loc-status-title.tone-help    { color: var(--color-danger); }
.loc-status-title.tone-unknown { color: var(--color-text-muted); }

.loc-address { font-size: 16px; font-weight: 600; line-height: 1.4; text-align: center; }
.loc-detail, .loc-time { font-size: 12px; color: var(--color-text-muted); text-align: center; }
.loc-time { margin-top: 4px; font-style: italic; }

.loc-contact { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.loc-phone { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 12px; color: var(--color-text-muted); }
.loc-phone-label { display: flex; align-items: center; gap: 6px; }
.loc-phone-label svg { width: 14px; height: 14px; }
.loc-phone-number { padding-left: 20px; font-size: 13px; font-weight: 500; color: var(--color-text); }
.loc-call {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 150px;
  min-height: 46px;
  padding: 0 26px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--color-danger);
  border-radius: 999px;
  text-decoration: none;
}
.loc-contact.no-phone .loc-call { flex: 1; }
.loc-call:hover { color: #fff; background: #b91c1c; }

/* Where the student chooses and sends their status. */
.loc-update { margin-top: 18px; padding-top: 16px; border-top: 1px solid #eef0f3; }

/* Segmented control: a quiet gray track, the chosen status sits on a white
   segment with only a small colored dot. */
.loc-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; margin-bottom: 12px; padding: 3px; background: #eef1f5; border-radius: 10px; }
.loc-choice { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 4px; font-size: 13px; font-weight: 500; line-height: 1.2; color: var(--color-text-muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; transition: background .15s, color .15s; }
.loc-choice[data-status="safe"]       { --tone: var(--color-success); }
.loc-choice[data-status="needs_help"] { --tone: var(--color-danger); }
.loc-choice[data-status="unknown"]    { --tone: var(--color-text-muted); }
.loc-choice.is-selected { font-weight: 600; color: var(--color-text); background: #fff; box-shadow: 0 1px 2px rgba(17, 24, 39, .1); }
.loc-choice.is-selected::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }

.loc-place { margin-bottom: 12px; font-size: 14px; }

.loc-submit { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; font-size: 14px; font-weight: 600; color: #fff; background: var(--color-text); border: 0; border-radius: 10px; }
.loc-submit:hover { background: #000; }

/* The pin: the student's initials with a soft gray halo, no colored ring. */
.loc-halo { display: flex; align-items: center; justify-content: center; width: 104px; height: 104px; background: rgba(107, 114, 128, .22); border-radius: 50%; }
.loc-pin { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; font-size: 15px; font-weight: 600; color: var(--color-primary); background: var(--color-primary-soft); border: 3px solid #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }

.hotline-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  min-height: 44px;
}

.hotline-list { display: flex; flex-direction: column; gap: .5rem; }
.hotline-empty { color: var(--color-text-muted); margin: 0; }
.hotline-info { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.hotline-icon,
.hotline-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
}
.hotline-icon { border-radius: 50%; }
.hotline-icon svg { width: 22px; height: 22px; }
.hotline-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hotline-icon.tone-blue   { background: var(--color-primary-soft); color: var(--color-primary); }
.hotline-icon.tone-red    { background: var(--color-danger-soft);  color: var(--color-danger); }
.hotline-icon.tone-orange { background: var(--color-warning-soft); color: var(--color-warning); }
.hotline-icon.tone-gray   { background: #eef1f5;                   color: var(--color-text-muted); }
.hotline-icon.hotline-badge-text { font-size: 12px; font-weight: 800; letter-spacing: -.02em; }
.hotline-name { font-weight: 600; font-size: 14px; line-height: 1.3; }
.hotline-number { color: var(--color-text-muted); font-size: 13px; margin-top: 2px; }
/* A soft raised light-gray tile with a red handset. */
.hotline-call {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(160deg, #f7f8fa 0%, #dde1e6 100%);
  box-shadow: inset 0 1px 0 #fff, 0 2px 5px rgba(17, 24, 39, .18);
  color: #d90f14;
}
.hotline-call:hover { color: #b30b0f; }
.hotline-call:active { box-shadow: inset 0 1px 3px rgba(17, 24, 39, .25); }
.hotline-call svg { width: 22px; height: 22px; }

/* Paging history - a flat, undivided feed (iansmart's activity-list
   recipe: a plain bottom-border between rows, no border/radius/background
   box around each individual item) rather than stacking bordered cards
   inside a card, which reads as clutter once there's more than a couple. */
.feed-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 0;
  border-bottom: 1px solid #e8ecf1;
}
.feed-item:last-child { border-bottom: none; }
.feed-item .replay-btn { flex-shrink: 0; }

.material-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
}

/* ---------- Breakpoints: tablet / desktop widen the phone card ---------- */

@media (min-width: 576px) {
  .app-shell { padding: 1.5rem 1rem; }
  .app-card {
    max-width: 480px;
    min-height: auto;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
  }
  .tile-btn { min-height: 130px; }
}

@media (min-width: 992px) {
  .app-shell { padding: 3rem 1rem; align-items: center; }
  .app-card { max-width: 460px; }
}

/* ---------- Auth (admin login) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f9fafb 0%, var(--color-primary-soft) 100%);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 32px;
}

.auth-logo { text-align: center; margin-bottom: 1rem; }
.auth-logo img { height: 56px; width: 56px; object-fit: contain; }

/* Same heavy-caps treatment as the evacuation plan title (school seal + gold ROXAS), so the two feel like one brand. */
.auth-title {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: .04em;
  text-align: center;
  margin-bottom: .25rem;
  color: #3b3f4a;
}
.auth-title span { color: #b8862b; }
.auth-subtitle { font-size: 13px; color: var(--color-text-muted); text-align: center; margin-bottom: 1.5rem; }

/* Form primitives - iansmart recipe (used by the admin login form) */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
}
.alert-error, .alert-danger { background: var(--color-danger-soft); color: var(--color-danger); border: none; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border: none; }
.alert-warning { background: var(--color-warning-soft); color: var(--color-warning); border: none; }

/* ---------- Admin app shell (ported from IANsmart's app.css) ---------- */

body.admin-body {
  background: #fff;
  margin: 0;
  /* iansmart's actual base size/line-height -- without this the admin panel
     inherits the browser default (16px), reading visibly larger/looser
     than the reference UI everywhere text size isn't pinned in absolute
     px (labels, table cells, form text, Bootstrap's own rem-scaled
     buttons/inputs). */
  font-size: 14px;
  line-height: 1.5;
}

.admin-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: #fff;
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 30;
  transition: transform .2s ease;
}

.sidebar-header {
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.sidebar-brand-text-wrap { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-brand-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #3b3f4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand-text span { color: #b8862b; }
.sidebar-brand-sub {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  white-space: nowrap;
}
.sidebar-close-mobile { display: none; margin-left: auto; flex-shrink: 0; }
.sidebar-collapse-toggle { display: flex !important; margin-left: auto; flex-shrink: 0; }
.icon-btn.sidebar-close-mobile,
.icon-btn.sidebar-collapse-toggle { width: 30px; height: 30px; }
.icon-btn.sidebar-close-mobile svg,
.icon-btn.sidebar-collapse-toggle svg { width: 17px; height: 17px; }
.sidebar-collapse-toggle .icon-expand { display: none; }

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }
.nav-item:hover { background: #eef1f5; color: var(--color-text); }
.nav-item.active { background: var(--color-primary-soft); color: var(--color-primary); }

/* Small uppercase section label grouping related sidebar items (e.g.
   "Attendance" above Dashboard/Students/Scan QR). */
.nav-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 12px 12px 4px;
}
.nav-section-label:first-child { padding-top: 4px; }

/* Collapsible sidebar groups (e.g. Students -> Grade -> Section) - iansmart recipe */
.nav-item.nav-group { cursor: pointer; justify-content: space-between; }
.nav-item.nav-group .nav-group-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.nav-item.nav-group .caret { transition: transform .15s; flex-shrink: 0; width: 14px; height: 14px; }
.nav-item.nav-group.open .caret { transform: rotate(90deg); }

.nav-submenu { padding-left: 20px; }
.nav-submenu.nav-submenu-nested { padding-left: 12px; margin-left: 8px; border-left: 1px solid var(--color-border); }

.nav-item.nav-sub { font-size: 13px; margin-top: -2px; }
.nav-item.nav-sub svg { width: 15px; height: 15px; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--color-border); }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(17, 17, 27, 0.45);
  z-index: 25; opacity: 0; pointer-events: none; transition: opacity .2s ease;
  display: none;
}
.sidebar-backdrop.visible { opacity: 1; pointer-events: auto; display: block; }

.main {
  margin-left: var(--sidebar-width);
  /* Not flex:1 -- the sidebar is position:fixed, so it's out of .admin-shell's
     flex flow and never actually reduces this by its own width; flex:1 alone
     let .main grow to the *full* admin-shell width and then margin-left
     pushed that whole box further right, overflowing the viewport by exactly
     one sidebar-width on every admin page (worse the wider a table's content
     was) instead of the table's own overflow-x:auto ever getting to kick in. */
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
}

/* Toggled on <body> (desktop only, remembered via localStorage) to shrink
   the sidebar down to just its icons -- the brand text, nav labels, section
   headings and any open Students/Grade submenu all hide, leaving the logo
   mark and a column of icon buttons (each still identifiable via its
   existing title="" tooltip). Scoped to the desktop breakpoint so it can
   never fight the mobile drawer's own width/transform rules below. */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
  body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed-width); width: calc(100% - var(--sidebar-collapsed-width)); }
  body.sidebar-collapsed .sidebar-header { flex-direction: column; padding: 10px 0 14px; gap: 8px; }
  body.sidebar-collapsed .sidebar-brand { justify-content: center; }
  body.sidebar-collapsed .sidebar-collapse-toggle { margin-left: 0; }
  body.sidebar-collapsed .sidebar-collapse-toggle .icon-collapse { display: none; }
  body.sidebar-collapsed .sidebar-collapse-toggle .icon-expand { display: block; }
  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-item .caret,
  body.sidebar-collapsed .nav-submenu { display: none; }
  body.sidebar-collapsed .nav-item,
  body.sidebar-collapsed .nav-item.nav-group .nav-group-left { justify-content: center; }
  body.sidebar-collapsed .nav-item.nav-group { justify-content: center; }
  body.sidebar-collapsed .sidebar-nav { padding-left: 8px; padding-right: 8px; }
}
@media (max-width: 991.98px) {
  .sidebar-collapse-toggle { display: none !important; }
}

/* Toggled on <body> while a page (currently just Emergency) is in
   fullscreen, so an unattended monitor/TV shows only that page's own
   content -- no sidebar, no topbar. */
body.fs-mode .sidebar,
body.fs-mode .topbar { display: none !important; }
body.fs-mode .main { margin-left: 0 !important; width: 100% !important; }

/* The evacuation plan itself scaled to fill the screen (whatever size it
   is) with no scrolling -- width:auto/height:auto with a max-height cap
   (rather than the normal width:100%) is what keeps the plan's own aspect
   ratio, so it's letterboxed instead of either overflowing the screen's
   height or the plan-wrap being taller than the image it's sized around
   (which would throw off the avatars, positioned as a % of plan-wrap). */
body.fs-mode .content { padding: 0; }
body.fs-mode .page-header { display: none; }
body.fs-mode .card.dash-card {
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  height: 100vh;
}
body.fs-mode .card.dash-card .card-body {
  padding: 0 !important;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.fs-mode .plan-img {
  /* Explicit width AND height (not width/height:auto, which falls back to
     the browser's generic ~300x150 replaced-element default size since this
     SVG has a viewBox but no width/height attributes of its own) fill the
     whole screen -- the plan's own 4:3 art doesn't match a widescreen
     monitor, so this stretches it a little rather than letterboxing empty
     space on the sides; avatar placement (a % of this same box, both axes
     independently) still lines up correctly either way. */
  width: 100%;
  height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 9px;
  display: none; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer; color: var(--color-text-muted);
}
.icon-btn:hover { background: #e8ecf1; }
.breadcrumb { font-size: 14px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--color-border); }
.user-chip .meta { line-height: 1.2; }
.user-chip .meta .name { font-weight: 600; font-size: 13px; }
.user-chip .meta .role { font-size: 11px; color: var(--color-text-muted); }

.content { padding: 24px; }

body.drawer-open { overflow: hidden; }

@media (max-width: 991.98px) {
  .sidebar { width: min(var(--sidebar-width), 82vw); transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .sidebar-toggle-mobile { display: flex !important; }
  .sidebar-close-mobile { display: flex !important; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .user-chip .role { display: none; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .content { padding: 12px; }
}

/* Cards - iansmart recipe: white surface, 12px radius, subtle border + shadow */
.card {
  background: #fff;
  border: 1px solid var(--color-border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border) !important;
  padding: 1.1rem 1.25rem;
  font-weight: 600;
  font-size: .95rem;
}
.card-body { background: #fff; padding: 1.25rem; }
.card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-title { font-size: 16px; font-weight: 600; }

/* List-page toolbar (search + filters + add button) - iansmart recipe */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; flex: 1 1 320px; }
.search-input { position: relative; }
.toolbar .search-input { flex: 1 1 220px; min-width: 180px; }
.search-input input { padding-left: 36px; min-width: 220px; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); width: 16px; height: 16px; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; margin-left: auto; }

/* Fixed-width filter dropdown (e.g. "All statuses"), consistent across list pages. */
.filter-select { width: 170px; flex-shrink: 0; }

/* Custom "Filters" dropdown (replaces a native <select>): the browser's own
   native option-list popup ignores author CSS for its highlighted row (it's
   OS chrome, confirmed by testing -- setting background-color on
   option:checked had no effect), so a fully custom, div-based list is the
   only way to guarantee the highlight color matches the rest of the theme. */
.custom-select { position: relative; flex-shrink: 0; }
.custom-select-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 190px;
  min-height: 44px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 400;
  font-family: inherit;
  color: var(--color-text);
  cursor: pointer;
  text-align: left;
}
.custom-select-trigger:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.custom-select-trigger .funnel { width: 15px; height: 15px; flex-shrink: 0; color: var(--color-text-muted); }
.chevron { width: 14px; height: 14px; flex-shrink: 0; color: var(--color-text-muted); }
.custom-select-trigger .chevron { margin-left: auto; }

/* "Add X" toolbar buttons (Add Student, Add Teacher) match the Filters
   trigger's lighter text weight instead of the bolder default .btn, so the
   whole toolbar row reads at one consistent weight. */
.add-split-buttons .btn, #addTeacherBtn { font-weight: 400; }
.custom-select-trigger span { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.custom-select-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  width: 220px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 40;
}
.custom-select-menu.open { display: block; }
.custom-select-group-label {
  padding: 8px 14px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.custom-select-option { padding: 9px 14px 9px 26px; font-size: 14px; font-weight: 400; color: var(--color-text); cursor: pointer; }
.custom-select-option:first-child { padding-left: 14px; }
.custom-select-option:hover { background: var(--color-primary); color: #fff; }
.custom-select-option.is-selected { font-weight: 600; color: var(--color-primary); }
.custom-select-option.is-selected:hover { color: #fff; }

/* Kept in the form (not display:none) purely so pressing Enter in the search
   box still submits now that there's no visible "Filter" button to anchor
   that behavior to. */
.visually-hidden-submit { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
select.input {
  appearance: none;
  background: #fff url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="%235d6b7a" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>') no-repeat right 10px center;
  padding-right: 32px;
}

@media (max-width: 767.98px) {
  .toolbar { width: 100%; }
  .toolbar .search-input,
  .toolbar select.input,
  .filter-select { width: 100%; min-width: 0; }
}

/* Underline tab strip with count badges - iansmart's Agent Console recipe
   (console-tabs/console-tab/tab-count), reused here for the Paging page's
   category picker and history filter. */
.console-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  border-bottom: 1px solid var(--color-border);
}
.console-tab {
  background: none;
  border: none;
  padding: 10px 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.console-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-count {
  background: #f0f0f0;
  color: var(--color-text-muted);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.console-tab.active .tab-count { background: var(--color-primary); color: #fff; }

/* Plain-text action trigger (e.g. Paging's "Schedule Announcement", sitting
   next to the tab row instead of as a boxed button in the card header). */
.text-action-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.text-action-link:hover, .text-action-link:focus { color: var(--color-primary-hover); text-decoration: underline; }

/* Bootstrap fills a disabled .btn-secondary solid gray; keep the white/bordered look, just faded. */
.btn-secondary:disabled, .btn-secondary.disabled {
  background: #fff;
  border-color: var(--color-border);
  color: var(--color-text-muted);
  opacity: .55;
}

/* Usernames/passwords handed to students: monospace so l/1/O/0 stay readable. */
.credential-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 600; letter-spacing: .03em; }

/* Teacher account form: scrollable checklist of sections. */
.section-picker { max-height: 190px; overflow-y: auto; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 6px 10px; }
.section-option { display: flex; align-items: center; gap: 8px; padding: 5px 0; margin: 0; cursor: pointer; font-size: 14px; }

/* Emergency page: "unaccounted by room" cards and the pin map. */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.room-card { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 12px; background: #fff; }
.room-card-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; }
.room-card-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 3px 0; }
.emergency-map { height: 380px; width: 100%; border-radius: 0 0 var(--radius) var(--radius); }

/* The evacuation plan's headcount (On Campus Today / Safe / Needs Help /
   No Response), as a small card floated inside a corner of the plan image
   itself -- instead of separate stat cards above the plan. */
.plan-stats {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 158px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.plan-stat { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-stat-label { font-size: 10px; color: var(--color-text-muted); white-space: nowrap; }
.plan-stat-value { font-size: 15px; font-weight: 700; color: var(--color-text); line-height: 1; white-space: nowrap; }

/* The evacuation plan with student avatars / setup pins laid on top; every
   position is a percentage of the image so it stays put at any width. */
.plan-wrap { position: relative; line-height: 0; }
.plan-img { display: block; width: 100%; height: auto; user-select: none; }
.plan-avatar {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  transform: translate(-50%, -50%);
  font: 600 11px/1 "Poppins", sans-serif; color: #fff;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  cursor: default;
}
/* Student ID photo: small round thumbnail in lists, initials when none is uploaded. */
.stu-photo {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px;
  font: 600 12px/1 "Poppins", sans-serif; color: var(--color-primary);
  background: var(--color-primary-soft) center top / cover no-repeat;
  border-radius: 50%;
}
.stu-photo:not(.is-empty) { font-size: 0; }
.stu-photo-zoomable { cursor: pointer; transition: transform .1s ease; }
.stu-photo-zoomable:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--color-primary-soft); }

/* Guard's scan confirmation: the student's photo, then a SUCCESS bar under it. */
.scan-photo { object-fit: cover; border-radius: 14px; margin-bottom: 0; }
.scan-ok { margin: 10px auto 4px; padding: 8px 18px; display: inline-block; font-weight: 700; letter-spacing: .12em; color: #fff; background: var(--color-success); border-radius: 999px; }
.scan-ok.scan-late { background: var(--color-warning); }

/* Modality colour code: F2F blue, Modular purple, ALS teal. */
.mod-chip { display: inline-block; padding: 5px 16px; font-size: 14px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #fff; border-radius: 6px; }
.mod-f2f     { background: #0b7bd6; }
.mod-modular { background: #7c3aed; }
.mod-als     { background: #0f9d8a; }
.mod-other   { background: #5d6b7a; }

/* Paging's Schedule Announcement modal: category as colored pills (matching
   each category's own table-badge color) instead of a plain <select>. */
.category-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.category-pill { position: relative; }
.category-pill input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.category-pill span {
  display: inline-flex; align-items: center;
  padding: 9px 18px;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.category-pill input:checked + span {
  border-color: var(--pill-color);
  color: var(--pill-color);
  background: var(--pill-soft);
  font-weight: 700;
}
.category-pill input:focus-visible + span { outline: 2px solid var(--pill-color); outline-offset: 2px; }

/* Play Time's custom hour/minute/AM-PM picker (paging.php) -- narrower and
   less heavy than the touch-target default (.btn/.form-control's 44px),
   sized to actually fit a 2-3 character label instead of towering over it. */
.time-picker { display: flex; align-items: center; gap: 5px; }
.time-colon { font-weight: 700; color: var(--color-text-muted); }
.time-select { position: relative; }
.time-trigger { display: flex; align-items: center; justify-content: center; min-width: 44px; height: 38px; padding: 6px 8px; background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; font-family: inherit; color: var(--color-text); cursor: pointer; }
.time-trigger:focus { outline: none; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
.time-menu { width: 64px; left: 50%; transform: translateX(-50%); text-align: center; max-height: 220px; }
.time-menu .custom-select-option { padding: 7px 8px; }
.time-menu .custom-select-option:first-child { padding-left: 8px; }

/* Audio File field (paging.php): a plain button + filename, replacing the
   native input[type=file] box -- that box's own file-selector-button (see
   the general input[type=file] rule above) sits inside a mostly-empty
   full-width rectangle, which looks oversized for a single file pick. */
.file-picker { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.file-picker .btn { min-height: 38px; padding: 6px 14px; }
.file-picker-name { font-size: 11.5px; color: var(--color-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SweetAlert2's own default confirm-button color (purple) doesn't match the
   app's navy brand -- plain (no !important) so a dialog that sets its own
   confirmButtonColor in JS (the red delete confirmations) still wins; this
   is only the fallback for every other Swal2 popup (success/error/info). */
.swal2-confirm { background: var(--color-primary); }
.swal2-confirm:hover { background: var(--color-primary-hover); }
.swal2-confirm:focus { box-shadow: 0 0 0 3px rgba(20, 49, 79, .3); }

/* Irregular student at the gate: a flashing red frame and banner, no reason shown. */
.swal2-popup.scan-warn { border: 8px solid #dc2626; animation: scanWarnPulse 1s ease-in-out infinite; }
.scan-warn-banner { display: block; padding: 12px 10px; font-size: 26px; font-weight: 800; letter-spacing: .08em; color: #fff; background: #dc2626; border-radius: 10px; }
@keyframes scanWarnPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .55); } 50% { box-shadow: 0 0 0 22px rgba(220, 38, 38, 0); } }
.scan-nophoto { margin-top: 6px; font-size: 12px; color: var(--color-warning); }

.plan-heat { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; }
.plan-pin {
  position: absolute; width: 14px; height: 14px; transform: translate(-50%, -50%);
  background: var(--color-primary); border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
}
.plan-pin.is-selected { background: var(--color-danger); box-shadow: 0 0 0 4px rgba(220, 38, 38, .25); }
.plan-pin span {
  position: absolute; left: 50%; top: -18px; transform: translateX(-50%);
  padding: 1px 6px; font: 600 10px/1.4 "Poppins", sans-serif; white-space: nowrap;
  color: #fff; background: rgba(17, 24, 39, .8); border-radius: 4px;
}
.plan-legend { display: flex; gap: 14px; font-size: 12px; color: var(--color-text-muted); }
.plan-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; }
.area-label { background: transparent; border: none; box-shadow: none; color: #14314f; font-weight: 700; }

/* Phone-shaped frame for previewing the student app (admin "Student View"). */
.phone-frame {
  width: 388px;
  max-width: 100%;
  margin: 0 auto;
  padding: 12px;
  background: #111827;
  border-radius: 44px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.phone-frame iframe {
  display: block;
  width: 100%;
  height: 760px;
  border: 0;
  border-radius: 32px;
  background: #fff;
}

/* Boxed variant of console-tab, for a picker where nothing is selected by
   default (e.g. Paging's category choice) -- a flat underline tab reads as
   plain, unclickable text until one is active, so this keeps a visible
   border/pill at rest instead of relying on an active state to look
   interactive. */
.console-tabs.pill { border-bottom: none; gap: 8px; }
.console-tabs.pill .console-tab {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 14px;
}
.console-tabs.pill .console-tab:hover { background: #eef1f5; color: var(--color-text); }
.console-tabs.pill .console-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* "Add X" split button: primary action + a caret sliver opening a small
   menu of secondary actions (Bulk Add / Export) - iansmart recipe. */
.add-split-wrap { position: relative; display: inline-flex; }
.add-split-buttons { display: flex; }
.add-split-buttons > * { flex: 0 0 auto; width: auto; }
.add-split-buttons > *:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.add-split-buttons > *:last-child {
  padding: 0 10px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid var(--color-border);
  flex-shrink: 0;
}
.add-split-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  min-width: 170px;
  z-index: 30;
  overflow: hidden;
}
.add-split-menu.open { display: block; }
.add-split-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text);
  white-space: nowrap;
}
.add-split-menu button:hover { background: var(--color-primary); color: #fff; }
.add-split-menu button + button { border-top: 1px solid var(--color-border); }

.responsive-table { overflow-x: auto; cursor: grab; }
.responsive-table.dragging { cursor: grabbing; user-select: none; }
/* Header labels stay on one line -- a wrapped "GRADE &
   SECTION"/"EMERGENCY CONTACT" reads as clutter next to the plain single-
   line ones. The table can already scroll horizontally on desktop
   (.responsive-table above) and collapses to cards on mobile (where thead
   is hidden), so this never causes the row itself to overflow badly. */
.responsive-table table thead th { white-space: nowrap; }

.th-sort-link {
  display: inline-flex; align-items: center; gap: 3px;
  color: inherit; text-decoration: none;
}
.th-sort-link:hover { color: var(--color-primary); }
.th-sort-link svg { flex-shrink: 0; }
.th-sort-link .th-sort-idle { opacity: .35; }
.th-sort-link:hover .th-sort-idle { opacity: .7; }

.icon-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-action-btn:hover { color: var(--color-primary); }
.icon-action-btn.danger:hover { color: var(--color-danger); }
/* The Paging schedule toggle (a switch, not a play/pause glyph): green
   while active, so its own on/off state reads at a glance too. */
.icon-action-btn.is-on { color: var(--color-success); }
/* Users page (admin/staff-accounts.php): role pills and role cards */
.staff-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.staff-pill.role-monitoring { background: #e6f4ea; color: #1e7b45; }
.staff-pill.role-broadcaster { background: #fdf3e1; color: #9a6a12; }
.staff-role-card { height: 100%; padding: 14px 16px; border: 1px solid var(--color-border); border-radius: 12px; background: #fff; }
.staff-role-card h6 { margin: 0 0 4px; font-weight: 700; }
.staff-role-card p { margin: 0; font-size: 13px; color: var(--color-text-muted); }
/* Activity Log (admin/audit-log.php): role pills and colored action text */
.log-role { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #eef1f5; color: #3b3f4a; }
.log-role.role-admin { background: #e8edf5; color: #14314f; }
.log-role.role-teacher { background: #e6f0fb; color: #1d5fa8; }
.log-role.role-monitoring { background: #e6f4ea; color: #1e7b45; }
.log-role.role-broadcaster { background: #fdf3e1; color: #9a6a12; }
.log-role.role-student { background: #f3eefb; color: #6a3fb0; }
.log-action { font-weight: 600; }
.log-action.log-success { color: var(--color-success); }
.log-action.log-danger { color: var(--color-danger); }
.log-action.log-neutral { color: var(--color-text); }
.users-code {font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--color-text); background: #eef1f5; padding: 2px 7px; border-radius: 6px; }
.icon-action-btn.is-on:hover { color: var(--color-success); opacity: .8; }
.icon-action-btn svg { width: 15px; height: 15px; display: block; flex-shrink: 0; }

.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; align-items: center; }
.empty-state { text-align: center; color: var(--color-text-muted); padding: 24px; }
.dash-empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 36px 24px; }
.dash-empty-icon { width: 36px; height: 36px; color: var(--color-text-muted); opacity: .5; }

@media (max-width: 767.98px) {
  .toolbar { width: 100%; }
  .toolbar .search-input { width: 100%; flex: 0 1 auto; }
  .toolbar-actions { width: 100%; justify-content: flex-end; margin-left: 0; }
}

/* Page header + stat cards - iansmart recipe, plain/neutral (no color coding) */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 20px; font-weight: 600; margin: 0; }
.page-subtitle { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-card .label { font-size: 11px; color: var(--color-text-muted); font-weight: 500; margin-bottom: 6px; }
.stat-card .value { font-size: 20px; font-weight: 700; color: var(--color-text); }

/* Badges - soft pill style */
.badge.text-bg-success { background: var(--color-success-soft) !important; color: var(--color-success) !important; font-weight: 500; }
.badge.text-bg-danger { background: var(--color-danger-soft) !important; color: var(--color-danger) !important; font-weight: 500; }
.badge.text-bg-secondary { background: #eef1f5 !important; color: var(--color-text-muted) !important; font-weight: 500; }

/* Tables - iansmart recipe: uppercase muted header, subtle row dividers, hover */
.table > thead {
  color: var(--color-text-muted);
}
.table > thead th {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .02em;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.table > tbody td {
  border-color: #e8ecf1;
  vertical-align: middle;
}
.table-hover > tbody > tr:hover > * {
  background-color: #fafafa;
}

@media (max-width: 767.98px) {
  .table-responsive-cards thead { display: none; }
  .table-responsive-cards, .table-responsive-cards tbody, .table-responsive-cards tr, .table-responsive-cards td {
    display: block;
    width: 100%;
  }
  .table-responsive-cards tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    background: #fff;
  }
  .table-responsive-cards td {
    border: none;
    padding: .4rem 0;
    display: flex;
    justify-content: space-between;
    gap: .5rem;
  }
  .table-responsive-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: .5rem;
  }
}

/* ---------- Dashboard (charts, compact stat cards, activity table) - iansmart recipe ---------- */

.dash-welcome-title { font-size: 20px; font-weight: 600; margin: 0; }
.dash-welcome-subtitle { color: var(--color-text-muted); font-size: 13px; margin: 4px 0 0; }


.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.dash-stat-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  padding-right: 40px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.dash-stat-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-stat-icon svg { width: 18px; height: 18px; }
.dash-stat-value { font-size: 17px; font-weight: 700; color: var(--color-text); line-height: 1.2; }
.dash-stat-label { font-size: 11px; color: var(--color-text-muted); margin-top: 1px; }

.dash-card { display: flex; flex-direction: column; }
.dash-card .card-header { padding: 10px 12px; }
.dash-card .card-body { padding: 10px 12px; flex: 1; }
.dash-card .card-header h3 { font-size: 13px; }

.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .dash-grid-2 { grid-template-columns: 1fr; }
}

.dash-mini-list { display: flex; flex-direction: column; }
.dash-mini-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--color-border);
}
.dash-mini-row:last-child { border-bottom: none; }
.dash-mini-time {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10.5px; font-weight: 700; color: var(--color-primary);
  font-variant-numeric: tabular-nums; flex-shrink: 0; width: 52px;
  padding: 6px 4px; background: var(--color-primary-soft); border-radius: 8px;
}
.dash-mini-time svg { width: 14px; height: 14px; color: var(--color-primary); }
.dash-mini-main { flex: 1; min-width: 0; }
.dash-mini-label { font-size: 12.5px; font-weight: 600; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-mini-label .text-muted { font-weight: 400; }
.dash-mini-badge { font-size: 10.5px; font-weight: 600; }
.dash-mini-check { color: var(--color-success); font-weight: 700; flex-shrink: 0; }
.dash-mini-footer { padding: 8px 12px; border-top: 1px solid var(--color-border); }
.dash-mini-footer a { font-size: 12px; font-weight: 600; color: var(--color-primary); text-decoration: none; }
.dash-mini-footer a:hover { text-decoration: underline; }

.dash-side-by-side { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.dash-side-by-side-left { flex: 0 0 auto; }
.dash-side-by-side-right { flex: 1 1 260px; min-width: 240px; }
@media (max-width: 700px) {
  .dash-side-by-side-right { border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 4px; }
}

/* Students by Grade / Teachers by Grade sharing one card, side by side. */
.dash-split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-split-half { min-width: 0; }
.dash-split-half + .dash-split-half { border-left: 1px solid var(--color-border); padding-left: 16px; }
.dash-split-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 8px; }
@media (max-width: 700px) {
  .dash-split-2 { grid-template-columns: 1fr; }
  .dash-split-half + .dash-split-half { border-left: none; padding-left: 0; border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 4px; }
}

.dash-donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.dash-donut-canvas { position: relative; width: 88px; height: 88px; flex-shrink: 0; overflow: hidden; }
.dash-donut-canvas canvas { width: 100% !important; height: 100% !important; display: block; opacity: 0; transition: opacity .12s ease; }
.dash-donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
  padding: 0 10px; text-align: center;
}
.dash-donut-total { font-size: 18px; font-weight: 800; color: var(--color-text); line-height: 1.1; letter-spacing: -0.02em; }
.dash-donut-total-label { font-size: 7.5px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; line-height: 1.25; margin-top: 1px; }

.dash-donut-legend { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 130px; max-width: 200px; }
.dash-legend-row { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.dash-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-legend-label { color: var(--color-text-muted); flex: 1; }
.dash-legend-value { font-weight: 600; color: var(--color-text); }

.dash-bar-wrap { position: relative; width: 100%; height: 120px; overflow: hidden; }
.dash-bar-wrap canvas { width: 100% !important; height: 100% !important; display: block; opacity: 0; transition: opacity .12s ease; }

/* ---------- Scan result card (admin/scan.php) ---------- */
.sr-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(17, 24, 39, .62); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .3s ease;
}
.sr-overlay.show { opacity: 1; pointer-events: auto; }

.sr-card {
  --tone: #059669; --tone-dark: #047857;
  position: relative; width: min(880px, 100%); overflow: hidden;
  background: #fff; border-radius: 28px;
  /* Explicit (not just inherited from body) so this card's text is
     guaranteed to render in the same font as the kiosk's own school-name
     header, wherever this markup ends up. */
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  transform: translateY(24px) scale(.96); transition: transform .35s cubic-bezier(.2, .9, .3, 1.2);
}
.sr-overlay.show .sr-card { transform: none; }
.sr-late { --tone: #d97706; --tone-dark: #b45309; }
.sr-warn { --tone: #dc2626; --tone-dark: #b91c1c; }

/* Faint school-seal watermark on the card -- ::before so it paints behind
   the schoolbar/band/body that follow it in the DOM (none of them sets its
   own z-index, so plain document order decides paint order here). The
   card's own overflow:hidden above clips it to the rounded corners. */
.sr-card::before {
  content: '';
  position: absolute;
  right: -40px;
  bottom: -40px;
  width: 340px;
  height: 340px;
  background: url('../img/logo.png') center / contain no-repeat;
  opacity: .07;
  pointer-events: none;
}

/* Result card's own school header -- the sr-overlay covers the whole
   screen (including the kiosk's own logo/title up top), so each scan
   result repeats that same branding on the card itself. */
.sr-schoolbar { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--color-border); text-align: center; }
.sr-schoolbar img { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; margin-top: 2px; }
.sr-schoolbar span { display: block; font-size: 17px; font-weight: 700; letter-spacing: .03em; color: #3b3f4a; }
.sr-schoolbar b { color: #b8862b; font-weight: 800; }
.sr-schoolbar small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: #5a5f6b; text-transform: uppercase; }

.sr-band {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 18px 24px; color: #fff;
  background: linear-gradient(135deg, var(--tone) 0%, var(--tone-dark) 100%);
  font-size: clamp(1.6rem, 4.6vh, 2.6rem); font-weight: 800; letter-spacing: .14em;
}
.sr-band svg { width: 1.3em; height: 1.3em; flex-shrink: 0; }
.sr-warn .sr-band { animation: srWarnBand 1s ease-in-out infinite; }
@keyframes srWarnBand { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.22); } }
.sr-warn { animation: srWarnGlow 1s ease-in-out infinite; }
@keyframes srWarnGlow { 0%, 100% { box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 0 rgba(220,38,38,.7); } 50% { box-shadow: 0 30px 80px rgba(0,0,0,.45), 0 0 0 26px rgba(220,38,38,0); } }

.sr-body { display: flex; align-items: center; gap: clamp(20px, 4vw, 44px); padding: clamp(20px, 4vh, 40px); position: relative; z-index: 1; }
.sr-photo-wrap { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sr-photo {
  width: clamp(180px, 34vh, 300px); aspect-ratio: 4 / 5;
  background: #eef1f5 center top / cover no-repeat; border-radius: 22px;
  box-shadow: 0 0 0 6px var(--tone), 0 12px 30px rgba(0, 0, 0, .18);
}
.sr-photo-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #8593a3; background: linear-gradient(160deg, #fbf3e2, #d8dee6); }
.sr-photo-empty span { font-size: 64px; font-weight: 800; color: #5d6b7a; }
.sr-photo-empty small { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--color-warning); }
.sr-sy { font-size: 13px; font-weight: 700; letter-spacing: .04em; color: #5d6b7a; }

.sr-info { flex: 1 1 auto; min-width: 0; }
.sr-label { font-size: 14px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--tone); }
.sr-name { margin: 4px 0 12px; font-size: clamp(1.8rem, 5.6vh, 3.2rem); font-weight: 800; line-height: 1.1; color: #1f2937; overflow-wrap: anywhere; }
.sr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: clamp(1rem, 2.6vh, 1.5rem); font-weight: 600; color: #4b5563; }
.sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 28px; margin-top: 4px; }
.sr-grid > div { min-width: 0; }
.sr-grid small { display: block; margin-bottom: 3px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #8593a3; }
.sr-grid b { display: block; font-size: clamp(1.05rem, 2.8vh, 1.6rem); font-weight: 700; color: #1f2937; overflow-wrap: anywhere; }
/* Here specifically (not the Students table's chip), the modality shows as
   plain colored text -- no filled badge -- so the fill color moves to the
   text itself. */
.sr-grid .mod-chip { display: inline; background: none; padding: 0; border-radius: 0; font-size: clamp(.95rem, 2.4vh, 1.3rem); }
.sr-grid .mod-chip.mod-f2f     { color: #0b7bd6; }
.sr-grid .mod-chip.mod-modular { color: #7c3aed; }
.sr-grid .mod-chip.mod-als     { color: #0f9d8a; }
.sr-grid .mod-chip.mod-other   { color: #5d6b7a; }
.sr-time { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 1rem; font-weight: 600; color: #5d6b7a; font-variant-numeric: tabular-nums; }
.sr-time svg { width: 18px; height: 18px; }

.sr-wait { display: flex; align-items: center; gap: 18px; margin-top: 22px; padding: 16px 20px; background: #fef2f2; border: 2px solid #fecaca; border-radius: 18px; }
.sr-wait-title { font-size: 1.15rem; font-weight: 800; color: #b91c1c; }
.sr-wait-text { margin-top: 2px; font-size: .95rem; color: #7f1d1d; }
.sr-count { position: relative; width: 80px; height: 80px; flex-shrink: 0; }
.sr-count svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.sr-count circle { fill: none; stroke-width: 7; }
.sr-ring-bg { stroke: #fecaca; }
.sr-ring { stroke: #dc2626; stroke-linecap: round; stroke-dasharray: 214; stroke-dashoffset: 0; animation: srRing linear forwards; }
@keyframes srRing { to { stroke-dashoffset: 214; } }
.sr-count b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; font-weight: 800; color: #b91c1c; }

.sr-next { display: block; width: 100%; padding: 16px; font: inherit; font-size: 1.05rem; font-weight: 700; letter-spacing: .06em; color: #fff; background: #1f2937; border: 0; cursor: pointer; }
.sr-next:hover { background: #111827; }

@media (max-width: 640px) {
  .sr-body { flex-direction: column; text-align: center; }
  .sr-meta, .sr-time { justify-content: center; }
  .sr-wait { text-align: left; }
}