:root {
  --bg-page: #F5F0F8;
  --bg-header: #4C126B;
  --header-nav-active: #350B4C;
  --color-primary-orange: #FF6A00;
  --color-secondary-gold: #FFA800;
  --text-dark: #28083B;
  --text-light: #FFFFFF;
  --border-light: #E2D8E8;
  --brand: var(--color-primary-orange);
  --brand-dark: var(--bg-header);
  --bg: var(--bg-page);
  --line: var(--border-light);
  --text: var(--text-dark);
  --muted: #6B5B75;
  --bad: #b3261e;
  --warn: #9a6700;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0 0 .6rem; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
button, input, select, textarea { font: inherit; }
input, select, textarea { padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; max-width: 100%; color: var(--text-dark); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--color-primary-orange); outline-offset: 1px; border-color: var(--color-primary-orange); }
textarea { width: 100%; min-height: 5rem; }
button { padding: .45rem .9rem; border: 0; border-radius: 6px; background: var(--color-primary-orange); color: var(--text-light); cursor: pointer; transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease; }
button:hover { background: var(--color-secondary-gold); box-shadow: 0 2px 8px rgba(76, 18, 107, 0.12); transform: translateY(-1px); }
button.ghost { background: #fff; color: var(--color-primary-orange); border: 1px solid var(--color-primary-orange); }
button.ghost:hover { background: var(--color-secondary-gold); border-color: var(--color-secondary-gold); color: var(--text-light); }
button.danger { background: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.login { max-width: 380px; margin: 8vh auto; background: #fff; padding: 2rem; border: 1px solid var(--border-light); border-radius: 12px; box-shadow: 0 8px 28px rgba(76, 18, 107, 0.05); }
.login h1 { color: var(--bg-header); }
.brand-logo { display: block; width: 100%; max-width: 380px; height: auto; }
.document-logo { width: 280px; margin-bottom: 1rem; }
.print-brand { display: none; }
.login label { display: block; margin: .6rem 0 .2rem; font-size: .85rem; color: var(--text-dark); }
.login input { width: 100%; }
.login button { width: 100%; margin-top: 1rem; }
.platform-login-link { margin: 1.2rem 0 0; text-align: center; font-size: .85rem; }
.platform-login-link a { color: var(--bg-header); }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: 100vh; }
nav { background: var(--bg-header); color: var(--text-light); padding: 1rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
nav .logo { color: var(--text-light); font-size: 1.3rem; font-weight: 750; padding: .3rem .6rem 1rem; }
nav .logo .brand-logo { background: #fff; border-radius: 6px; padding: .3rem; }
nav a { color: rgba(255, 255, 255, 0.88); padding: .5rem .7rem; border-left: 3px solid transparent; border-radius: 0 6px 6px 0; cursor: pointer; text-decoration: none; }
nav a.active, nav a:hover { background: var(--header-nav-active); border-left-color: var(--color-primary-orange); color: var(--text-light); }
nav .nav-group { margin-bottom: .35rem; }
nav .nav-group > summary { color: var(--text-light); padding: .5rem .7rem; font-size: .9rem; }
nav .nav-group > a { display: block; margin-left: .4rem; font-size: .85rem; }
nav a:focus-visible, nav summary:focus-visible { outline: 2px solid var(--color-secondary-gold); outline-offset: -2px; }
nav { position: sticky; top: 0; height: 100vh; overflow: hidden; }
nav .nav-head { flex: none; }
nav .nav-menu { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .2rem; padding-top: .4rem; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.35) transparent; }
nav .nav-menu::-webkit-scrollbar { width: 6px; }
nav .nav-menu::-webkit-scrollbar-track { background: transparent; }
nav .nav-menu::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.35); border-radius: 3px; }
.workspace { min-width: 0; }
.user-bar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: flex-end; padding: .7rem 1.6rem; background: var(--bg-page); }
.user-bar .who { width: 260px; max-width: 100%; margin: 0; padding: .6rem; color: var(--text-light); background: var(--bg-header); border: 1px solid rgba(255, 255, 255, 0.22); border-left: 4px solid var(--color-primary-orange); border-radius: 8px; }
.who-id { display: flex; align-items: center; gap: .55rem; }
.who-avatar { flex: none; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--color-primary-orange); color: #fff; font-weight: 750; font-size: 1rem; border: 2px solid rgba(255, 255, 255, 0.85); }
.who-avatar img { width: 100%; height: 100%; object-fit: cover; }
.who-text { min-width: 0; line-height: 1.25; }
.who-name { font-weight: 750; font-size: .95rem; overflow-wrap: anywhere; }
.who-role { color: var(--color-secondary-gold); font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em; }
.who-school { color: rgba(255, 255, 255, 0.88); font-size: .8rem; overflow-wrap: anywhere; }
.who button { margin-top: .5rem; width: 100%; min-height: 30px; padding: .25rem .5rem; font-size: .82rem; background: var(--color-primary-orange); color: var(--text-light); }
.who button:hover { background: var(--color-secondary-gold); }
main { padding: 1.4rem 1.6rem; overflow-x: auto; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1rem; box-shadow: 0 4px 18px rgba(76, 18, 107, 0.05); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; box-shadow: 0 4px 18px rgba(76, 18, 107, 0.05); }
.stat b { display: block; font-size: 1.5rem; color: var(--bg-header); }
.stat span { color: var(--muted); font-size: .85rem; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); font-size: .93rem; color: var(--text-dark); }
th { color: var(--bg-header); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 2px solid var(--border-light); }
tbody tr:hover { background: var(--bg-page); }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: .8rem; }
.row > div { display: flex; flex-direction: column; gap: .2rem; }
.row > div[hidden] { display: none; }
.row label { font-size: .8rem; color: var(--bg-header); }
.table-scroll { overflow-x: auto; }
.accounting-page, .accounting-page .card, .accounting-page .row > div { min-width: 0; max-width: 100%; }
.accounting-page .row > div { flex: 1 1 180px; }
.accounting-page input, .accounting-page select { min-width: 0; max-width: 100%; }
.coa-category { margin: .5rem 0; border-left: 4px solid var(--bg-header); padding-left: .6rem; }
.coa-category > summary { font-weight: 700; color: var(--bg-header); cursor: pointer; padding: .25rem 0; }
.coa-table { width: 100%; }
.coa-table .coa-group th { text-align: left; background: #F1E8F6; color: var(--bg-header); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.coa-table .coa-code { font-variant-numeric: tabular-nums; white-space: nowrap; }
.coa-table .coa-name { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.coa-table .coa-depth-0 .coa-name { padding-left: .75rem; }
.coa-table .coa-depth-1 .coa-name { padding-left: 2rem; }
.coa-table .coa-depth-2 .coa-name { padding-left: 3.25rem; }
.coa-table .coa-depth-3 .coa-name, .coa-table .coa-depth-4 .coa-name { padding-left: 4.5rem; }
.coa-table .coa-depth-1 .coa-code, .coa-table .coa-depth-2 .coa-code, .coa-table .coa-depth-3 .coa-code, .coa-table .coa-depth-4 .coa-code { color: #555; }
.coa-table .coa-parent td { font-weight: 700; }
.coa-table .coa-branch { color: var(--bg-header); font-family: monospace; }
.coa-table .coa-inactive td { color: #888; }
.accounting-page .journal-line { align-items: flex-end; }
.accounts-interface-group { margin-top: 14px; }
.accounts-interface-group h4 { margin: 0 0 6px; }
.accounts-interface-group select { min-width: 220px; }
.gl-picker { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.gl-picker .gl-search { font-size: .9em; padding: 6px 10px; }
.gl-picker .gl-count:empty { display: none; }
.gl-view { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.gl-detail { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
.gl-summary .cards { margin: .6rem 0 1rem; }
.gl-table td.num, .gl-table th:nth-child(n+5), .gl-lines td.num, .gl-lines th.num { text-align: right; white-space: nowrap; }
.gl-table tr.gl-row { cursor: pointer; }
.gl-table tr.gl-row:hover td { background: #faf5ff; }
.gl-table tr.gl-row:focus { outline: 2px solid var(--color-primary-orange); outline-offset: -2px; }
.gl-table tr.gl-selected td { background: #fff4e5; font-weight: 600; }
.gl-table tr.gl-selected td:first-child { box-shadow: inset 4px 0 0 var(--color-primary-orange); }
.gl-facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .75rem; margin: 0 0 .8rem; font-size: .9rem; }
.gl-facts dt { color: var(--muted); }
.gl-facts dd { margin: 0; }
.gl-lines { width: 100%; font-size: .88rem; }
.gl-lines tr.gl-this td { background: #fff4e5; font-weight: 600; }
.gl-lines tfoot th { border-top: 2px solid var(--line); }
@media (max-width: 1100px) { .gl-view { grid-template-columns: 1fr; } .gl-detail { position: static; max-height: none; } }
.accounting-page .actions { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.fee-invoice, .fee-invoice .row > div { min-width: 0; max-width: 100%; }
.fee-payment-allocations { flex: 1 1 100%; min-width: 0; max-width: 100%; }
.document-id { overflow-wrap: anywhere; }
.fee-credit-account .row > div { min-width: 0; max-width: 100%; }
.fee-credit-account input, .fee-credit-account select { max-width: 100%; }
.fee-credit-account table { overflow-wrap: anywhere; }
.pagination { margin: 1rem 0 0; }
.profile-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.profile-heading h3 { margin: 0; }
.learner-profile h4 { color: var(--bg-header); margin-bottom: .6rem; }
.guardian-form { border-top: 1px solid var(--border-light); padding-top: 1rem; margin-top: 1rem; }
details > summary { cursor: pointer; font-weight: 650; color: var(--bg-header); }
details > form { margin-top: 1rem; }
@media print {
  body:has(.stock-document) #app *:not(.stock-document):not(.stock-document *):not(:has(.stock-document)) { display: none; }
  body:has(.stock-document) #app :has(.stock-document) { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .stock-document { position: static; border: 0; box-shadow: none; margin: 0; }
  .stock-document table { width: 100%; font-size: 9pt; overflow-wrap: anywhere; }
  .stock-document thead { display: table-header-group; }
  .stock-document tr { break-inside: avoid; }
  .brand-logo { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  nav, .user-bar, .toast { display: none; }
  .shell { display: block; }
  .print-brand { display: block; }
  body:has(.exam-report, .fee-document) * { visibility: hidden; }
  body:has(.exam-report) .exam-report, body:has(.exam-report) .exam-report *,
  body:has(.fee-document) .fee-document, body:has(.fee-document) .fee-document * { visibility: visible; }
  body:has(.exam-report, .fee-document) .shell, body:has(.exam-report, .fee-document) main { display: block; overflow: visible; }
  .exam-report, .fee-document { position: absolute; inset: 0; border: 0; box-shadow: none; margin: 0; }
  .exam-report .table-scroll, .fee-document .table-scroll { overflow: visible; }
  body:has(.fee-document) #app *:not(.fee-document):not(.fee-document *):not(:has(.fee-document)) { display: none; }
  body:has(.fee-document) #app :has(.fee-document) { margin: 0; padding: 0; border: 0; box-shadow: none; }
  body:has(.fee-document) .fee-document { position: static; }
  .academic-marksheet table { table-layout: fixed; width: 100%; }
  .academic-marksheet th, .academic-marksheet td { font-size: 8pt; padding: .2rem; overflow-wrap: anywhere; }
  .academic-marksheet tr { break-inside: avoid; }
  .academic-marksheet thead { display: table-header-group; }
}
.muted { color: var(--muted); }
.narrow { width: 6rem; } .wide { min-width: 22rem; }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .78rem; background: #F1E8F6; color: var(--bg-header); }
.pill.bad { background: #f9dedc; color: var(--bad); } .pill.warn { background: #fff1cc; color: var(--warn); }
.toast { position: fixed; right: 1rem; bottom: 1rem; background: var(--brand-dark); color: #fff; padding: .7rem 1rem; border-radius: 8px; max-width: 340px; z-index: 9; }
.toast.bad { background: var(--bad); }
.error { color: var(--bad); margin: .5rem 0; }
.platform-header { min-height: 64px; padding: .8rem 1.5rem; background: var(--bg-header); display: flex; align-items: center; justify-content: space-between; }
.platform-brand { color: #fff; text-decoration: none; font-size: 1.2rem; font-weight: 750; letter-spacing: -.02em; display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }
.platform-brand .brand-logo { width: 230px; background: #fff; border-radius: 6px; padding: .3rem; }
.platform-brand span { margin-left: .4rem; color: rgba(255, 255, 255, 0.8); font-size: .9rem; font-weight: 500; }
.platform-school-link { color: rgba(255, 255, 255, 0.9); text-decoration: none; font-size: .9rem; }
.platform-main { max-width: 1180px; margin: 0 auto; padding: 2rem 1.4rem; }
.platform-login { margin-top: 8vh; }
.platform-title, .platform-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.platform-title { margin: .5rem 0 1.2rem; }
.platform-title h1 { font-size: 1.8rem; }
.platform-title > button.ghost { flex-shrink: 0; background: var(--color-primary-orange); color: var(--text-light); white-space: nowrap; }
.platform-title > button.ghost:hover { background: var(--color-secondary-gold); }
.platform-eyebrow { color: var(--brand); font-size: .75rem; font-weight: 700; letter-spacing: .14em; margin: 0 0 .3rem; }
.platform-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; margin-top: 1rem; }
.platform-form label { display: flex; flex-direction: column; gap: .25rem; color: var(--bg-header); font-size: .82rem; }
.platform-form input, .platform-form select { width: 100%; min-width: 0; min-height: 40px; color: var(--text); }
.platform-form-heading, .platform-form-note { grid-column: 1 / -1; margin: .35rem 0 0; }
.platform-form-heading { color: var(--bg-header); padding-top: .7rem; border-top: 1px solid var(--border-light); }
.platform-form-note { font-size: .82rem; }
.institution-contact span { display: block; }
dialog { max-width: 560px; width: calc(100% - 2rem); max-height: calc(100dvh - 2rem); overflow: auto; border: 1px solid var(--border-light); border-radius: 12px; padding: 1.5rem; color: var(--text-dark); }
#school-admin-dialog { max-width: 1000px; }
dialog::backdrop { background: rgba(40, 8, 59, .45); }
.platform-form-actions { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.platform-form-actions p { margin: 0; font-size: .85rem; }
.platform-admin-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.platform-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; margin-top: 1rem; }
.platform-table-wrap table { min-width: 760px; width: 100%; table-layout: fixed; }
.platform-table-wrap .platform-institutions-table { min-width: 1150px; }
.platform-institutions-table col:nth-child(1) { width: 12%; }
.platform-institutions-table col:nth-child(2), .platform-institutions-table col:nth-child(8) { width: 8%; }
.platform-institutions-table col:nth-child(3), .platform-institutions-table col:nth-child(4) { width: 10%; }
.platform-institutions-table col:nth-child(5), .platform-institutions-table col:nth-child(6) { width: 16%; }
.platform-institutions-table col:nth-child(7) { width: 7%; }
.platform-institutions-table col:nth-child(9) { width: 13%; }
.platform-table-wrap th, .platform-table-wrap td { padding: .7rem; vertical-align: top; white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.platform-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.platform-actions button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.platform-main .card, .platform-title > div, .platform-section-heading > div { min-width: 0; }
.platform-header, .platform-section-heading, .platform-form-actions { flex-wrap: wrap; }
.platform-main, #school-admin-dialog { overflow-wrap: anywhere; }
.platform-form-actions button { flex-shrink: 0; }
.platform-scroll-hint { font-size: .82rem; margin-bottom: 0; }
.platform-message { min-height: 1.4rem; margin: 0 0 .8rem; color: var(--brand-dark); }
.platform-footer { color: var(--muted); font-size: .82rem; padding: 1rem 0 2rem; }
.platform-password-card summary { cursor: pointer; font-weight: 650; }
@media screen {
  body { font-size: 14px; line-height: 1.4; }
  h1, h2, h3 { margin-bottom: .45rem; }
  h4 { margin: .6rem 0 .4rem; }
  p { margin: .4rem 0; }
  main { padding: 1rem 1.2rem; }
  .card { padding: .75rem .9rem; margin-bottom: .7rem; box-shadow: none; }
  .cards { gap: .6rem; margin-bottom: .7rem; }
  .stat { padding: .6rem .8rem; box-shadow: none; }
  .stat b { font-size: 1.3rem; }
  .row { gap: .5rem; margin-bottom: .6rem; }
  .row > div { min-width: 0; max-width: 100%; }
  input, select, button { min-height: 36px; }
  th, td { padding: .35rem .5rem; font-size: .875rem; }
  th { font-size: .75rem; }
  td p { margin: .2rem 0; }
  nav { padding: .7rem .5rem; }
  nav a, nav .nav-group > summary { padding: .4rem .6rem; }
  details > form { margin-top: .6rem; }
  .platform-main { padding: 1.2rem 1rem; }
  .platform-title { gap: .7rem; margin-bottom: .8rem; }
  .platform-title h1 { font-size: 1.5rem; }
  .platform-form { gap: .6rem; margin-top: .6rem; }
  .platform-form-heading { padding-top: .5rem; }
  .platform-table-wrap { margin-top: .6rem; }
  .platform-table-wrap th, .platform-table-wrap td { padding: .5rem; }
  .platform-message:empty { display: none; }
}
@media (max-width: 760px) {
  .platform-form, .platform-admin-form { grid-template-columns: 1fr; }
  .platform-form-actions { align-items: stretch; flex-direction: column; }
  .platform-title { align-items: flex-start; }
  .platform-main { padding: 1.2rem .8rem; }
}
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } nav { flex-direction: column; position: static; height: auto; overflow: visible; } nav .nav-menu { flex-direction: row; flex-wrap: wrap; overflow: visible; } .user-bar { padding: .6rem 1rem; } nav a.active, nav a:hover { border-left-color: transparent; border-bottom: 3px solid var(--color-primary-orange); } }

/* Fees workspace */
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.fee-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .9rem; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.fee-tabs button { border-radius: 999px; }
.fee-tabs button[aria-pressed="true"] { background: var(--color-primary-orange); color: var(--text-light); }
.fee-tool-panel:empty { display: none; }
.fee-recon .row input:not([type=file]) { min-width: 12rem; }
.fee-recon input[type=file] { padding: .3rem .4rem; }
.fee-recon h4 { margin: 1rem 0 .4rem; }
.form-hint { margin-left: .7rem; font-size: .85rem; }
.fee-recon textarea { margin-bottom: .6rem; }
textarea.mono { font-family: Consolas, "Courier New", monospace; font-size: .9rem; min-height: 4.5rem; }
