:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1c2333;
  --muted: #6b7388;
  --border: #e2e6f0;
  --primary: #3b5bdb;
  --primary-dark: #2f49b3;
  --present: #2f9e44;
  --present-bg: #e6f6ea;
  --absent: #e03131;
  --absent-bg: #fdeaea;
  --late: #e67700;
  --late-bg: #fff3df;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h1 small { font-size: .9rem; font-weight: 400; margin-left: .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .9rem; }
a { color: var(--primary); }
code { background: #eef1fa; padding: 1px 6px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.c { text-align: center; }

/* ---- Layout ---- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: .7rem 1.5rem; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.topbar nav a {
  text-decoration: none; color: var(--muted); padding: .4rem .8rem; border-radius: 8px; font-weight: 500;
}
.topbar nav a:hover { background: var(--bg); color: var(--text); }
.topbar nav a.active { background: #e9eefe; color: var(--primary); }
.userbox { display: flex; align-items: center; gap: .7rem; font-size: .9rem; margin: 0; }

.container { max-width: 1150px; margin: 0 auto; padding: 1.5rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.2rem;
}
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.cards .card { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; align-items: start; }
.grid-2-wide-right { grid-template-columns: 340px 1fr; }
.grid-2 > .card { margin-bottom: 0; }

.stat { display: flex; flex-direction: column; }
.stat-num { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .88rem; }
.stat-present .stat-num { color: var(--present); }
.stat-absent .stat-num { color: var(--absent); }
.stat-late .stat-num { color: var(--late); }

/* ---- Forms & buttons ---- */
.form { display: flex; flex-direction: column; gap: .9rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: .5rem; }
input, select {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: var(--text);
}
input:focus, select:focus { outline: 2px solid #bac8ff; border-color: var(--primary); }
.input-sm { padding: .3rem .5rem; width: 140px; }
.search { min-width: 180px; padding: .4rem .7rem; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text);
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--absent); border-color: #f5c2c2; }
.btn-danger:hover { background: var(--absent-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: .3rem .65rem; font-size: .83rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: wait; }

.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.row form { margin: 0; }
.filters { align-items: flex-end; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .7rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th.c, .table td.c { text-align: center; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tbody tr:hover { background: #fafbff; }
.row-muted { opacity: .55; }
.row-low { background: #fff5f5; }

/* ---- Attendance radios ---- */
.pill { cursor: pointer; display: inline-block; }
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 34px; border-radius: 8px; font-weight: 700;
  border: 1px solid var(--border); color: var(--muted); background: #fff; transition: all .12s;
}
.pill input:focus-visible + span { outline: 2px solid #bac8ff; }
.pill-present input:checked + span { background: var(--present); border-color: var(--present); color: #fff; }
.pill-absent  input:checked + span { background: var(--absent);  border-color: var(--absent);  color: #fff; }
.pill-late    input:checked + span { background: var(--late);    border-color: var(--late);    color: #fff; }

.sticky-actions {
  position: sticky; bottom: 0; background: var(--surface);
  padding: .9rem 0 .2rem; margin-top: .5rem; border-top: 1px solid var(--border);
}
.summary { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { padding: .25rem .7rem; border-radius: 999px; font-size: .85rem; }
.chip-present { background: var(--present-bg); color: var(--present); }
.chip-absent  { background: var(--absent-bg);  color: var(--absent); }
.chip-late    { background: var(--late-bg);    color: var(--late); }
.badge { font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; margin-left: .5rem; }
.badge-info { background: #e9eefe; color: var(--primary); }

/* ---- Bars ---- */
.bar-row { display: grid; grid-template-columns: 90px 1fr 45px; gap: .6rem; align-items: center; margin-bottom: .5rem; font-size: .88rem; }
.bar { background: #edf0f7; border-radius: 999px; height: 10px; overflow: hidden; }
.bar-sm { height: 8px; width: 110px; display: inline-block; vertical-align: middle; margin-right: .4rem; }
.bar-fill { background: var(--present); height: 100%; border-radius: 999px; }
.bar-fill.bar-low { background: var(--absent); }
.bar-val { text-align: right; font-weight: 600; }

/* ---- Alerts & toast ---- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.alert-success { background: var(--present-bg); color: #1e6b2f; }
.alert-error { background: var(--absent-bg); color: #a61e1e; }

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translate(-50%, 30px);
  background: #1c2333; color: #fff; padding: .7rem 1.2rem; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--absent); }

/* ---- Login ---- */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 2rem; width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: .9rem;
}
.login-card h1 { margin: 0; text-align: center; }
.login-card p { margin: 0; text-align: center; }
.login-logo { font-size: 2.5rem; text-align: center; }

@media (max-width: 800px) {
  .grid-2, .grid-2-wide-right { grid-template-columns: 1fr; }
  .container { padding: 1rem; }
  .topbar { padding: .6rem 1rem; }
}

/* =====================  School management additions  ===================== */
.spacer { flex: 1; }
.grow { flex: 1; min-width: 120px; }
.r { text-align: right; }
.text-bad { color: var(--absent); }
.text-good { color: var(--present); }
.badge-ok { background: var(--present-bg); color: var(--present); }
textarea { font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; resize: vertical; width: 100%; }
textarea:focus { outline: 2px solid #bac8ff; border-color: var(--primary); }
ul.plain { margin: 0; padding-left: 1.1rem; }
.table tfoot th, .table tfoot td { border-top: 2px solid var(--border); border-bottom: none; }

/* Sidebar layout */
.menu-btn { display: none; font-size: 1.3rem; background: none; border: 0; cursor: pointer; color: var(--text); }
.topbar { justify-content: space-between; }
.topbar .brand { flex: 1; }
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--border); padding: 1rem .7rem;
  position: sticky; top: 56px; align-self: flex-start; height: calc(100vh - 56px); overflow-y: auto;
}
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar a {
  display: flex; gap: .6rem; align-items: center; text-decoration: none; color: var(--muted);
  padding: .55rem .8rem; border-radius: 8px; font-weight: 500; font-size: .93rem;
}
.sidebar a:hover { background: var(--bg); color: var(--text); }
.sidebar a.active { background: #e9eefe; color: var(--primary); }
.layout .container { flex: 1; min-width: 0; margin: 0; max-width: none; }

/* Tabs */
.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab { padding: .55rem 1rem; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Notices */
.notice { padding: .8rem 0; border-bottom: 1px solid var(--border); }
.notice:last-of-type { border-bottom: 0; }
.notice h3 { margin: 0; font-size: 1rem; }
.notice p { margin: .25rem 0 0; }

/* Timetable */
.tt th:first-child { white-space: nowrap; }
.tt select { padding: .3rem; max-width: 110px; font-size: .82rem; }
.tt td { min-width: 100px; }

/* Report card & receipt */
.report-card, .receipt { max-width: 820px; margin-left: auto; margin-right: auto; }
.rc-head { text-align: center; margin-bottom: 1rem; }
.rc-head h1 { margin: 0; }
.rc-head h2 { margin: .8rem 0 0; letter-spacing: .04em; }
.rc-head p { margin: .2rem 0 0; }
.rc-info, .rc-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem 1.2rem;
  padding: 1rem; background: var(--bg); border-radius: 8px; margin: 1rem 0;
}
.rc-sign { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; font-size: .88rem; color: var(--muted); }
.rc-sign span { border-top: 1px solid var(--muted); padding-top: .3rem; min-width: 140px; text-align: center; }

/* Public site */
.public .topbar { position: static; }
.hero { background: linear-gradient(135deg, #3b5bdb, #5f3dc4); color: #fff; text-align: center; padding: 4rem 1.5rem; }
.hero h1 { font-size: 2.3rem; margin: 0 0 .5rem; }
.hero p { margin: 0 0 1.5rem; font-size: 1.1rem; opacity: .9; }
.btn-light { background: #fff; color: var(--primary); border-color: #fff; }
.btn-light:hover { background: #eef1ff; }
.public .container { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }
.features h3 { margin-top: 0; }
.site-footer { text-align: center; color: var(--muted); padding: 2rem 1rem; font-size: .88rem; }

@media (max-width: 800px) {
  .menu-btn { display: inline-block; }
  .sidebar {
    position: fixed; left: 0; top: 56px; z-index: 20; height: calc(100vh - 56px);
    transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 16px rgba(0,0,0,.1);
  }
  .sidebar.open { transform: translateX(0); }
  .userbox span { display: none; }
  .hero h1 { font-size: 1.7rem; }
}

/* Printing */
@media print {
  .no-print, .topbar, .sidebar, .toast { display: none !important; }
  body { background: #fff; }
  .layout { display: block; }
  .container { padding: 0; }
  .card { border: 0; padding: 0; }
  .report-card, .receipt { max-width: none; }
  .table tbody tr:hover { background: none; }
}

/* Alerts, parents, status badges */
.badge-warn { background: var(--late-bg); color: var(--late); }
.badge-bad  { background: var(--absent-bg); color: var(--absent); }
.parent-block { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.parent-block:last-child { border-bottom: 0; }
.chip form, form.chip { display: inline-flex; align-items: center; gap: .3rem; margin: 0; }
.chip-x { border: 0; background: none; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; padding: 0 .1rem; }

/* UPI / bank payment page */
.pay-method { border-top: 1px solid var(--border); padding-top: 1rem; margin-top: 1rem; }
.pay-method h3 { margin: 0 0 .6rem; font-size: 1rem; }
.qr-box { display: inline-block; line-height: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.qr-box svg { max-width: 100%; height: auto; }
.kv th { width: 9rem; text-transform: none; letter-spacing: 0; font-size: .88rem; }
.badge { display: inline-block; font-size: .75rem; padding: .15rem .55rem; border-radius: 999px; background: #edf0f7; color: var(--muted); }

/* ---------- ID cards ---------- */
.id-sheet { display: flex; flex-direction: column; gap: 6mm; margin-bottom: 1.2rem; page-break-after: always; break-after: page; }
.id-sheet:last-of-type { page-break-after: auto; break-after: auto; }
.id-row { display: flex; gap: 6mm; align-items: flex-start; flex-wrap: wrap; }
.id-card { width: 85.6mm; height: 54mm; border: .3mm solid #999; border-radius: 3mm; background: #fff; color: #111; position: relative; overflow: hidden; font-size: 2.9mm; line-height: 1.35; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.id-head { background: var(--accent, #1d4ed8); color: #fff; padding: 1.6mm 3mm; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.id-school { font-size: 3.3mm; }
.id-tag { font-size: 2.3mm; letter-spacing: .3mm; opacity: .9; }
.id-photo { position: absolute; left: 3mm; top: 11mm; width: 20mm; height: 26.7mm; border: .3mm solid #bbb; background: #eef2ff; display: flex; align-items: center; justify-content: center; font-size: 9mm; color: #6b7cc4; overflow: hidden; }
.id-photo img { width: 100%; height: 100%; object-fit: cover; }
.id-info { position: absolute; left: 25.5mm; top: 11mm; right: 25mm; }
.id-info b { color: #555; font-weight: 600; display: inline-block; min-width: 11mm; }
.id-name { font-size: 3.6mm; font-weight: 700; margin-bottom: 1mm; color: var(--accent, #1d4ed8); }
.id-qr { position: absolute; right: 3mm; top: 11mm; width: 22mm; height: 22mm; }
.id-qr svg { width: 100%; height: 100%; display: block; }
.id-foot { position: absolute; left: 0; right: 0; bottom: 0; background: #f1f5f9; text-align: center; font-size: 2.4mm; padding: 1mm; color: #444; }
.id-backbody { padding: 3mm; display: flex; flex-direction: column; gap: 2mm; }
.id-guardian { border-top: .2mm solid #ccc; padding-top: 2mm; }
.id-note { font-size: 2.4mm; color: #555; }
.id-sign { position: absolute; right: 4mm; bottom: 3mm; width: 28mm; border-top: .25mm solid #333; text-align: center; font-size: 2.4mm; padding-top: .6mm; }
.id-reissue { align-self: center; }

/* ---------- Scan page ---------- */
.scan-cam { max-width: 360px; margin-bottom: .8rem; }
.scan-cam video { width: 100%; border-radius: 8px; background: #000; }
.scan-result { display: flex; gap: 1rem; align-items: center; padding: 1rem; border-radius: 10px; border: 2px solid var(--border, #ddd); min-height: 96px; }
.scan-result.idle { background: #f8fafc; }
.scan-result.ok   { background: var(--present-bg); border-color: var(--present); }
.scan-result.late { background: var(--late-bg);    border-color: var(--late); }
.scan-result.dup  { background: #eff6ff;           border-color: #3b82f6; }
.scan-result.bad  { background: var(--absent-bg);  border-color: var(--absent); }
.scan-photo { width: 66px; height: 88px; border-radius: 6px; background: #e2e8f0; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; color: #64748b; overflow: hidden; flex: none; }
.scan-photo img { width: 100%; height: 100%; object-fit: cover; }
.scan-name { font-size: 1.2rem; font-weight: 700; }
.scan-msg { margin-top: .3rem; font-weight: 600; }
.scan-recent { list-style: none; padding: 0; font-size: .88rem; }
.scan-recent li { padding: .25rem .5rem; border-left: 4px solid #ccc; margin-bottom: .2rem; }
.scan-recent .r-ok { border-color: var(--present); } .scan-recent .r-late { border-color: var(--late); } .scan-recent .r-bad { border-color: var(--absent); } .scan-recent .r-dup { border-color: #3b82f6; }
.student-thumb { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: .4rem; background: #e2e8f0; }
@media print { .id-card { break-inside: avoid; } .id-row { flex-wrap: nowrap; } .id-reissue { display: none; } }

/* ---------- Notification bell ---------- */
.bell-wrap { position: relative; margin-right: .6rem; }
.bell { position: relative; font-size: 1.1rem; }
.bell-badge { position: absolute; top: -4px; right: -4px; background: #dc2626; color: #fff; border-radius: 999px; font-size: .68rem; min-width: 1.1rem; height: 1.1rem; line-height: 1.1rem; text-align: center; padding: 0 .2rem; }
.bell-panel { position: absolute; right: 0; top: calc(100% + 6px); width: min(340px, 92vw); background: #fff; border: 1px solid var(--border, #ddd); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 60; }
.bell-head, .bell-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .8rem; }
.bell-head { border-bottom: 1px solid var(--border, #eee); }
.bell-foot { border-top: 1px solid var(--border, #eee); }
.bell-panel ul { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.bell-panel li.muted { padding: .8rem; }
.bell-item a { display: block; padding: .55rem .8rem; color: inherit; text-decoration: none; border-bottom: 1px solid #f1f1f1; }
.bell-item a:hover { background: #f8fafc; }
.bell-item.unread a { background: #eff6ff; border-left: 3px solid #3b82f6; }
.bell-item span, .bell-item small { display: block; font-size: .85rem; }

[hidden] { display: none !important; }

/* ---------- Study material ---------- */
.material-body { white-space: normal; line-height: 1.55; margin: .6rem 0; overflow-wrap: anywhere; }
.material-file { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: #f8fafc; border: 1px solid var(--border, #e5e7eb); border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
.material .row { gap: .5rem; align-items: center; }
.video-wrap { position: relative; width: 100%; max-width: 720px; aspect-ratio: 16 / 9; margin: .6rem 0; background: #000; border-radius: 8px; overflow: hidden; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.login-extras { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .9rem; }
.login-card .alert-success { text-align: left; }
.login-extras label.check { width: auto; }
.login-extras { justify-content: space-between; }

/* ---------- Transport ---------- */
.btn-lg { padding: .9rem 1.2rem; font-size: 1.05rem; }
.driver-status { padding: .8rem 1rem; border-radius: 8px; background: var(--present-bg); color: #1e6b2f; margin: .6rem 0; font-weight: 600; }
.driver-status.bad { background: var(--absent-bg); color: var(--absent); }
.track-wrap { position: relative; background: #eef2f7; border: 1px solid var(--border, #ddd); border-radius: 10px; overflow: hidden; }
.track-wrap svg { display: block; width: 100%; height: auto; }
.track-info { display: flex; gap: .6rem; flex-wrap: wrap; margin: .8rem 0; }
.track-info .chip { background: #eef2ff; color: #1e3a8a; }
.track-info .chip.warn { background: var(--late-bg); color: var(--late); }
.stop-list li { padding: .25rem 0; }
.stop-list li.mine { font-weight: 700; color: var(--primary, #1d4ed8); }

/* ---------- Street map ---------- */
#leafMap { height: 440px; width: 100%; z-index: 0; }
@media (max-width: 700px) { #leafMap { height: 340px; } }
.map-stop span, .map-bus span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; box-sizing: border-box; }
.map-stop span { background: #fff; border: 3px solid #475569; color: #334155; font: 700 12px/1 system-ui, sans-serif; }
.map-stop.mine span { background: #16a34a; border-color: #14532d; color: #fff; }
.map-bus span { background: #1d4ed8; border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(37,99,235,.28), 0 2px 6px rgba(0,0,0,.4); font-size: 17px; }
.map-bus.stale span { background: #d97706; box-shadow: 0 0 0 4px rgba(245,158,11,.3), 0 2px 6px rgba(0,0,0,.4); }
.track-wrap svg[hidden], .track-wrap #leafMap[hidden] { display: none; }
.bell-sound { display: block; padding: 0 .8rem .7rem; color: var(--muted, #64748b); }
.leaflet-container .leaflet-attribution-flag { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
input:disabled { background: #e9ecf2; color: #8a93a5; cursor: not-allowed; }


/* Notification panel on phones: a full-width sheet under the top bar (it used to run off the left edge) */
@media (max-width: 640px) {
  .bell-wrap { position: static; }
  .bell-panel { position: fixed; left: 8px; right: 8px; top: 64px; width: auto; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); display: flex; flex-direction: column; overflow: hidden; }
  .bell-panel[hidden] { display: none; }
  .bell-panel ul { max-height: none; flex: 1 1 auto; min-height: 0; }
  .bell-head, .bell-foot { flex: none; }
  .bell-foot { flex-wrap: wrap; }
}

/* Phones: nothing may push the page wider than the screen (grid children and wide tables scroll inside their own box) */
.grid-2 > *, .card { min-width: 0; }
@media (max-width: 800px) {
  .grid-2, .grid-2-wide-right { grid-template-columns: minmax(0, 1fr); }
  .card { overflow-wrap: anywhere; }
  .table-wrap { max-width: 100%; }
}

/* Prompt to turn on notifications (portal pages, mostly on phones) */
.ntf-bar { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 900; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; padding: .75rem .9rem;
  background: #17324d; color: #fff; border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.3); font-size: .92rem; max-width: 560px; margin: 0 auto; }
.ntf-bar span { flex: 1 1 100%; line-height: 1.35; }
.ntf-bar button { font: inherit; border: 0; border-radius: 8px; padding: .5rem .95rem; cursor: pointer; min-height: 40px; }
.ntf-bar .ntf-on { background: #ffd24a; color: #1d2a38; font-weight: 600; }
.ntf-bar .ntf-later { background: transparent; color: #dbe6f1; text-decoration: underline; }
.ntf-bar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media print { .ntf-bar { display: none; } }

/* Phones: smaller school name so the top bar stays short (two lines at most) */
@media (max-width: 640px) {
  .topbar .brand { min-width: 0; font-size: .92rem; line-height: 1.2; overflow-wrap: anywhere; }
}

/* ---------- All-buses map ---------- */
.fleet-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .fleet-layout { grid-template-columns: minmax(0, 1fr); } }
#fleetMap { height: 560px; width: 100%; z-index: 0; }
@media (max-width: 900px) { #fleetMap { height: 400px; } }
.fleet-fallback { padding: 2rem 1rem; text-align: center; color: #475569; }
.fleet-fallback[hidden], #fleetMap[hidden] { display: none; }
.fleet-bus span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 50%; box-sizing: border-box; background: var(--c, #2563eb); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4); font-size: 17px; }
.fleet-bus.stale span { opacity: .85; }
.leaflet-tooltip.fleet-label { background: #fff; border: 1px solid #94a3b8; border-radius: 6px; padding: 1px 6px; font: 600 12px/1.4 system-ui, sans-serif; color: #0f172a; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.fleet-side { max-height: 560px; overflow-y: auto; }
.fleet-list { list-style: none; margin: 0; padding: 0; }
.fleet-list li { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .4rem; border-bottom: 1px solid var(--border, #e5e7eb); }
.fleet-list li.live { cursor: pointer; }
.fleet-list li.live:hover, .fleet-list li.live:focus-visible { background: #eef2ff; outline: none; }
.fleet-list li.idle, .fleet-list li.waiting { opacity: .75; }
.fleet-list i { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: .3rem; }
.fleet-pop > div { margin-top: .15rem; }
.fleet-pop-links { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: .4rem !important; }

/* Final report card (web view + print; the PDF has the same layout) */
.rc-final { background: #fff; color: #111; border: 2px solid #222; padding: 1rem 1.1rem; max-width: 1100px; margin: 0 auto; page: rcfinal; }
@page rcfinal { size: A4 landscape; margin: 8mm; }
.rcf-head { display: grid; grid-template-columns: 74px 1fr 84px; gap: .8rem; align-items: start; }
.rcf-head > * { min-width: 0; }
.rcf-logo img, .rcf-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rcf-logo { width: 64px; height: 64px; }
.rcf-logo img { object-fit: contain; }
.rcf-photo { width: 78px; height: 100px; border: 1px solid #555; background: #f1f1f1; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: #888; justify-self: end; overflow: hidden; }
.rcf-title { text-align: center; }
.rcf-title h1 { margin: 0; font-size: 1.7rem; letter-spacing: .02em; }
.rcf-title p { margin: .1rem 0 .4rem; color: #444; font-size: .9rem; }
.rcf-title h2 { margin: 0; font-size: 1.15rem; letter-spacing: .08em; }
.rcf-bar { display: grid; grid-template-columns: 1fr 1fr; background: #fff2b3; border: 1px solid #222; font-weight: 700; text-align: center; margin-top: .5rem; }
.rcf-bar div { padding: .3rem; }
.rcf-bar div + div { border-left: 1px solid #222; }
.rcf-info { display: grid; grid-template-columns: 1.4fr 1fr; gap: .6rem 1.5rem; border: 1px solid #222; border-top: 0; padding: .6rem .8rem; margin-bottom: .6rem; }
.rcf-info dl { margin: 0; display: grid; grid-template-columns: 8.5rem 1fr; gap: .2rem .4rem; font-size: .92rem; }
.rcf-info dt { font-weight: 700; }
.rcf-info dt::after { content: " :"; float: right; }
.rcf-info dd { margin: 0; overflow-wrap: anywhere; }
.rcf-scroll { overflow-x: auto; }
.rcf-table, .rcf-scale { border-collapse: collapse; width: 100%; font-size: .88rem; }
.rcf-table th, .rcf-table td, .rcf-scale th, .rcf-scale td { border: 1px solid #222; padding: .22rem .35rem; text-align: center; }
.rcf-table thead th { background: #fff2b3; }
.rcf-table thead .rcf-mm th { background: #ddf5ea; font-size: .78rem; }
.rcf-table .rcf-sub { text-align: left; min-width: 11rem; }
.rcf-table tfoot th { background: #fff2b3; }
.rcf-table tfoot .rcf-r { text-align: right; }
.rcf-bold { font-weight: 700; }
.rcf-strip { display: flex; flex-wrap: wrap; gap: .3rem 1.6rem; background: #f4f4f4; border: 1px solid #222; padding: .4rem .7rem; margin: .6rem 0 .4rem; font-weight: 700; font-size: .92rem; }
.rcf-line { border: 1px solid #222; padding: .35rem .7rem; margin-bottom: .4rem; font-size: .92rem; }
.rcf-scale caption { background: #fff2b3; border: 1px solid #222; border-bottom: 0; padding: .25rem; font-weight: 700; font-size: .8rem; caption-side: top; }
.rcf-scale th { background: #fff2b3; font-size: .78rem; }
.rcf-sign { display: grid; grid-template-columns: 1fr 1fr 1fr; border: 1px solid #222; border-top: 0; min-height: 4.2rem; font-size: .85rem; }
.rcf-sign > div { padding: .4rem .6rem; }
.rcf-sign > div + div { border-left: 1px solid #222; }
.rcf-sig { display: flex; align-items: flex-end; justify-content: center; text-align: center; }
@media (max-width: 700px) {
  .rcf-head { grid-template-columns: 56px 1fr 64px; }
  .rcf-title h1 { font-size: 1.15rem; }
  .rcf-photo { width: 62px; height: 80px; }
  .rcf-info { grid-template-columns: 1fr; }
  .rcf-info dl { grid-template-columns: 8.2rem 1fr; }
  .rc-final { padding: .7rem; }
}
@media print {
  .rc-final { border: 2px solid #222; padding: .5rem; max-width: none; }
  .rcf-scroll { overflow: visible; }
  .rcf-table, .rcf-scale { font-size: 10px; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.pk-wrap { margin-top: .9rem; }
.pk-or { text-align: center; position: relative; margin: .2rem 0 .7rem; color: var(--muted, #6b7280); font-size: .85rem; }
.pk-or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #e3e6ee; }
.pk-or span { position: relative; background: #fff; padding: 0 .7rem; }
.table .btn-sm { white-space: nowrap; }
.pk-offer { background: #eef4ff; border: 1px solid #c9d9f8; color: #1e3a8a; }
.pk-offer-btns { display: inline-flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.alert-info { background: #eef4ff; border: 1px solid #c9d9f8; color: #1e3a8a; }
