:root {
  --bg: #f4f6fa; --panel: #ffffff; --text: #23262d; --muted: #6b7280; --line: #e2e6ec;
  --brand: #1f3a66; --brand-text: #ffffff; --accent: #2f6fed; --ok: #2f9e5b; --bad: #d64545; --warn: #c98a12;
  --chip-debit: #fdeeb0; --chip-credit: #b7ecd8; --chip-owed: #f5c2c2; --chip-clear: #c4efcd; --chip-current: #e3c9f5;
  --chip-required: #ffd8a8; --row-hl: #f6e3a1; --chip-text: #23262d; --row-alt: #fafbfc; --shadow: 0 2px 10px rgba(31, 58, 102, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161b; --panel: #1d2027; --text: #e4e6eb; --muted: #9aa1ae; --line: #343944;
    --brand: #26446f; --accent: #6b9bff; --ok: #5fd08a; --bad: #ff8a8a; --warn: #e6b34a;
    --chip-debit: #5b4d16; --chip-credit: #1d5440; --chip-owed: #6a2a2a; --chip-clear: #1f5a2c; --chip-current: #4b2f63;
    --chip-required: #6b4a1c; --row-hl: #6e5514; --chip-text: #f1f2f4; --row-alt: #22252d; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6;
       font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Noto Sans Arabic", system-ui, sans-serif; }
a { color: var(--accent); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
td.ltr, th.ltr { display: table-cell; }          /* inline-block would pull the cell out of the table: no row borders or striping */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 18px;
       background: var(--brand); color: var(--brand-text); }
.top a { color: inherit; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; white-space: nowrap; }
.top a, .top button { white-space: nowrap; }
.links { display: flex; gap: 6px; margin-inline-start: auto; margin-inline-end: 18px; }
.links a { font-weight: 600; padding: 6px 14px; border-radius: 999px; opacity: .85; transition: background .15s, opacity .15s; }
.links a:hover { opacity: 1; background: rgba(255, 255, 255, .1); }
.links a.on { opacity: 1; background: rgba(255, 255, 255, .2); }
.who { display: flex; align-items: center; gap: 14px; font-size: .95rem; }
.who form { margin: 0; }

/* the menu: beside the brand on a computer; behind a burger button on a phone (a checkbox, so it works without JavaScript) */
.menu { display: contents; }
.menu-toggle, .menu-btn { display: none; }
@media (max-width: 760px) {
  .top { position: relative; }
  .menu-toggle { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-inline-start: auto;
              border-radius: 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .15s; }
  .menu-btn:hover, .menu-toggle:checked + .menu-btn { background: rgba(255, 255, 255, .16); }
  .menu-btn:focus-visible { outline: 3px solid #fff; outline-offset: 1px; }
  .bars, .bars::before, .bars::after { display: block; width: 22px; height: 2.5px; border-radius: 2px; background: currentColor; transition: transform .2s, opacity .2s; }
  .bars { position: relative; }
  .bars::before, .bars::after { content: ""; position: absolute; inset-inline-start: 0; }
  .bars::before { top: -7px; } .bars::after { top: 7px; }
  .menu-toggle:checked + .menu-btn .bars { background: transparent; }
  .menu-toggle:checked + .menu-btn .bars::before { top: 0; transform: rotate(45deg); }
  .menu-toggle:checked + .menu-btn .bars::after { top: 0; transform: rotate(-45deg); }
  .menu { display: none; position: absolute; top: 100%; inset-inline: 0; z-index: 30; flex-direction: column; gap: 4px; padding: 10px 12px 14px;
          background: var(--brand); border-top: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 16px 32px rgba(0, 0, 0, .35); }
  .menu-toggle:checked ~ .menu { display: flex; animation: menu-in .16s ease-out; }
  .menu .links { flex-direction: column; margin: 0; gap: 4px; }
  .menu .links a { display: flex; align-items: center; min-height: 46px; padding: 0 14px; border-radius: 12px; font-size: 1.02rem; }
  .menu .who { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 6px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .18); }
  .menu .who .name { padding: 0 14px 4px; opacity: .75; font-size: .9rem; }
  .menu .who a, .menu .who button.link { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 14px; border-radius: 12px;
                                         font-size: 1rem; text-decoration: none; text-align: start; opacity: 1; }
  .menu .who a:hover, .menu .who button.link:hover, .menu .who a.on { background: rgba(255, 255, 255, .14); }
  .menu .who button.link { color: #ffb4b4; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .menu, .bars, .bars::before, .bars::after { animation: none !important; transition: none !important; } }

button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { margin: 0 0 6px; font-size: 1.5rem; }

.btn, button.primary { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px;
       padding: 9px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn:hover, button.primary:hover { filter: brightness(1.08); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

input[type=text], input[type=password], input[type=search] {
  width: 100%; padding: 11px 14px; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; }

/* login */
.login { max-width: 380px; margin: 40px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
         padding: 28px 24px; text-align: center; box-shadow: var(--shadow); }
.login form { text-align: right; display: grid; gap: 8px; margin-top: 14px; }
.login label { font-weight: 600; font-size: .92rem; }
.login .primary { margin-top: 10px; width: 100%; }
.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); border-radius: 10px; padding: 9px 12px; margin: 10px 0 0; font-weight: 600; }
.pw-link { font-size: .9rem; opacity: .85; } .pw-link:hover, .pw-link.on { opacity: 1; }
.login small { margin-top: -4px; }
.due-note { margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius, 10px); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.confidential-banner { background: color-mix(in srgb, var(--warn) 22%, var(--panel)); border-bottom: 2px solid var(--warn); padding: 8px 16px; line-height: 1.6; font-size: .92rem; text-align: center; }
.confidential { background: color-mix(in srgb, var(--warn) 16%, transparent); border: 1px solid var(--warn); border-radius: 10px; padding: 9px 12px; margin: 8px 0 14px; line-height: 1.7; }
.alert { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border-radius: 10px; padding: 9px 12px; margin: 10px 0 0; font-weight: 600; }

/* search */
.search { max-width: 640px; margin: 28px auto; text-align: center; }
.searchbox { position: relative; display: flex; gap: 8px; margin-top: 14px; text-align: right; }
.searchbox input { flex: 1; font-size: 1.1rem; }
#suggestions, .results { list-style: none; margin: 0; padding: 0; }
#suggestions { position: absolute; top: calc(100% + 4px); inset-inline: 0; z-index: 5; background: var(--panel);
               border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 360px; overflow: auto; }
#suggestions[hidden] { display: none; }
#suggestions li, .results li a { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; padding: 10px 14px;
               text-decoration: none; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--line); }
#suggestions li:last-child, .results li:last-child a { border-bottom: 0; }
#suggestions li[aria-selected=true], #suggestions li:hover, .results li a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.n { font-weight: 600; } .d { color: var(--muted); font-size: .9rem; } .no { color: var(--muted); direction: ltr; font-variant-numeric: tabular-nums; }
.results { margin-top: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-align: right; }
.hint { font-size: .9rem; margin-top: 10px; }
.empty { color: var(--muted); text-align: center; margin: 24px 0; }

/* statement */
.student-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.info { display: flex; flex-wrap: wrap; gap: 6px 26px; margin: 4px 0 0; }
.info div { display: flex; gap: 8px; } .info dt { color: var(--muted); } .info dd { margin: 0; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 8px 0 18px; }
.chip { border-radius: 12px; padding: 10px 16px; color: var(--chip-text); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chip span { font-size: .92rem; opacity: .85; } .chip b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.chip.debit { background: var(--chip-debit); } .chip.credit { background: var(--chip-credit); }
.chip.required { background: var(--chip-required); }
.big-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; padding: 16px; }
.big-chips .chip { flex-direction: column; text-align: center; padding: 14px 18px; }
.big-chips .chip b { font-size: 1.6rem; }
.chip.owed { background: var(--chip-owed); } .chip.clear { background: var(--chip-clear); } .chip.current { background: var(--chip-current); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; margin-top: 16px; overflow: hidden; box-shadow: var(--shadow); }
.card > header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; background: var(--brand); color: var(--brand-text); padding: 10px 16px; }
.tag { background: rgba(255,255,255,.18); border-radius: 20px; padding: 1px 12px; font-size: .92rem; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 8px 12px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
thead th { background: var(--row-alt); color: var(--muted); font-size: .9rem; font-weight: 600; border-bottom-width: 2px; }
tbody tr:nth-child(even) { background: var(--row-alt); }
td.num { font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }   /* -1,000 keeps its minus on the left */
tbody tr.hl { background: var(--row-hl); }   /* neither a receipt nor the fee charge: stands out */
tfoot td { background: color-mix(in srgb, var(--brand) 14%, transparent); font-weight: 700; border-bottom: 0; }
details.plan { border-top: 1px solid var(--line); padding: 0 0 6px; }
details.plan summary { cursor: pointer; padding: 10px 16px; font-weight: 600; }
details.plan summary.late { color: var(--bad); } details.plan summary.ok { color: var(--ok); }
td.settled { color: var(--ok); font-weight: 600; } td.due { color: var(--bad); font-weight: 600; }
.message { text-align: center; margin: 60px auto; max-width: 480px; }

/* the home screen: one tile per section (a link when built, a placeholder marked «قريباً» when not) */
.home-head { margin: 6px 0 18px; } .home-head h1 { margin: 0 0 4px; font-size: 1.6rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.tile { --accent-tile: var(--accent); position: relative; display: flex; align-items: center; gap: 16px; height: 100%; min-height: 96px; padding: 16px 18px;
        background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; text-decoration: none;
        box-shadow: 0 1px 2px rgba(20, 30, 60, .06), 0 8px 24px -14px rgba(20, 30, 60, .2); transition: transform .15s, border-color .15s, box-shadow .15s; }
a.tile:hover { transform: translateY(-2px); border-color: var(--accent-tile); box-shadow: 0 10px 28px -12px rgba(20, 30, 60, .35); }
a.tile:focus-visible { outline: 3px solid var(--accent-tile); outline-offset: 2px; }
.tile .ico { flex: none; width: 48px; height: 48px; padding: 11px; border-radius: 14px; color: var(--accent-tile);
             background: color-mix(in srgb, var(--accent-tile) 14%, transparent); }
.tile .txt { display: grid; gap: 3px; min-width: 0; } .tile .txt b { font-size: 1.05rem; } .tile .txt span { color: var(--muted); font-size: .86rem; line-height: 1.45; }
.tile.soon { opacity: .62; border-style: dashed; box-shadow: none; cursor: default; }
.tile .badge { position: absolute; inset-block-start: 10px; inset-inline-end: 12px; font-style: normal; font-size: .72rem; font-weight: 700; padding: 1px 9px;
               border-radius: 999px; background: var(--panel-2, color-mix(in srgb, var(--muted) 18%, transparent)); color: var(--muted); }
.tile.c0 { --accent-tile: #2f6fed; } .tile.c1 { --accent-tile: #2f9e5b; } .tile.c2 { --accent-tile: #c98a12; }
.tile.c3 { --accent-tile: #8a5cf6; } .tile.c4 { --accent-tile: #d6468a; } .tile.c5 { --accent-tile: #1f9fb0; }
@media (prefers-color-scheme: dark) { .tile.c0 { --accent-tile: #6b9bff; } .tile.c1 { --accent-tile: #5fd08a; } .tile.c2 { --accent-tile: #e6b34a; }
  .tile.c3 { --accent-tile: #b394ff; } .tile.c4 { --accent-tile: #ff8cbc; } .tile.c5 { --accent-tile: #5fd6e6; } }
@media (max-width: 640px) { .tiles { grid-template-columns: minmax(0, 1fr); } .tile { min-height: 84px; } }

/* daily income */
main:has(> .income) { max-width: 1440px; }
.income { --panel-2: #f1f4f9; --kpi-green: #2f9e5b; --kpi-amber: #c98a12; --kpi-red: #d64545; --kpi-blue: #2f6fed;
          --ring: 0 1px 2px rgba(20, 30, 60, .06), 0 8px 24px -12px rgba(20, 30, 60, .18); }
@media (prefers-color-scheme: dark) { .income { --panel-2: #252a35; --ring: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px -14px rgba(0, 0, 0, .7);
          --kpi-green: #5fd08a; --kpi-amber: #e6b34a; --kpi-red: #ff8a8a; --kpi-blue: #6b9bff; } }
.income h1 { font-size: 1.7rem; letter-spacing: -.01em; margin: 4px 0 14px; }

/* tabs: a segmented control */
.income .tabs { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.income .tabs a { padding: 8px 26px; border-radius: 9px; border: 0; margin: 0; color: var(--muted); font-weight: 600; text-decoration: none; transition: background .15s, color .15s; }
.income .tabs a:hover { color: var(--text); }
.income .tabs a.on { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

/* the filter bar */
.income .filter { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: end; margin: 0 0 12px; padding: 14px 16px;
                  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--ring); }
.income .filter label { display: grid; gap: 5px; font-weight: 600; font-size: .85rem; color: var(--muted); }
.income .filter input[type=date], .income .filter input[type=text] { width: auto; padding: 9px 12px; border-radius: 10px; color: var(--text); background: var(--bg); }
.income .filter input[type=text] { width: 7.5em; }
.income .filter .btn, .income .filter .primary { padding: 9px 18px; border-radius: 10px; }
.income .filter button#print-btn { margin-inline-start: auto; }
.income .range { color: var(--muted); margin: 0 2px 14px; font-weight: 600; }

/* activity log */
.income .filter select { width: auto; padding: 9px 12px; border-radius: 10px; color: var(--text); background: var(--bg); border: 1px solid var(--line); font: inherit; }
.income .filter label.grow { flex: 1 1 14em; }
.income .filter label.grow input[type=text] { width: 100%; }
.log-table td { vertical-align: top; }
.log-table .when { white-space: nowrap; text-align: right; }
.log-table .act-delete, .log-table .act-login_failed { font-weight: 700; color: var(--kpi-red); }
.log-table .act-create { font-weight: 700; color: var(--kpi-green); }
.log-table .act-login_failed { color: var(--kpi-amber); }
.log-details { min-width: 16em; margin: 6px 0 2px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; font: inherit; font-size: .9rem; background: var(--panel-2); border-radius: 8px; }

/* phones: nothing may be wider than the screen (the tabs scroll sideways instead of widening the page) */
.income .tabs { max-width: 100%; overflow-x: auto; }
.income .range, .income .chips { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .income .tabs a { padding: 8px 12px; white-space: nowrap; }
  .income .filter label { flex: 1 1 8em; }
  .income .filter select, .income .filter input[type=text], .income .filter input[type=date] { width: 100%; min-width: 0; }
  .owing .filter .outputs { margin-inline-start: 0; }
}

/* owing report */
.owing .help-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; margin: 0 0 14px; }
.owing .help-box summary { cursor: pointer; font-weight: 600; }
.owing .help-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 10px 0 4px; }
.owing .help-list dt { font-weight: 600; }
.owing .help-list dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.owing .outputs { margin: 0 0 14px; }
.owing .print-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.owing .cols-box { flex: 1 1 18em; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 14px; }
.owing .cols-box summary { cursor: pointer; font-weight: 600; }
.owing .cols-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(11em, 1fr)); gap: 6px 14px; margin: 10px 0 4px; }
.owing .cols-list label { display: flex; gap: 6px; align-items: center; font-weight: 400; }
.owing .print-form > .btn, .owing .print-form > button { padding: 9px 18px; border-radius: 10px; }
.owing .filter label.check { display: flex; gap: 8px; align-items: center; padding-bottom: 10px; }
.owing .chips { margin: 0 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.owing .chip { padding: 4px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.owing .sort { color: inherit; text-decoration: none; white-space: nowrap; }
.owing-table td.owed { color: var(--kpi-red); font-weight: 600; }
.owing-table td, .owing-table th { white-space: nowrap; }
.owing-table td.l { white-space: normal; min-width: 9em; }
.owing .pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 14px 0; color: var(--muted); }

/* reconcile */
.reconcile .quick { margin: 0 0 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.reconcile .chip { padding: 4px 12px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .9rem; }
.reconcile .chip.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.reconcile .gap-ok { color: var(--kpi-green); font-weight: 600; margin: 0 2px 12px; }
.reconcile tr.picked td { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.reconcile .sub-title { margin: 14px 2px 6px; font-size: 1rem; }
.reconcile .hint { margin: 0 2px 8px; font-size: .85rem; }
.reconcile .sort { color: inherit; text-decoration: none; white-space: nowrap; }
.reconcile .filter label.check { display: flex; gap: 8px; align-items: center; padding-bottom: 10px; }
.reconcile .filter .outputs { margin-inline-start: auto; display: inline-flex; gap: 8px; flex-wrap: wrap; }
.reconcile .filter select { width: auto; padding: 9px 12px; border-radius: 10px; color: var(--text); background: var(--bg); border: 1px solid var(--line); font: inherit; }
.reconcile .filter label.grow { flex: 1 1 12em; }
.reconcile .filter label.grow input[type=text] { width: 100%; }

/* financial orders */
.orders .filter select { width: auto; padding: 9px 12px; border-radius: 10px; color: var(--text); background: var(--bg); border: 1px solid var(--line); font: inherit; }
.orders .filter label.grow { flex: 1 1 12em; }
.orders .filter label.grow input[type=text] { width: 100%; }
.orders td.discount { color: var(--kpi-green); font-weight: 600; }
.kpi b.small { font-size: 1.05rem; }
.orders .facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 8px 0 0; }
.orders .facts dt { color: var(--muted); font-weight: 600; }
.orders .facts dd { margin: 0; overflow-wrap: anywhere; }
.orders .pager { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 14px 0; color: var(--muted); }

/* vouchers */
.vouchers .filter select { width: auto; padding: 9px 12px; border-radius: 10px; color: var(--text); background: var(--bg); border: 1px solid var(--line); font: inherit; }
.vouchers .filter label.grow { flex: 1 1 12em; }
.vouchers .filter label.grow input[type=text] { width: 100%; }
.vouchers .choose { display: flex; gap: 12px; flex-wrap: wrap; margin: 8px 0 20px; }
.vouchers .choose .btn { padding: 14px 28px; font-size: 1.05rem; text-decoration: none; }
.vouchers tr.dup td { background: color-mix(in srgb, var(--kpi-red) 22%, transparent); }
.vouchers .dup-warning { background: color-mix(in srgb, var(--kpi-red) 14%, var(--panel)); border: 1px solid var(--kpi-red); border-radius: 10px; padding: 8px 14px; margin: 0 0 14px; }
.vouchers .dup-warning p { margin: 6px 0; overflow-wrap: anywhere; }
.badge.void { background: var(--kpi-amber); color: #000; border-radius: 8px; padding: 2px 10px; font-size: .8rem; vertical-align: middle; }
.vouchers .facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 8px 0 0; }
.vouchers .facts dt { color: var(--muted); font-weight: 600; }
.vouchers .facts dd { margin: 0; overflow-wrap: anywhere; }

/* student data */
.students .filter label.grow { flex: 1 1 14em; }
.students .filter label.grow input[type=text] { width: 100%; }
.students .facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 8px 0 0; }
.students .facts dt { color: var(--muted); font-weight: 600; }
.students .facts dd { margin: 0; overflow-wrap: anywhere; }

/* push notifications */
.notifications .push-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.notifications .push-note { min-height: 1.4em; color: var(--kpi-green); font-weight: 600; margin: 8px 0; }
.notifications .push-note.bad { color: var(--kpi-red); }
.notifications .gap-note { margin: 10px 0; }

/* the figures */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0 0 16px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 18px 14px 14px; background: var(--panel); color: var(--text);
       border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--ring); overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--kpi-blue); }
.kpi.credit::before { background: var(--kpi-green); } .kpi.debit::before { background: var(--kpi-amber); }
.kpi.owed::before { background: var(--kpi-red); } .kpi.clear::before { background: var(--kpi-green); }
.kpi span { font-size: .85rem; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi.credit b { color: var(--kpi-green); } .kpi.owed b { color: var(--kpi-red); }

/* cards and tables */
.income .income-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 860px) { .income .income-grid { grid-template-columns: minmax(0, 1fr); } }
.income .card { margin: 0; min-width: 0; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--ring); overflow: hidden; }
.income .card.wide { grid-column: 1 / -1; }
.income .card h2 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 14px 18px; font-size: 1rem; font-weight: 700;
                   background: transparent; color: var(--text); border-bottom: 1px solid var(--line); }
.income .card h2 .count { margin-inline-start: auto; font-size: .78rem; font-weight: 600; padding: 2px 10px; border-radius: 999px;
                          background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; }
/* too much data: the table scrolls inside its card, the header and the total stay in view */
.income .scroll { max-height: 520px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.income .card.dates .scroll { max-height: 640px; }
.income table { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; }
.income th, .income td { padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.income thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted); font-size: .8rem; font-weight: 700;
                   letter-spacing: .02em; border-bottom: 1px solid var(--line); }
.income tbody tr:nth-child(even) { background: transparent; }
.income tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.income tfoot td { position: sticky; bottom: 0; z-index: 2; background: var(--panel-2); font-weight: 700; border-top: 1px solid var(--line); border-bottom: 0; }
.income td.num { font-weight: 600; font-variant-numeric: tabular-nums; }
.income td.l, .income th.l { text-align: right; white-space: normal; }
.income td a { color: var(--accent); font-weight: 600; text-decoration: none; }
.income td a:hover { text-decoration: underline; }
.income td.void { color: var(--warn); font-weight: 700; }
.income details.sub summary { cursor: pointer; font-weight: 600; }
.income details.sub table { margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.income details.sub tr:last-child td { border-bottom: 0; }
.income .empty { padding: 36px 0; }
.gap-note { color: var(--bad); font-weight: 600; background: color-mix(in srgb, var(--bad) 12%, transparent); border-radius: 10px; padding: 10px 14px; }

@media (max-width: 640px) {
  .top { padding: 8px 12px; } .brand span { font-size: .95rem; }
  main { padding: 14px 10px 40px; } th, td { padding: 7px 9px; font-size: .92rem; }
}

/* the "install the app" banner (shown by pwa.js) */
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 0 16px 28px; }
.install { position: fixed; inset-inline: 12px; bottom: 12px; z-index: 20; display: flex; align-items: center; gap: 12px; max-width: 520px; margin-inline: auto;
           padding: 12px 14px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
           box-shadow: 0 12px 36px rgba(0, 0, 0, .35); }
.install[hidden], .install [hidden] { display: none; }                              /* button.primary sets display, which would beat the hidden attribute */
.install img { border-radius: 10px; flex: none; }
.install-text { display: grid; gap: 2px; flex: 1; min-width: 0; font-size: .9rem; } .install-text b { font-size: 1rem; } .install-text span { color: var(--muted); }
.install .primary { padding: 8px 16px; flex: none; } .install .link { color: var(--muted); flex: none; }
@media (max-width: 480px) { .install { flex-wrap: wrap; } .install-text { flex-basis: calc(100% - 60px); } }

.print-only { display: none; }
/* printing (the income page; the statement has its own print page): plain black on white, no navigation, no filters */
@media print {
  :root { --bg: #fff; --panel: #fff; --text: #000; --muted: #444; --line: #bbb; --brand: #fff; --brand-text: #000; --row-alt: #f3f3f3;
          --chip-debit: #fff; --chip-credit: #fff; --chip-owed: #fff; --chip-clear: #fff; --chip-current: #fff; --chip-required: #fff;
          --chip-text: #000; --row-hl: #eee; --shadow: none; }
  .top, .tabs, .filter, .no-print, .actions { display: none !important; }
  .print-only.print-head { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px; }
  .print-head .printed { margin-inline-start: auto; text-align: left; font-size: 10pt; }
  .print-head b { font-size: 16pt; }
  .income h1 { display: none; }
  body { background: #fff; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border-color: #999; break-inside: avoid-page; }
  .card > header, .card h2 { background: #fff; color: #000; border-bottom: 1px solid #999; }
  .chip, .kpi { border: 1px solid #999; box-shadow: none; } .kpi b, .kpi.credit b, .kpi.owed b { color: #000; }
  .income .scroll, .income .card.dates .scroll { max-height: none !important; overflow: visible !important; }
  .income thead th, .income tfoot td { position: static; background: #f3f3f3; color: #000; }
  .income .card { box-shadow: none; border-radius: 0; }
  .income-grid { display: block; } .income-grid .card { margin-top: 12px; }
  table { min-width: 0; } th, td { padding: 4px 8px; }
  thead { display: table-header-group; } tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* the student's photo on the statement: a small card beside the name, filled in after the page has loaded. The picture is a background
   behind a transparent layer (no <img>), and selecting, dragging and the long-press menu are off, so there is no easy way to save it. */
.student-head .photo { margin: 0; width: 110px; flex: none; text-align: center; }
.photo, .photo-box { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; }
.photo-box { position: relative; width: 110px; height: 140px; border: 1px solid var(--border); border-radius: 8px; display: flex; align-items: center;
  justify-content: center; overflow: hidden; padding: 6px; font-size: 12px; line-height: 1.5; color: var(--muted, #8a8f98); }
.photo-box::after { content: ""; position: absolute; inset: 0; }
.photo-box.has-photo { background-size: cover; background-position: center; background-repeat: no-repeat; padding: 0; }
.photo figcaption { margin-top: 4px; font-size: 12px; color: var(--muted, #8a8f98); }
.photo-mark { position: absolute; inset: -40%; transform: rotate(-30deg); display: flex; flex-direction: column; justify-content: space-around;
  pointer-events: none; font-size: 10px; line-height: 1.2; white-space: nowrap; direction: ltr; color: rgba(255, 255, 255, 0.6);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8); }
@media (max-width: 600px) { .student-head .photo { width: 88px; } .photo-box { width: 88px; height: 112px; } }
@media print { .photo { display: none; } }
