/* ============================================================================
   LEP Secondary School portal - styles
   Navy + gold, system fonts, mobile-first (most parents will use a phone).
   ========================================================================== */
:root {
  --navy-950: #081a33; --navy-900: #0b2447; --navy-800: #10305c; --navy-700: #164077;
  --navy-600: #1c4f93; --navy-100: #e6edf7; --navy-50: #f0f4fa;
  --gold: #c99a2e; --gold-dark: #a97d17; --gold-soft: #fbf3dd;
  --bg: #f3f5f9; --surface: #ffffff; --text: #1b2333; --muted: #5d6879;
  --line: #e1e6ee; --line-strong: #cfd6e2;
  --ok: #17703f; --ok-bg: #e3f4eb; --warn: #8a5a00; --warn-bg: #fdf0d0;
  --bad: #b42318; --bad-bg: #fde8e6; --info: #1c56a0; --info-bg: #e4eefb;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 32, 64, .06), 0 6px 20px rgba(16, 32, 64, .06);
  --sidebar: 256px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
a { color: var(--navy-600); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 28px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }
.ic { flex: none; vertical-align: -3px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: .92em; }

/* ------------------------------------------------------------- app shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950)); color: #cfd9ea; transition: transform .2s ease;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 14px; text-decoration: none; }
.brand img { width: 44px; height: 44px; flex: none; }
.brand b { display: block; color: #fff; font-size: .95rem; line-height: 1.2; }
.brand small { color: #9fb0cc; font-size: .78rem; }
.nav { padding: 8px 10px; overflow-y: auto; flex: 1; }
.nav a {
  display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-bottom: 2px; border-radius: 10px;
  color: #cfd9ea; text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(201, 154, 46, .18); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav .nav-label { padding: 14px 12px 4px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #7f92b3; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .78rem; color: #8fa2c2; }
.scrim { display: none; }

.main { margin-left: var(--sidebar); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 24px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.topbar .grow { flex: 1; }
.icon-btn.menu-btn { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--gold-soft); color: #7a5a0c; font-size: .8rem; font-weight: 600; }
.userbtn { display: flex; align-items: center; gap: 10px; background: none; border: 0; cursor: pointer; padding: 4px 6px; border-radius: 10px; color: inherit; font: inherit; }
.userbtn:hover { background: var(--navy-50); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-700); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.usermeta { text-align: left; line-height: 1.2; }
.usermeta b { display: block; font-size: .88rem; }
.usermeta span { font-size: .75rem; color: var(--muted); text-transform: capitalize; }
.menu-pop {
  position: absolute; right: 16px; top: 56px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  min-width: 210px; padding: 6px; z-index: 60;
}
.menu-pop button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.menu-pop button:hover { background: var(--navy-50); }

.page { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 26, 51, .5); z-index: 35; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-flex; }
  .page { padding: 16px; }
  .topbar { padding: 8px 12px; }
  .usermeta { display: none; }
  h1 { font-size: 1.35rem; }
}

/* ------------------------------------------------------------- components */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1.02rem; }
.card + .card { margin-top: 18px; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .value { font-size: 1.5rem; }
}

.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.9rem; font-weight: 700; color: var(--navy-800); line-height: 1.2; margin-top: 4px; }
.stat .hint { color: var(--muted); font-size: .82rem; }
.stat.warn { border-color: #f0d38a; background: #fffaf0; } .stat.warn .value { color: var(--warn); }
.stat.bad { border-color: #f3b8b2; background: #fff6f5; } .stat.bad .value { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .nav a:focus-visible { outline: 3px solid rgba(28, 79, 147, .35); outline-offset: 1px; }
.btn-primary { background: var(--navy-700); color: #fff; } .btn-primary:hover { background: var(--navy-800); }
.btn-gold { background: var(--gold); color: #2b1f00; } .btn-gold:hover { background: var(--gold-dark); color: #fff; }
.btn-outline { background: #fff; color: var(--navy-700); border-color: var(--line-strong); } .btn-outline:hover { background: var(--navy-50); border-color: var(--navy-600); }
.btn-danger { background: #fff; color: var(--bad); border-color: #efb4ae; } .btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { background: transparent; color: var(--navy-700); } .btn-ghost:hover { background: var(--navy-50); }
.btn-sm { padding: 5px 10px; font-size: .84rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--navy-50); color: var(--navy-700); }

label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 5px; }
label .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-600); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--navy-700); }
.field { margin-bottom: 14px; }
.field .hint { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; margin-bottom: 10px; cursor: pointer; }
.check input { margin-top: 2px; }
.form-error { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; }
.notice { border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-size: .92rem; }
.notice.info { background: var(--info-bg); color: #163f73; } .notice.warn { background: var(--warn-bg); color: #6d4700; }
.notice.ok { background: var(--ok-bg); color: #10532e; } .notice.bad { background: var(--bad-bg); color: #8a1a10; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; }
.filters .grow { flex: 1; min-width: 200px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; background: var(--navy-50); white-space: nowrap; }
td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--muted); font-size: .8rem; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
td input[type=number] { width: 84px; padding: 6px 8px; text-align: right; }
td input.bad { border-color: var(--bad); background: var(--bad-bg); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.badge.gray { background: #eceff4; color: #445064; } .badge.green { background: var(--ok-bg); color: var(--ok); }
.badge.red { background: var(--bad-bg); color: var(--bad); } .badge.amber { background: var(--warn-bg); color: var(--warn); }
.badge.blue { background: var(--info-bg); color: var(--info); } .badge.navy { background: var(--navy-100); color: var(--navy-700); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { background: none; border: 0; font: inherit; font-weight: 600; color: var(--muted); padding: 10px 14px; cursor: pointer; text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--navy-700); }
.tabs a.active, .tabs button.active { color: var(--navy-700); border-bottom-color: var(--gold); }

.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 1rem; margin-bottom: 4px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 46px; color: var(--muted); }
.spin { width: 18px; height: 18px; border: 3px solid var(--line-strong); border-top-color: var(--navy-600); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; }
.ann { padding: 14px 0; border-top: 1px solid var(--line); }
.ann:first-child { border-top: 0; }
.ann h3 { margin-bottom: 2px; }
.ann p { white-space: pre-wrap; margin: 6px 0 0; }

/* modals & toasts */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(8, 26, 51, .55); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 5vh 14px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 900px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(92vw, 380px); }
.toast { background: var(--navy-900); color: #fff; padding: 11px 15px; border-radius: 10px; box-shadow: var(--shadow); animation: pop .2s ease; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.secret { background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: 10px; padding: 12px 14px; font-size: 1.15rem; letter-spacing: .04em; text-align: center; margin: 10px 0; user-select: all; }

/* charts */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar { width: 100%; max-width: 64px; background: linear-gradient(180deg, var(--navy-600), var(--navy-800)); border-radius: 8px 8px 0 0; min-height: 4px; }
.bar-val { font-weight: 700; font-size: .85rem; margin-bottom: 4px; }
.bar-label { font-size: .72rem; color: var(--muted); margin-top: 6px; text-align: center; line-height: 1.2; }
.meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--navy-600); }

/* ------------------------------------------------------------- exam taking */
.exam-bar { position: sticky; top: 56px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 700; }
.timer.low { color: #ffb4a8; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.exam-layout { display: grid; grid-template-columns: 1fr 220px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .exam-layout { grid-template-columns: 1fr; } .qnav-card { order: -1; } .exam-bar { top: 52px; } }
.q-card { padding: 20px; }
.q-card + .q-card { margin-top: 16px; }
.q-num { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.q-prompt { font-size: 1.05rem; margin-bottom: 14px; white-space: pre-wrap; }
.opt { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; margin-bottom: 8px; cursor: pointer; font-weight: 500; }
.opt:hover { background: var(--navy-50); }
.opt.picked { border-color: var(--navy-600); background: var(--info-bg); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); } .opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qnav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qnav button { display: grid; place-items: center; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; cursor: pointer; font: inherit; font-weight: 600; color: var(--muted); font-size: .85rem; }
.qnav button.done { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.save-state { font-size: .8rem; color: #b8c7e0; }

/* ------------------------------------------------------------ report card */
.report { background: #fff; border: 1px solid var(--line-strong); border-radius: 6px; padding: 32px 36px; max-width: 900px; margin: 0 auto; box-shadow: var(--shadow); }
.report-head { text-align: center; border-bottom: 3px double var(--navy-800); padding-bottom: 14px; margin-bottom: 18px; }
.report-head img { width: 70px; height: 70px; }
.report-head h2 { font-size: 1.4rem; color: var(--navy-800); text-transform: uppercase; letter-spacing: .03em; margin-top: 6px; }
.report-head p { margin: 2px 0; color: var(--muted); font-size: .9rem; }
.report-title { text-align: center; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin: 8px 0 16px; color: var(--navy-700); }
.report dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 24px; margin: 0 0 18px; }
.report dl div { display: flex; gap: 8px; border-bottom: 1px dotted var(--line-strong); padding: 3px 0; }
.report dt { color: var(--muted); min-width: 110px; } .report dd { margin: 0; font-weight: 600; }
.report table th { background: var(--navy-800); color: #fff; }
.report table td { padding: 8px 12px; }
.report .summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
.report .summary div { border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px; text-align: center; }
.report .summary b { display: block; font-size: 1.3rem; color: var(--navy-800); }
.report .summary span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.report .comment { border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px 14px; min-height: 64px; }
.report .sign { display: flex; justify-content: space-between; gap: 30px; margin-top: 34px; font-size: .85rem; color: var(--muted); }
.report .sign div { flex: 1; border-top: 1px solid var(--muted); padding-top: 4px; text-align: center; }
.scale { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); margin-top: 14px; }
@media (max-width: 640px) {
  .report { padding: 18px 14px; } .report dl { grid-template-columns: 1fr; } .report .summary { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .toasts, .scrim { display: none !important; }
  .main { margin: 0; } .page { padding: 0; max-width: none; }
  .report { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .report table th { background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; }
  .print-only { display: block !important; }
  .slip { break-inside: avoid; }
}
.print-only { display: none; }
.slips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.slip { border: 1px dashed #777; border-radius: 8px; padding: 12px 14px; font-size: .9rem; }
.slip h4 { margin-bottom: 6px; }

/* ------------------------------------------------------- login / landing */
body.landing { background: #fff; }
.land-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 6vw; }
.land-top .brand { padding: 0; }
.land-top .brand b { color: var(--navy-900); } .land-top .brand small { color: var(--muted); }
.hero { background: radial-gradient(1200px 500px at 85% -10%, rgba(201, 154, 46, .25), transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-700)); color: #fff; }
.hero-in { max-width: 1160px; margin: 0 auto; padding: 56px 6vw 70px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: #f0c964; }
.hero p.lead { font-size: 1.1rem; color: #cfdcf2; max-width: 520px; margin-top: 14px; }
.hero .pill { display: inline-block; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; margin-bottom: 16px; }
.login-card { background: #fff; color: var(--text); border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.login-card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.login-card .foot { margin-top: 14px; font-size: .84rem; color: var(--muted); text-align: center; }
.roles { max-width: 1160px; margin: 0 auto; padding: 54px 6vw; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.role-tile { border: 1px solid var(--line); border-radius: 14px; padding: 20px; background: #fff; }
.role-tile .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--navy-100); color: var(--navy-700); display: grid; place-items: center; margin-bottom: 12px; }
.role-tile h3 { margin-bottom: 6px; } .role-tile p { color: var(--muted); font-size: .92rem; margin: 0; }
.land-foot { background: var(--navy-950); color: #9fb0cc; padding: 26px 6vw; text-align: center; font-size: .88rem; }
@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; gap: 30px; padding: 34px 6vw 44px; }
  .roles { grid-template-columns: repeat(2, 1fr); padding: 34px 6vw; }
}
@media (max-width: 520px) { .roles { grid-template-columns: 1fr; } }
.center-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); }
.center-page .login-card { width: 100%; max-width: 440px; }

/* ------------------------------------------------------------ sign-up page */
.signup-wrap { background: linear-gradient(160deg, var(--navy-900), var(--navy-700)); padding: 36px 16px 60px; min-height: 70vh; display: flex; justify-content: center; align-items: flex-start; }
.signup-wrap .login-card { width: 100%; max-width: 620px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 18px; }
.seg-opt { margin: 0; cursor: pointer; position: relative; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: block; text-align: center; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; font-weight: 600; color: var(--muted); }
.seg-opt input:checked + span { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }
.seg-opt input:focus-visible + span { outline: 3px solid rgba(28, 79, 147, .35); outline-offset: 1px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.login-card .link-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; font-size: .92rem; }

/* ------------------------------------------------ administrator portal theme
   Graphite and wine instead of the school portal's navy, so it is always obvious which door you are in. */
body.theme-admin {
  --navy-950: #0d1017; --navy-900: #171b26; --navy-800: #4a1420; --navy-700: #7a1d2e; --navy-600: #9a2b40;
  --navy-100: #f4e4e8; --navy-50: #faf2f4;
  --gold: #e0a93c; --gold-soft: #fbf0d8;
  --bg: #f1f2f5;
}
body.theme-admin .topbar { border-bottom: 3px solid var(--navy-700); }
body.theme-admin .nav a.active { background: rgba(224, 169, 60, .16); box-shadow: inset 3px 0 0 var(--gold); }
body.theme-admin .report { --navy-800: #10305c; --navy-700: #164077; --navy-600: #1c4f93; }
.admin-tag { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 6px; background: var(--navy-700); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; vertical-align: middle; }
.foot-link { color: #9fb0cc; }

body.admin-landing { background: radial-gradient(900px 500px at 15% -10%, rgba(154, 43, 64, .35), transparent 60%), linear-gradient(160deg, #0d1017, #1b2030); min-height: 100vh; }
.admin-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 30px 28px 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); border-top: 5px solid var(--navy-700); }
.gate-card .gate-head { text-align: center; margin-bottom: 18px; }
.gate-card .gate-head img { width: 64px; height: 64px; }
.gate-card h1 { font-size: 1.35rem; margin-top: 8px; }
.gate-card .gate-sub { color: var(--muted); font-size: .9rem; }
.gate-card .foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); text-align: center; }

/* ============================================================================
   Design refresh: a polish layer over the base styles above.
   ========================================================================== */
:root {
  --line: #e4e8ef;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 64, .05);
  --shadow: 0 1px 2px rgba(16, 32, 64, .04), 0 4px 14px rgba(16, 32, 64, .06);
  --shadow-lg: 0 12px 32px rgba(16, 32, 64, .12), 0 2px 6px rgba(16, 32, 64, .05);
}
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.page { animation: pageIn .28s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* sidebar */
.brand { padding: 20px 18px 18px; border-bottom: 1px solid rgba(255, 255, 255, .07); margin-bottom: 6px; }
.brand img { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.nav a { padding: 9px 12px; font-size: .93rem; transition: background .15s, color .15s; }
.nav a .ic { opacity: .75; }
.nav a.active .ic, .nav a:hover .ic { opacity: 1; }
.nav a.active { background: linear-gradient(90deg, rgba(201, 154, 46, .24), rgba(201, 154, 46, .05)); }
.side-user { display: flex; align-items: center; gap: 10px; margin: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .06); }
.side-user .avatar { background: var(--gold); color: #2b1f00; box-shadow: none; }
.side-user .grow { flex: 1; min-width: 0; }
.side-user b { display: block; color: #fff; font-size: .85rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user small { color: #9fb0cc; font-size: .74rem; }
.side-user .icon-btn { color: #9fb0cc; }
.side-user .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }

/* top bar */
.topbar { min-height: 60px; box-shadow: var(--shadow-sm); }
.avatar { background: linear-gradient(135deg, var(--navy-600), var(--navy-800)); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line); }

/* welcome banner */
.welcome {
  position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap;
  padding: 26px 28px; margin-bottom: 22px; border-radius: 18px; color: #fff; box-shadow: var(--shadow-lg);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(240, 201, 100, .26), transparent 70%),
    radial-gradient(300px 300px at 80% 130%, rgba(255, 255, 255, .08), transparent 70%),
    linear-gradient(135deg, var(--navy-900), var(--navy-700));
}
.welcome::after { content: ""; position: absolute; right: -50px; top: -60px; width: 230px; height: 230px; border-radius: 50%; border: 30px solid rgba(255, 255, 255, .05); pointer-events: none; }
.welcome-text { position: relative; z-index: 1; min-width: 0; }
.welcome h1 { color: #fff; font-size: 1.75rem; }
.welcome p { margin: 6px 0 0; color: rgba(255, 255, 255, .78); }
.welcome-date { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 600; color: #f0c964; margin-bottom: 8px; }
.welcome-actions { display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.welcome .btn-primary { background: var(--gold); color: #2b1f00; box-shadow: none; }
.welcome .btn-primary:hover { background: #e2b448; color: #2b1f00; }
.welcome .btn-outline { background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(255, 255, 255, .28); }
.welcome .btn-outline:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .5); }

/* stat tiles */
.stat { position: relative; padding: 18px 20px; transition: transform .15s, box-shadow .15s; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat .label { font-size: .74rem; letter-spacing: .06em; padding-right: 46px; }
.stat .value { font-size: 1.9rem; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat-ico { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); }
.stats > .stat:nth-child(5n+2) .stat-ico { background: #fbf0d6; color: #946400; }
.stats > .stat:nth-child(5n+3) .stat-ico { background: #e3f4eb; color: #17703f; }
.stats > .stat:nth-child(5n+4) .stat-ico { background: #e4eefb; color: #1c56a0; }
.stats > .stat:nth-child(5n+5) .stat-ico { background: #f5e6f0; color: #8e2a60; }
.stats > .stat.warn .stat-ico { background: var(--warn-bg); color: var(--warn); }
.stats > .stat.bad .stat-ico { background: var(--bad-bg); color: var(--bad); }

/* cards, lists, empty states */
.card { border-color: var(--line); box-shadow: var(--shadow); }
.card-head { padding: 16px 20px; }
.card-head h2 { font-size: 1rem; font-weight: 700; }
.grid-auto > .card { transition: transform .15s, box-shadow .15s; }
.grid-auto > .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.empty { padding: 40px 20px; }
.empty-ico { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px; background: var(--navy-50); color: var(--navy-600); }
.notice { border: 1px solid transparent; }
.notice.info { border-color: #cfdef4; } .notice.warn { border-color: #f1dca4; } .notice.ok { border-color: #bfe3cf; } .notice.bad { border-color: #f3c1bc; }

/* buttons & forms */
.btn { transition: background .15s, border-color .15s, box-shadow .15s, transform .08s; }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--navy-600), var(--navy-700)); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: linear-gradient(180deg, var(--navy-700), var(--navy-800)); }
.btn-gold { box-shadow: 0 1px 2px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .25); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea { transition: border-color .15s, box-shadow .15s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 4px rgba(28, 79, 147, .12); }
.badge { padding: 3px 10px; letter-spacing: .01em; }

/* tables */
th { background: #f6f8fb; border-bottom: 1px solid var(--line); font-size: .72rem; padding: 11px 16px; }
td { padding: 12px 16px; border-top-color: #eef1f6; }
tbody tr:nth-child(even) td { background: #fbfcfe; }
tbody tr:hover td { background: #f2f5fa; }
.report tbody tr:nth-child(even) td, .report tbody tr:hover td { background: transparent; }

/* tabs & modals */
.tabs a, .tabs button { border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
.tabs a:hover, .tabs button:hover { background: var(--navy-50); }
.modal-backdrop { backdrop-filter: blur(3px); }
.modal { border-radius: 18px; animation: pop .18s ease; }
.modal-head { padding: 18px 22px; }
.modal-body { padding: 22px; }

/* phone bottom bar */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(16, 32, 64, .06);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; min-width: 0; border: 0; background: none;
    font: inherit; font-size: .68rem; font-weight: 600; color: var(--muted); text-decoration: none; border-radius: 10px; cursor: pointer;
  }
  .bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav a.active { color: var(--navy-700); background: var(--navy-50); }
  .main { padding-bottom: 76px; }
  .toasts { bottom: 86px; }
}
@media (max-width: 640px) {
  .welcome { padding: 20px; border-radius: 14px; }
  .welcome h1 { font-size: 1.35rem; }
  .stat-ico { width: 32px; height: 32px; right: 10px; top: 10px; border-radius: 10px; }
  .stat-ico svg { width: 16px; height: 16px; }
  .stat .label { padding-right: 36px; }
}
@media print { .bottom-nav, .welcome { display: none !important; } .main { padding-bottom: 0; } }
@media (prefers-reduced-motion: reduce) {
  .page, .modal, .toast { animation: none; }
  .stat, .btn, .grid-auto > .card, .feature, .role-tile { transition: none; }
  .stat:hover, .grid-auto > .card:hover, .feature:hover, .role-tile:hover { transform: none; }
}

/* ----------------------------------------------------------- landing page */
body.landing { background: #f7f8fb; }
.land-top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); gap: 12px; }
.land-top .brand { border: 0; margin: 0; }
.land-nav { display: flex; gap: 4px; align-items: center; }
.land-nav a { padding: 8px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; }
.land-nav a:hover { background: var(--navy-50); }
.land-nav .btn { margin-left: 6px; color: #fff; }
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%); mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 70%);
}
.hero-in { position: relative; padding-bottom: 96px; }
.hero-points { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 10px; }
.hero-points li { display: flex; gap: 10px; align-items: center; color: #dbe5f5; }
.tick { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(240, 201, 100, .18); color: #f0c964; }
.strip { position: relative; z-index: 2; max-width: 1160px; margin: -44px auto 0; padding: 0 6vw; }
.strip-in { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.strip-in > div { padding: 20px 22px; border-left: 1px solid var(--line); }
.strip-in > div:first-child { border-left: 0; }
.strip b { display: block; font-size: 1.1rem; color: var(--navy-800); }
.strip span { color: var(--muted); font-size: .86rem; }
.section { max-width: 1160px; margin: 0 auto; padding: 68px 6vw 0; scroll-margin-top: 20px; }
#loginCard { scroll-margin-top: 90px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.eyebrow { color: var(--gold-dark); font-weight: 700; font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin-top: 8px; letter-spacing: -.02em; }
.section-head p { color: var(--muted); margin: 10px 0 0; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature, .role-tile, .step { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.feature:hover, .role-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature .ico, .role-tile .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-100); color: var(--navy-700); margin-bottom: 14px; }
.feature:nth-child(3n+2) .ico { background: #fbf0d6; color: #946400; }
.feature:nth-child(3n+3) .ico { background: #e3f4eb; color: #17703f; }
.feature h3 { margin-bottom: 6px; }
.feature p { color: var(--muted); margin: 0; font-size: .93rem; }
.roles { padding: 0; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; counter-reset: step; }
.step::before {
  counter-increment: step; content: counter(step); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--navy-600), var(--navy-800)); color: #fff; font-weight: 700;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--muted); margin: 0; font-size: .93rem; }
.cta { max-width: 1160px; margin: 68px auto 0; padding: 0 6vw; }
.cta-in {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 32px 34px; border-radius: 20px; color: #fff;
  background: radial-gradient(400px 200px at 100% 0%, rgba(240, 201, 100, .25), transparent 70%), linear-gradient(135deg, var(--navy-900), var(--navy-700));
}
.cta-in h2 { color: #fff; font-size: 1.4rem; }
.cta-in p { margin: 6px 0 0; color: rgba(255, 255, 255, .78); }
.cta-in .btn-gold:hover { color: #2b1f00; background: #e2b448; }
.site-foot { margin-top: 68px; background: var(--navy-950); color: #9fb0cc; }
.site-foot-in { max-width: 1160px; margin: 0 auto; padding: 42px 6vw 22px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
.site-foot .brand { padding: 0; border: 0; margin: 0 0 10px; }
.site-foot .brand b { color: #fff; }
.site-foot .brand small { color: #9fb0cc; }
.site-foot p { font-size: .9rem; margin: 0; }
.site-foot h4 { color: #fff; font-size: .9rem; margin-bottom: 10px; }
.site-foot a:not(.brand) { display: block; color: #cfd9ea; text-decoration: none; padding: 3px 0; font-size: .92rem; }
.site-foot a:not(.brand):hover { color: #fff; }
.site-foot-bottom { border-top: 1px solid rgba(255, 255, 255, .08); text-align: center; padding: 16px 6vw; font-size: .82rem; }
@media (max-width: 900px) {
  .land-nav a:not(.btn) { display: none; }
  .strip-in { grid-template-columns: repeat(2, 1fr); }
  .strip-in > div:nth-child(3) { border-left: 0; }
  .strip-in > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .features { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .site-foot-in { grid-template-columns: 1fr 1fr; }
  .site-foot-in > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .features { grid-template-columns: 1fr; }
  .strip-in > div { padding: 16px; }
  .cta-in { padding: 24px; }
  .land-top { padding: 10px 16px; }
  .land-top .brand small { display: none; }
}
