/* =====================================================
   Sterling Heights Academy Portal — styles
   Colours from the school crest (royal blue #0303D3), with
   accent colours for icons and summary cards.
   ===================================================== */
:root {
  --navy: #0A0A5C;        /* sidebar, headings */
  --navy-2: #12127A;      /* sidebar hover */
  --blue: #0B0BC4;        /* the crest's royal blue: primary actions */
  --sky: #EEF0FD;         /* pale tint: working surfaces */
  --sky-line: #D6D9F5;
  --marigold: #F2C14E;
  --marigold-soft: #FFF4D6;
  --ink: #16193A;
  --muted: #5E6283;
  --paper: #FFFFFF;
  --page: #F4F6FC;
  --danger: #D92D20;
  --ok: #12805C;

  /* accent colours for icons and cards */
  --c-blue: #2563EB;   --c-blue-bg: #E3ECFF;
  --c-teal: #0D9488;   --c-teal-bg: #D8F5F1;
  --c-purple: #7C3AED; --c-purple-bg: #EEE5FE;
  --c-amber: #D97706;  --c-amber-bg: #FEF0D7;
  --c-green: #16A34A;  --c-green-bg: #DDF6E6;
  --c-pink: #DB2777;   --c-pink-bg: #FDE3EF;
  --c-sky: #0284C7;    --c-sky-bg: #DDF1FC;
  --green: #22A559; --amber: #F2A93B; --red: #E5484D;

  --radius-s: 8px;
  --radius-m: 14px;
  --shadow: 0 1px 2px rgba(22, 25, 58, 0.05), 0 6px 20px rgba(22, 25, 58, 0.06);

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.2rem;
  --step-2: 1.5rem;
  --step-3: 1.9rem;
  --side-w: 256px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  font-family: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 400; color: var(--ink); background: var(--page); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0; font-weight: 600; }
h1 { font-size: var(--step-3); letter-spacing: -0.01em; }
h2 { font-size: var(--step-1); }
h3 { font-size: var(--step-0); }
p { margin: 0; }
a { color: var(--blue); }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; border-radius: 4px; }
.ico { width: 1.25em; height: 1.25em; flex: none; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* accent colour helpers: coloured glyph on a tinted tile */
.c-blue { color: var(--c-blue); background: var(--c-blue-bg); }
.c-teal { color: var(--c-teal); background: var(--c-teal-bg); }
.c-purple { color: var(--c-purple); background: var(--c-purple-bg); }
.c-amber { color: var(--c-amber); background: var(--c-amber-bg); }
.c-green { color: var(--c-green); background: var(--c-green-bg); }
.c-pink { color: var(--c-pink); background: var(--c-pink-bg); }
.c-sky { color: var(--c-sky); background: var(--c-sky-bg); }

/* ---------- sign-in: the graduation photo behind a see-through blue wash ---------- */
.auth {
  min-height: 100vh;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 470px);
  align-items: center; gap: clamp(1.5rem, 5vw, 5rem);
  padding: clamp(1.25rem, 5vw, 4rem) clamp(1.25rem, 6vw, 6rem);
  background:
    linear-gradient(100deg, rgba(10, 10, 92, 0.62) 0%, rgba(11, 11, 196, 0.30) 42%, rgba(10, 10, 92, 0.10) 70%, rgba(10, 10, 92, 0.18) 100%),
    url("login-bg.jpg") center 30% / cover no-repeat;
  color: #fff;
}
.auth-brand { max-width: 34rem; text-shadow: 0 2px 14px rgba(5, 5, 50, 0.65), 0 1px 3px rgba(5, 5, 50, 0.5); }
.auth-brand .crest-lg { width: clamp(96px, 12vw, 140px); height: auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.35)); }
.auth-brand h1 { color: #fff; font-size: clamp(2.3rem, 5vw, 3.8rem); font-weight: 700; line-height: 1.02; margin-top: 1.5rem; }
.auth-brand h1 span { color: #FFD65C; }
.auth-motto { margin-top: 0.9rem; font-size: var(--step-1); font-style: italic; font-weight: 300; color: #E3E4FF; }
.auth-tag { margin-top: 2.5rem; display: inline-block; padding: 0.45rem 0.9rem; border-radius: 999px;
  background: rgba(10,10,92,.45); backdrop-filter: blur(4px); font-size: var(--step--1); color: #fff; }
.auth-card {
  background: rgba(255,255,255,0.97); color: var(--ink); border-radius: 18px;
  box-shadow: 0 30px 80px rgba(5, 5, 50, 0.45); padding: clamp(1.5rem, 4vw, 2.5rem);
}
.auth-card form { display: grid; gap: 1.05rem; }
.auth-card h2 { font-size: var(--step-2); }
.auth-foot { margin-top: 1.5rem; text-align: center; color: var(--muted); font-size: 0.78rem; }
.center { text-align: center; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--sky); border-radius: 10px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 0.6rem; border-radius: 8px; color: var(--navy); cursor: pointer; font-weight: 500;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; }
.seg button[aria-pressed="true"] { background: var(--paper); box-shadow: var(--shadow); color: var(--blue); }

.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 500; font-size: var(--step--1); color: var(--navy); }
.field input, .field select {
  width: 100%; padding: 0.72rem 0.85rem; border: 1.5px solid var(--sky-line); border-radius: var(--radius-s); background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(11,11,196,.14); }
.input-ico { position: relative; }
.input-ico > .ico { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-ico input { padding-left: 2.6rem; }
.input-ico .peek { position: absolute; right: 0.4rem; top: 50%; transform: translateY(-50%); border: 0; background: none; padding: 0.4rem; color: var(--muted); cursor: pointer; display: flex; }
.hint { font-size: var(--step--1); color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border: 0; border-radius: var(--radius-s); padding: 0.72rem 1.15rem;
  background: var(--blue); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #0808A0; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.secondary { background: var(--sky); color: var(--navy); }
.btn.secondary:hover { background: #E1E4FB; }
.btn.quiet { background: transparent; color: var(--blue); padding: 0.45rem 0.6rem; }
.btn.danger { background: #fff; color: var(--danger); border: 1.5px solid #F2B8B5; }
.btn.small { padding: 0.45rem 0.75rem; font-size: var(--step--1); }

.alert { border-radius: var(--radius-s); padding: 0.75rem 0.9rem; font-size: var(--step--1); }
.alert.error { background: #FEEDEC; color: var(--danger); }
.alert.info { background: var(--c-blue-bg); color: #1D3E9E; }
.alert.warn { background: var(--marigold-soft); color: #7A5200; }

/* ---------- layout: navy sidebar on the left ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(90deg, #08084A 0 var(--side-w), transparent var(--side-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: linear-gradient(180deg, #0A0A5C 0%, #08084A 100%); color: #D9DAF7;
  display: flex; flex-direction: column; padding: 1.1rem 0.8rem; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: #fff; padding: 0.25rem 0.5rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 0.9rem; }
.brand .crest-sm { width: 46px; height: auto; flex: none; }
.brand span { font-weight: 700; letter-spacing: 0.04em; font-size: 0.95rem; line-height: 1.15; }
.brand small { display: block; color: #FFD65C; font-weight: 600; letter-spacing: 0.3em; font-size: 0.72rem; }
.sidebar nav { display: grid; gap: 0.2rem; }
.sidebar nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0.65rem; border-radius: 10px;
  color: #D9DAF7; text-decoration: none; font-size: 0.93rem; font-weight: 500;
}
.sidebar nav a:hover { background: var(--navy-2); color: #fff; }
.sidebar nav a.on { background: #fff; color: var(--navy); box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.nav-ico { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 9px; flex: none; }
.sidebar nav a:not(.on) .nav-ico { background: rgba(255,255,255,.08); }
.sidebar nav a:not(.on) .nav-ico.c-blue { color: #8FB1FF; } .sidebar nav a:not(.on) .nav-ico.c-teal { color: #5EE3D2; }
.sidebar nav a:not(.on) .nav-ico.c-purple { color: #C4A6FF; } .sidebar nav a:not(.on) .nav-ico.c-amber { color: #FFC56B; }
.sidebar nav a:not(.on) .nav-ico.c-green { color: #7EE2A4; } .sidebar nav a:not(.on) .nav-ico.c-pink { color: #FF9CC8; }
.sidebar nav a:not(.on) .nav-ico.c-sky { color: #7DD0FF; }
.side-foot { margin-top: auto; padding: 1rem 0.5rem 0; border-top: 1px solid rgba(255,255,255,.1); font-size: var(--step--1); }
.side-foot small { color: #9FA1D8; }
.side-out { margin-top: 0.9rem; width: 100%; display: flex; align-items: center; gap: 0.6rem; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.08); color: #fff; padding: 0.6rem 0.75rem; cursor: pointer; font-weight: 500; }
.side-out:hover { background: rgba(255,255,255,.16); }
.scrim { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--sky-line);
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
}
.icon-btn { border: 0; background: var(--sky); color: var(--navy); border-radius: 10px; padding: 0.5rem; display: grid; place-items: center; cursor: pointer; }
.menu-btn { display: none; }
.top-term { display: inline-flex; align-items: center; gap: 0.45rem; color: var(--muted); font-size: var(--step--1); }
.me { margin-left: auto; display: flex; align-items: center; gap: 0.7rem; }
.avatar { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 0.9rem;
  background: linear-gradient(135deg, var(--c-blue), var(--c-purple)); color: #fff; flex: none; }
.avatar.big { width: 3rem; height: 3rem; font-size: 1rem; }
.me-name { display: grid; line-height: 1.2; font-weight: 600; color: var(--navy); font-size: 0.92rem; }
.me-name small { font-weight: 400; color: var(--muted); font-size: 0.78rem; }

main { width: 100%; max-width: 1180px; padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2.25rem) 4rem; }

/* ---------- dashboard ---------- */
.greeting { display: grid; gap: 0.4rem; margin-bottom: 1.5rem; }
.greeting p { color: var(--muted); max-width: 64ch; }
.today { display: inline-flex; align-items: center; gap: 0.45rem; margin-top: 0.4rem; width: fit-content;
  background: var(--c-blue-bg); color: #1D3E9E; border-radius: 999px; padding: 0.3rem 0.85rem; font-size: var(--step--1); }
.today.closed { background: var(--marigold-soft); color: #7A5200; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat-card { display: flex; gap: 1rem; align-items: center; background: #fff; border-radius: var(--radius-m); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.stat-ico { width: 3.3rem; height: 3.3rem; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat-ico .ico { width: 1.6rem; height: 1.6rem; }
.stat-label { color: var(--muted); font-size: var(--step--1); }
.stat-value { font-size: 1.85rem; font-weight: 700; color: var(--navy); line-height: 1.15; }
.stat-note { color: var(--muted); font-size: 0.8rem; }

.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.panel { background: #fff; border-radius: var(--radius-m); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.25rem; }
.dash-grid .panel { margin-bottom: 0; }
.panel h2 { margin-bottom: 0.9rem; }
.qa-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.qa { display: grid; justify-items: center; gap: 0.45rem; padding: 0.8rem 0.4rem; border-radius: 12px; text-decoration: none; color: var(--navy);
  font-size: 0.85rem; font-weight: 500; text-align: center; transition: background .15s; }
.qa:hover { background: var(--sky); }
.qa-ico { width: 3rem; height: 3rem; border-radius: 14px; display: grid; place-items: center; }
.qa-ico .ico { width: 1.45rem; height: 1.45rem; }
.qa.small { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.35rem 0.55rem 0.35rem 0.35rem; background: var(--page); }
.qa.small .qa-ico { width: 2rem; height: 2rem; border-radius: 9px; }
.qa.small .qa-ico .ico { width: 1.1rem; height: 1.1rem; }

.class-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.class-cards li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem; padding: 0.8rem; border-radius: 12px; background: var(--page); }
.cc-code { width: 3.2rem; height: 3.2rem; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 0.85rem;
  background: linear-gradient(135deg, var(--blue), var(--c-purple)); flex: none; }
.cc-main { display: grid; gap: 0.2rem; flex: 1 1 200px; min-width: 0; }
.cc-main .sub { color: var(--muted); font-size: var(--step--1); }
.cc-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.mini-list li { display: flex; align-items: center; gap: 0.7rem; }
.mini-ico { width: 2.2rem; height: 2.2rem; border-radius: 10px; display: grid; place-items: center; flex: none; }
.all-clear { display: flex; align-items: center; gap: 0.6rem; color: var(--ok); font-weight: 500; }

.donut-wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.donut > div { width: 96px; height: 96px; border-radius: 50%; background: #fff; display: grid; place-items: center; align-content: center; }
.donut b { font-size: 1.4rem; color: var(--navy); line-height: 1; }
.donut small { color: var(--muted); font-size: 0.72rem; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; min-width: 160px; font-size: var(--step--1); }
.legend li { display: flex; align-items: center; gap: 0.5rem; }
.legend b { margin-left: auto; color: var(--navy); }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.bar { height: 0.7rem; border-radius: 999px; background: var(--sky); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c-teal), var(--c-blue)); }

section.block { margin-top: 2rem; }
section.block > header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.classes { list-style: none; padding: 0; margin: 0; background: #fff; border-radius: var(--radius-m); box-shadow: var(--shadow); overflow: hidden; }
.classes li { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 1rem; align-items: center; padding: 0.85rem 1rem; border-bottom: 1px solid #EEF0F8; }
.classes li:last-child { border-bottom: 0; }
.classes .code { font-weight: 700; color: var(--blue); }
.classes .sub { color: var(--muted); font-size: var(--step--1); }
.classes .count { color: var(--navy); font-weight: 500; font-size: var(--step--1); }
.empty { border: 1.5px dashed var(--sky-line); border-radius: var(--radius-m); padding: 1.25rem; color: var(--muted); background: #fff; }
.next-update { margin-top: 2rem; color: var(--muted); font-size: var(--step--1); max-width: 64ch; }
.stats { display: flex; flex-wrap: wrap; gap: 2.5rem; margin: 0.5rem 0 0; }
.stat b { display: block; font-size: var(--step-3); color: var(--navy); font-weight: 600; line-height: 1.1; }
.stat span { color: var(--muted); font-size: var(--step--1); }

/* status chips: clearer colours */
.chip { display: inline-block; padding: 0.18rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.chip.none { background: #EEF0F5; color: var(--muted); }
.chip.active { background: var(--c-blue-bg); color: #1D3E9E; }
.chip.ok { background: var(--c-green-bg); color: #106B38; }
.chip.pending { background: var(--marigold-soft); color: #7A5200; }
.chip.off { background: #FDE7E6; color: var(--danger); }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 0.7rem 1.1rem; border-radius: var(--radius-s); box-shadow: var(--shadow);
  font-size: var(--step--1); z-index: 60; max-width: calc(100vw - 2rem);
}

/* ---------- accounts table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-bottom: 1rem; }
.toolbar .field { flex: 1 1 260px; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--sky-line); margin: 1.5rem 0 1rem; }
.tabs button {
  border: 0; background: none; padding: 0.6rem 0.9rem; cursor: pointer; color: var(--muted); font-weight: 500;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--blue); }

.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius-m); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th { text-align: left; font-weight: 600; color: var(--navy); background: var(--sky); padding: 0.65rem 0.8rem; white-space: nowrap; }
td { padding: 0.65rem 0.8rem; border-top: 1px solid #EDF2F8; vertical-align: middle; }
td.actions { white-space: nowrap; text-align: right; }
td.staffno { font-variant-numeric: tabular-nums; color: var(--navy); font-weight: 500; white-space: nowrap; }

.chip { display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px; font-size: 0.78rem; font-weight: 500; white-space: nowrap; }
.chip.none { background: #EEF1F5; color: var(--muted); }
.chip.active { background: var(--sky); color: var(--navy); }
.chip.pending { background: var(--marigold-soft); color: #6B4E00; }
.chip.off { background: #F4E3E2; color: var(--danger); }

/* ---------- dialog ---------- */
dialog {
  border: 0; border-radius: var(--radius-m); padding: 0; width: min(440px, calc(100vw - 2rem));
  box-shadow: 0 20px 60px rgba(23,35,58,.3); color: var(--ink);
}
dialog::backdrop { background: rgba(23, 35, 58, 0.45); }
dialog .dlg { padding: 1.5rem; display: grid; gap: 1rem; }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.25rem; }
.secret {
  display: grid; gap: 0.25rem; background: var(--sky); border-radius: var(--radius-s); padding: 0.9rem 1rem;
}
.secret div { display: flex; justify-content: space-between; gap: 1rem; }
.secret span { color: var(--muted); font-size: var(--step--1); }
.secret b { font-size: var(--step-1); color: var(--navy); letter-spacing: 0.02em; }

.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--navy); color: #fff; padding: 0.7rem 1.1rem; border-radius: var(--radius-s); box-shadow: var(--shadow);
  font-size: var(--step--1); z-index: 50;
}

/* ---------- Stage 2: sheets ---------- */
.crumbs { font-size: var(--step--1); color: var(--muted); margin: 0 0 0.75rem; }
.crumbs a { color: var(--blue); text-decoration: none; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.sheet-head h1 { font-size: var(--step-2); }
.datepick { flex: 0 0 auto; }
.tally { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: baseline; margin: 0.75rem 0; color: var(--muted); font-size: var(--step--1); }
.tally b { color: var(--navy); font-size: var(--step-1); font-weight: 600; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.classes li:has(.row-actions) { grid-template-columns: 5.5rem 1fr auto; }
section.block > header a { font-size: var(--step--1); }

/* register rows: one line per learner, like the paper register */
.register { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--navy); background: #fff; }
.reg-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--sky-line); }
.reg-row.changed, tr.changed td, .remarks li.changed { background: var(--marigold-soft); }
.reg-name { min-width: 0; }
.reg-name .sub { color: var(--muted); font-size: 0.8rem; }
.tri { display: inline-grid; grid-auto-flow: column; gap: 3px; background: var(--sky); padding: 3px; border-radius: 8px; flex: none; }
.tri button { border: 0; background: transparent; padding: 0.45rem 0.7rem; border-radius: 6px; cursor: pointer; color: var(--navy); font-weight: 500; min-width: 3rem; }
.tri button[aria-pressed="true"] { background: #fff; box-shadow: var(--shadow); }
.tri button.t-late[aria-pressed="true"] { background: var(--marigold); color: #3F2E00; }
.tri button.t-absent[aria-pressed="true"] { background: var(--danger); color: #fff; }
.tri button[disabled] { opacity: 0.3; cursor: not-allowed; }
.tri.rate button { min-width: 2.6rem; }
.tri.rate button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.chip.st-present { background: var(--sky); color: var(--navy); }
.chip.st-late { background: var(--marigold-soft); color: #6B4E00; }
.chip.st-absent { background: #F4E3E2; color: var(--danger); }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; margin: 1.25rem 0; }
.sheet-actions .grow { flex: 1 1 280px; }
.daylinks { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.daylinks a { text-decoration: none; }

/* mark sheet: learner column stays put while scrolling sideways */
.table-wrap.sheet { max-height: 70vh; overflow: auto; }
table.marks th { text-align: center; position: sticky; top: 0; z-index: 2; }
table.marks th small { font-weight: 400; color: var(--muted); }
table.marks .stick { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 12rem; text-align: left; }
table.marks th.stick { z-index: 3; background: var(--sky); }
table.marks tr.changed .stick { background: var(--marigold-soft); }
table.marks td { padding: 0.3rem 0.35rem; text-align: center; }
input.num { width: 4.2rem; padding: 0.4rem; border: 1.5px solid var(--sky-line); border-radius: 5px; text-align: center; font-variant-numeric: tabular-nums; }
input.num:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(11,11,196,.18); }
input.num[disabled] { background: #F4F6F9; color: var(--muted); }
td.calc { color: var(--muted); font-variant-numeric: tabular-nums; }
td.calc.total { color: var(--navy); font-weight: 600; }

/* rating sheet: learner list beside the panel */
.scale-key { margin-bottom: 0.75rem; }
.rate-layout { display: grid; grid-template-columns: 16rem 1fr; gap: 1.5rem; align-items: start; }
.learner-list { list-style: none; margin: 0; padding: 0; position: sticky; top: 5rem; max-height: 75vh; overflow: auto; background: #fff; border-radius: var(--radius-m); box-shadow: var(--shadow); }
.learner-list button { width: 100%; display: flex; justify-content: space-between; gap: 0.5rem; border: 0; background: none; padding: 0.55rem 0.8rem; text-align: left; cursor: pointer; border-bottom: 1px solid #EDF2F8; color: var(--ink); font-size: var(--step--1); }
.learner-list button[aria-current="true"] { background: var(--sky); color: var(--navy); font-weight: 600; }
.learner-list .sub { color: var(--muted); }
h3.cat { margin: 1.25rem 0 0.4rem; font-size: var(--step-0); }
.fill { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; color: var(--muted); font-size: var(--step--1); margin: 0.5rem 0 0; }

/* remarks */
.remarks { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.remarks li { display: grid; gap: 0.3rem; padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--sky-line); }
.remarks label { font-weight: 500; color: var(--navy); }
.remarks textarea { width: 100%; font: inherit; padding: 0.6rem 0.75rem; border: 1.5px solid var(--sky-line); border-radius: var(--radius-s); resize: vertical; line-height: 1.5; }
.remarks textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(11,11,196,.18); }
.remarks .count { justify-self: end; }
.remarks .count.over { color: var(--danger); }

/* ---------- Stage 3: administrators ---------- */
.requests { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--navy); }
.requests > li { display: flex; gap: 1.25rem; justify-content: space-between; align-items: flex-start; padding: 1rem 0.5rem; border-bottom: 1px solid var(--sky-line); background: #fff; }
.req-main { display: grid; gap: 0.35rem; min-width: 0; }
.req-title { font-weight: 600; color: var(--navy); }
.req-why { font-style: italic; }
.req-changes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; font-size: var(--step--1); }
.req-actions { display: flex; gap: 0.4rem; flex: none; }
.dates-form, .cal-form { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: flex-end; background: #fff; padding: 1rem; border-radius: var(--radius-m); box-shadow: var(--shadow); }
.dates-form .field, .cal-form .field { flex: 1 1 180px; }
.cal-form .field.wide { flex-basis: 100%; }
table.readiness th small { font-weight: 400; color: var(--muted); }
table.readiness td.actions { white-space: nowrap; }
.toolbar .field { max-width: 420px; }
.cal-type { font-size: var(--step--1) !important; }
.cal-type.t-public_holiday { color: var(--blue); }
.cal-type.t-mid_term_break { color: #8A6100; }
.cal-type.t-school_closure { color: var(--danger); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .classes li { grid-template-columns: 4.5rem 1fr; }
  .classes .count { grid-column: 2; }
  table.stack thead { display: none; }
  table.stack tr { display: grid; grid-template-columns: 1fr auto; padding: 0.6rem 0.4rem; border-top: 1px solid #EDF2F8; }
  table.stack td { border: 0; padding: 0.15rem 0.4rem; }
  table.stack td.actions { grid-column: 1 / -1; text-align: left; padding-top: 0.5rem; }
  .classes li:has(.row-actions) { grid-template-columns: 4.5rem 1fr; }
  .row-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .rate-layout { grid-template-columns: 1fr; }
  .learner-list { position: static; max-height: 12rem; }
  .reg-row { flex-wrap: wrap; }
  .tri button { padding: 0.55rem 0.6rem; }
  .requests > li { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- tablets and phones: sidebar slides in from the left ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(82vw, 290px); transform: translateX(-105%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(8, 8, 50, .45); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 25; }
  .scrim.open { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .dash-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; align-content: start; }
  .auth-brand { text-align: center; margin: 0 auto; }
  .auth-brand h1 { margin-top: 0.9rem; }
  .auth-tag { margin-top: 1rem; }
}
@media (max-width: 560px) {
  .top-term { display: none; }
  .me-name { display: none; }
  .qa-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .stat-card { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding: 0.9rem; }
  .stat-ico { width: 2.6rem; height: 2.6rem; }
  .stat-value { font-size: 1.45rem; }
}

/* ---------- number guard ---------- */
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
input.shake { animation: shake .3s; border-color: var(--danger) !important; }

/* ---------- fees and announcements ---------- */
.finder .input-ico input { width: 100%; border: 1.5px solid var(--sky-line); border-radius: var(--radius-s); font-size: 1.02rem; padding-top: .85rem; padding-bottom: .85rem; }
.finder-results { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .4rem; }
.finder-results li { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .7rem .8rem; border-radius: 12px; background: var(--page); }
.finder-bal { font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.finder-bal.owe { color: #9A5B00; } .finder-bal.ok { color: var(--ok); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .9rem; }
.panel-head h2 { margin: 0; }
.arr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.arr-grid > div { display: grid; gap: .2rem; align-content: start; }
.rules-grid { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; margin-bottom: .6rem; }
.rules-grid .field { flex: 0 1 230px; }
.pay-line small.hand { color: var(--muted); }
.check.wide { grid-column: 1 / -1; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-value.money { font-size: 1.35rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: var(--step--1); color: var(--navy); cursor: pointer; }
.toolbar .check { align-self: flex-end; padding-bottom: 0.7rem; }
tr.total-row td { background: var(--sky); }
.class-cards li.voided { opacity: 0.65; }
input.num.wide { width: 6.5rem; }
table.fee-grid td { padding: 0.35rem; }
dialog.wide-dialog { width: min(640px, calc(100vw - 2rem)); }
.pay-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.pay-grid .wide { grid-column: 1 / -1; }
.pay-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; max-height: 46vh; overflow: auto; padding: 0.25rem; }
.pay-line { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: var(--step--1); color: var(--navy); }
.pay-line small { display: block; color: var(--c-amber); font-size: 0.75rem; }
.pay-total { text-align: right; font-size: var(--step-1); color: var(--navy); }
textarea.ta { width: 100%; font: inherit; padding: 0.6rem 0.75rem; border: 1.5px solid var(--sky-line); border-radius: var(--radius-s); resize: vertical; }
.ann-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.ann-list li { display: flex; gap: 1rem; align-items: flex-start; background: #fff; border-radius: var(--radius-m); padding: 1rem 1.2rem; box-shadow: var(--shadow); }
.ann-list li.pinned { border-left: 4px solid var(--c-amber); }
.ann-list li.not-live { opacity: 0.6; }
.ann-ico { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; flex: none; }
.ann-main { flex: 1; min-width: 0; display: grid; gap: 0.3rem; }
.ann-meta { color: var(--muted); font-size: 0.82rem; }
.ann-body { white-space: normal; }
.receipt { position: relative; width: 148mm; min-height: 150mm; background: #fff; padding: 10mm 11mm; box-shadow: 0 6px 30px rgba(22,25,58,.14); overflow: hidden; font-size: 10.5pt; color: #111; }
.receipt header { display: flex; gap: 5mm; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: 3mm; }
.receipt header img { width: 20mm; }
.receipt header h2 { color: var(--navy); font-size: 13pt; }
.receipt header p { font-size: 8.5pt; color: #444; }
.receipt-title { display: flex; justify-content: space-between; align-items: center; margin: 4mm 0; font-weight: 700; color: var(--navy); }
.receipt-title span { letter-spacing: .12em; }
.receipt-info { width: 100%; border-collapse: collapse; margin-bottom: 4mm; }
.receipt-info th { text-align: left; font-weight: 500; color: #555; width: 34%; padding: 1.2mm 0; }
.receipt-info td { padding: 1.2mm 0; font-weight: 600; }
.receipt-lines { width: 100%; border-collapse: collapse; }
.receipt-lines th, .receipt-lines td { padding: 1.8mm 2mm; border-bottom: 1px solid #E3E5EE; text-align: left; }
.receipt-lines th:last-child, .receipt-lines td:last-child { text-align: right; }
.receipt-lines thead th { background: var(--sky); color: var(--navy); }
.receipt-lines tfoot th { font-size: 12pt; color: var(--navy); border-bottom: 2px solid var(--navy); }
.receipt-lines tfoot td { color: #555; font-size: 9pt; }
.receipt footer { display: flex; justify-content: space-between; margin-top: 8mm; font-size: 9pt; color: #555; }
@media print { .receipt { box-shadow: none; margin: 10mm auto; } }
@media (max-width: 560px) { .pay-grid, .pay-lines { grid-template-columns: 1fr; } }

/* =====================================================
   REPORT CARDS: A4 pages, on screen and in print
   ===================================================== */
.rc-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.rc-toolbar h1 { font-size: var(--step-2); }
.rc-tools { display: flex; gap: 0.5rem; }
#cards { display: grid; gap: 1.5rem; justify-content: center; }
.rc-page {
  --rc-blue: #0B0BC4; --rc-navy: #0A0A5C; --rc-head: #D5DAF8; --rc-cell: #EEF0FD; --rc-line: #B9C1F2;
  position: relative; width: 210mm; min-height: 297mm; padding: 14mm 15mm 16mm; background: #fff;
  box-shadow: 0 6px 30px rgba(22,25,58,.14); color: #111; font-size: 10.5pt; line-height: 1.35; overflow: hidden;
  display: flex; flex-direction: column;
}
.rc-page h1, .rc-page h2, .rc-page h3 { color: #111; }
.rc-draft { position: absolute; inset: 0; display: grid; place-items: center; font-size: 110pt; font-weight: 700; color: rgba(11,11,196,.06);
  transform: rotate(-30deg); pointer-events: none; letter-spacing: .1em; }
.rc-pno { margin-top: auto; padding-top: 6mm; text-align: center; font-weight: 600; font-size: 9.5pt; }

.rc-head { display: flex; align-items: center; gap: 6mm; }
.rc-head.cover { justify-content: center; text-align: center; }
.rc-crest { width: 30mm; height: auto; }
.rc-school { flex: 1; text-align: center; }
.rc-school h1 { font-size: 20pt; font-weight: 700; letter-spacing: .02em; }
.rc-contact { display: flex; justify-content: center; gap: 10mm; color: var(--rc-blue); font-size: 9.5pt; margin-top: 1mm; }
.rc-title { border-top: 1.5px solid #7FA8E8; border-bottom: 3px double #7FA8E8; margin: 4mm 0 2mm; padding: 1.5mm 0; text-align: center; }
.rc-title h2 { font-size: 13pt; font-weight: 700; }
.rc-year { text-align: center; margin-bottom: 4mm; }
.rc-cover-crest { display: block; width: 62mm; margin: 6mm auto 8mm; }

table.rc-info { width: 100%; border-collapse: collapse; border: 1px solid var(--rc-line); margin-bottom: 3mm; }
.rc-info th { text-align: left; font-weight: 600; padding: 1.6mm 3mm; width: 26%; }
.rc-info td { padding: 1.6mm 3mm; }
.rc-info tr.rc-name { background: var(--rc-head); }
.rc-info tr.rc-name td { text-align: center; font-weight: 700; font-size: 12pt; }

table.rc-scores { width: 100%; border-collapse: separate; border-spacing: 1.2mm; margin: 2mm -1.2mm; font-size: 11pt; }
.rc-scores th { font-weight: 500; font-size: 9.5pt; text-align: center; padding: 1mm; }
.rc-scores th:first-child { text-align: left; }
.rc-scores td { padding: 2mm 2.5mm; }
.rc-scores td.rc-subj { border-bottom: 1.5px solid var(--rc-line); }
.rc-scores td.num { background: var(--rc-cell); text-align: center; }
.rc-scores td.strong { font-weight: 700; }
.rc-scores td.rated { text-align: center; font-weight: 700; border: 1px solid var(--rc-line); }
.rc-scores tr.rc-agg td { background: #F1F2F6; font-size: 11pt; }
.rc-scores tr.rc-agg td:first-child { text-align: center; }

.rc-key { display: flex; gap: 4mm; font-size: 8.5pt; margin-top: 2mm; border-top: 1px solid var(--rc-line); padding-top: 2mm; }
.rc-key > b { font-style: italic; white-space: nowrap; }
.rc-key-grid { display: grid; grid-template-columns: repeat(3, auto auto); column-gap: 4mm; row-gap: 1mm; }
.rc-wkey { display: flex; gap: 5mm; font-size: 8.5pt; margin-top: 3mm; }
.rc-wkey p { margin: 0 0 .5mm; }
.rc-note { font-size: 8.5pt; margin-top: 3mm; }
.rc-remarks { display: grid; grid-template-columns: 30mm 1fr; gap: 3mm; margin-top: 4mm; border: 1px solid var(--rc-line); padding: 3mm; }
.rc-remarks b { font-weight: 600; }
.rc-remarks p { text-align: center; }

.rc-band { background: var(--rc-navy); color: #fff; text-align: center; font-weight: 600; padding: 1.2mm; margin: 2mm auto 3mm; width: 110mm; }
table.rc-analysis { border-collapse: collapse; margin: 0 auto 4mm; width: 110mm; }
.rc-analysis th, .rc-analysis td { border: 1px solid var(--rc-line); padding: 2mm; text-align: center; }
.rc-analysis thead th { background: var(--rc-navy); color: #fff; font-weight: 500; }
.rc-analysis tbody th { font-weight: 400; font-size: 9.5pt; }
.rc-analysis td { font-weight: 700; font-size: 11.5pt; }

.rc-chart-title { text-align: center; font-size: 15pt; font-weight: 600; margin: 5mm 0 2mm; border-bottom: 2px solid #111; width: 120mm; margin-inline: auto; }
.rc-chart { width: 100%; height: auto; border: 1px solid #E3E5EE; }
.rc-chart-sm .rc-chart-title { font-size: 12pt; margin-top: 4mm; width: 90mm; }
.rc-chart-sm .rc-chart { width: 58%; display: block; margin: 0 auto; }
.rc-chart-sm .rc-chart-title { margin-top: 3mm; margin-bottom: 1.5mm; }

.rc-skills-title { text-align: center; font-size: 12pt; font-weight: 700; margin-bottom: 2mm; }
.rc-skills { display: grid; grid-template-columns: 1fr 1fr; border: 1.5px solid #9CC3F2; }
.rc-skills table { border-collapse: collapse; width: 100%; align-self: start; font-size: 8.2pt; line-height: 1.22; }
.rc-skills td, .rc-skills th { padding: 0.75mm 1.8mm; }
.rc-skills tr + tr td { border-top: 0.5px solid #E6EAF7; }
.rc-skills tr.rc-cat th { background: #FFE89A; text-align: left; font-weight: 700; font-size: 8.5pt; }
.rc-skills tr.rc-cat th:not(:first-child) { text-align: center; width: 7mm; }
.rc-skills td.mark { text-align: center; font-weight: 700; font-size: 10pt; width: 7mm; }
.rc-skills table + table { border-left: 1.5px solid #9CC3F2; }
.rc-skills-key { background: #FFE89A; text-align: center; padding: 1.5mm; border: 1.5px solid #9CC3F2; border-top: 0; font-size: 9.5pt; }

.rc-foot { margin-top: 4mm; text-align: center; display: grid; gap: 2mm; justify-items: center; }
.rc-quote { font-style: italic; font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 12pt; }
.rc-quote span { font-size: 10.5pt; }
.rc-numkey { border: 1.5px solid #111; background: var(--rc-cell); display: flex; gap: 5mm; align-items: center; padding: 2mm 4mm; font-size: 8.5pt; }
.rc-numkey div { display: grid; grid-template-columns: repeat(3, auto); column-gap: 6mm; }

@media screen and (max-width: 900px) {
  #cards { justify-content: start; overflow-x: auto; }
  .rc-page { transform-origin: top left; }
}

@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .scrim, .no-print, .toast, dialog { display: none !important; }
  .layout { display: block; background: none; }
  main { padding: 0; max-width: none; }
  #cards { display: block; }
  .rc-page { box-shadow: none; margin: 0; height: 297mm; min-height: 0; page-break-after: always; break-after: page; }
  .rc-draft { color: rgba(11,11,196,.08); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
