/* সান মুন প্রি-ক্যাডেট স্কুল — ওয়েব + PWA প্রিন্ট স্টুডিও (Original Emerald-Navy Design System) */
@font-face {
  font-family: 'Hind Siliguri';
  src: url('../fonts/HindSiliguri-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Hind Siliguri';
  src: url('../fonts/HindSiliguri-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Hind Siliguri';
  src: url('../fonts/HindSiliguri-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Hind Siliguri';
  src: url('../fonts/HindSiliguri-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Serif Bengali';
  src: url('../fonts/NotoSerifBengali-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Serif Bengali';
  src: url('../fonts/NotoSerifBengali-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --teal: #0F766E;
  --teal-dark: #115E59;
  --teal-soft: #CCFBF1;
  --navy: #0F2942;
  --navy-mid: #1E3A5F;
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --border: #CBD5E1;
  --text: #0F172A;
  --muted: #475569;
  --ok: #059669;
  --warn: #D97706;
  --err: #DC2626;
  --gold: #B45309;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(15, 41, 66, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Hind Siliguri', system-ui, -apple-system, 'Noto Sans Bengali', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.serif-bn { font-family: 'Noto Serif Bengali', 'Hind Siliguri', serif; }

/* ── Auth / Login Gate ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at top left, #134E4A 0%, #0F2942 60%, #081726 100%);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: 22px;
  padding: 30px 28px;
  box-shadow: 0 28px 65px rgba(0, 0, 0, 0.35);
}
.auth-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.auth-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  border: 2px solid var(--teal-soft);
}
.auth-title { margin: 0; font-size: 20px; color: var(--navy); }
.auth-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

/* ── App Shell (Sidebar Rail + Topbar + Content) ── */
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.rail {
  background: linear-gradient(180deg, var(--navy) 0%, #0B1F33 100%);
  color: #E2E8F0;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
}
.rail-brand img {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: #fff;
  padding: 2px;
}
.rail-brand h1 { margin: 0; font-size: 15px; line-height: 1.25; color: #FFFFFF; }
.rail-brand small { display: block; font-size: 11.5px; color: #99F6E4; margin-top: 2px; }

.rail-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rail-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  color: #CBD5E1;
  text-align: left;
  padding: 11px 12px;
  border-radius: 11px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.rail-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.rail-btn.active {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #FFFFFF;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.35);
}
.rail-ico { width: 22px; text-align: center; font-size: 16px; }
.rail-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 12px;
  font-size: 12px;
  color: #94A3B8;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-col { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-title { margin: 0; font-size: 18px; color: var(--navy); font-weight: 700; }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--navy);
}
.pill.ok { background: #ECFDF5; border-color: #A7F3D0; color: #065F46; }
.pill.warn { background: #FFFBEB; border-color: #FDE68A; color: #92400E; }
.pill.err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }

.content {
  padding: 20px 22px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* ── Forms & Buttons & Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--navy); }
.muted { color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.g-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.grid > * { min-width: 0; }
.studio-split { display: grid; grid-template-columns: 350px 1fr; gap: 16px; align-items: start; }

.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.field { margin-bottom: 10px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="color"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: inherit;
  font-size: 13.5px;
  background: #FFFFFF;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--teal);
}
input[type="color"] { padding: 3px 6px; height: 38px; cursor: pointer; }
input[type="checkbox"] { width: auto; accent-color: var(--teal); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 9px;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--teal);
  color: #FFFFFF;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.08s;
}
.btn:hover { opacity: 0.93; }
.btn:active { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-navy { background: var(--navy); }
.btn-ok { background: var(--ok); }
.btn-warn { background: var(--warn); }
.btn-err { background: var(--err); }
.btn-sec { background: #E2E8F0; color: var(--navy); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 16px;
  border-left: 4px solid var(--teal);
}
.kpi .k-lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .k-val { font-size: 24px; font-weight: 700; color: var(--navy); margin-top: 4px; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.subtab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--navy);
  padding: 8px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.subtab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #FFFFFF;
}

.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; }
table.tbl th, table.tbl td { border-bottom: 1px solid #E2E8F0; padding: 8px 10px; text-align: left; }
table.tbl th { background: #F8FAFC; color: var(--navy); font-weight: 700; white-space: nowrap; }
table.tbl tr:hover td { background: #F8FAFC; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.ctr { text-align: center !important; }

/* ── Interactive ID Card Studio ── */
.stage-bg {
  background: repeating-conic-gradient(#E2E8F0 0% 25%, #F8FAFC 0% 50%) 50% / 20px 20px;
  padding: 20px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}
.id-canvas {
  position: relative;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.16);
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}
.id-canvas.portrait { width: 286px; height: 454px; }
.id-canvas.landscape { width: 454px; height: 286px; }
.id-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; z-index: 0; }
.id-frame-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.id-el { position: absolute; z-index: 2; padding: 2px 4px; border: 1px dashed transparent; border-radius: 4px; }
.id-el.draggable { cursor: grab; }
.id-el.draggable:hover { border-color: #0284C7; background: rgba(2, 132, 199, 0.08); }
.id-el.selected { border: 1.5px solid #0F766E; background: rgba(15, 118, 110, 0.10); }
.id-batch-grid { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ── Interactive Seating Room Grid ── */
.room-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #FFFFFF;
  padding: 14px;
  margin-bottom: 14px;
}
.bench-grid {
  display: grid;
  gap: 10px;
}
.bench-box {
  border: 1.5px solid #94A3B8;
  border-radius: 10px;
  padding: 8px;
  background: #F8FAFC;
}
.bench-title { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-align: center; }
.bench-slots { display: flex; gap: 6px; }
.seat-chip {
  flex: 1;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #FFFFFF;
  padding: 6px;
  min-height: 58px;
  cursor: pointer;
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.seat-chip:hover { border-color: var(--teal); }
.seat-chip.swap-active {
  border: 2px solid #D97706;
  background: #FEF3C7;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25);
}
.seat-cls { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #E0F2FE; color: #0369A1; margin-bottom: 3px; align-self: flex-start; }

/* ── Toast & Modal & Mobile Rail ── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  z-index: 200;
  display: none;
  max-width: 420px;
}
.toast.show { display: block; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 150;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.mobile-menu-btn { display: none; }
#printRoot { display: none; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 100;
    transition: left 0.2s ease;
  }
  .rail.open { left: 0; box-shadow: 20px 0 50px rgba(0,0,0,0.45); }
  .mobile-menu-btn { display: inline-flex; }
  .studio-split { grid-template-columns: 1fr; }
}

/* ── Dedicated Print Sheet Components (visible preview & crisp A4/PVC printing) ── */
.print-sheet {
  background: #FFFFFF;
  color: #0F172A;
  width: 100%;
}
.doc-page {
  border: 2px solid #0F2942;
  padding: 22px 26px;
  background: #FFFFFF;
  page-break-after: always;
  break-after: page;
  margin-bottom: 18px;
}
.doc-page:last-child { page-break-after: auto; break-after: auto; }
.doc-inner-border {
  border: 1px solid #0F766E;
  padding: 18px 22px;
}
.letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0F2942;
  padding-bottom: 10px;
  margin-bottom: 14px;
  gap: 12px;
}
.letterhead img { width: 58px; height: 58px; object-fit: contain; }
.letterhead-center { flex: 1; text-align: center; }
.letterhead-center h2 { margin: 0; font-size: 20px; color: #0F2942; }
.letterhead-center p { margin: 2px 0; font-size: 12.5px; color: #334155; }

.admit-grid {
  display: grid;
  gap: 12px;
}
.admit-grid.g-2up { grid-template-columns: 1fr; }
.admit-grid.g-4up { grid-template-columns: repeat(2, 1fr); }
.admit-card {
  border: 2px solid #0F2942;
  border-radius: 10px;
  padding: 12px 14px;
  page-break-inside: avoid;
  break-inside: avoid;
  background: #fff;
}
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.bench-sticker {
  border: 1.5px dashed #334155;
  border-radius: 6px;
  padding: 8px 10px;
  page-break-inside: avoid;
  break-inside: avoid;
  font-size: 12px;
}
.tab-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.tab-tbl th, .tab-tbl td {
  border: 1px solid #475569;
  padding: 4px 6px;
}
.tab-tbl th { background: #F1F5F9; font-weight: 700; text-align: center; }
.fail-cell { color: #B91C1C; font-weight: 700; background: #FEF2F2; }

.sig-row {
  display: flex;
  justify-content: space-between;
  margin-top: 34px;
  gap: 18px;
}
.sig-box {
  width: 185px;
  border-top: 1px solid #0F172A;
  text-align: center;
  padding-top: 5px;
  font-size: 12px;
  font-weight: 600;
}

.rail-group-label {
  font-size: 11px;
  font-weight: 700;
  color: #5EEAD4;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 10px 4px;
  opacity: 0.9;
}

/* ── Public School Website & Guardian Portal ── */
.pub-wrap { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pub-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.pub-brand { display: flex; align-items: center; gap: 10px; }
.pub-brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border); }
.pub-brand h1 { margin: 0; font-size: 16.5px; color: var(--navy); }
.pub-brand small { display: block; font-size: 12px; color: var(--muted); }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-main { flex: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 20px 16px 40px; }
.pub-hero {
  background: linear-gradient(135deg, var(--teal) 0%, var(--navy) 85%);
  color: #FFFFFF;
  border-radius: 20px;
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
  align-items: center;
  box-shadow: 0 14px 36px rgba(15, 41, 66, 0.16);
  margin-bottom: 20px;
}
.pub-hero h2 { margin: 0 0 8px; font-size: clamp(22px, 3vw, 30px); }
.pub-hero p { margin: 0 0 16px; opacity: 0.92; line-height: 1.55; }
.pub-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pub-stat {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 14px;
  padding: 12px 14px;
}
.pub-stat strong { display: block; font-size: 20px; color: #FFFFFF; }
.pub-stat span { font-size: 12px; color: #CCFBF1; }
.pub-footer {
  background: var(--navy);
  color: #CBD5E1;
  text-align: center;
  padding: 16px;
  font-size: 12.5px;
}

.g-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.g-header {
  background: linear-gradient(135deg, var(--teal-dark), var(--navy));
  color: #fff;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.g-body { width: 100%; max-width: 1080px; margin: 0 auto; padding: 18px 16px; flex: 1; }

.thermal-80 {
  width: 76mm;
  margin: 0 auto;
  padding: 6px;
  font-size: 11.5px;
  color: #000;
  background: #fff;
  border: 1px dashed #64748B;
}
.thermal-80 hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }

.table-wrap, .tbl-wrap, .stage-bg { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.btn-wa { background: #16A34A; color: #FFFFFF; }
.btn-wa:hover { background: #15803D; }

@media (max-width: 760px) {
  .pub-hero { grid-template-columns: 1fr; padding: 20px 16px; }
  .auth-card { padding: 22px 18px; }
  .topbar { padding: 10px 12px; }
  .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
}

/* =========================================================================
   বসন্ত (Bengal Spring) PWA App Shell, Dark Theme, Vector Charts & Mobile UI
   ========================================================================= */
:root {
  --spring-bg: #F3FAF7;
  --spring-blossom: #D97706;
  --spring-emerald: #10B981;
  --spring-leaf: #059669;
  --surface: #FFFFFF;
  --surface-soft: #ECFDF5;
}

html, body {
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
}
.main-col, .content, .pub-main, .g-body { min-width: 0; max-width: 100%; }

body.txt-lg { font-size: 16.5px; }
body.txt-lg .tbl { font-size: 14.5px; }
body.txt-lg .card-title { font-size: 18px; }

body.theme-dark {
  --bg: #08121B;
  --card: #0F1E2B;
  --surface: #0F1E2B;
  --surface-soft: #132A3A;
  --navy: #E2F1EC;
  --text: #E2F1EC;
  --muted: #94B0A8;
  --border: #1F394A;
  --teal: #14B8A6;
  --teal-dark: #0D9488;
}
body.theme-dark .topbar,
body.theme-dark .pub-nav,
body.theme-dark .card,
body.theme-dark .room-card,
body.theme-dark .bench-box,
body.theme-dark .seat-chip,
body.theme-dark .modal-card,
body.theme-dark .app-drawer-sheet,
body.theme-dark .bottom-nav {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
body.theme-dark .bench-box,
body.theme-dark .stage-bg {
  background: #0B1620;
}
body.theme-dark input,
body.theme-dark select,
body.theme-dark textarea {
  background: #0A1620;
  color: var(--text);
  border-color: #274457;
}
body.theme-dark .tbl th {
  background: #132A3A;
  color: #CCFBF1;
}
body.theme-dark .subtab {
  background: #132A3A;
  color: #E2F1EC;
  border-color: #254558;
}
body.theme-dark .subtab.active {
  background: #0F766E;
  color: #FFFFFF;
}
body.theme-dark .btn-sec {
  background: #132A3A;
  color: #E2F1EC;
  border-color: #254558;
}
/* Print cards always remain ink-on-white regardless of dark mode */
body.theme-dark .id-canvas,
body.theme-dark .doc-page,
body.theme-dark .admit-card,
body.theme-dark #printRoot,
body.theme-dark .thermal-80 {
  background: #FFFFFF !important;
  color: #0F172A !important;
}
body.theme-dark .id-canvas *,
body.theme-dark .doc-page *,
body.theme-dark .admit-card *,
body.theme-dark #printRoot *,
body.theme-dark .thermal-80 * {
  color: inherit;
}

.pub-nav {
  background: rgba(255, 255, 255, 0.90);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
}
body.theme-dark .pub-nav { background: rgba(15, 30, 43, 0.92); }
.topbar { backdrop-filter: blur(10px); }
.card { transition: transform 0.2s ease, box-shadow 0.2s ease; min-width: 0; }

/* Spring animations */
@keyframes riseFade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes springSway {
  0%, 100% { transform: rotate(-1.6deg) translateY(0px); }
  50% { transform: rotate(1.6deg) translateY(-4px); }
}
@keyframes springFloat {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}
@keyframes tickerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes ringDraw {
  from { stroke-dashoffset: 251; }
}
.anim-rise { animation: riseFade 0.36s cubic-bezier(0.22, 1, 0.36, 1) both; }
.spring-sway { transform-origin: 50% 90%; animation: springSway 5.5s ease-in-out infinite; }
.spring-float { animation: springFloat 4.8s ease-in-out infinite; }
.ring-anim { animation: ringDraw 0.9s cubic-bezier(0.22, 1, 0.36, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .anim-rise, .spring-sway, .spring-float, .ring-anim { animation: none !important; }
}
body.reduce-motion .anim-rise,
body.reduce-motion .spring-sway,
body.reduce-motion .spring-float,
body.reduce-motion .ring-anim { animation: none !important; }

/* Public site Spring hero, ticker, seat capacity & teachers grid */
.pub-hero-stage {
  background: linear-gradient(135deg, #0B253A 0%, #0F766E 54%, #10B981 100%);
  border-radius: 20px;
  padding: 26px;
  color: #FFFFFF;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
  box-shadow: 0 18px 40px rgba(11, 37, 58, 0.18);
}
.pub-hero-stage h2 {
  color: #FFFFFF;
  margin: 0 0 8px;
  font-size: clamp(21px, 3vw, 31px);
  line-height: 1.28;
}
.pub-hero-stage p {
  color: #E6FFFA;
  margin: 0 0 14px;
  line-height: 1.6;
}
.spring-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #FEF3C7;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.notice-ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid #D97706;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 16px;
  overflow: hidden;
}
.notice-ticker-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #D97706;
  flex-shrink: 0;
  animation: tickerPulse 1.6s infinite;
}
.notice-ticker-text {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-bar-bg {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
  margin-top: 6px;
}
body.theme-dark .seat-bar-bg { background: #1E3647; }
.seat-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0F766E, #10B981);
  transition: width 0.5s ease;
}
.teacher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 12px;
}
.teacher-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-soft);
}
.teacher-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0F766E, #0B253A);
  color: #FFFFFF;
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* EdTech Smart Insights & Analytics Widgets */
.insight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.insight-item.warn { border-left: 4px solid #D97706; }
.insight-item.err { border-left: 4px solid #DC2626; }
.insight-item.ok { border-left: 4px solid #059669; }

.qr-video-box {
  width: 100%;
  max-height: 240px;
  border-radius: 12px;
  background: #0F172A;
  object-fit: cover;
  border: 2px solid #10B981;
}
.routine-matrix th, .routine-matrix td {
  min-width: 115px;
  vertical-align: top;
}
.routine-slot {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 4px;
  font-size: 12px;
}

/* Mobile App Persistent Bottom Nav + Drawer */
.bottom-nav { display: none; }
.bnav-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  min-width: 0;
}
.bnav-btn .bnav-ico { font-size: 18px; line-height: 1.1; }
.bnav-btn.active { color: var(--teal); font-weight: 700; }
.bnav-btn.active .bnav-ico { transform: translateY(-1px); }

.app-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 58, 0.56);
  z-index: 140;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.app-drawer-backdrop.open { display: flex; }
.app-drawer-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 82vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.28);
  animation: riseFade 0.2s ease both;
}
.app-launcher-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.app-tile {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.app-tile.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.22);
}
.app-tile-ico { font-size: 22px; }

/* Mobile-First Responsive Breakpoint (<= 860px) */
@media (max-width: 860px) {
  .pub-hero-stage { grid-template-columns: 1fr; padding: 18px 16px; }
  .pub-nav { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .pub-links .subtab, .pub-links #btnShowLoginSection { display: none; }
  .pub-nav .pub-brand { flex: 1; min-width: 0; }
  .g-header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .topbar { padding: 10px 12px; }
  .topbar-title { font-size: 15.5px; }
  .content, .pub-main, .g-body {
    padding: 12px 10px calc(86px + env(safe-area-inset-bottom));
  }
  .pub-footer { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 95;
    background: var(--card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -6px 24px rgba(11, 37, 58, 0.10);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 20px 20px 0 0;
    padding: 18px 14px calc(20px + env(safe-area-inset-bottom));
    animation: riseFade 0.22s ease both;
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-width: none;
    text-align: center;
  }
  .app-launcher-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .app-launcher-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bnav-btn { font-size: 10px; }
}

@media print {
  body { background: #FFFFFF !important; margin: 0 !important; padding: 0 !important; }
  #loginView, #publicPortalView, #guardianShell, #appShell, #modalHost, #appDrawerHost, .bottom-nav, #toastEl { display: none !important; }
  #printRoot { display: block !important; width: 100%; }
  .thermal-80 { border: none; width: 78mm; }
  .pvc-page {
    display: flex;
    align-items: center;
    justify-content: center;
    page-break-after: always;
    break-after: page;
  }
  .pvc-page:last-child { page-break-after: auto; break-after: auto; }
  .pvc-page .id-canvas { box-shadow: none !important; border: none !important; border-radius: 0 !important; }
  .pvc-page .id-canvas.portrait { width: 54mm; height: 85.6mm; }
  .pvc-page .id-canvas.landscape { width: 85.6mm; height: 54mm; }
}
