/* Amaya ERP — one stylesheet, colours taken from the Amaya logo. */
:root {
  --ink: #33373c;
  --muted: #646a72;
  --line: #e2e4e8;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --accent: #555a93;          /* deep version of the logo's violet */
  --accent-hover: #474b7e;
  --accent-soft: #eceef8;
  --blue: #7bb8e3;
  --green: #98c8a0;
  --yellow: #eed68a;
  --red: #ef7068;
  --ok-bg: #e7f4ea;  --ok-ink: #24613a;
  --err-bg: #fdecea; --err-ink: #9b2c22;
  --info-bg: #eaf3fb; --info-ink: #1f4f78;
  --radius: 10px;
  --sidebar: 220px;
  --topbar: 56px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inline { display: inline; margin: 0; }

/* Staging strip so nobody mistakes the test copy for the real ERP. */
.env-strip {
  background: var(--yellow); color: #5c4700; text-align: center;
  font-size: .8rem; font-weight: 600; padding: 3px 8px; letter-spacing: .02em;
}

/* ---- buttons and forms ---- */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px;
  padding: .6rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--ink); padding: .35rem .8rem; font-weight: 500; }
.btn-quiet:hover { background: var(--bg); }
.btn-link { background: none; border: 0; color: var(--accent); text-decoration: underline; font-weight: 500; padding: .5rem; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus-visible, a:focus-visible, button:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 2px;
}

.stack { display: grid; gap: 1rem; margin: 1rem 0; }
label { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
input[type=email], input[type=password], input[type=text] {
  width: 100%; font: inherit; font-weight: 400; padding: .6rem .75rem;
  border: 1px solid #c9cdd3; border-radius: 8px; background: #fff; color: var(--ink);
}
input:focus { border-color: var(--accent); }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

.alert { border-radius: 8px; padding: .65rem .9rem; margin: .75rem 0; font-size: .95rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--ok-bg); color: var(--ok-ink); }
.alert-error { background: var(--err-bg); color: var(--err-ink); }
.alert-info { background: var(--info-bg); color: var(--info-ink); }
.alert-warning { background: #fff3d6; color: #7a5a00; }

.badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 1px 10px; font-size: .78rem; font-weight: 600;
}

/* ---- sign-in pages ---- */
.auth-wrap {
  min-height: calc(100vh - 24px); display: grid; padding: 24px 16px;
  grid-template-columns: min(400px, 100%); justify-content: center; align-content: center;
}
.auth-card {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 24px 28px 20px;
}
.auth-card h1 { text-align: center; font-size: 1.3rem; }
.auth-logo { display: block; margin: 0 auto 4px; width: 210px; height: auto; }
.auth-foot { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 16px; }

/* ---- application shell ---- */
.shell {
  display: grid; min-height: 100vh;
  grid-template-columns: var(--sidebar) 1fr;
  grid-template-rows: var(--topbar) 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; }
.brand img { border-radius: 6px; }
.user { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; }
.user .link { color: var(--muted); }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.burger, .burger::before, .burger::after {
  display: block; width: 20px; height: 2px; background: var(--ink); position: relative; content: "";
}
.burger::before { position: absolute; top: -6px; }
.burger::after { position: absolute; top: 6px; }

.sidebar { grid-area: side; background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a, .sidebar .soon {
  display: block; padding: .5rem .75rem; border-radius: 8px; text-decoration: none; color: var(--ink);
}
.sidebar a:hover { background: var(--bg); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .soon { color: #9aa0a7; cursor: default; }
.sidebar .soon small { display: block; font-size: .72rem; }

.content { grid-area: main; padding: 24px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.narrow { max-width: 460px; }

.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.steps { margin: .5rem 0 0; padding: 0; list-style: none; color: var(--muted); }
.steps li { padding: 2px 0 2px 1.6rem; position: relative; }
.steps li::before { content: "○"; position: absolute; left: .2rem; }
.steps li.done { color: var(--ok-ink); }
.steps li.done::before { content: "✓"; }

/* ---- page furniture ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.crumbs { margin: 0 0 .25rem; font-size: .9rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.small { font-size: .85rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; color: var(--muted);
       border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-left: 6px; vertical-align: middle; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin: 16px 0; }
.panel h2 { margin-bottom: .75rem; }
.content > .panel + .panel, .grid-2 + .panel { margin-top: 16px; }
.grid-2 > .panel { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 1rem 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
code.secret { font-size: 1.15rem; font-weight: 700; letter-spacing: .06em; background: var(--accent-soft);
              color: var(--accent); padding: 4px 10px; border-radius: 6px; margin-right: 8px; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
              padding: 10px 0; border-top: 1px solid var(--line); }
.action-row:first-of-type { border-top: 0; }
.action-row p { margin: 2px 0 0; }
.form-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.btn-danger { background: #fff; border-color: #e5b4ae; color: var(--err-ink); padding: .35rem .8rem; }
.btn-danger:hover { background: var(--err-bg); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 1rem; min-width: 0; }
select { width: 100%; font: inherit; font-weight: 400; padding: .55rem .7rem; border: 1px solid #c9cdd3;
         border-radius: 8px; background: #fff; color: var(--ink); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
.notes { padding-left: 1.1rem; margin-top: 1rem; }
.nav-heading { margin: 14px 12px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
               text-transform: uppercase; color: var(--muted); }
.nav-group { margin-top: 6px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
                       padding: 4px 12px; margin: 8px 0 2px; border-radius: 6px; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▾"; font-size: 1.25rem; line-height: 1; margin-left: auto; }
.nav-group:not([open]) > summary::after { content: "▸"; }
.nav-group > summary:hover { background: var(--bg); color: var(--ink); }
.nav-group > summary:focus-visible { outline: 2px solid var(--accent-soft); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.panel .table-wrap { border: 0; border-radius: 0; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
.table tbody tr:last-child th, .table tbody tr:last-child td { border-bottom: 0; }
.table tbody th { font-weight: 600; }
.table .c { text-align: center; }
.table small { display: block; font-weight: 400; }
.row-muted td, .row-muted td a { color: #9aa0a7; }
.rights tr.override { background: #fff8e6; }
.rights .changed { color: #8a6500; font-size: .75rem; }
.rights input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); }
.lvl { display: inline-block; min-width: 3.4rem; border-radius: 6px; padding: 1px 8px; font-size: .82rem; font-weight: 600; }
.lvl-edit { background: var(--ok-bg); color: var(--ok-ink); }
.lvl-view { background: var(--info-bg); color: var(--info-ink); }
.lvl-none { background: #f1f2f4; color: #8b9097; }

.status { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.status-active { background: var(--ok-bg); color: var(--ok-ink); }
.status-inactive { background: #f1f2f4; color: #6b7178; }
.status-locked { background: var(--err-bg); color: var(--err-ink); }
.status-waiting-for-first-sign-in { background: #fff3d6; color: #7a5a00; }

/* ---- school setup ---- */
/* Tabs: rounded buttons, so it is plain they can be clicked; the open one is filled violet */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0 16px; }
.tabs a { padding: .4rem 1rem; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid #cfd3da;
          border-radius: 999px; font-weight: 500; line-height: 1.35; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.tabs a:hover { border-color: var(--accent); color: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tabs a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
h3.sub { font-size: .95rem; margin: .5rem 0 0; }
textarea { width: 100%; font: inherit; font-weight: 400; padding: .6rem .75rem; border: 1px solid #c9cdd3;
           border-radius: 8px; resize: vertical; color: var(--ink); }
input[type=number] { font: inherit; font-weight: 400; padding: .5rem .6rem; border: 1px solid #c9cdd3;
                     border-radius: 8px; width: 7.5rem; color: var(--ink); }
input[type=file] { font: inherit; font-weight: 400; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin-top: 14px; }
.inline-form label { font-size: .9rem; }
.inline-form input[type=text] { min-width: 220px; }
.inline-form select { width: auto; min-width: 180px; }
.inline-form.compact { margin: 0; flex-wrap: nowrap; align-items: center; }
.inline-form.compact input[type=number] { width: 6.5rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
fieldset.checks { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
fieldset.checks legend { font-weight: 600; font-size: .95rem; padding: 0 4px; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .inline + .inline { margin-left: 6px; }
details.edit { display: inline-block; text-align: left; }
details.edit summary { list-style: none; display: inline-block; }
details.edit summary::-webkit-details-marker { display: none; }
details.edit[open] summary { background: var(--accent-soft); }
.edit-form { min-width: 260px; max-width: 360px; margin: 10px 0 0; padding: 12px; background: #fafbfc;
             border: 1px solid var(--line); border-radius: 8px; white-space: normal; }
.warn-text { color: #8a6500; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
               padding: 6px 0; border-bottom: 1px solid var(--line); }
.cat-list li > span { padding-top: 6px; }
.cat-list li.row-muted > span { color: #9aa0a7; }
.logo-preview { display: block; max-width: 200px; max-height: 160px; border: 1px solid var(--line);
                border-radius: 8px; padding: 8px; background: #fff; margin-bottom: 12px; }
code.num { font-weight: 600; color: var(--accent); white-space: nowrap; }
.big { font-size: 1.6rem; font-weight: 700; margin: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 3px 0; }

/* ---- change log and error log ---- */
.filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; background: var(--panel);
           border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; }
.filters label { font-size: .85rem; }
.filters input, .filters select { font-size: .9rem; padding: .45rem .55rem; width: auto; }
.filters input[type=date] { font: inherit; font-size: .9rem; padding: .4rem .5rem; border: 1px solid #c9cdd3; border-radius: 8px; }
.filters input[type=text] { min-width: 180px; }
.filter-actions { display: flex; gap: 8px; }
.nowrap { white-space: nowrap; }
.log td small { display: block; }
.log tr.log-failed td:nth-child(4) { color: var(--err-ink); font-weight: 600; }
table.diff { border-collapse: collapse; font-size: .85rem; }
table.diff th, table.diff td { padding: 1px 8px 1px 0; border: 0; vertical-align: top; }
table.diff th { font-weight: 600; color: var(--muted); white-space: nowrap; }
table.diff .was { color: #9b2c22; text-decoration: line-through; text-decoration-color: rgba(155,44,34,.4); }
table.diff .now { color: var(--ok-ink); }
table.diff .arrow { color: var(--muted); }
.pager { display: flex; gap: 8px; justify-content: center; margin: 14px 0; }
.ok-text { color: var(--ok-ink); margin: 0; }
.err-text { color: var(--err-ink); }
.req { color: var(--err-ink); font-weight: 700; }
.danger-zone { border-color: #e5b4ae; margin-bottom: 16px; }
.table .num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fee-table td:first-child { width: 38%; }
.plan-total { margin: 0; }
.fee-summary { margin: 0; font-size: 1.05rem; }
.fee-statement td small { display: block; }
.fee-statement small.concession { color: var(--ok-ink); }
.fee-statement tfoot th, .fee-statement tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.form-grid.tight { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px 10px; }
.edit-form hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.fee-paid, .fee-nothing_due { background: var(--ok-bg); color: var(--ok-ink); }
.fee-overdue { background: var(--err-bg); color: var(--err-ink); }
.fee-due { background: #fff3d6; color: #7a5a00; }
.fee-upcoming { background: var(--info-bg); color: var(--info-ink); }
.fee-not_charged { background: #f1f2f4; color: #6b7178; }
details.add-line { margin-top: 10px; }
.content > section.panel + section.panel, .content > section.panel + .grid-2 { margin-top: 16px; }
.danger-zone summary { cursor: pointer; }
.danger-zone[open] summary { margin-bottom: 8px; }
.wrap-anywhere, .wrap-anywhere code { overflow-wrap: anywhere; white-space: normal; }
.error-list { display: grid; gap: 10px; }
.error-entry { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--yellow);
               border-radius: 8px; padding: 10px 14px; }
.error-entry.level-error, .error-entry.level-critical { border-left-color: var(--red); }
.error-entry header { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.error-entry p { margin: 6px 0 0; overflow-wrap: anywhere; }
.error-entry pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; background: #fafbfc;
                   border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 6px 0 0; }
.error-entry summary { cursor: pointer; color: var(--accent); font-size: .85rem; margin-top: 6px; }

.small-tabs { margin: 0; gap: 6px; }
.small-tabs a { padding: .25rem .75rem; font-size: .88rem; }

/* ---- overview ---- */
.checks-panel { margin-top: 12px; }
.checks-panel h2 .count { display: inline-block; min-width: 1.6rem; text-align: center; background: var(--err-bg);
                          color: var(--err-ink); border-radius: 999px; font-size: .8rem; padding: 1px 8px; }
.checks { list-style: none; margin: 0; padding: 0; }
.check { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px 12px; align-items: start;
         padding: 10px 0; border-top: 1px solid var(--line); }
.check:first-child { border-top: 0; }
.check p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.check-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--blue); }
.check-error .check-dot { background: var(--red); }
.check-warning .check-dot { background: #e0a800; }
.check .btn { white-space: nowrap; }
.card-coming { border-style: dashed; background: #fbfbfc; }
.card-coming h2 { color: var(--muted); }
.kv.compact { margin: 0; gap: 4px 12px; font-size: .92rem; }

/* ---- students ---- */
.form-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
input[type=date], input[type=month], input[type=tel] { width: 100%; font: inherit; font-weight: 400; padding: .55rem .7rem;
                                     border: 1px solid #c9cdd3; border-radius: 8px; color: var(--ink); background: #fff; }
fieldset.guardian { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 0 0 12px; display: grid; gap: 10px; }
fieldset.guardian legend { font-weight: 700; padding: 0 4px; }
summary.link { cursor: pointer; color: var(--accent); margin: 4px 0 10px; }
.student-head { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.student-head h1 { margin: 0; }
.student-head p { margin: 2px 0 0; }
.student-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex: none; }
.student-photo.placeholder { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
                             font-size: 1.8rem; font-weight: 700; }
.kv.details { grid-template-columns: 11rem 1fr; }
.notes-list, .timeline { list-style: none; padding: 0; margin: 12px 0 0; }
.notes-list li, .timeline li { padding: 10px 0; border-top: 1px solid var(--line); }
.notes-list li:first-child, .timeline li:first-child { border-top: 0; }
.notes-list p, .timeline p { margin: 2px 0; white-space: pre-wrap; }
.status-enrolled { background: var(--ok-bg); color: var(--ok-ink); }
.status-admitted { background: var(--info-bg); color: var(--info-ink); }
.status-enquiry { background: #fff3d6; color: #7a5a00; }
.status-withdrawn, .status-graduated { background: #f1f2f4; color: #6b7178; }

.count-pill { display: inline-block; background: var(--err-bg); color: var(--err-ink); border-radius: 999px;
              font-size: .75rem; padding: 0 7px; margin-left: 4px; }
.stage-new { background: #fff3d6; color: #7a5a00; }
.stage-contacted, .stage-visit, .stage-visited, .stage-form { background: var(--info-bg); color: var(--info-ink); }
.stage-offered { background: var(--accent-soft); color: var(--accent); }
.stage-converted { background: var(--ok-bg); color: var(--ok-ink); }
.stage-lost { background: #f1f2f4; color: #6b7178; }

/* ---- phones and small tablets ---- */
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .nav-toggle { display: block; }
  .sidebar {
    position: fixed; top: var(--topbar); left: 0; bottom: 0; width: 260px; z-index: 20;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 16px rgba(0,0,0,.08);
  }
  body.nav-open .sidebar { transform: none; }
  .topbar { padding: 0 8px; gap: 6px; }
  .brand span { white-space: nowrap; }
  .user { gap: 8px; }
  .user .user-name, .user .link, .user .badge { display: none; }
  .user .help-link { display: inline; }
  .content { padding: 16px; }
  .rights th, .rights td { padding: .55rem .4rem; }
  .table .opt { display: none; }
  .log thead { display: none; }
  .log, .log tbody, .log tr, .log > tbody > tr > td { display: block; width: 100%; }
  .log > tbody > tr { padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .log > tbody > tr > td { border: 0; padding: 2px 0; }
  .log > tbody > tr > td small { display: inline; margin-left: 6px; }
  .log > tbody > tr > td:nth-child(4) { font-weight: 600; }
  .table th, .table td { padding: .55rem .5rem; }
  .check { grid-template-columns: 14px 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .kv.details { grid-template-columns: 1fr; }
  .kv.details dd { margin-bottom: 6px; }
  .check .btn { grid-column: 2; justify-self: start; }
  .inline-form.compact { flex-wrap: wrap; gap: 6px; }
  .inline-form.compact input[type=number] { width: 5rem; }
  .tabs { gap: 6px; }
  .tabs a { padding: .35rem .8rem; }
  .panel { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Receipts */
small.block, .block { display: block; }
.rec-cancelled { background: var(--err-bg); color: var(--err-ink); }
.receipt-lines td.tick, .receipt-lines th.tick { width: 2.2rem; }
.receipt-lines td.tick input { width: 18px; height: 18px; accent-color: var(--accent); }
.receipt-lines input.amount { width: 8.5rem; text-align: right; }
.receipt-lines input.amount:disabled { background: #f4f5f7; }
.receipt-lines tfoot th, .receipt-lines tfoot td { border-top: 2px solid var(--line); }
.filters .custom-dates[hidden] { display: none; }
.totals-cards { margin: 0 0 16px; }
.fee-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Data import */
.problems { margin: 0; padding-left: 1.2rem; }
.problems li { margin: 4px 0; color: var(--err-ink); }
.crosscheck tr.row-flag td { background: #fff8f0; }

/* Bank book */
.cards.cards-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.bank-book .status { margin-top: 4px; }
.table .phone-only { display: none; }
@media (max-width: 800px) { .table .phone-only { display: table-cell; } }

/* Accounts */
.scope-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.scope-year select { font-size: .9rem; padding: .4rem .55rem; border: 1px solid #c9cdd3; border-radius: 8px; background: #fff; }
.scope-months { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  color: var(--ink); text-decoration: none; font-size: .88rem; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.scope-title { font-size: 1.1rem; margin: 4px 0 12px; }
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi h3 { margin: 0; font-size: .82rem; font-weight: 600; color: var(--muted); }
.kpi-v { margin: 4px 0 0; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-d { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.kpi-warn { border-color: #e0a800; background: #fffbf0; }
.chart-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.chart-panel h2 { margin-bottom: 4px; }
.chart-svg { max-width: 100%; height: auto; display: block; font-family: inherit; }
.chart-svg .hit:hover { fill: rgba(85, 90, 147, .06); }
.hbars { list-style: none; margin: 8px 0 0; padding: 0; max-width: 860px; }
.hbar { display: grid; grid-template-columns: 190px 1fr 150px; gap: 10px; align-items: center; padding: 3px 4px;
  border-radius: 6px; color: var(--ink); text-decoration: none; font-size: .9rem; }
.hbar:hover { background: var(--accent-soft); }
.hbar.active .hbar-label { font-weight: 700; }
.hbar-label { text-align: right; }
.hbar-track { display: block; width: 100%; height: 16px; }
.hbar-value { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .hbar { grid-template-columns: 1fr auto; gap: 2px 8px; }
  .hbar-label { text-align: left; }
  .hbar-track { grid-column: 1 / -1; grid-row: 2; height: 12px; }
}
.chart-table { margin-top: 8px; font-size: .9rem; }
.chart-table summary { cursor: pointer; color: var(--accent); }
.legend { margin: 0 0 4px; font-size: .85rem; color: var(--muted); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin: 0 4px 0 10px; }
.legend .key:first-child { margin-left: 0; }
.key-in { background: #5b5fc7; }
.key-out { background: #c9762a; }
.flag-split { background: #fff3d6; color: #7a5a00; }
.flag-check { background: var(--err-bg); color: var(--err-ink); }
.flag-awaiting { background: var(--info-bg); color: var(--info-ink); }
.doc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btn.disabled { pointer-events: none; opacity: .5; }
.table tr.row-flag td { background: #fffbf0; }

/* Salary month */
.tabs .tabs-right { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.salary-grid th, .salary-grid td { padding: .3rem .25rem; font-size: .84rem; }
.salary-grid td:first-child, .salary-grid th:first-child { position: sticky; left: 0; background: var(--panel); z-index: 1; }
.salary-grid th.in, .salary-grid td.in { background: #fbf8ec; }
.salary-grid input.cell { width: 3.3rem; padding: .2rem .25rem; font-size: .85rem; text-align: right; }
.salary-grid input.cell::placeholder { color: #c3c6cc; }
.salary-grid tfoot td, .salary-grid tfoot th { border-top: 2px solid var(--line); font-weight: 600; }
.problems.warn li { color: #7a5a00; }
.plain-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.plain-list li { margin: 4px 0; }
.btn-small { padding: .2rem .6rem; font-size: .85rem; }
@media (max-width: 600px) {
  .cards.cards-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cards.cards-4 .card { padding: 12px 14px; }
  .cards.cards-4 .card h2 { font-size: .9rem; }
  .cards.cards-4 .big { font-size: 1.15rem; }
}

/* Roles grid */
.roles .lvl-select { width: auto; font-size: .85rem; padding: .25rem .4rem; border-radius: 6px; border: 1px solid #c9cdd3; }
.roles .lvl-select.lvl-none { color: var(--muted); }
.roles .lvl-select.lvl-edit { color: var(--ok-ink); font-weight: 600; }
.roles .changed-mark { color: #b07800; font-weight: 700; margin-left: 4px; }

/* Search */
.page-search { position: relative; max-width: 560px; margin: 0 0 14px; }
.page-search input, .global-search input { width: 100%; font-size: .95rem; padding: .5rem .7rem; border: 1px solid #c9cdd3;
  border-radius: 8px; background: #fff; }
.page-search input:focus, .global-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.page-search-count { display: block; margin-top: 4px; font-size: .82rem; color: var(--muted); }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; list-style: none; margin: 0; padding: 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 60vh; overflow-y: auto; }
.suggest li.item { padding: .45rem .6rem; border-radius: 6px; cursor: pointer; }
.suggest li.item strong { display: block; font-weight: 600; font-size: .92rem; }
.suggest li.item small { display: block; color: var(--muted); font-size: .8rem; }
.suggest li.item:hover, .suggest li.item.active { background: var(--accent-soft); }
.suggest li.group { padding: .4rem .6rem .1rem; font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); }
.global-search { position: relative; flex: 0 1 380px; margin-left: 24px; }
.global-search input { padding: .4rem .7rem; }
.global-search .suggest { min-width: 340px; }
tr.search-hit td, li.search-hit { background: #fff3c4 !important; transition: background .4s; }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { padding: 6px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 800px) {
  .brand span { display: none; }
  .global-search { margin-left: 4px; flex: 1 1 auto; }
  .global-search .suggest { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar) + 4px); min-width: 0; }
  .page-search { max-width: none; }
  .topbar .btn-quiet { white-space: nowrap; padding: .35rem .55rem; font-size: .85rem; }
}

/* ---- pastel tones: one per sidebar group, carried onto its pages. Text stays dark on every tint. ---- */
.tone-mint     { --tone-bg: #e3f4e8; --tone-edge: #9fd3ae; --tone-ink: #2f6b45; }
.tone-rose     { --tone-bg: #fbe4ea; --tone-edge: #eda7b9; --tone-ink: #8f3550; }
.tone-sky      { --tone-bg: #dfedfb; --tone-edge: #9dc3ea; --tone-ink: #2f5f8f; }
.tone-peach    { --tone-bg: #fde9da; --tone-edge: #f0b88e; --tone-ink: #8a4a1c; }
.tone-butter   { --tone-bg: #fbf2cc; --tone-edge: #e5cc6a; --tone-ink: #7a5f00; }
.tone-lavender { --tone-bg: #ece8f8; --tone-edge: #b3a9de; --tone-ink: #554a8f; }
.nav-group > summary::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone-edge, var(--line)); }
.sidebar li[class*="tone-"] a.active { background: var(--tone-bg); color: var(--ink); box-shadow: inset 3px 0 0 var(--tone-edge); }
.sidebar li[class*="tone-"] a:hover:not(.active) { background: var(--tone-bg); }
/* Each sidebar group sits in its own pastel block; the page you are on is a white bar inside it. */
.sidebar .nav-group { background: var(--tone-bg); border-radius: 10px; padding: 2px 4px 6px; margin-top: 8px; }
.sidebar .nav-group > summary { color: var(--tone-ink); margin-top: 4px; }
.sidebar .nav-group > summary:hover { background: transparent; color: var(--tone-ink); }
.sidebar .nav-group li a.active { background: #fff; }
.sidebar .nav-group li a:hover:not(.active) { background: rgba(255, 255, 255, .6); }
/* Overview sits in its own coloured block, like the groups below it */
.tone-sand     { --tone-bg: #f3ece1; --tone-edge: #d4bf98; --tone-ink: #6e5527; }
.sidebar .nav-home { background: var(--tone-bg); border-radius: 10px; padding: 6px 4px; }
.sidebar .nav-home a.active { background: #fff; box-shadow: inset 3px 0 0 var(--tone-edge); }
.sidebar .nav-home a:hover:not(.active) { background: rgba(255, 255, 255, .6); }
.card[class*="tone-"], body[class*="tone-"] .content .cards > .card:not(.card-coming) {
  background: var(--tone-bg); border-color: var(--tone-edge); border-top: 4px solid var(--tone-edge); }
body[class*="tone-"] .content > .page-head, body[class*="tone-"] .content > h1:first-child {
  padding-bottom: 10px; border-bottom: 3px solid var(--tone-edge); margin-bottom: 14px; }
.check { padding: 10px 12px; border-top: 0; border-radius: 8px; margin-top: 6px; background: #e8f1fa; }
.check:first-child { margin-top: 0; }
.check-error { background: #fce8e6; }
.check-warning { background: #fdf3d7; }
.check .btn { background: #fff; }
.chip-in, .chip-out { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .85rem; }
.chip-in { background: #e3f4e8; color: #24613a; }
.chip-out { background: #fde9da; color: #8a4316; }
body[class*="tone-"] .kpis > .kpi:not(.kpi-warn):not(.kpi-alert) { background: var(--tone-bg); border-color: var(--tone-edge);
  border-top: 4px solid var(--tone-edge); }
/* ---- classes ---- */
.big .unit { font-size: .95rem; font-weight: 500; color: var(--muted); }
.class-cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.class-cards .card p { margin: 6px 0 0; }
.class-table td { vertical-align: top; }
.birthdays li { padding: 4px 0; }
.content > .cards + .panel { margin-top: 16px; }
.nowrap { white-space: nowrap; }
@media (max-width: 640px) {
  .class-table th, .class-table td { padding-left: 6px; padding-right: 6px; }
  .class-table td.num { white-space: nowrap; }
}
/* ---- day care ---- */
.narrow-input { width: 7rem; min-width: 0 !important; }
tr.subtotal th, tr.subtotal td { background: #fafbfc; font-size: .9rem; }
.dc-paid { background: var(--ok-bg); color: var(--ok-ink); }
.dc-partial { background: #fff3d6; color: #7a5a00; }
.dc-unpaid { background: var(--err-bg); color: var(--err-ink); }
.dc-excess { background: var(--info-bg); color: var(--info-ink); }
.dc-none { background: #f1f2f4; color: #6b7178; }
.dc-roster td { vertical-align: top; }
.filters .filter-part { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; margin: 0; }
.inline-form input.narrow-input { width: 7rem; min-width: 0; }
@media (max-width: 640px) {
  .dc-roster { font-size: .85rem; }
  .dc-roster th, .dc-roster td { padding-left: 4px; padding-right: 4px; }
  .dc-roster td { overflow-wrap: anywhere; }
  .dc-roster td.num { overflow-wrap: normal; white-space: nowrap; }
  .dc-roster .row-actions { white-space: normal; }
  .dc-roster .row-actions details.edit, .dc-roster .row-actions > .btn { display: block; margin: 0 0 4px; }
  .dc-roster .row-actions .btn { padding: .15rem .45rem; }
  .dc-roster .status { padding: 1px 6px; font-size: .72rem; }
}
/* ---- calendar ---- */
.cal-months { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 16px; }
.cal-months > .panel { margin: 0; }
.cal-month h2 { margin-bottom: .5rem; }
.cal-grid { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.cal-grid th { font-size: .72rem; font-weight: 600; color: var(--muted); padding: 2px 0; text-align: center; }
.cal-grid td { text-align: center; padding: 5px 0; border-radius: 6px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.cal-grid td.cal-weekend, .cal-chip.cal-weekend { background: #f1f2f4; color: #6b7178; }
.cal-grid td.cal-holiday, .cal-chip.cal-holiday { background: #fbe4ea; color: #8f3550; font-weight: 600; }
.cal-grid td.cal-class-holiday, .cal-chip.cal-class-holiday { background: #fff; color: #8f3550; box-shadow: inset 0 0 0 2px #eda7b9; }
.cal-grid td.cal-half, .cal-chip.cal-half { background: #fbf2cc; color: #7a5f00; }
.cal-grid td.cal-event, .cal-chip.cal-event { background: #dfedfb; color: #2f5f8f; }
.cal-grid td.cal-staff, .cal-chip.cal-staff { background: #e3f4e8; color: #2f6b45; font-weight: 600; }
.cal-grid td.cal-today { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-chip { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .82rem; white-space: nowrap; }
.cal-key { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.cal-list { list-style: none; margin: 10px 0 0; padding: 0; }
.cal-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.cal-list details.edit { margin-left: 6px; }
/* ---- attendance ---- */
.day-steps { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.today-classes a { text-decoration: none; margin-right: 4px; }
.chip-leave { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: .85rem; background: #fbf2cc; color: #7a5f00; }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; }
.att-list li { display: grid; grid-template-columns: minmax(140px, 1.2fr) auto minmax(120px, 1fr); gap: 8px 12px; align-items: center;
               padding: 8px 0; border-top: 1px solid var(--line); }
.att-list li:first-child { border-top: 0; }
.att-name { font-weight: 500; }
.att-note { font-size: .9rem; padding: .4rem .6rem; }
.seg { display: inline-flex; border: 1px solid #c9cdd3; border-radius: 8px; overflow: hidden; background: #fff; }
.seg label { position: relative; margin: 0; cursor: pointer; }
.seg label + label { border-left: 1px solid #c9cdd3; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: block; padding: .42rem .8rem; font-size: .9rem; font-weight: 500; color: var(--muted); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg-present input:checked + span { background: var(--ok-bg); color: var(--ok-ink); font-weight: 700; }
.seg-absent input:checked + span { background: var(--err-bg); color: var(--err-ink); font-weight: 700; }
.seg-leave input:checked + span { background: #fbf2cc; color: #7a5f00; font-weight: 700; }
.seg input:disabled + span { cursor: default; }
.att-register { font-size: .85rem; }
.att-register th, .att-register td { padding: 5px 3px; text-align: center; }
.att-register th small { display: block; font-weight: 400; font-size: .66rem; color: var(--muted); }
.att-register .att-child { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--panel); padding-right: 10px; z-index: 1; }
.att-register .att-off { background: #f1f2f4; }
.att-register .att-absent { color: var(--err-ink); font-weight: 700; background: var(--err-bg); }
.att-register .att-leave { color: #7a5f00; background: #fbf2cc; }
.att-register .att-present { color: var(--ok-ink); }
@media (max-width: 640px) {
  .att-list li { grid-template-columns: 1fr auto; }
  .att-list .att-note { grid-column: 1 / -1; }
  .att-list li:has(.seg-present input:checked) .att-note { display: none; }
  .seg span { padding: .42rem .55rem; }
  .day-steps { margin-left: 0; }
}
.seg-half-day input:checked + span { background: #dfedfb; color: #2f5f8f; font-weight: 700; }
.att-register .att-half-day { color: #2f5f8f; background: #dfedfb; }
/* ---- email ---- */
.email-preview { background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 8px 0; }
.email-preview p { margin: 0 0 10px; white-space: pre-line; }
.email-preview p:last-child { margin-bottom: 0; }
.email-to li { display: block; padding: 6px 0; }
.email-to label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
details.edit.wide { display: block; }
details.edit.wide > .stack { margin-top: 10px; }
code { background: var(--accent-soft); border-radius: 4px; padding: 0 4px; font-size: .85em; }
/* ---- notes ---- */
.notes { list-style: none; margin: 0; padding: 0; }
.notes .note { padding: 10px 0; border-top: 1px solid var(--line); }
.notes .note:first-child { border-top: 0; padding-top: 0; }
.note-head { margin: 0 0 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.note-head .tag { margin-left: 0; }
.note-body { margin: 0 0 6px; white-space: pre-line; overflow-wrap: anywhere; }
.note-pin a { font-weight: 500; }
.note-form { max-width: 520px; }
.note-add .grow { flex: 1 1 260px; }
.note-add .grow input { width: 100%; }
.card-notes li { padding: 5px 0; }
.pack-form { margin: 0 0 12px; align-items: center; }
.card-notes .tag { margin-left: 0; }
.tag-salary { background: #fde9da; border-color: #f0b88e; color: #8a4a1c; }
.tag-fees, .tag-bank, .tag-cash { background: #dfedfb; border-color: #9dc3ea; color: #2f5f8f; }
.tag-students { background: #e3f4e8; border-color: #9fd3ae; color: #2f6b45; }
.tag-daycare { background: #fbe4ea; border-color: #eda7b9; color: #8f3550; }
.tag-general { background: #ece8f8; border-color: #b3a9de; color: #554a8f; }

/* Lessons (Academics): the lesson list by area, and the year-end report headings */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip-row .chip { text-decoration: none; color: var(--ink); }
.chip-row .chip.active { color: #fff; }
.chip-n { font-size: .8rem; opacity: .75; margin-left: 2px; }
.lesson-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.lesson-topic { margin-top: 14px; }
.lesson-topic h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lesson-pres { border-top: 1px solid var(--line); padding: 10px 0 4px; scroll-margin-top: 70px; }
.lesson-pres h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 1rem; }
.lesson-table { font-size: .92rem; }
.lesson-table td { padding: .35rem .6rem; }
.lesson-table .lesson-name { width: 46%; }
.lesson-table .lesson-act { width: 1%; white-space: nowrap; text-align: right; }
.row-off .lesson-name > span[data-search-title], li.row-off > a, li.row-off { color: var(--muted); }
.chip-off { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: .78rem; background: #eceef1; color: #555c66; }
.arrows { display: inline-flex; gap: 2px; margin-right: 4px; vertical-align: middle; }
.btn-arrow { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; width: 30px; height: 28px;
  font-size: 1rem; line-height: 1; cursor: pointer; color: var(--ink); }
.btn-arrow:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-arrow:disabled { opacity: .3; cursor: default; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.heading-fold { border-top: 1px solid var(--line); padding: 8px 0; scroll-margin-top: 70px; }
.heading-fold > summary { cursor: pointer; font-weight: 600; }
.heading-line { border-top: 1px solid var(--line); margin: 0; padding: 8px 0; }
.heading-lessons { margin: 6px 0 4px; padding-left: 1.2rem; columns: 2 320px; column-gap: 28px; font-size: .92rem; }
.heading-lessons li { break-inside: avoid; margin-bottom: 2px; }
.danger-panel { margin-top: 18px; }
@media (max-width: 640px) {
  .lesson-table tr { display: block; padding: .3rem 0; border-bottom: 1px solid var(--line); }
  .lesson-table td { display: block; border: 0; padding: .1rem .2rem; width: auto !important; text-align: left !important; }
}

/* Progress (Academics): pick a presentation, tick children, mark lessons */
.pick-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.pick-head .chip-row { margin: 0; }
.find-lesson input[type=search] { min-width: 210px; font-size: .9rem; padding: .4rem .6rem; }
.pres-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px 20px; align-items: start; margin-top: 10px; }
.pres-col h3 { margin: 0 0 4px; font-size: .95rem; padding-bottom: 6px; border-bottom: 2px solid var(--tone-edge, var(--line)); }
.pres-col ol { list-style: none; margin: 0; padding: 0; }
.pres-col li a { display: grid; grid-template-columns: 1.7rem 1fr auto; gap: 6px; align-items: baseline; padding: .32rem .4rem;
  border-bottom: 1px solid #eef0f3; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: .93rem; }
.pres-col li a:hover, .pres-col li a:focus-visible { background: var(--tone-bg, var(--accent-soft)); }
.pres-no { color: #8b929c; font-size: .8rem; text-align: right; font-variant-numeric: tabular-nums; }
.pres-n { color: var(--muted); font-size: .8rem; background: #f0f2f5; border-radius: 999px; padding: 0 8px; }
.kid-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 8px 0 12px; background: #fafbfc; }
.kid-box > summary { cursor: pointer; font-weight: 600; }
.kid-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 8px; }
.kid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.kid { display: flex; align-items: center; gap: 8px; font-weight: 400; padding: .3rem 0; cursor: pointer; }
.kid input { width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.mark-list { list-style: none; margin: 0; padding: 0; }
.mark-list li { display: grid; grid-template-columns: minmax(180px, 1.4fr) auto minmax(140px, 1fr); gap: 8px 12px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--line); }
.mark-list li:first-child { border-top: 0; }
.mark-name { font-weight: 500; }
.mark-standing { display: block; font-weight: 400; margin-top: 2px; }
.mk { display: inline-block; border-radius: 999px; padding: 0 8px; font-size: .82rem; margin-right: 4px; white-space: nowrap; }
/* The three marks are shades of one colour, darker as the child moves on (1 presented, 2 improved, 3 proficient). */
.mk-presented, .seg-presented input:checked + span, .m1 { background: #dcf1e4; color: #2f6b47; }
.mk-improved, .seg-improved input:checked + span, .m2 { background: #8fd0a8; color: #173f29; }
.mk-proficient, .seg-proficient input:checked + span, .m3 { background: #2f8f5b; color: #fff; }
.seg-marks input:checked + span { font-weight: 700; }
.seg-none input:checked + span { background: #eceef1; color: #555c66; }
@media (max-width: 720px) {
  .mark-list li { grid-template-columns: 1fr; }
  .seg-marks { display: flex; }
  .seg-marks label { flex: 1; text-align: center; }
  .seg-marks .seg-none { flex: 0 0 2.6rem; }
  .kid-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 2px 10px; }
  .kid { align-items: flex-start; font-size: .93rem; }
  .find-lesson { width: 100%; }
  .find-lesson input[type=search] { flex: 1; min-width: 0; }
}

/* Progress grid: lessons down, children across; built to show as many lessons as the window allows */
.nowrap { white-space: nowrap; }
.grid-top { display: flex; align-items: center; gap: 4px 18px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 0 0 8px; }
.grid-top h1 { margin: 0; font-size: 1.35rem; }
.grid-top .tabs { margin: 6px 0; }
.grid-date { margin-left: auto; }
.filters-slim { padding: 6px 10px; gap: 6px 10px; margin-bottom: 8px; }
.filters-slim label { font-size: .75rem; }
.filters-slim select, .filters-slim input, .filters-slim input[type=date] { padding: .25rem .4rem; font-size: .85rem; }
.filters-slim .btn { padding: .25rem .6rem; font-size: .85rem; }
.filters-slim select { max-width: 190px; }
.grid-panel { padding: 8px 10px 6px; }
/* On the grid's page nothing but the grid scrolls: the menu scrolls inside itself, so the page is never taller
   than the window and the grid can reach the bottom edge. */
body.grid-page .content { padding: 12px 16px 6px; }
@media (min-width: 801px) {
  body.grid-page .sidebar { position: sticky; top: 0; align-self: start; max-height: calc(100vh - var(--topbar)); overflow-y: auto; }
}
.paint { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: 0 0 6px; }
.paint-tools { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.paint .tool { position: relative; margin: 0; cursor: pointer; }
.paint .tool input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.paint .tool > span { display: inline-flex; gap: 7px; align-items: center; border: 1px solid #c9cdd3; border-radius: 9px;
  padding: .22rem .55rem; font-weight: 600; font-size: .84rem; background: #fff; }
.paint .tool input:checked + span { outline: 3px solid var(--accent); outline-offset: 1px; }
.paint .tool input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
.paint .savebar { display: inline-flex; gap: 6px; margin: 0 0 0 auto; }
.paint .btn { padding: .3rem .7rem; font-size: .85rem; }
.paint .savebar + .grid-full-btn { margin-left: 0; }
.grid-full-btn { margin-left: auto; }
.sw { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; font-style: normal; }
.sw-none { background: #f7f8fa; border: 1px solid #c9cdd3; }
.grid-wrap { overflow: auto; max-height: 72vh; border: 1px solid var(--line); border-radius: 8px; }
.pgrid { border-collapse: separate; border-spacing: 0; width: 100%; background: #fff; font-size: .85rem; }
.pgrid th, .pgrid td { border-right: 1px solid #fff; border-bottom: 1px solid #fff; }
.pgrid thead th { position: sticky; top: 0; z-index: 3; background: #e3f2ea; vertical-align: bottom; height: 84px; padding: 0; }
.pgrid thead th.pres-h, .pgrid thead th.lesson-h { z-index: 4; text-align: left; padding: 0 8px 6px; font-size: .78rem; color: #45604f; }
.pgrid thead th.pres-h { left: 0; }
.pgrid thead th.lesson-h { left: 150px; }
.pgrid th.kidh span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 4px 0; font-weight: 600;
  font-size: .74rem; display: inline-block; max-height: 80px; overflow: hidden; text-overflow: ellipsis; }
.pgrid th.kidh.away span { color: #8b929c; font-weight: 500; }
.pgrid .band-topic th { text-align: left; background: #d5ebdd; color: #24513a; font-size: .82rem; padding: 3px 8px; }
.pgrid .band-topic th > span { position: sticky; left: 8px; }
.pgrid .band-topic { scroll-margin-top: 86px; }
.pgrid th.presc { position: sticky; left: 0; z-index: 2; background: #f3f5f7; text-align: left; vertical-align: top; padding: 0 8px;
  font-size: .8rem; color: #4a525d; font-weight: 600; width: 150px; min-width: 150px; max-width: 150px;
  border-bottom: 2px solid #fff; border-right: 1px solid #e3e6ea; }
.pgrid th.presc > span { position: sticky; top: 86px; display: block; padding: .25rem 0; line-height: 1.25; }
.pgrid tr.pres-first > * { border-top: 1px solid #e3e6ea; }
.pgrid th.lesson { position: sticky; left: 150px; z-index: 2; text-align: left; font-weight: 500; padding: 0; background: #fff;
  border-bottom: 1px solid #eef0f3; border-right: 1px solid #e3e6ea; max-width: 330px; }
.pgrid th.lesson button { all: unset; display: block; box-sizing: border-box; width: 100%; padding: .18rem 8px; cursor: default; line-height: 1.25; }
.pgrid.painting th.lesson button { cursor: pointer; color: #2a55a3; text-decoration: underline dotted #b8c4dd; text-underline-offset: 3px; }
.pgrid th.lesson button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pgrid td { min-width: 38px; height: 27px; text-align: center; font-weight: 700; position: relative; background: #f7f8fa; cursor: pointer;
  user-select: none; -webkit-user-select: none; }
.pgrid td.m1 { background: #dcf1e4; color: #2f6b47; }
.pgrid td.m2 { background: #8fd0a8; color: #173f29; }
.pgrid td.m3 { background: #2f8f5b; color: #fff; }
.pgrid td[data-t] { box-shadow: inset 0 0 0 3px #1f2937; }
.pgrid td.ch { box-shadow: inset 0 0 0 3px #e0a800; }
.pgrid td.ch::after { content: ""; position: absolute; right: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #e0a800; }
.pgrid td[data-c]::before { content: ""; position: absolute; left: 3px; bottom: 3px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); border: 1px solid #fff; }
.grid-legend { display: flex; gap: 2px 14px; flex-wrap: wrap; color: #555c66; margin: 5px 0 0; align-items: center; font-size: .78rem; }
.grid-legend span { display: inline-flex; gap: 6px; align-items: center; }
.lg { width: 16px; height: 16px; border-radius: 4px; display: inline-block; background: #f7f8fa; position: relative; }
.lg.m1 { background: #dcf1e4; } .lg.m2 { background: #8fd0a8; } .lg.m3 { background: #2f8f5b; }
.lg-today { box-shadow: inset 0 0 0 3px #1f2937; }
.lg-changed { box-shadow: inset 0 0 0 3px #e0a800; }
.lg-comment::before { content: ""; position: absolute; left: 5px; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (min-width: 801px) { .pgrid th.lesson { min-width: 230px; } }
/* A narrower window: a slimmer presentation column and cells, so the lesson names keep to one line. */
@media (min-width: 801px) and (max-width: 1320px) {
  .pgrid th.presc { width: 112px; min-width: 112px; max-width: 112px; font-size: .76rem; }
  .pgrid thead th.lesson-h, .pgrid th.lesson { left: 112px; }
  .pgrid td { min-width: 34px; }
  .filters-slim select { max-width: 150px; }
}
/* A short window: the filters and the tools each stay on one line (they slide sideways if they must). */
@media (max-height: 800px) and (min-width: 801px) {
  body.grid-page .filters-slim, body.grid-page .paint { flex-wrap: nowrap; overflow-x: auto; }
  body.grid-page .filters-slim > *, body.grid-page .paint > * { flex: none; }
  body.grid-page .paint-tools { flex-wrap: nowrap; padding: 4px; }
  body.grid-page .grid-top h1 { font-size: 1.15rem; }
  body.grid-page .grid-top .tabs a { padding: .25rem .8rem; }
}
/* Full screen: only the filters, the tools and the grid */
body.grid-full .topbar, body.grid-full .sidebar, body.grid-full .env-strip, body.grid-full .grid-top { display: none; }
body.grid-full .alert { margin: 0 0 6px; padding: .3rem .7rem; }
body.grid-full .shell { display: block; }
body.grid-full .content { padding: 8px 12px; max-width: none; }
.area-fold { border-top: 0; padding: 0; }
.area-fold > summary { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .pgrid th.presc { position: static; width: 96px; min-width: 96px; max-width: 96px; font-size: .74rem; padding: 0 5px; }
  .pgrid thead th.pres-h { position: sticky; left: auto; z-index: 3; }
  .pgrid thead th.lesson-h, .pgrid th.lesson { left: 0; }
  .pgrid th.lesson { max-width: 160px; font-size: .8rem; }
  .pgrid td { min-width: 36px; }
  .paint .savebar { margin-left: 0; }
}

/* Progress reports */
.table td.tick { width: 2.2rem; }
.table td.tick input { width: 18px; height: 18px; accent-color: var(--accent); }
.report-tabs { margin: -6px 0 12px; }
.year-write textarea { min-height: 320px; line-height: 1.5; }
.year-areas { margin: 8px 0 0; padding-left: 1.1rem; }
.year-comments-h { margin: 16px 0 6px; font-size: 1rem; }
.year-comments p { margin: 2px 0 0; }
.year-comments { max-height: 420px; overflow-y: auto; }

/* ---- library ---- */
.lib-lists { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); align-items: start; }
.lib-lists > .panel { margin: 0; }
.lib-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 4.5rem; gap: 8px; align-items: center; }
.lib-row.lib-add { grid-template-columns: minmax(0, 1fr) auto; margin-top: 10px; }
.lib-row input[type=text] { width: 100%; min-width: 0; }
@media (max-width: 560px) { .lib-lists { grid-template-columns: 1fr; } }
.extend-form { display: inline-flex; gap: 6px; align-items: center; }
.extend-form input[type=date] { width: 9.5rem; padding: .3rem .4rem; }
ol.rank { margin: .3rem 0 0; padding-left: 1.4rem; display: grid; gap: 6px; }
ol.rank .tag { margin-left: 4px; }

/* ---- Overview: user guides ---- */
.guide-books { list-style: none; margin: .4rem 0 .6rem; padding: 0; display: grid; gap: 8px; }
.guide-books li { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center;
                  padding: 8px 0; border-bottom: 1px solid var(--line); }
.guide-books li > div:first-child { display: flex; flex-direction: column; }

/* ---- communication record ---- */
.comm-items { list-style: none; margin: .4rem 0 0; padding: 0; }
.comm-items > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comm-items > li:last-child { border-bottom: 0; }
.comm-items p { margin: .3rem 0; white-space: pre-line; }
.comm-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tag-note { background: #fff3d6; border-color: #f0d38e; color: #7a5a00; }
.grid-2.comm { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.section-title { margin: 22px 0 4px; font-size: 1.15rem; }
