/*
  Consool interface.
  Look: a school register. Ink-blue headings, ruled lines, and the red margin line of an
  exercise book on every list of pupils. One bright colour, highlighter yellow, marks the
  main action on each screen. System fonts only, so pages load fast on slow connections.
*/

:root {
  --ink: #1e3a64;
  --ink-soft: #3d5a86;
  --text: #1b2433;
  --muted: #5a6577;
  --desk: #eef2f6;
  --paper: #ffffff;
  --rule: #d3deeb;
  --rule-strong: #b7c6d8;
  --margin: #e0565b;
  --highlight: #ffd34e;
  --highlight-edge: #e2b21c;
  --highlight-hover: #f7c736;
  --chalk: #2d6a4f;
  --chalk-bg: #e7f3ec;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn-bg: #fff4d6;
  --focus: 0 0 0 3px rgba(30, 58, 100, 0.35);
  --radius: 10px;
  --radius-lg: 14px;
  --font: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--desk);
}

img { max-width: 100%; display: block; }

a { color: var(--ink); text-underline-offset: 2px; }
a:hover { color: var(--ink-soft); }

h1, h2, h3 { color: var(--ink); line-height: 1.25; margin: 0 0 0.5rem; }
h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 650; }
h3 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 0.75rem; }

.icon { width: 1.25em; height: 1.25em; flex: none; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Top bar and navigation ---------- */

.topbar {
  background: var(--ink);
  color: #fff;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  min-height: 60px;
}
.school-mark {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none; min-width: 0; flex: 1;
}
.school-mark:hover { color: #fff; }
.school-mark img, .school-initial {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  background: #fff; object-fit: contain;
}
.school-initial {
  display: grid; place-items: center;
  color: var(--ink); font-weight: 700; font-size: 1.05rem;
}
.school-name {
  font-weight: 650; font-size: 1.02rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.user-menu { position: relative; }
.user-menu summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  min-height: 40px;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--highlight); color: var(--ink);
  display: grid; place-items: center; font-weight: 700; font-size: 0.85rem;
}
.user-menu .who { font-size: 0.92rem; max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--paper); color: var(--text);
  border: 1px solid var(--rule); border-radius: var(--radius);
  min-width: 220px; padding: 6px;
  box-shadow: 0 10px 30px rgba(20, 35, 60, 0.18);
}
.menu .menu-role { padding: 8px 10px 6px; font-size: 0.85rem; color: var(--muted); }
.menu a, .menu button {
  display: block; width: 100%; text-align: left;
  padding: 10px; border-radius: 8px;
  font: inherit; color: var(--text); text-decoration: none;
  background: none; border: 0; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--desk); }

.mainnav { background: var(--paper); border-bottom: 1px solid var(--rule); }
.mainnav ul {
  max-width: 1080px; margin: 0 auto; padding: 0 8px;
  display: flex; gap: 4px; list-style: none;
}
.mainnav a {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 12px 12px;
  color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.mainnav a:hover { color: var(--ink); }
.mainnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.notice-bar {
  font-size: 0.92rem; text-align: center;
  padding: 8px 16px; background: var(--warn-bg); color: #5c4400;
  border-bottom: 1px solid #f0dc9c;
}
.notice-bar.ended { background: var(--danger-bg); color: var(--danger); border-color: #f5c2bd; }

/* ---------- Page ---------- */

.page {
  max-width: 1080px; margin: 0 auto;
  padding: 24px 16px 48px;
}
.page-narrow { max-width: 640px; }
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 20px;
}
.page-head h1 { margin: 0; }
.page-head .lede { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.backlink {
  display: inline-flex; align-items: center; gap: 4px;
  margin-bottom: 12px; font-weight: 600; text-decoration: none;
  color: var(--ink-soft);
}

.panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.grid-2 { display: grid; gap: 20px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 3fr 2fr; align-items: start; } }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  font: inherit; font-weight: 650; line-height: 1.2;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--highlight); border-color: var(--highlight-edge); color: var(--ink); }
.btn-primary:hover { background: var(--highlight-hover); color: var(--ink); }
.btn-secondary { background: var(--paper); border-color: var(--rule-strong); color: var(--ink); }
.btn-secondary:hover { border-color: var(--ink-soft); color: var(--ink); }
.btn-danger { background: var(--paper); border-color: #e7a59f; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-whatsapp { background: #1f8f4e; color: #fff; }
.btn-whatsapp:hover { background: #197a42; color: #fff; }
.btn-block { width: 100%; }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 0.92rem; }
.btn-link {
  background: none; border: 0; padding: 0; font: inherit; font-weight: 600;
  color: var(--ink); text-decoration: underline; cursor: pointer; min-height: 0;
}

.button-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 20px; }

/* ---------- Forms ---------- */

.field { margin-bottom: 18px; }
.field > label, .field > .label, fieldset > legend {
  display: block; font-weight: 650; margin-bottom: 6px; color: var(--text);
}
.field > label.choice { display: flex; font-weight: 400; margin-bottom: 8px; }
.optional { font-weight: 400; color: var(--muted); }
.hint { margin: -2px 0 8px; font-size: 0.9rem; color: var(--muted); }

input:not([type]), input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input[type="time"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 48px;
  padding: 10px 12px;
  font: inherit; color: var(--text);
  background: var(--paper);
  border: 1px solid var(--rule-strong); border-radius: 8px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[type="file"] { font: inherit; padding: 10px 0; }

.field-error {
  margin: 6px 0 0; padding-left: 10px;
  border-left: 3px solid var(--danger);
  color: var(--danger); font-size: 0.92rem; font-weight: 600;
}

fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }

.choice {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; min-height: 52px;
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  background: var(--paper); cursor: pointer; margin-bottom: 8px;
}
.choice:has(input:checked) { border-color: var(--ink); background: #f3f7fc; }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); flex: none; }
.choice .choice-text { flex: 1; }
.choice .choice-sub { display: block; font-size: 0.88rem; color: var(--muted); }
.choices-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.choices-inline .choice { margin: 0; flex: 1 1 140px; }

.input-addon { display: flex; align-items: stretch; }
.input-addon .addon {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--desk); border: 1px solid var(--rule-strong);
  color: var(--muted); font-size: 0.95rem; white-space: nowrap;
}
.input-addon .addon:first-child { border-right: 0; border-radius: 8px 0 0 8px; }
.input-addon .addon:last-child { border-left: 0; border-radius: 0 8px 8px 0; }
.input-addon input { border-radius: 0; flex: 1; min-width: 0; }
.input-addon input:first-child { border-radius: 8px 0 0 8px; }
.input-addon input:last-child { border-radius: 0 8px 8px 0; }
.slug-status { font-size: 0.9rem; margin-top: 6px; min-height: 1.4em; }
.slug-status.ok { color: var(--chalk); }
.slug-status.bad { color: var(--danger); }

.two-cols { display: grid; gap: 0 16px; }
@media (min-width: 600px) { .two-cols { grid-template-columns: 1fr 1fr; } }

details.more {
  border-top: 1px solid var(--rule);
  margin: 8px 0 18px; padding-top: 4px;
}
details.more > summary {
  cursor: pointer; font-weight: 650; color: var(--ink);
  padding: 12px 0; list-style-position: inside;
}
details.more[open] > summary { margin-bottom: 8px; }

/* ---------- Messages ---------- */

.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 20px;
  border-radius: var(--radius);
  background: var(--chalk-bg); color: #1d4d38;
  border-left: 4px solid var(--chalk);
}
.flash.error { background: var(--danger-bg); color: var(--danger); border-left-color: var(--danger); }
.flash .icon { margin-top: 2px; }
.callout {
  padding: 14px 16px; border-radius: var(--radius);
  background: #f3f7fc; border: 1px solid var(--rule);
  margin-bottom: 18px;
}
.callout.warn { background: var(--warn-bg); border-color: #f0dc9c; }

/* ---------- The register: the list style for pupils ---------- */

.register {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 0 0 20px; padding: 0; list-style: none;
  position: relative;
}
.register::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 48px;
  width: 0; border-left: 2px solid var(--margin); opacity: 0.55;
  pointer-events: none;
}
.register li { border-bottom: 1px solid var(--rule); }
.register li:last-child { border-bottom: 0; }
.register-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px 10px 0; min-height: 60px;
  color: var(--text); text-decoration: none;
}
a.register-row:hover { background: #f7f9fc; color: var(--text); }
.register-no {
  width: 48px; flex: none; text-align: center;
  color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem;
}
.register-main { flex: 1; min-width: 0; }
.register-name { font-weight: 650; display: block; }
.register-sub { display: block; font-size: 0.88rem; color: var(--muted); }
.register-side { font-size: 0.9rem; color: var(--muted); text-align: right; }
.register-head {
  display: flex; gap: 14px; padding: 10px 16px 10px 0;
  font-size: 0.85rem; color: var(--muted); background: #f7f9fc;
  border-bottom: 1px solid var(--rule-strong);
}
.register-empty { padding: 28px 16px 28px 64px; color: var(--muted); }

.photo {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  object-fit: cover; background: #e9eff7; border: 1px solid var(--rule);
  display: grid; place-items: center; font-weight: 700; color: var(--ink-soft); font-size: 0.85rem;
}
.photo-lg { width: 96px; height: 96px; font-size: 1.6rem; border-radius: 16px; }

/* ---------- Home: what to do next ---------- */

.hello { margin-bottom: 20px; }
.hello h1 { margin-bottom: 2px; }
.hello p { color: var(--muted); margin: 0; }

.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li + li { border-top: 1px solid var(--rule); }
.task {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; min-height: 64px;
  text-decoration: none; color: var(--text);
}
.task:hover { color: var(--text); }
.task:hover .task-title { text-decoration: underline; }
.task-icon {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: #e9eff7; color: var(--ink);
}
.task-icon .icon { width: 22px; height: 22px; }
.task.main .task-icon { background: var(--highlight); }
.task-title { display: block; font-weight: 650; color: var(--ink); }
.task-sub { display: block; font-size: 0.9rem; color: var(--muted); }
.task .icon.chev { color: var(--rule-strong); margin-left: auto; }

.figures { display: flex; flex-wrap: wrap; gap: 0; margin: 0; }
.figure { flex: 1 1 120px; padding: 4px 16px 4px 0; }
.figure + .figure { border-left: 1px solid var(--rule); padding-left: 16px; }
.figure dt { font-size: 0.88rem; color: var(--muted); }
.figure dd { margin: 0; font-size: 1.6rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.todo .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--highlight-edge); margin-top: 7px; flex: none; }

/* ---------- Setup steps ---------- */

.steps { list-style: none; margin: 0 0 20px; padding: 0; display: flex; gap: 6px; }
.steps li { flex: 1; }
.steps .bar { height: 6px; border-radius: 3px; background: var(--rule); }
.steps .done .bar, .steps .now .bar { background: var(--ink); }
.steps .now .bar { background: var(--highlight-edge); }
.steps .step-name { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.steps .now .step-name { color: var(--ink); font-weight: 650; }
@media (max-width: 520px) { .steps .step-name { display: none; } .steps .now .step-name { display: block; } }

.class-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.class-row label.tick { display: flex; align-items: center; gap: 12px; font-weight: 600; min-height: 44px; cursor: pointer; }
.class-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--ink); }
.class-row select { width: auto; min-width: 132px; }
.section-title { margin: 22px 0 4px; font-size: 1rem; color: var(--ink-soft); }

.subject-grid { display: grid; gap: 8px; }
@media (min-width: 600px) { .subject-grid { grid-template-columns: 1fr 1fr; } }
.subject-grid .choice { margin: 0; }

/* ---------- Tables (staff, terms, platform) ---------- */

.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); font-size: 0.85rem; padding: 10px 12px; border-bottom: 1px solid var(--rule-strong); }
table.list td { padding: 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 0.82rem; font-weight: 600;
  background: #e9eff7; color: var(--ink-soft); white-space: nowrap;
}
.badge.good { background: var(--chalk-bg); color: var(--chalk); }
.badge.warn { background: var(--warn-bg); color: #7a5a00; }
.badge.off { background: #f1f1f1; color: #666; }

.kv { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.share-box {
  background: #f7f9fc; border: 1px dashed var(--rule-strong); border-radius: var(--radius);
  padding: 14px; font-size: 0.93rem; word-break: break-word; margin-bottom: 14px;
}

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters .search { flex: 2 1 220px; position: relative; }
.filters .search .icon { position: absolute; left: 12px; top: 14px; color: var(--muted); }
.filters .search input { padding-left: 40px; }
.filters select { flex: 1 1 160px; width: auto; }

.import-table td.bad { color: var(--danger); }
.row-bad td { background: #fff7f6; }
.problem { color: var(--danger); font-weight: 600; font-size: 0.88rem; }
.note { color: #7a5a00; font-size: 0.88rem; }

/* ---------- Public pages (sign in, signup) ---------- */

.public-top { padding: 18px 16px; }
.public-top .brand {
  max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  font-weight: 700; color: var(--ink); text-decoration: none; font-size: 1.15rem;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: var(--highlight);
  display: grid; place-items: center; font-weight: 800;
}
.auth-card {
  max-width: 460px; margin: 8px auto 48px; padding: 28px 24px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg);
}
.auth-card.wide { max-width: 640px; }
.auth-school { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-school img, .auth-school .school-initial { width: 48px; height: 48px; border: 1px solid var(--rule); }

.landing { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }
.landing-hero { display: grid; gap: 32px; align-items: center; padding: 24px 0 40px; }
@media (min-width: 860px) { .landing-hero { grid-template-columns: 1.1fr 1fr; } }
.landing-hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; margin-bottom: 16px; }
.landing-hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 34em; }
.landing-points { display: grid; gap: 20px; margin-top: 8px; }
@media (min-width: 760px) { .landing-points { grid-template-columns: repeat(3, 1fr); } }
.landing-points h2 { font-size: 1.05rem; }
.landing-points p { color: var(--muted); }

/* The sample register on the landing page */
.sample-register .register-row { min-height: 52px; }
.sample-register .paid { color: var(--chalk); font-weight: 650; }
.sample-register .owing { color: var(--danger); font-weight: 650; }

/* ---------- Phones ---------- */

@media (max-width: 759px) {
  .mainnav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    border-top: 1px solid var(--rule); border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mainnav ul { padding: 0; gap: 0; }
  .mainnav li { flex: 1; }
  .mainnav a {
    flex-direction: column; gap: 2px; justify-content: center;
    padding: 8px 4px; min-height: 60px; font-size: 0.78rem;
    border-bottom: 0; border-top: 3px solid transparent;
  }
  .mainnav a[aria-current="page"] { border-top-color: var(--ink); border-bottom-color: transparent; }
  .mainnav .icon { width: 24px; height: 24px; }
  body.has-nav .page { padding-bottom: 100px; }
  .user-menu .who { display: none; }
  .page { padding-top: 18px; }
  h1 { font-size: 1.4rem; }
  .page-head .actions { width: 100%; flex-wrap: wrap; }
  .page-head .actions > * { flex: 1 1 calc(50% - 8px); min-width: 9em; }
  .page-head .actions .btn { width: 100%; }
  .figure { flex-basis: 33%; }
  .figure dd { font-size: 1.35rem; }
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--rule); padding: 8px 0; }
  /* Each cell: its label in a narrow column on the left, the value (which may be several lines) beside it. */
  .table-wrap:has(table.stack) { overflow-x: visible; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  table.stack td { display: block; position: relative; border: 0; padding: 5px 0 5px 36%; min-height: 1.9em; text-align: left; overflow-wrap: anywhere; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 33%; color: var(--muted); font-size: 0.85rem; line-height: 1.3; }
  table.stack td.no-label { padding-left: 0; min-height: 0; }
  table.stack td.no-label::before { content: none; }
  table.stack td:empty { display: none; }
}

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

@media print {
  .topbar, .mainnav, .notice-bar, .page-head .actions, .button-row, .filters { display: none !important; }
  body { background: #fff; }
  .panel, .register { border-color: #999; }
}

/* Spacing helpers (inline styles are blocked by the security policy) */
.mt-1 { margin-top: 12px; }
.mt-2 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; }
.inline-form { display: inline; }
.row-actions { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.tasks .task > form.inline-form { margin-left: auto; }

/* Fees */
.amount-input { width: 180px; }
.amount-input input { text-align: right; font-variant-numeric: tabular-nums; }
a.callout.task { display: flex; color: var(--text); text-decoration: none; }
.balance-due { color: var(--danger); }
.balance-clear { color: var(--chalk); }
.ledger td.money, .ledger th.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger tr.subtotal td { font-weight: 650; border-top: 1px solid var(--rule-strong); }
.ledger tr.cancelled td { color: var(--muted); text-decoration: line-through; }
.big-balance { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 0; }
.receipt-paper {
  max-width: 560px; margin: 0 auto 20px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 24px;
  position: relative; overflow: hidden;
}
.receipt-paper::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 28px;
  border-left: 2px solid var(--margin); opacity: 0.45;
}
.receipt-paper > * { position: relative; margin-left: 24px; }
.receipt-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.receipt-head img, .receipt-head .school-initial { width: 52px; height: 52px; border: 1px solid var(--rule); }
.receipt-amount { font-size: 2.2rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 4px; margin-bottom: 12px; }
.receipt-paper .kv dd { overflow-wrap: anywhere; }
.stamp {
  display: inline-block; padding: 4px 12px; border: 2px solid var(--chalk); color: var(--chalk);
  border-radius: 8px; font-weight: 700; transform: rotate(-3deg);
}
.stamp.cancelled { border-color: var(--danger); color: var(--danger); }
@media print {
  .receipt-paper { border: 0; max-width: none; }
  .no-print { display: none !important; }
}

/* Segmented tabs (claims) */
.seg { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.seg a { padding: 10px 14px; color: var(--ink-soft); text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.seg a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--highlight-edge); }
.claim-actions { display: grid; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--rule); }
.proof { display: block; max-width: 100%; max-height: 420px; margin-top: 8px; border: 1px solid var(--rule); border-radius: 8px; }
.pay-steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.pay-steps > li { counter-increment: s; position: relative; padding: 0 0 14px 40px; }
.pay-steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--highlight); color: var(--ink); font-weight: 700; display: grid; place-items: center; }
.bank-card { background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 14px 16px; font-variant-numeric: tabular-nums; }
.bank-card .acct { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.04em; }
a.register-main { text-decoration: none; color: inherit; }
a.register-main .register-name { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }

/* Results */
.score-input { width: 4.2em; text-align: center; font-variant-numeric: tabular-nums; }
.part-row, .band-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.part-row input:not(.score-input), .band-row input:not(.score-input) { flex: 1; min-width: 0; }
.part-out { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.part-row .score-input, .band-row .score-input { flex: 0 0 5.5em; width: 5.5em; }
.band-head { display: grid; grid-template-columns: 4.2em 4.2em 1fr; gap: 8px; margin-bottom: 4px; }
.callout.good { background: var(--chalk-bg); border-color: #b9dcc7; }
.register-compact .register-row { padding-top: 10px; padding-bottom: 10px; }
.broadsheet-wrap { padding: 0; }
.broadsheet { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.92rem; min-width: 100%; }
.broadsheet th, .broadsheet td { border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: center; white-space: nowrap; }
.broadsheet thead th { vertical-align: bottom; color: var(--ink-soft); font-size: 0.85rem; }
.broadsheet tbody th, .broadsheet tfoot th, .broadsheet thead th:first-child { text-align: left; position: sticky; left: 0; background: var(--paper); box-shadow: inset -1px 0 0 var(--rule); }
.broadsheet .rot { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 9em; overflow: hidden; text-overflow: ellipsis; }
.broadsheet td.low { color: var(--danger); font-weight: 600; }
.broadsheet tfoot td, .broadsheet tfoot th { font-weight: 650; background: var(--desk); }
.score-sheet { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.score-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--rule); }
.score-row:nth-child(even) { background: #fafcfe; }
.score-name { flex: 1; min-width: 0; font-weight: 600; }
.score-name .no { display: inline-block; width: 2em; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.score-cells { display: flex; gap: 8px; align-items: flex-end; }
.score-cells .cell { width: 4.6em; text-align: center; font-size: 0.85rem; }
.score-cells .cell .score-input { width: 100%; }
.score-cells .total { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1rem; }
.score-cells .grade { color: var(--ink-soft); font-size: 0.85rem; }
.score-head { background: var(--desk) !important; color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }
.score-input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-bg); }
.cell-label { display: none; }
.sheet-actions { position: sticky; bottom: 0; display: flex; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--paper); border-top: 1px solid var(--rule); }
@media (max-width: 759px) {
  .score-row.score-head { display: none; }
  .score-row { display: block; padding: 10px 12px; }
  .score-name { margin-bottom: 6px; }
  .score-cells .cell { flex: 1; width: auto; }
  .cell-label { display: block; color: var(--muted); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .score-cells select { width: 100%; }
  .sheet-actions { bottom: calc(60px + env(safe-area-inset-bottom)); }
}
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
fieldset.panel { min-width: 0; }
.rate-row { border: 0; padding: 6px 0; margin: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--rule); }
.rate-row legend { float: left; padding: 0; font-weight: 600; }
.rate-choices { display: flex; gap: 4px; margin-left: auto; }
.rate-choices label { position: relative; }
.rate-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rate-choices span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--rule-strong); border-radius: 50%; font-weight: 650; cursor: pointer; background: var(--paper); }
.rate-choices input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.rate-choices input:focus-visible + span { box-shadow: var(--focus); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--rule-strong); background: var(--desk); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; color: var(--ink); cursor: pointer; text-align: left; }
.chip:hover { background: var(--paper); }
.mt-0 { margin-top: 0; }
.mb-2 { margin-bottom: 20px; }

/* Report card: reads like the printed card, prints one per A4 page */
.report-card { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 22px; margin-bottom: 24px; color: var(--text); }
.rc-head { display: flex; gap: 14px; align-items: center; border-bottom: 3px double var(--ink); padding-bottom: 12px; margin-bottom: 14px; }
.rc-head img, .rc-head .school-initial { width: 64px; height: 64px; border: 1px solid var(--rule); border-radius: 10px; object-fit: contain; flex: none; }
.rc-head h1 { font-size: 1.35rem; margin: 0; }
.rc-title { margin: 6px 0 0; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.9rem; }
.rc-info { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; margin: 0 0 14px; }
.rc-info dt { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.rc-info dd { margin: 0; font-weight: 650; }
.rc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.rc-table th, .rc-table td { border: 1px solid var(--rule-strong); padding: 5px 7px; text-align: center; }
.rc-table thead th { background: var(--desk); color: var(--ink); font-size: 0.78rem; line-height: 1.25; }
.rc-table tbody th, .rc-table tfoot th { text-align: left; font-weight: 600; white-space: nowrap; }
.rc-table .rc-remark { text-align: left; }
.rc-table tfoot td { text-align: left; }
.rc-traits { display: grid; gap: 0 16px; }
@media (min-width: 600px) { .rc-traits { grid-template-columns: 1fr 1fr; } }
.rc-small td { text-align: left; }
.rc-comments { display: grid; gap: 12px; }
@media (min-width: 600px) { .rc-comments { grid-template-columns: 1fr 1fr; } }
.rc-comments > div { border: 1px solid var(--rule-strong); border-radius: 8px; padding: 10px 12px; }
.rc-comments h2 { font-size: 0.85rem; margin: 0 0 4px; color: var(--ink-soft); }
.rc-comments p { margin: 0 0 4px; }
.rc-key { margin: 12px 0 0; }
@media print {
  @page { size: A4; margin: 12mm; }
  .page { padding: 0 !important; max-width: none !important; }
  .report-card { border: 0; border-radius: 0; padding: 0; margin: 0; break-after: page; page-break-after: always; font-size: 11px; }
  .report-card:last-of-type { break-after: auto; page-break-after: auto; }
  .report-card .table-wrap { overflow: visible; }
  .rc-traits, .rc-comments { grid-template-columns: 1fr 1fr; }
  .rc-table th, .rc-table td { padding: 3px 5px; }
  .rc-table thead th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .flash, .backlink, .public-top { display: none !important; }
}

.kv-scores { grid-template-columns: 1fr auto; }
.kv-scores dd { text-align: right; white-space: nowrap; }

/* Notices bell */
.bell { position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; color: #fff; text-decoration: none; }
.bell .icon { width: 24px; height: 24px; }
.bell:hover { background: rgba(255,255,255,0.12); }
.bell-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--highlight); color: var(--ink); font-size: 0.72rem; font-weight: 800; display: grid; place-items: center; }
.notice-list .task.unread .task-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--margin); margin-right: 8px; vertical-align: middle; }

/* Incidents */
.status-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 650; background: var(--warn-bg); color: #7a5a00; white-space: nowrap; }
.status-chip.approved { background: var(--chalk-bg); color: var(--chalk); }
.status-chip.returned { background: var(--danger-bg); color: var(--danger); }
.status-chip.withdrawn { background: #f1f1f1; color: #666; }
.prose-block { white-space: pre-wrap; margin: 0 0 12px; }
.steps-list { list-style: none; padding: 0; margin: 0; }
.steps-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.steps-list .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--rule-strong); display: grid; place-items: center; font-size: 0.75rem; }
.steps-list .tick.done { background: var(--chalk); border-color: var(--chalk); color: #fff; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--rule); margin-left: 6px; }
.timeline li.returned { border-left-color: var(--danger); }

/* Clock in and out */
.clock-bar { position: sticky; top: 0; z-index: 5; background: var(--desk); padding: 6px 0 8px; }
.clock-search input { font-size: 1.15rem; min-height: 54px; }
.clock-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.clock-filters .chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.clock-filters .chip span { opacity: 0.75; margin-left: 4px; font-variant-numeric: tabular-nums; }
.clock-live { min-height: 1.3em; margin: 6px 0 0; }
.clock-list { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden; }
.clock-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
.clock-row[hidden] { display: none; }
.clock-row .photo { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--desk); color: var(--ink); font-weight: 700; object-fit: cover; }
.clock-who { flex: 1; min-width: 0; }
.clock-name { display: block; font-weight: 700; font-size: 1.05rem; }
.clock-sub, .clock-state { display: block; font-size: 0.88rem; color: var(--muted); }
.clock-state { color: var(--text); margin-top: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.in { background: var(--chalk); }
.dot.out { background: var(--rule-strong); }
.clock-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.clock-btn { min-width: 112px; min-height: 48px; font-size: 1rem; }
.clock-row[data-state="out"] { background: #fafcfe; }
.clock-cta { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 20px; border-radius: var(--radius-lg); background: var(--ink); color: #fff; text-decoration: none; }
.clock-cta .icon { width: 36px; height: 36px; color: var(--highlight); }
.clock-cta strong { display: block; font-size: 1.15rem; }
.clock-cta span span { display: block; opacity: 0.85; font-size: 0.92rem; }
.clock-search { position: relative; }
.clock-search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 24px; height: 24px; }
.clock-search input { width: 100%; padding-left: 48px; }
@media (max-width: 759px) { .clock-page-head .actions { display: none; } }
#incident-text { white-space: pre-wrap; }

/* Wide logo in the top bar, in the space the name uses */
.school-mark img.wide-logo { width: auto; height: 40px; max-width: 100%; background: transparent; border-radius: 0; object-fit: contain; object-position: left center; }
.wide-logo-preview { background: var(--ink); padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; display: inline-block; max-width: 100%; }
.wide-logo-preview img { display: block; height: 40px; max-width: 100%; object-fit: contain; }
.phone-only { display: none; }
@media (max-width: 759px) {
  .mainnav .phone-hide { display: none; }
  .mainnav .phone-only { display: block; flex: 1; }
}
.mainnav ul { overflow-x: auto; }

/* Admission letters */
.letter-paper { background: #fff; max-width: 760px; margin: 0 auto 24px; padding: 36px 44px 48px; border: 1px solid var(--rule); border-radius: 6px; color: #1b1b1b; font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; line-height: 1.6; }
.letterhead { display: block; width: 100%; height: auto; margin-bottom: 20px; }
.letter-plainhead { border-bottom: 2px solid var(--ink); padding-bottom: 10px; margin-bottom: 20px; }
.letter-plainhead h1 { font-size: 1.4rem; margin: 0; color: var(--ink); }
.letter-date { text-align: right; }
.letter-body { white-space: pre-wrap; }
.letter-sign { margin-top: 18px; }
.letter-sign img { display: block; max-height: 70px; max-width: 220px; margin-bottom: 4px; }
.letter-sign .sign-space { height: 50px; border-bottom: 1px solid #999; width: 200px; margin-bottom: 6px; }
.letterhead-preview { display: block; max-width: 100%; border: 1px solid var(--rule); margin-bottom: 8px; }
.signature-preview { display: block; max-height: 70px; border: 1px dashed var(--rule-strong); padding: 6px; margin-bottom: 8px; background: #fff; }
.placeholder-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 4px; font-size: 0.9rem; }
.placeholder-list code { background: var(--desk); padding: 1px 6px; border-radius: 4px; }
@media (max-width: 600px) { .letter-paper { padding: 20px 18px 28px; font-size: 0.98rem; } }
@media print { .letter-paper { border: 0; max-width: none; padding: 0; margin: 0; } }

/* Parents */
.btn-signout { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: #fff; border-radius: 8px; padding: 8px 12px; font: inherit; font-size: 0.9rem; cursor: pointer; }
.child-cards { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 12px; }
.child-card { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); text-decoration: none; color: var(--text); }
.child-main { flex: 1; min-width: 0; }
.parents-table td { vertical-align: top; }

/* Passes and the gate */
.pass-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-top: 12px; }
.pass-card { border: 2px dashed var(--rule-strong); border-radius: 12px; padding: 14px; text-align: center; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.pass-head { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 6px; margin-bottom: 8px; text-align: left; }
.pass-qr { width: 190px; height: 190px; margin: 0 auto; }
.pass-qr svg { width: 100%; height: 100%; display: block; }
.pass-name { font-weight: 700; font-size: 1.1rem; margin: 8px 0 0; }
.pass-what { color: var(--muted); margin: 0; font-size: 0.9rem; }
.pass-code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.08em; margin: 6px 0 0; font-size: 0.95rem; }
.pass-cancelled { color: var(--danger); font-weight: 700; margin: 4px 0 0; }
.pass-page { max-width: 640px; }
.scan-view video { width: 100%; max-height: 60vh; background: #000; border-radius: 10px; object-fit: cover; }
.scan-start { min-height: 64px; font-size: 1.15rem; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.3rem; letter-spacing: 0.08em; text-transform: uppercase; }
.gate-result { border-radius: var(--radius-lg); padding: 20px; border: 3px solid; background: var(--paper); }
.gate-result.go { border-color: var(--chalk); }
.gate-result.wait { border-color: var(--highlight-edge); background: var(--warn-bg); }
.gate-result.stop { border-color: var(--danger); background: var(--danger-bg); }
.gate-verdict { font-size: 1.6rem; font-weight: 800; margin: 0 0 12px; }
.go .gate-verdict { color: var(--chalk); }
.stop .gate-verdict { color: var(--danger); }
.wait .gate-verdict { color: #7a5a00; }
.gate-who { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.gate-name { font-size: 1.3rem; font-weight: 700; margin: 0; }
.gate-btn { min-height: 64px; font-size: 1.2rem; }
@media print {
  .print-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .pass-qr { width: 150px; height: 150px; }
}
.clock-cta:hover { color: #fff; background: #253f6e; }
.att-days { list-style: none; padding: 0; margin: 0; }
.att-days li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0 7px 12px; border-bottom: 1px solid var(--rule); border-left: 4px solid var(--chalk); }
.att-days li.late { border-left-color: var(--highlight-edge); }
.att-days li.absent { border-left-color: var(--danger); color: var(--danger); }
.att-day { font-weight: 600; white-space: nowrap; }
.att-time { text-align: right; font-size: 0.92rem; }

/* Date picker: always reads 12th Oct 2026 */
.datepick { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; font: inherit; color: var(--text); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: var(--radius); cursor: pointer; text-align: left; }
.datepick:focus-visible { outline: none; box-shadow: var(--focus); border-color: var(--ink); }
.datepick[aria-invalid="true"] { border-color: var(--danger); }
.datepick .icon { color: var(--ink-soft); }
.datepick-empty { color: var(--muted); }
.datepick-panel { position: absolute; z-index: 30; margin-top: 6px; width: 300px; max-width: calc(100vw - 32px); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 12px; box-shadow: 0 10px 30px rgba(20, 35, 60, 0.18); padding: 10px; }
.field, .datepick-host { position: relative; }
.dp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.dp-head select { flex: 1; min-height: 38px; padding: 4px 8px; }
.dp-nav { width: 38px; height: 38px; border: 1px solid var(--rule); background: var(--paper); border-radius: 8px; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--ink); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.dp-dow { font-size: 0.75rem; color: var(--muted); padding: 4px 0; }
.dp-day { height: 38px; border: 0; background: transparent; border-radius: 8px; font: inherit; cursor: pointer; color: var(--text); }
.dp-day:hover { background: var(--desk); }
.dp-day.today { box-shadow: inset 0 0 0 1px var(--ink-soft); }
.dp-day.sel { background: var(--ink); color: #fff; }
.dp-day[disabled] { color: #c3cad4; cursor: default; background: transparent; }
.dp-foot { display: flex; justify-content: space-between; margin-top: 6px; }
.minutes-doc { font-family: Georgia, "Times New Roman", serif; line-height: 1.6; }
.minutes-doc h2, .minutes-doc h3, .minutes-doc h4 { font-family: inherit; }

/* Term calendar */
.cal-month h2 { margin-bottom: 6px; }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-item { display: flex; gap: 14px; align-items: flex-start; padding: 10px 0 10px 12px; border-bottom: 1px solid var(--rule); border-left: 4px solid var(--ink-soft); flex-wrap: wrap; }
.cal-item.kind-holiday, .cal-item.kind-break { border-left-color: var(--chalk); }
.cal-item.kind-exam { border-left-color: var(--margin); }
.cal-item.kind-term { border-left-color: var(--highlight-edge); }
.cal-item.past { opacity: 0.6; }
.cal-when { flex: 0 0 11.5em; font-weight: 600; font-size: 0.92rem; }
.cal-what { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.cal-notes { display: block; font-size: 0.9rem; color: var(--muted); }
.cal-what .badge { margin-left: 6px; }
@media (max-width: 600px) { .cal-when { flex-basis: 100%; } }
.assign-main { flex: 1; min-width: 0; }
.assign-details { display: block; margin-top: 4px; font-size: 0.92rem; color: var(--text); }
.assign-soon .assign-status { color: var(--danger); }
.assign-open .assign-status { color: var(--chalk); }
.assign-past { opacity: 0.65; }
.assign-later .assign-status { color: var(--ink-soft); }
.check-row { min-width: 0; }
.check-keep { display: inline-flex; margin-bottom: 6px; }
.three-cols { display: grid; gap: 0 16px; }
@media (min-width: 600px) { .three-cols { grid-template-columns: 1fr 1fr 1fr; } }
.name-with-title { display: grid; grid-template-columns: 7em 1fr; gap: 0 12px; }
.title-field select { width: 100%; }
.field.title-field { max-width: 12em; }
.name-with-title .title-field { max-width: none; }

/* ---------- Consool admin ---------- */
.admin-top {
  background: var(--ink); color: #fff; padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
}
.admin-top .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; font-size: 1.05rem; }
.admin-top .brand-mark { background: var(--highlight); color: var(--ink); width: 30px; height: 30px; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; }
.admin-nav a, .admin-nav .btn-link { color: #dbe5f2; text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 0; }
.admin-nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 var(--highlight); }
.admin-nav .btn-link:hover, .admin-nav a:hover { color: #fff; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.admin-tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--paper); color: var(--text); text-decoration: none; font-size: 0.9rem;
}
.admin-tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.admin-tabs .n { font-weight: 700; }
.school-list { display: grid; gap: 12px; }
.school-card { display: grid; gap: 10px; }
.school-card h2 { margin: 0; font-size: 1.1rem; }
.school-card h2 a { color: var(--ink); text-decoration: none; }
.school-card h2 a:hover { text-decoration: underline; }
.school-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.school-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; font-size: 0.93rem; }
.school-cols h3 { margin: 0 0 4px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.school-cols p { margin: 0 0 2px; overflow-wrap: anywhere; }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.danger-zone { border-color: #f5c2bd; }

/* ---------- Subscription prices ---------- */
.price-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.price-table tfoot td { padding: 10px 12px; border-top: 1px solid var(--rule-strong); }
.price-table tfoot .price-sub td { color: var(--muted); border-top: 0; padding-top: 6px; padding-bottom: 2px; }
.price-table tfoot tr:first-child td { border-top: 1px solid var(--rule-strong); }
.price-table .price-total td { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.price-detail { display: none; }
.price-bands .num { text-align: right; }
@media (max-width: 640px) {
  .price-table th:nth-child(2), .price-table th:nth-child(3), .price-table th:nth-child(4),
  .price-table tbody td:nth-child(2), .price-table tbody td:nth-child(3), .price-table tbody td:nth-child(4) { display: none; }
  .price-table, .price-table tbody, .price-table tfoot { display: block; width: 100%; }
  .price-table thead { display: none; }
  .price-table tr { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--rule); }
  .price-table tr[hidden] { display: none; }
  table.list.price-table td, table.list.price-table tfoot td { border: 0; padding: 10px 0; }
  table.list.price-table tfoot td { padding: 8px 0; }
  .price-table tfoot tr.price-total { border-top: 1px solid var(--rule-strong); }
  .price-table tfoot tr { border-bottom: 0; }
  .price-detail { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
  .price-table tfoot td[colspan] { white-space: normal; }
  .price-bands th, .price-bands td { padding: 8px 6px; }
}
.sub-panel .figure dd { font-size: 1.25rem; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; border: 0; border-top: 1px solid var(--rule); padding: 10px 0 0; margin: 0 0 4px; min-width: 0; }
.tier-row .tier-head { grid-column: 1 / -1; margin: 0 0 6px; font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.tier-row .field { margin-bottom: 8px; min-width: 0; }
.tier-row .tier-price { font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-left: 6px; }
.tier-row input { min-width: 0; width: 100%; }
@media (max-width: 640px) {
  .admin-top { padding: 10px 16px 0; }
  .admin-nav { width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 18px; padding-bottom: 2px; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a, .admin-nav .btn-link { white-space: nowrap; padding: 8px 0 10px; font-size: 0.92rem; }
  .admin-nav .inline-form { margin-left: auto; }
}

/* ---------- Keep long words, links and codes inside the page on phones ---------- */
code { overflow-wrap: anywhere; word-break: break-word; }
.panel, .callout { min-width: 0; overflow-wrap: break-word; }
.admin-grid > * { min-width: 0; }
.grid-2 > *, .two-cols > *, .three-cols > * { min-width: 0; }
.cal-item .row-actions { flex-basis: 100%; }

/* ---------- Admin: homepage editor ---------- */
.hp-form .panel { max-width: 980px; }
.hp-images { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.hp-image img { width: 100%; height: 140px; object-fit: contain; background: repeating-conic-gradient(#f2f4f8 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--rule); border-radius: 10px; margin-bottom: 10px; }
.hp-sub { margin: 22px 0 6px; font-size: 1rem; color: var(--ink); }
.hp-row { display: grid; gap: 0 12px; }
.hp-row > * { min-width: 0; }
.hp-row-2 { grid-template-columns: 1fr 2fr; }
.hp-row-3 { grid-template-columns: 2fr 1fr 1fr; }
.hp-row-5 { grid-template-columns: 1.3fr 1fr 1.3fr 1fr 1fr; }
.hp-row .field label { font-size: .85rem; }
.hp-feature { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 4px; }
.hp-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--desk) 30%); padding: 18px 0 12px; margin-top: 0; }
@media (max-width: 760px) {
  .hp-row-2, .hp-row-3 { grid-template-columns: 1fr 1fr; }
  .hp-row-3 > :first-child, .hp-row-2 > :first-child { grid-column: 1 / -1; }
  .hp-row-5 { grid-template-columns: 1fr 1fr; }
  .hp-row-5 > :first-child { grid-column: 1 / -1; }
}

.brand-logo { height: 30px; width: auto; display: block; }
.admin-top .brand-logo { height: 24px; }
.brand-tag { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; background: rgba(255,255,255,.14); color: #fff; }

/* Admin bar: light, so the logo uploaded under Homepage shows in its own colours. */
.admin-top { background: #fff; color: var(--ink); border-bottom: 1px solid var(--rule); }
.admin-top .brand { color: var(--ink); }
.admin-top .brand-logo { height: 28px; }
.admin-nav a, .admin-nav .btn-link { color: var(--muted); }
.admin-nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--highlight-edge); }
.admin-nav .btn-link:hover, .admin-nav a:hover { color: var(--ink); }
.brand-tag { background: var(--desk); color: var(--ink-soft); }
.order-list { list-style: none; margin: 0; padding: 0; }
.order-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.order-list li:last-child { border-bottom: 0; }
.order-name { font-weight: 600; }
.order-buttons { display: flex; gap: 8px; }
.btn[disabled] { opacity: .4; cursor: default; }
.medical-alert { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--danger-bg); color: var(--danger); }
.medical-alert .icon { flex: none; margin-top: 2px; }
.badge.demo { background: #efe8fd; color: #5b30c9; }
