/* Sanabil Institute - admin panel */
:root {
  --ink: #1a1d23;
  --muted: #5c6370;
  --line: #e3e6ea;
  --field: #d5d9df;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --primary: #0f7a55;
  --primary-dark: #0a5c40;
  --primary-soft: #e6f4ee;
  --side: #ffffff;
  --green: #0f7a55;
  --red: #b42318;
  --red-soft: #fdecea;
  --amber: #8a5300;
  --amber-soft: #fef3e2;
  --focus: #1d5fbf;
  --radius: 8px;
  --radius-lg: 14px;
  --font: "Figtree", system-ui, sans-serif;
  --serif: "Figtree", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--primary); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 2px; }

/* Layout */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--side); color: #d6deeb; padding: 20px 0 32px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 20px 20px; color: #fff; text-decoration: none; font-weight: 700; }
.brand img, .brand svg { width: 34px; height: 34px; }
.brand small { display: block; font-weight: 400; color: #9fb0c9; font-size: .8rem; }
.nav-group { margin-top: 18px; }
.nav-group > span { display: block; padding: 0 20px 6px; font-size: .78rem; color: #8a9bb6; font-weight: 600; }
.sidebar a.nav { display: block; padding: 7px 20px; color: #d6deeb; text-decoration: none; border-left: 3px solid transparent; }
.sidebar a.nav:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar a.nav.is-active { background: rgba(255,255,255,.1); color: #fff; border-left-color: #5fbf86; font-weight: 600; }

.main { min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 12px 32px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar .who { color: var(--muted); font-size: .9rem; }
.topbar form { margin: 0; }
.content { padding: 28px 32px 64px; max-width: 1200px; }
.menu-toggle { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 1.9rem; line-height: 1.2; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel h2 { font-size: 1.1rem; margin: 0 0 14px; }
.panel h2 + p { margin-top: -8px; color: var(--muted); }
.panel.flush { padding: 0; overflow-x: auto; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #f8f9fb; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table .thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; background: var(--bg); display: block; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sub { display: block; color: var(--muted); font-size: .85rem; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #e8ecf2; color: var(--muted); }
.badge.ok { background: #e3f3ea; color: #136a39; }
.badge.warn { background: #fbefd9; color: var(--amber); }
.badge.off { background: #f9e3e4; color: #9b1d22; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 15px; border-radius: var(--radius); border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3; }
.btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: #b7c0cc; background: #f8f9fb; }
.btn.danger { background: var(--panel); color: var(--red); border-color: #e6b8ba; }
.btn.danger:hover { background: #fbeeee; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 500; }
.inline { display: inline; margin: 0; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, .field .label { font-weight: 600; font-size: .92rem; }
.field .help { color: var(--muted); font-size: .85rem; }
.field .error { color: var(--red); font-size: .85rem; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date],
input[type=datetime-local], input[type=color], input[type=search], input[type=file], select, textarea {
  font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #c5cdd8; border-radius: var(--radius); background: #fff; width: 100%;
}
input[type=color] { height: 40px; padding: 3px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid rgba(27,79,156,.2); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.check input { margin-top: 4px; }
.form-foot { display: flex; gap: 10px; margin-top: 8px; }
.current-file { display: flex; gap: 10px; align-items: center; }
.current-file img { width: 120px; height: 72px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
trix-editor { min-height: 260px; background: #fff; border-color: #c5cdd8 !important; }
trix-toolbar .trix-button-group--file-tools { display: none; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; }
.perm-grid legend { font-weight: 700; padding: 0 4px; }

/* Messages */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid; }
.flash.ok { background: #e9f6ef; border-color: #b6dfc6; color: #11532e; }
.flash.err { background: #fbeeee; border-color: #edc2c4; color: #8a1a1f; }
.flash ul { margin: 6px 0 0; padding-left: 18px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--primary); font-weight: 600; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select { width: auto; min-width: 180px; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; }
.stat b { display: block; font-size: 1.6rem; font-family: var(--serif); }
.stat span { color: var(--muted); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.media-item { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.media-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bg); }
.media-item .meta { padding: 8px 10px; font-size: .82rem; display: flex; flex-direction: column; gap: 6px; }
.media-item input { font-size: .8rem; padding: 4px 6px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 5px 11px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; text-decoration: none; color: var(--ink); }
.pagination .is-current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--side); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 10px; padding: 32px; }
.auth-card .brand { color: var(--ink); padding: 0 0 18px; }
.auth-card .brand small { color: var(--muted); }
.auth-card h1 { font-family: var(--serif); font-size: 1.6rem; margin: 0 0 18px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 30; }
  .sidebar.is-open { transform: none; }
  .menu-toggle { display: inline-flex; margin-right: auto; }
  .content { padding: 20px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Money and multi-column helpers */
.money, td.money, th.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.big-figure { font-family: var(--serif); font-size: 2rem; font-weight: 600; }
.big-figure.due { color: var(--red); }
.big-figure.clear { color: var(--green); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details.inline-form summary { cursor: pointer; color: var(--primary); font-weight: 600; }
details.inline-form[open] { background: #f8f9fb; padding: 12px; border-radius: var(--radius); }
.table tr.sub-row td { background: #fafbfc; font-size: .9rem; padding-top: 6px; padding-bottom: 6px; }
.notice { padding: 10px 14px; border-left: 4px solid var(--amber); background: #fdf6e7; margin-bottom: 14px; }
@media (max-width: 900px) { .grid-3, .split { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; } }

/* Short bullet notes under a panel heading */
.help-list { margin: 0 0 14px; padding-left: 20px; color: var(--muted); font-size: .92rem; }
.help-list li { margin: 2px 0; }

/* Registration: one row per required education */
.edu-rows { display: grid; gap: 14px; }
.edu-row { border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.edu-row h3 { margin: 0 0 10px; font-size: 1rem; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.edu-row h3 .badge { font-weight: 600; }
.edu-row .grid-5 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 14px; }
.edu-row .field label { font-size: .85rem; }
.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.photo-thumb { width: 96px; height: 120px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f3f5f8; }

/* ---- Step-by-step "Give access" ---- */
.wizard-steps { list-style: none; display: flex; gap: 8px; padding: 0; margin: 0 0 16px; counter-reset: step; flex-wrap: wrap; }
.wizard-steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: #eef2f7; color: var(--muted); font-weight: 600; font-size: .92rem; }
.wizard-steps li::before { content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 1px solid var(--line); }
.wizard-steps li.is-current { background: #1b4f9c; color: #fff; }
.wizard-steps li.is-current::before { color: #1b4f9c; border-color: #fff; }
.wizard-steps li.is-done::before { content: "✓"; color: #136a39; }
.choice-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin: 12px 0; max-height: 420px; overflow: auto; padding: 2px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.choice:has(input:checked) { border-color: #1b4f9c; box-shadow: 0 0 0 2px rgba(27, 79, 156, .2); }
.choice input { margin-top: 3px; }
.choice .sub, .role-card .sub { display: block; }
.mode-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-bottom: 16px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.role-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.role-card:has(input:checked) { border-color: #1b4f9c; box-shadow: 0 0 0 2px rgba(27, 79, 156, .2); }
.role-card input { margin-top: 3px; }
.role-card details { margin-top: 6px; font-size: .9rem; }
.role-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.perm-group legend { font-weight: 700; padding: 0 6px; }
.check-row { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: .93rem; cursor: pointer; }
.check-row input { margin-top: 3px; }
.review { margin-top: 16px; padding: 14px 16px; border-left: 4px solid #1b4f9c; background: #f3f6fb; border-radius: 4px; }
.review h3 { margin: 0 0 4px; font-size: 1rem; }
.review p { margin: 0; }

/* Approval cards (refunds, deletions) and the small count badge in the sidebar */
.approval-card { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.approval-card .sub { display: block; }
.nav .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #c8282e; color: #fff; font-size: .75rem; text-align: center; line-height: 20px; }

/* ---- Financial statements (screen; the PDF has its own styles) ---- */
.period-presets { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; margin-bottom: 6px; }
.st-tabs { display: flex; gap: 6px 14px; flex-wrap: wrap; margin: 0 0 12px; font-size: .92rem; }
.st-tabs span { display: inline-flex; gap: 6px; align-items: baseline; }
.st-tabs .st-pdf { font-size: .78rem; font-weight: 700; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.statements .st-section { padding: 6px 0 18px; scroll-margin-top: 80px; }
.statements .st-section + .st-section, .statements > div + div .st-section { border-top: 1px solid var(--line); padding-top: 16px; }
.statements h2 { margin: 0 0 8px; }
.st-note { color: var(--muted); margin: 0 0 8px; }
.st-muted { color: var(--muted); font-size: .88rem; }
.st-table { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: .94rem; }
.st-table th { text-align: left; border-bottom: 2px solid var(--line); padding: 6px 8px; font-weight: 600; }
.st-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.st-table .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-sub td { font-weight: 600; background: #f6f8fb; }
.st-total td { font-weight: 700; border-top: 2px solid #17202e; }
.st-figures { width: 100%; border-collapse: separate; border-spacing: 8px; margin: 0 -8px 8px; }
.st-figures td { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; width: 33%; }
.st-figures span { display: block; color: var(--muted); font-size: .88rem; }
.st-figures b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.st-insights td { border-bottom: 1px solid var(--line); }
.st-tone { width: 90px; font-weight: 700; white-space: nowrap; }
.st-good { color: #136a39; } .st-warning { color: #8a5a00; } .st-serious { color: #a3201f; } .st-neutral { color: var(--muted); }
.st-bar { background: #eef2f7; height: 10px; border-radius: 3px; overflow: hidden; }
.st-bar div { background: #1b4f9c; height: 10px; }
@media (max-width: 720px) { .st-figures td { display: block; width: auto; margin-bottom: 8px; } }

/* Student record: quick links to everything about this student */
.quick-links { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 0 0 16px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .93rem; }
.quick-links a { font-weight: 600; }
.quick-links form { margin-left: auto; }
.link-danger { background: none; border: 0; padding: 0; color: #b42318; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Student record: quick links to everything about this student */
.quick-links { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 0 0 16px; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: .93rem; }
.quick-links a { font-weight: 600; }
.quick-links form { margin-left: auto; }
.link-danger { background: none; border: 0; padding: 0; color: #b42318; font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.plain-list { list-style: none; margin: 0; padding: 0; columns: 2 220px; }
.plain-list li { padding: 3px 0; break-inside: avoid; }

/* Row of figures at the top of a page (same as .stat-row) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.stats .stat b { font-size: 1.35rem; }

/* Dashboard */
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin-bottom: 20px; }
.dash-row > .panel { margin-bottom: 0; min-width: 0; }
.dash-wide { flex: 2 1 520px; }
.dash-side { flex: 1 1 280px; }
.dash-half { flex: 1 1 420px; }
.dash-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.dash-head h2 { margin: 0; }
.dash-head a { margin-left: auto; font-weight: 600; font-size: .92rem; }
.dash-head.bare { padding: 0 0 12px; border: 0; }
.dash-foot { margin: 0; padding: 14px 22px; color: var(--muted); }
.dash-label { font-size: 1rem; margin: 28px 0 10px; color: var(--muted); }
.approvals { list-style: none; margin: 0; padding: 0; }
.approvals li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 14px 22px; border-bottom: 1px solid #eef1f5; }
.approvals li:last-child { border-bottom: 0; }
.approvals .kind { flex: 0 0 104px; text-align: center; font-size: .78rem; font-weight: 700; border-radius: 4px; padding: 3px 6px; }
.approvals .what { flex: 1 1 240px; min-width: 0; }
.approvals .do { display: flex; gap: 6px; }
.tone-amber { background: #fbefd9; color: #7a4f00; }
.tone-blue { background: #e6eefa; color: #1b4f9c; }
.tone-green { background: #e3f3ea; color: #136a39; }
.tone-purple { background: #efe8f8; color: #5b3f86; }
.tone-red { background: #f9e3e4; color: #9b1d22; }
.balances { margin: 0; }
.balances > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #eef1f5; }
.balances dt a { font-weight: 600; text-decoration: none; }
.balances dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.balances dd.neg { color: var(--red); }
.balances .total { border-bottom: 0; padding-top: 12px; font-weight: 700; }
.balances .total dd { font-size: 1.2rem; }
.meter { height: 10px; border-radius: 5px; background: #e6eaf0; overflow: hidden; margin: 10px 0 16px; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.mini-stats div { background: #f5f7fa; border-radius: var(--radius); padding: 10px 12px; }
.mini-stats b { display: block; font-variant-numeric: tabular-nums; }
.mini-stats span { color: var(--muted); font-size: .85rem; }
.late { color: #9b1d22; font-weight: 700; }
.dash-salary { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; }
.dash-salary > div { flex: 1 1 220px; }
.dash-salary h2 { margin-bottom: 4px; }
.steps { flex: 2 1 420px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; list-style: none; margin: 0; padding: 0; }
.steps li { background: #f5f7fa; border-radius: var(--radius); padding: 10px 12px; font-size: .92rem; }
.steps li span { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); }
.steps li em { display: block; font-style: normal; color: var(--muted); font-size: .82rem; }
.steps li.done { background: #e3f3ea; }
.steps li.done span { color: #136a39; }
.steps li.now { background: #fbefd9; outline: 2px solid #e0b04a; }
.steps li.now span { color: #7a4f00; }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }

/* Waive all or part of a fine */
details.waive { display: inline-block; vertical-align: top; }
details.waive[open] { display: block; }
details.waive > summary { list-style: none; }
details.waive > summary::-webkit-details-marker { display: none; }
details.waive form { position: static; margin-top: 8px; width: 240px; display: grid; gap: 8px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(16, 40, 79, .14); text-align: left; }
details.waive label { display: grid; gap: 3px; font-size: .85rem; font-weight: 600; }
details.waive input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }

/* ===== Admin refresh: light menu, calm surfaces, one green for actions ===== */
body { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { letter-spacing: -.005em; }

/* Menu */
.sidebar { background: var(--side); color: var(--ink); border-right: 1px solid var(--line); padding: 18px 12px 28px; }
.brand { color: var(--ink); padding: 0 8px 14px; }
.brand small { color: var(--muted); }
.nav-find { padding: 0 4px 10px; }
.nav-find input { height: 38px; background: #f8f9fa; border-color: var(--field); font-size: .92rem; }
.nav-group { margin-top: 14px; }
.nav-group > span, .nav-group.fold > summary { display: block; padding: 0 10px 4px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.nav-group.fold > summary { cursor: pointer; list-style: none; padding-top: 4px; padding-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.nav-group.fold > summary::-webkit-details-marker { display: none; }
.nav-group.fold > summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin-left: auto; margin-right: 6px; transition: transform .15s; }
.nav-group.fold[open] > summary::after { transform: rotate(45deg); }
.sidebar a.nav { display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 1px 0; color: var(--ink); border-left: 0; border-radius: var(--radius); }
.sidebar a.nav:hover { background: #f1f3f5; color: var(--ink); }
.sidebar a.nav.is-active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.sidebar .badge, .sidebar .count, .count { margin-left: auto; display: inline-block; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: .78rem; font-weight: 700; }

/* Top bar and page heading */
.topbar { background: var(--panel); border-bottom-color: var(--line); }
.content { max-width: 1280px; }
.page-head h1 { font-weight: 700; font-size: 1.75rem; }
.crumbs { display: flex; gap: 8px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Surfaces */
.panel { border-radius: var(--radius-lg); border-color: var(--line); }
.panel.flush { border-radius: var(--radius-lg); }
.stat { border-radius: var(--radius-lg); }
.stat b { font-family: var(--font); font-weight: 700; }
.big-figure { font-family: var(--font); font-weight: 700; }
.table th { background: #fafbfc; color: var(--muted); font-size: .8rem; }
.table td { border-bottom-color: #eef0f3; }
.table tr.sub-row td { background: #fcfcfd; }

/* Controls */
.btn { border-radius: var(--radius); padding: 9px 16px; min-height: 40px; }
.btn.small { min-height: 32px; padding: 5px 11px; }
.btn.secondary { border-color: var(--field); }
.btn.wide { width: 100%; justify-content: center; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], input[type=file], select, textarea { border-color: var(--field); border-radius: var(--radius); padding: 9px 11px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 2px solid rgba(15, 122, 85, .18); }
details.inline-form summary { color: var(--primary-dark); }
details.inline-form[open] { background: #fafbfc; }
.badge { border-radius: 6px; padding: 2px 8px; }
.badge.ok { background: var(--primary-soft); color: var(--primary-dark); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.off { background: var(--red-soft); color: var(--red); }
.flash { border-radius: var(--radius); }
.flash.ok { background: var(--primary-soft); border-color: #b9e0cd; color: var(--primary-dark); }
.notice { border-left: 0; border-radius: var(--radius); background: var(--amber-soft); color: #4a3300; }
.tabs a.is-active { border-bottom-color: var(--primary); }
.pagination .is-current { background: var(--primary); border-color: var(--primary); }
.wizard-steps li.is-current { background: var(--primary); }
.wizard-steps li.is-current::before { color: var(--primary); }
.choice:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 122, 85, .18); }
.meter span { background: var(--primary); }

/* Sign-in page */
.auth { background: var(--bg); }
.auth-card { border: 1px solid var(--line); border-radius: var(--radius-lg); }
.auth-card h1 { font-family: var(--font); font-weight: 700; }

/* Person summary (student fees and record) */
.person-head { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 22px; margin-bottom: 14px; }
.person-head .avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; }
.person-head .who { flex: 1 1 260px; min-width: 0; }
.person-head h1 { margin: 0; font-size: 1.65rem; font-weight: 700; }
.person-head p { margin: 2px 0 0; color: var(--muted); }
.person-head .figures { margin: 0; display: grid; grid-template-columns: repeat(3, auto); gap: 8px 32px; }
.person-head .figures dt { font-size: .82rem; color: var(--muted); }
.person-head .figures dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 700; }
.person-head .figures dd.due { color: var(--red); }
.person-head .figures dd.clear { color: var(--primary); }
.person-head .figures dd.late { color: var(--amber); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* Fees page: details on the left, the payment form always to hand on the right */
.fees-layout { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.fees-main { flex: 2 1 560px; min-width: 0; }
.fees-side { flex: 1 1 300px; min-width: 0; position: sticky; top: 16px; }
.fees-side .stack { display: grid; gap: 12px; }
.fees-side .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fees-main .split { grid-template-columns: 1fr; }
@media (max-width: 900px) {
  .fees-side { position: static; }
  .person-head .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; }
  .person-head .figures dd { font-size: 1.25rem; }
}
.role-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(15, 122, 85, .18); }
.review { border-left: 0; background: var(--primary-soft); border-radius: var(--radius); }
.st-bar div { background: var(--primary); }
.fees-main .table td:first-child > a, .table td a[href*="/invoices/"] { white-space: nowrap; }

/* Logins and passwords */
.panel.issue { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; }
.panel.issue > div { flex: 1 1 360px; }
.panel.issue h2 { margin-bottom: 4px; }
.panel.one-time { border: 2px solid var(--primary); background: var(--primary-soft); }
code.secret { font-size: 1.25rem; font-weight: 700; letter-spacing: .04em; background: #fff; padding: 2px 10px; border-radius: 6px; border: 1px solid var(--line); user-select: all; }
[hidden] { display: none !important; }
