/*
 * Hoshmand System — the one design system of the product.
 *
 * Every page (school panel, owner's panel, sign-in) is built only from what is defined
 * here: the brand tokens, the Bootstrap components themed with them, and the shared
 * parts (shell, page head, toolbars, lists, forms, dialogs, cards, badges). A page never
 * brings its own colours or look; when something new is needed it is added here once.
 * Action icons and tones come from App\Support\Ui. Official Ministry prints keep the
 * Ministry's layout (css/result-tables.css).
 */

/* ==== 1. Tokens (colours of the logo) ================================================ */
:root {
  --hs-ink: #050b18;
  --hs-night: #071334;
  --hs-navy: #0b1f4d;
  --hs-blue: #0b4fd8;
  --hs-blue-600: #0a44bb;
  --hs-blue-700: #093a9f;
  --hs-azure: #1e90ff;
  --hs-sky: #5ab0ff;
  --hs-mist: #eef4ff;
  --hs-mist-2: #e1ebff;
  --hs-gradient: linear-gradient(135deg, var(--hs-blue), var(--hs-azure));

  --hs-bg: #f4f7fc;
  --hs-surface: #fff;
  --hs-surface-2: #f8faff;
  --hs-line: #e1e8f4;
  --hs-line-strong: #cbd6ea;
  --hs-text: #13213f;
  --hs-muted: #5b6b8c;
  --hs-faint: #8a97b3;

  --hs-success: #10845a;
  --hs-success-soft: #e5f6ee;
  --hs-warning: #9a5b00;
  --hs-warning-soft: #fff3dc;
  --hs-danger: #cf2a4b;
  --hs-danger-soft: #fdeaef;
  --hs-info: var(--hs-blue);
  --hs-info-soft: var(--hs-mist);

  --hs-radius-sm: 6px;
  --hs-radius: 10px;
  --hs-radius-lg: 14px;
  --hs-shadow-sm: 0 1px 2px rgba(11, 31, 77, .06);
  --hs-shadow: 0 6px 20px rgba(11, 31, 77, .08);
  --hs-shadow-lg: 0 18px 48px rgba(5, 11, 24, .22);
  --hs-ring: 0 0 0 .2rem rgba(30, 144, 255, .2);

  --hs-font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  --hs-fs: 14px;
  --hs-fs-sm: 13px;
  --hs-fs-xs: 12px;
  --hs-control-h: 36px;
  --hs-control-h-sm: 30px;

  --hs-header-h: 56px;
  --hs-rail-w: 76px;
  --hs-panel-w: 244px;
  --hs-nav-w: calc(var(--hs-rail-w) + var(--hs-panel-w));
  --hs-gutter: 20px;

  /* Bootstrap reads its own variables; they all point at the brand. */
  --bs-body-font-family: var(--hs-font);
  --bs-body-font-size: var(--hs-fs);
  --bs-body-color: var(--hs-text);
  --bs-body-bg: var(--hs-bg);
  --bs-primary: var(--hs-blue);
  --bs-primary-rgb: 11, 79, 216;
  --bs-success: var(--hs-success);
  --bs-success-rgb: 16, 132, 90;
  --bs-danger: var(--hs-danger);
  --bs-danger-rgb: 207, 42, 75;
  --bs-warning-rgb: 154, 91, 0;
  --bs-secondary-color: var(--hs-muted);
  --bs-tertiary-bg: var(--hs-surface-2);
  --bs-border-color: var(--hs-line);
  --bs-border-radius: var(--hs-radius-sm);
  --bs-border-radius-sm: var(--hs-radius-sm);
  --bs-border-radius-lg: var(--hs-radius);
  --bs-link-color: var(--hs-blue);
  --bs-link-color-rgb: 11, 79, 216;
  --bs-link-hover-color: var(--hs-blue-700);
  --bs-link-hover-color-rgb: 9, 58, 159;
  --bs-emphasis-color: var(--hs-navy);
  --bs-heading-color: var(--hs-navy);
  --bs-focus-ring-color: rgba(30, 144, 255, .25);
}

/* ==== 2. Base ========================================================================= */
html, body { height: 100%; }
body { margin: 0; background: var(--hs-bg); color: var(--hs-text); font-family: var(--hs-font); font-size: var(--hs-fs); -webkit-font-smoothing: antialiased; }
::selection { background: var(--hs-mist-2); }
.text-muted, .form-text { color: var(--hs-muted) !important; }
.text-primary { color: var(--hs-blue) !important; }
.text-success { color: var(--hs-success) !important; }
.text-danger { color: var(--hs-danger) !important; }
.text-warning { color: var(--hs-warning) !important; }
.small, small { font-size: var(--hs-fs-sm); }
hr { border-color: var(--hs-line); opacity: 1; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.id-chip { direction: ltr; display: inline-block; font-family: ui-monospace, Consolas, monospace; font-size: var(--hs-fs-xs); background: var(--hs-mist); color: var(--hs-blue); border-radius: var(--hs-radius-sm); padding: 2px 8px; white-space: nowrap; }

/* ==== 3. Buttons ======================================================================
 * The only buttons: btn-primary (the one main action of a place), btn-secondary (every
 * other), btn-danger-soft / btn-success-soft (actions whose tone is danger or success),
 * btn-danger (only to confirm a deletion). .btn-icon makes any of them a square icon
 * button for toolbars and table rows. <x-action> picks them from App\Support\Ui; the
 * older class names (btn-light-secondary, btn-outline-*) still map onto the same looks
 * until every page uses <x-action>. */
.btn { --bs-btn-font-family: var(--hs-font); --bs-btn-font-size: var(--hs-fs-sm); --bs-btn-font-weight: 600; --bs-btn-border-radius: var(--hs-radius-sm); --bs-btn-padding-y: 0; --bs-btn-padding-x: 14px; --bs-btn-focus-box-shadow: var(--hs-ring); min-height: var(--hs-control-h); display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; white-space: nowrap; }
.btn-sm { --bs-btn-padding-x: 12px; --bs-btn-font-size: var(--hs-fs-sm); --bs-btn-border-radius: var(--hs-radius-sm); }
.btn-lg { --bs-btn-padding-x: 20px; --bs-btn-font-size: 15px; --bs-btn-border-radius: var(--hs-radius); min-height: 46px; }
.btn i { font-size: 1.05em; line-height: 1; }
.btn-link { --bs-btn-color: var(--hs-blue); --bs-btn-hover-color: var(--hs-blue-700); min-height: 0; }

.btn-primary { --bs-btn-color: #fff; --bs-btn-bg: var(--hs-blue); --bs-btn-border-color: var(--hs-blue); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--hs-blue-600); --bs-btn-hover-border-color: var(--hs-blue-600); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--hs-blue-700); --bs-btn-active-border-color: var(--hs-blue-700); --bs-btn-disabled-bg: var(--hs-blue); --bs-btn-disabled-border-color: var(--hs-blue); box-shadow: 0 2px 6px rgba(11, 79, 216, .22); }

.btn-secondary,
.btn-light-secondary, .btn-outline-primary, .btn-outline-secondary, .btn-outline-warning, .btn-light, .btn-outline-dark {
  --bs-btn-color: var(--hs-navy); --bs-btn-bg: var(--hs-surface); --bs-btn-border-color: var(--hs-line-strong);
  --bs-btn-hover-color: var(--hs-blue); --bs-btn-hover-bg: var(--hs-mist); --bs-btn-hover-border-color: var(--hs-sky);
  --bs-btn-active-color: var(--hs-blue-700); --bs-btn-active-bg: var(--hs-mist-2); --bs-btn-active-border-color: var(--hs-sky);
  --bs-btn-disabled-color: var(--hs-faint); --bs-btn-disabled-bg: var(--hs-surface); --bs-btn-disabled-border-color: var(--hs-line);
}
.btn-danger { --bs-btn-color: #fff; --bs-btn-bg: var(--hs-danger); --bs-btn-border-color: var(--hs-danger); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #b62140; --bs-btn-hover-border-color: #b62140; --bs-btn-active-bg: #a01d38; --bs-btn-active-border-color: #a01d38; }
.btn-danger-soft, .btn-outline-danger, .btn-light-danger {
  --bs-btn-color: var(--hs-danger); --bs-btn-bg: var(--hs-surface); --bs-btn-border-color: #f3c3ce;
  --bs-btn-hover-color: var(--hs-danger); --bs-btn-hover-bg: var(--hs-danger-soft); --bs-btn-hover-border-color: var(--hs-danger);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--hs-danger); --bs-btn-active-border-color: var(--hs-danger);
}
.btn-success-soft, .btn-success, .btn-outline-success, .btn-light-success {
  --bs-btn-color: var(--hs-success); --bs-btn-bg: var(--hs-surface); --bs-btn-border-color: #b6e2cd;
  --bs-btn-hover-color: var(--hs-success); --bs-btn-hover-bg: var(--hs-success-soft); --bs-btn-hover-border-color: var(--hs-success);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--hs-success); --bs-btn-active-border-color: var(--hs-success);
}

/* Icon buttons: square, the same in every toolbar and table row. */
.btn-icon { width: var(--hs-control-h); min-width: var(--hs-control-h); height: var(--hs-control-h); padding: 0; --bs-btn-padding-x: 0; font-size: 16px; }
.btn-icon.btn-sm { width: var(--hs-control-h-sm); min-width: var(--hs-control-h-sm); height: var(--hs-control-h-sm); min-height: var(--hs-control-h-sm); font-size: 14px; }
.row-actions .btn { min-width: var(--hs-control-h-sm); height: var(--hs-control-h-sm); min-height: var(--hs-control-h-sm); padding: 0 7px; font-size: 14px; }
.btn-icon.btn-primary { box-shadow: 0 2px 6px rgba(11, 79, 216, .22); }

/* ==== 4. Form controls ================================================================ */
.form-label { font-size: var(--hs-fs-sm); font-weight: 600; color: var(--hs-muted); margin-bottom: 4px; }
.form-control, .form-select { min-height: var(--hs-control-h); font-size: var(--hs-fs-sm); color: var(--hs-text); background-color: var(--hs-surface); border: 1px solid var(--hs-line-strong); border-radius: var(--hs-radius-sm); box-shadow: none; }
.form-control::placeholder { color: var(--hs-faint); }
.form-control:focus, .form-select:focus { border-color: var(--hs-sky); box-shadow: var(--hs-ring); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--hs-surface-2); color: var(--hs-muted); }
.form-control-sm, .form-select-sm { min-height: var(--hs-control-h-sm); font-size: var(--hs-fs-xs); }
.form-control-lg { min-height: 46px; font-size: 15px; border-radius: var(--hs-radius); }
textarea.form-control { min-height: 72px; }
.form-check-input { border-color: var(--hs-line-strong); }
.form-check-input:checked { background-color: var(--hs-blue); border-color: var(--hs-blue); }
.form-check-input:focus { box-shadow: var(--hs-ring); border-color: var(--hs-sky); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%235ab0ff'/%3e%3c/svg%3e"); }
.input-group-text { background: var(--hs-surface-2); border-color: var(--hs-line-strong); color: var(--hs-muted); font-size: var(--hs-fs-sm); }
.invalid-feedback { font-size: var(--hs-fs-xs); color: var(--hs-danger); }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--hs-danger); }
.jdate { direction: ltr; text-align: center; }

/* ==== 5. Surfaces: cards, alerts, badges, tabs ======================================== */
.card { --bs-card-border-color: var(--hs-line); --bs-card-border-radius: var(--hs-radius); --bs-card-inner-border-radius: calc(var(--hs-radius) - 1px); --bs-card-cap-bg: var(--hs-surface); background: var(--hs-surface); box-shadow: var(--hs-shadow-sm); }
.card-header { font-weight: 700; color: var(--hs-navy); border-bottom-color: var(--hs-line); }
.card-titlebar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 16px; background: var(--hs-surface); border-bottom: 1px solid var(--hs-line); border-radius: var(--hs-radius) var(--hs-radius) 0 0; }
.card-titlebar h6, .card-titlebar .title { margin: 0; font-size: var(--hs-fs); font-weight: 700; color: var(--hs-navy); }

.alert { border-radius: var(--hs-radius); border: 1px solid transparent; font-size: var(--hs-fs-sm); padding: 10px 14px; }
.alert-info, .alert-primary { background: var(--hs-mist); border-color: var(--hs-mist-2); color: var(--hs-navy); }
.alert-success { background: var(--hs-success-soft); border-color: #c4e9d7; color: #0b5c3f; }
.alert-warning { background: var(--hs-warning-soft); border-color: #f6dfb0; color: #6e4100; }
.alert-danger { background: var(--hs-danger-soft); border-color: #f6c9d3; color: #8f1730; }
.alert-secondary, .alert-light { background: var(--hs-surface-2); border-color: var(--hs-line); color: var(--hs-text); }

/* Badges are soft pills; the tone tells the meaning. */
.badge { font-weight: 600; font-size: var(--hs-fs-xs); border-radius: 20px; padding: 4px 10px; }
.badge.bg-primary, .badge.bg-info, .badge.text-bg-primary, .badge.text-bg-info, .badge.bg-primary-subtle { background: var(--hs-mist) !important; color: var(--hs-blue) !important; }
.badge.bg-success, .badge.text-bg-success { background: var(--hs-success-soft) !important; color: var(--hs-success) !important; }
.badge.bg-danger, .badge.text-bg-danger { background: var(--hs-danger-soft) !important; color: var(--hs-danger) !important; }
.badge.bg-warning, .badge.text-bg-warning { background: var(--hs-warning-soft) !important; color: var(--hs-warning) !important; }
.badge.bg-secondary, .badge.bg-light, .badge.text-bg-light, .badge.text-bg-secondary, .badge.bg-dark { background: #edf1f8 !important; color: var(--hs-muted) !important; }

.nav-tabs { --bs-nav-tabs-border-color: var(--hs-line); --bs-nav-tabs-link-active-color: var(--hs-blue); --bs-nav-tabs-link-active-bg: transparent; --bs-nav-tabs-link-active-border-color: transparent; gap: 4px; }
.nav-tabs .nav-link { color: var(--hs-muted); font-weight: 600; font-size: var(--hs-fs-sm); border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; }
.nav-tabs .nav-link:hover { color: var(--hs-blue); border-bottom-color: var(--hs-mist-2); }
.nav-tabs .nav-link.active { color: var(--hs-blue); border-bottom-color: var(--hs-blue); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--hs-blue); --bs-nav-pills-border-radius: var(--hs-radius-sm); }
.nav-pills .nav-link { color: var(--hs-muted); font-weight: 600; font-size: var(--hs-fs-sm); }

.dropdown-menu { --bs-dropdown-border-color: var(--hs-line); --bs-dropdown-border-radius: var(--hs-radius); --bs-dropdown-link-hover-bg: var(--hs-mist); --bs-dropdown-link-hover-color: var(--hs-blue); --bs-dropdown-link-active-bg: var(--hs-blue); --bs-dropdown-font-size: var(--hs-fs-sm); box-shadow: var(--hs-shadow); padding: 6px; }
.dropdown-item { border-radius: var(--hs-radius-sm); padding: 7px 10px; }
.tooltip { --bs-tooltip-bg: var(--hs-navy); --bs-tooltip-font-size: var(--hs-fs-xs); font-family: var(--hs-font); }
.progress { --bs-progress-bar-bg: var(--hs-blue); --bs-progress-bg: var(--hs-mist); }
.list-group { --bs-list-group-border-color: var(--hs-line); --bs-list-group-active-bg: var(--hs-blue); --bs-list-group-active-border-color: var(--hs-blue); }

/* ==== 6. Dialogs and messages ========================================================= */
.modal { --bs-modal-border-radius: var(--hs-radius-lg); --bs-modal-inner-border-radius: calc(var(--hs-radius-lg) - 1px); --bs-modal-border-color: transparent; --bs-modal-header-border-color: var(--hs-line); --bs-modal-footer-border-color: var(--hs-line); --bs-modal-box-shadow: var(--hs-shadow-lg); --bs-modal-header-padding: 14px 18px; --bs-modal-padding: 18px; }
.modal-content { box-shadow: var(--hs-shadow-lg); }
.modal-title { font-size: 16px !important; font-weight: 800; color: var(--hs-navy); }
/* Every dialog: a quiet head, and its form on a white sheet (like the file forms of records). */
.modal-header { background: var(--hs-surface-2); }
.modal-body .form-label { margin-bottom: 4px; font-size: var(--hs-fs-xs); font-weight: 600; color: var(--hs-muted); }
.modal-body:has(> form[data-ajax]:only-child) { background: var(--hs-surface-2); }
.modal-body > form[data-ajax]:only-child { margin: 0; padding: 18px 20px 20px; background: var(--hs-surface); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); box-shadow: var(--hs-shadow-sm); }
.modal-footer { justify-content: flex-start; gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-bg: var(--hs-ink); --bs-backdrop-opacity: .45; }
.app-confirm { z-index: 1070; }
.app-confirm .modal-dialog { max-width: 400px; }
.app-confirm-backdrop { z-index: 1065; }
.dialog-loading { padding: 48px; text-align: center; color: var(--hs-muted); }
.toast { --bs-toast-bg: var(--hs-navy); --bs-toast-color: #fff; --bs-toast-border-radius: var(--hs-radius); --bs-toast-header-bg: var(--hs-navy); --bs-toast-header-color: #fff; border: 0; box-shadow: var(--hs-shadow-lg); font-size: var(--hs-fs-sm); }
.toast .btn-close { filter: invert(1); }

/* ==== 7. School shell: content ======================================= */
body.app { overflow: hidden; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--hs-mist); color: var(--hs-blue); display: grid; place-items: center; overflow: hidden; flex: none; font-size: 16px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.school-logo { width: 38px; height: 38px; border-radius: var(--hs-radius-sm); object-fit: contain; background: var(--hs-mist); display: inline-grid; place-items: center; color: var(--hs-blue); font-size: 18px; flex: none; overflow: hidden; }
.school-logo img { width: 100%; height: 100%; object-fit: contain; }

.brand-tile { width: 40px; height: 40px; border-radius: 10px; background: transparent; display: grid; place-items: center; overflow: hidden; flex: none; }
.brand-tile img { width: 100%; height: 100%; object-fit: contain; }



.app-main { position: fixed; top: var(--hs-header-h); bottom: 0; left: 0; right: 0; margin-right: var(--hs-nav-w); transition: margin .2s; }
.content-wrapper { height: 100%; overflow: auto; padding: 18px var(--hs-gutter) 48px; }

/* Page head: where you are, the page's name and its tools — the same on every page. */
.page-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 2px; }
.crumbs { font-size: var(--hs-fs-xs); color: var(--hs-faint); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.crumbs a { color: var(--hs-muted); text-decoration: none; }
.crumbs a:hover { color: var(--hs-blue); }
.crumbs .sep { margin: 0 6px; font-size: 9px; color: var(--hs-faint); }
.crumbs .current { color: var(--hs-navy); font-weight: 700; }
.page-title { font-size: 21px; font-weight: 800; color: var(--hs-navy); margin: 4px 0 16px; letter-spacing: -.2px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.list-toolbar, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.list-toolbar .btn, .toolbar .btn { min-width: var(--hs-control-h); min-height: var(--hs-control-h); padding: 0 10px; }
.list-toolbar .btn > i:only-child, .toolbar .btn > i:only-child { font-size: 16px; }

/* ==== 8. Lists: search panel, data tables, pagination ================================= */
/* The filters of every list (form.search-panel, and .list-bar on the two big lists): one bar in
 * view above the list, never a hidden card. The search box comes first with its icon; every other
 * filter is one compact control with its name inside it (.filter-field: «صنف پایه | همه ▾»).
 * A list marked data-live-list answers as they change; the filters in use show as chips under it. */
.search-panel, .list-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px !important; padding: 0 !important; background: none; border: 0; border-radius: 0; box-shadow: none; }
.search-panel > .row { display: contents; }
.search-panel > .row > *, .search-panel > :not(.row) { flex: 0 1 auto; width: auto; max-width: none; margin: 0 !important; padding: 0; }
.search-panel > .form-text, .search-panel > .alert { flex-basis: 100%; font-size: 11px; }
.search-panel > .d-flex { gap: 8px !important; }
.search-panel.is-live [data-search-submit] { display: none; }
.filter-field { display: inline-flex; align-items: stretch; height: var(--hs-control-h); background: var(--hs-surface); border: 1px solid var(--hs-line-strong); border-radius: var(--hs-radius-sm); overflow: hidden; }
.filter-field:focus-within { border-color: var(--hs-sky); box-shadow: var(--hs-ring); }
.filter-field > .form-label { display: flex; align-items: center; margin: 0; padding-inline: 10px 8px; background: var(--hs-surface-2); border-inline-end: 1px solid var(--hs-line); font-size: var(--hs-fs-xs); font-weight: 600; color: var(--hs-muted); white-space: nowrap; }
.filter-field > .form-select, .filter-field > .form-control { width: auto; min-width: 92px; height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none !important; background-color: transparent; font-size: var(--hs-fs-sm); }
.filter-field > input[type="number"] { min-width: 0; width: 76px; }
.filter-field > .form-text { display: none; }
.search-panel .form-check, .list-bar .form-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: var(--hs-fs-sm); }
.search-panel > :not(.row):has(> .form-check) { display: flex; flex-wrap: wrap; gap: 6px 14px; }

.table { --bs-table-color: var(--hs-text); --bs-table-border-color: var(--hs-line); --bs-table-hover-bg: #f5f9ff; --bs-table-striped-bg: var(--hs-surface-2); --bs-table-bg: var(--hs-surface); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: 8px 10px; }
.table thead th { background: var(--hs-surface); color: var(--hs-muted); font-weight: 600; font-size: var(--hs-fs-xs); vertical-align: middle; border-bottom: 1px solid var(--hs-line-strong); }
.table-scroll { overflow: visible; background: var(--hs-surface); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); box-shadow: var(--hs-shadow-sm); }
.table-scroll > .table { border-radius: var(--hs-radius); }
.table-scroll > .table-bordered { border-style: hidden; }
.modal .table-scroll { overflow-x: auto; box-shadow: none; }
.data-table { margin: 0; font-size: var(--hs-fs-sm); white-space: normal; }
.data-table thead th { background: var(--hs-surface); color: var(--hs-muted); font-weight: 600; font-size: var(--hs-fs-xs); vertical-align: middle; text-align: start; position: sticky; top: 0; z-index: 2; white-space: nowrap; border-color: var(--hs-line); border-bottom: 1px solid var(--hs-line-strong); }
.data-table.text-center thead th, .data-table thead th.text-center, .data-table thead th[colspan] { text-align: center; }
.data-table.multi-head thead th, .data-table.table-bordered thead th { background: var(--hs-surface-2); color: var(--hs-navy); }
.data-table thead tr:nth-child(2) th { top: var(--head-row-h, 37px); }
.content-wrapper > .table-scroll .data-table thead th { top: -18px; }
.content-wrapper > .table-scroll .data-table thead tr:nth-child(2) th { top: calc(var(--head-row-h, 37px) - 18px); }
.data-table td { padding: 9px 10px; vertical-align: middle; }
.data-table.table-sm td { padding: 6px 8px; }
.data-table tbody tr:has(> td .row-menu [data-row-open]), .data-table tbody tr[data-row-dialog] { cursor: pointer; }
.data-table tbody tr:hover > * { background: #f5f9ff; }
.data-table .row-actions { white-space: nowrap; width: 1%; }
.data-table .row-actions > .d-flex, .data-table .row-actions { gap: 4px; }
.data-table .totals-row td { background: var(--hs-surface-2); font-weight: 700; color: var(--hs-navy); }
.data-table .totals-row span { margin-left: 28px; white-space: nowrap; }
.data-table .empty-row td, .empty-state { text-align: center; color: var(--hs-muted); padding: 32px 12px !important; }
.col-hidden { display: none !important; }
.data-table thead th.vertical { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; padding: 6px 2px; font-weight: 600; font-size: 11px; height: 104px; }
.data-table.multi-head thead { position: sticky; top: -18px; z-index: 3; }
.data-table.multi-head thead th { position: static; }

.pagination { --bs-pagination-color: var(--hs-navy); --bs-pagination-border-color: var(--hs-line); --bs-pagination-hover-bg: var(--hs-mist); --bs-pagination-hover-color: var(--hs-blue); --bs-pagination-hover-border-color: var(--hs-sky); --bs-pagination-active-bg: var(--hs-blue); --bs-pagination-active-border-color: var(--hs-blue); --bs-pagination-disabled-color: var(--hs-faint); --bs-pagination-focus-box-shadow: var(--hs-ring); --bs-pagination-font-size: var(--hs-fs-sm); gap: 4px; }
.pagination .page-link { border-radius: var(--hs-radius-sm) !important; min-width: 32px; text-align: center; }

/* ==== 9. Content blocks: metrics, charts, details, wizard, placeholders =============== */
.metric { background: var(--hs-surface); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 100%; box-shadow: var(--hs-shadow-sm); }
.metric .m-label { font-size: var(--hs-fs-xs); color: var(--hs-muted); font-weight: 600; }
.metric .m-value { font-size: 21px; font-weight: 800; color: var(--hs-navy); font-variant-numeric: tabular-nums; }
.metric .m-split { font-size: 11px; color: var(--hs-muted); line-height: 1.5; }
.metric i { font-size: 20px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--hs-mist); color: var(--hs-blue); }
.metric.green i { background: var(--hs-success-soft); color: var(--hs-success); }
.metric.red i { background: var(--hs-danger-soft); color: var(--hs-danger); }
.metric.orange i { background: var(--hs-warning-soft); color: var(--hs-warning); }
.metric.gray i { background: #edf1f8; color: var(--hs-muted); }
.metric.blue i, .metric.purple i, .metric.cyan i { background: var(--hs-mist); color: var(--hs-blue); }

.chart-card { height: 100%; }
.chart-card .tools { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chart-card .tools .btn { width: var(--hs-control-h-sm); min-width: var(--hs-control-h-sm); min-height: var(--hs-control-h-sm); height: var(--hs-control-h-sm); padding: 0; font-size: 13px; }
.chart-card .tools .btn.on { background: var(--hs-blue); border-color: var(--hs-blue); color: #fff; }
.chart-card .filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: var(--hs-fs-xs); color: var(--hs-muted); }
.chart-card .filters .form-select, .chart-card .filters .form-control { width: auto; min-width: 92px; min-height: var(--hs-control-h-sm); height: var(--hs-control-h-sm); padding-top: 0; padding-bottom: 0; font-size: var(--hs-fs-xs); }
.chart-card .filters input.jdate { width: 112px; }
.chart-card .chart-body { position: relative; height: 340px; padding: 12px; }
.chart-card.collapsed .chart-body { display: none; }
.chart-card .empty { height: 100%; display: grid; place-items: center; color: var(--hs-muted); font-size: var(--hs-fs-sm); }
.chart-card .center-label { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; text-align: center; font-size: var(--hs-fs-xs); color: var(--hs-muted); }
.chart-card .center-label b { display: block; font-size: 16px; color: var(--hs-navy); }
.chart-card.pinned { outline: 2px solid rgba(30, 144, 255, .35); }
.chart-card.loading .chart-body { opacity: .4; }
.col-chart.hidden-by-user { display: none; }

.placeholder-box { background: var(--hs-surface); border: 1px dashed var(--hs-line-strong); border-radius: var(--hs-radius); padding: 36px; text-align: center; color: var(--hs-muted); }
.placeholder-box > i { color: var(--hs-sky); }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 20px; }
.detail-grid div { border-bottom: 1px dashed var(--hs-line); padding: 6px 0; font-size: var(--hs-fs-sm); }
.detail-grid b { color: var(--hs-muted); font-weight: 600; margin-left: 6px; }
.profile-photo { width: 120px; height: 120px; flex: none; border-radius: 50%; background: var(--hs-mist); color: var(--hs-sky); display: grid; place-items: center; overflow: hidden; font-size: 64px; }
.profile-photo.small { width: 64px; height: 64px; font-size: 34px; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }

.wizard { display: flex; gap: 20px; }
.wizard .stepper { width: 180px; flex: none; background: var(--hs-surface-2); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); padding: 10px; align-self: flex-start; }
.wizard .step { display: flex; align-items: center; gap: 10px; padding: 7px 8px; color: var(--hs-muted); text-decoration: none; border-radius: var(--hs-radius-sm); font-size: var(--hs-fs-sm); }
.wizard .step .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: #fff; border: 1px solid var(--hs-line-strong); color: var(--hs-faint); flex: none; }
.wizard .step.current { color: var(--hs-navy); font-weight: 700; background: var(--hs-mist); }
.wizard .step.current .num { background: var(--hs-blue); border-color: var(--hs-blue); color: #fff; }
.wizard .step.done .num { background: var(--hs-mist); border-color: var(--hs-sky); color: var(--hs-blue); }
.wizard .step.disabled { pointer-events: none; opacity: .55; }
.wizard .step:hover { background: var(--hs-mist); }
.wizard .step-body { flex: 1; min-width: 0; }
.wizard .form-label { font-size: var(--hs-fs-xs); margin-bottom: 3px; }

/* Particular tables (reports, exams, attendance) — still only brand colours. */
.marks-sheet .mark-input { min-width: 56px; padding: 2px 4px; }
.gov-report .gov-band { background: var(--hs-mist-2); text-align: center; font-weight: 700; color: var(--hs-navy); }
.gov-report .gov-calc th { background: var(--hs-surface); font-weight: 600; }
.fee-report tr.free-row td, .legend-box.free-row { background: var(--hs-danger-soft); }
.fee-report td.owed-cell, .legend-box.owed-cell { background: var(--hs-danger); color: #fff; font-weight: 600; }
.legend-box { display: inline-block; width: 14px; height: 10px; border: 1px solid var(--hs-line-strong); vertical-align: middle; border-radius: 2px; }
.fee-report th.vertical { height: 56px; }
.attendance-grid th.friday, .attendance-grid td.friday { width: 14px; min-width: 14px; padding: 0; background: var(--hs-surface-2); }
.attendance-grid td { padding: 2px 3px; }
.attendance-legend { max-width: 720px; margin-inline: auto; }
.table-head .table-emblem { font-size: 46px; color: var(--hs-blue); line-height: 1; }
.table-signatures { padding-inline: 8px; }

/* ==== 10. Owner's panel and sign-in (same tokens, same parts) ======================== */
.hs-top { position: sticky; top: 0; z-index: 1030; background: linear-gradient(90deg, var(--hs-ink), var(--hs-night)); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 var(--hs-gutter); height: var(--hs-header-h); }
.hs-top .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.hs-top .brand .title { font-weight: 800; }
.hs-top .brand .sub { color: var(--hs-sky); font-size: var(--hs-fs-xs); }
.hs-top .spacer { flex: 1; }
.hs-top .user { color: #fff; text-decoration: none; font-size: var(--hs-fs-sm); display: inline-flex; align-items: center; gap: 6px; }
.hs-main { max-width: 1280px; margin: 0 auto; padding: 22px 16px 48px; }
.issued-password { direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: 20px; letter-spacing: .08em; background: var(--hs-ink); color: #fff; border-radius: var(--hs-radius-sm); padding: 10px 14px; display: inline-block; user-select: all; }

/* The logo is drawn on black, so the side that shows it is black too. */
.hs-login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.hs-login .showcase { background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 32px 24px; text-align: center; }
.hs-login .brand-logo-full { width: min(440px, 100%); height: auto; display: block; }
.hs-login .brand-name-fa { color: var(--hs-sky); font-size: 18px; font-weight: 700; margin-top: -64px; } /* the logo has an empty band at its foot */
.hs-login .panel { display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--hs-surface); }
.hs-login .card-login { width: 100%; max-width: 380px; }
.hs-login .card-login h1 { font-size: 22px; font-weight: 800; color: var(--hs-navy); }
.hs-login .card-login .hint { color: var(--hs-muted); font-size: var(--hs-fs-sm); }

/* ==== 11. Small screens and print ===================================================== */
@media (max-width: 991.98px) {
  .app-main { margin-right: 0; }
  .content-wrapper { padding: 14px 16px 40px; }
}
@media (max-width: 860px) {
  .hs-login { grid-template-columns: 1fr; }
  .hs-login .showcase { padding: 16px; }
  .hs-login .brand-logo-full { width: 220px; }
  .hs-login .brand-name-fa { font-size: 15px; margin-top: -32px; }
}
@media (max-width: 767.98px) { .wizard { flex-direction: column; } .wizard .stepper { width: 100%; display: flex; flex-wrap: wrap; } }
}

/* ==== 12. Messages drawn by public/js/dialogs.js ====================================== */
.hs-toast { background: var(--hs-navy); color: #fff; border: 0; }
.hs-toast.is-danger { background: var(--hs-danger); }
.hs-toast .toast-body { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.hs-toast .toast-body i { font-size: 18px; color: var(--hs-sky); flex: none; }
.hs-toast.is-danger .toast-body i { color: #fff; }
.app-confirm .modal-body { padding: 28px 24px 12px; }
.app-confirm .confirm-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; font-size: 26px; background: var(--hs-mist); color: var(--hs-blue); margin-bottom: 12px; }
.app-confirm .confirm-icon.is-danger { background: var(--hs-danger-soft); color: var(--hs-danger); }
.app-confirm .confirm-text { margin: 0; font-size: var(--hs-fs); color: var(--hs-navy); font-weight: 600; }
.app-confirm .modal-footer { border-top: 0; padding-bottom: 22px; }

/* Label/value table of a record's details. */
/* What a dialog tells about one thing: names in a quiet column, values beside them, hairlines between. */
.details-table { --bs-table-bg: transparent; width: 100%; margin-bottom: 18px; border: 0 !important; font-size: var(--hs-fs-sm); }
.details-table > :not(caption) > * > * { padding: 9px 0 !important; border: 0 !important; border-bottom: 1px solid var(--hs-line) !important; background: none !important; box-shadow: none !important; vertical-align: top; }
.details-table th { width: 170px; padding-inline-end: 16px !important; font-size: var(--hs-fs-xs); font-weight: 500; color: var(--hs-muted); }
.details-table td { font-weight: 600; white-space: pre-line; }
.details-table th[colspan] { width: auto; padding-top: 4px !important; font-size: var(--hs-fs-sm); font-weight: 800; color: var(--hs-navy); border-bottom-color: var(--hs-line-strong) !important; }
.details-table tr:last-child > * { border-bottom: 0 !important; }
@media (max-width: 991.98px) { .table-scroll { overflow-x: auto; } }

/* ==== 13. Shell details ================================================================ */
.content-wrapper > .crumbs { margin-bottom: 6px; }
.dropdown-item { display: flex; align-items: center; gap: 10px; }
.dropdown-item > i { font-size: 15px; width: 18px; text-align: center; color: var(--hs-muted); flex: none; }
.dropdown-item:hover > i, .dropdown-item:focus > i { color: inherit; }
.dropdown-item.is-danger, .dropdown-item.is-danger > i { color: var(--hs-danger); }
.dropdown-item.is-danger:hover { background: var(--hs-danger-soft); color: var(--hs-danger); }
.dropdown-item.is-success > i { color: var(--hs-success); }
.toast-zone { position: fixed; bottom: 0; left: 0; padding: 16px; z-index: 1090; }

/* An area's overview: its groups as cards of links. */
.area-overview { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.area-links { list-style: none; margin: 0; padding: 6px; }
.area-links a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: var(--hs-radius-sm); color: var(--hs-text); text-decoration: none; font-size: var(--hs-fs-sm); }
.area-links a:hover { background: var(--hs-mist); color: var(--hs-blue); }
.area-links a i { font-size: 11px; color: var(--hs-faint); }

/* ==== 14. Lists: page head, row menu ================================================== */
.page-head .titles { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.page-count { font-size: var(--hs-fs-xs); font-weight: 700; color: var(--hs-blue); background: var(--hs-mist); border-radius: 20px; padding: 3px 10px; }
.page-head .toolbar .dropdown-menu { min-width: 220px; }

/* Lists are open sheets: lines between rows, no grid. */
.data-table:not(.table-bordered) > :not(caption) > * > * { border-bottom-color: var(--hs-line); }
.data-table:not(.table-bordered) thead th { border-bottom: 1px solid var(--hs-mist-2); text-align: start; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table .col-num { width: 1%; white-space: nowrap; color: var(--hs-faint); font-size: var(--hs-fs-xs); text-align: center; }
.data-table .col-menu { width: 1%; white-space: nowrap; text-align: center; padding-inline: 4px; }
.row-menu-toggle { --bs-btn-color: var(--hs-muted); --bs-btn-bg: transparent; --bs-btn-border-color: transparent; --bs-btn-hover-color: var(--hs-blue); --bs-btn-hover-bg: var(--hs-mist); --bs-btn-hover-border-color: transparent; --bs-btn-active-bg: var(--hs-mist-2); --bs-btn-active-color: var(--hs-blue); --bs-btn-active-border-color: transparent; }
.row-menu.show .row-menu-toggle, .row-menu-toggle.show { background: var(--hs-mist); color: var(--hs-blue); }
.dropdown-menu > .menu-divider:first-child { display: none; }
.dropdown-item.is-primary > i { color: var(--hs-blue); }
button.dropdown-item { font-family: var(--hs-font); }

.list-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.per-page { display: flex; align-items: center; gap: 8px; font-size: var(--hs-fs-xs); color: var(--hs-muted); margin: 0; }
.per-page .form-select { width: auto; }
.section-title { font-size: var(--hs-fs); font-weight: 800; color: var(--hs-navy); padding-bottom: 6px; margin: 4px 0 10px; border-bottom: 1px solid var(--hs-line); }
.letter-sheet { border: 1px solid var(--hs-line); border-radius: var(--hs-radius); padding: 16px; margin-bottom: 16px; }

/* A printed list whose font and size the user picks: the page hands them over as --print-font / --print-size. */
.print-sized { font-family: var(--print-font, var(--hs-font)), var(--hs-font); font-size: var(--print-size, var(--hs-fs-sm)); }
.print-sized .data-table { font-size: inherit; }
.photo-cell { font-size: 22px; color: var(--hs-faint); }
.sign-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; font-size: var(--hs-fs-sm); font-weight: 600; margin-top: 16px; padding-inline: 8px; }

/* ==== 15. Size scale for layout (pages use these, never their own sizes) ============== */
.pre-line { white-space: pre-line; }
.fs-xs { font-size: var(--hs-fs-xs) !important; }
.w-col-xs { width: 44px; } .w-col-sm { width: 72px; } .w-col-md { width: 110px; } .w-col-lg { width: 150px; }
.min-col-sm { min-width: 72px; } .min-col-md { min-width: 110px; } .min-col-lg { min-width: 150px; } .min-col-xl { min-width: 200px; }
.w-20 { width: 20% !important; } .w-30 { width: 30% !important; }
.box-narrow { max-width: 560px; } .box-medium { max-width: 720px; } .box-wide { max-width: 900px; }
.page-break { break-after: page; page-break-after: always; }
.scroll-box { max-height: 300px; overflow: auto; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--dot, var(--hs-blue)); vertical-align: middle; }
.chart-box { position: relative; height: 300px; }
.cell-tall { height: 48px; }
.col-tile { flex: 1 0 140px; }
.tinted { background: var(--tint, transparent) !important; }
/* Round emblem and photo frames of printed sheets; the page hands over the size as --size / --w, --h. */
.emblem { display: inline-grid; place-items: center; flex: none; width: var(--size, 56px); height: var(--size, 56px); border: 1px solid var(--hs-line-strong); border-radius: 50%; color: var(--hs-faint); font-size: calc(var(--size, 56px) / 2); }
.emblem.square { border-radius: var(--hs-radius-sm); }
/* The national, the ministry's and the school's marks on official sheets (x-official-mark). */
/* A cell whose text is made smaller to fit its width (public/js/number-words.js): «به حروف». max-width 0 keeps long words from widening the column. */
.fit-cell { width: 22%; max-width: 0; overflow: hidden; white-space: nowrap; }
/* A head of a form of the school's own: the marks stand in the middle of the empty space on each side of the lines of text. */
.head-grid, .id-card .band.head-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.head-grid > .head-marks.corners { display: contents; }
.head-grid > .head-marks > :first-child { grid-area: 1 / 1; justify-self: center; }
.head-grid > .head-marks > :last-child { grid-area: 1 / 3; justify-self: center; }
.head-grid > :not(.head-marks) { grid-area: 1 / 2; }
.head-marks.corners { position: absolute; top: 0; inset-inline: 0; justify-content: space-between; margin: 0; pointer-events: none; }
.head-marks { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 4px; }
.official-mark { flex: none; width: var(--size, 56px); height: var(--size, 56px); object-fit: contain; }
.photo-frame { display: inline-grid; place-items: center; flex: none; overflow: hidden; width: var(--w, 90px); height: var(--h, 110px); border: 1px solid var(--hs-line-strong); border-radius: var(--hs-radius-sm); color: var(--hs-faint); font-size: calc(var(--w, 90px) / 2.5); }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.bubble { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--hs-ink); border-radius: 50%; font-size: 10px; }

/* ==== 16. Paper: our own printed documents ============================================
 * Receipts, bills, cards and sheets the school prints. Values the user chooses (font,
 * size, paper colour…) come in as custom properties on the document; paper size and
 * orientation as a .paper-* class (named pages). Ministry forms keep result-tables.css. */
@page a4-portrait { size: A4 portrait; margin: 7mm; }
@page a4-landscape { size: A4 landscape; margin: 7mm; }
@page a5-portrait { size: A5 portrait; margin: 7mm; }
@page a5-landscape { size: A5 landscape; margin: 7mm; }
.paper-a4-portrait { page: a4-portrait; } .paper-a4-landscape { page: a4-landscape; }
.paper-a5-portrait { page: a5-portrait; } .paper-a5-landscape { page: a5-landscape; }
@media print { .no-print { display: none !important; } }

/* A document page opened on its own (receipts, cards, timetables). */
body.doc { overflow: auto; background: var(--hs-bg); font-size: var(--hs-fs-sm); }
body.doc .doc-bar { display: flex; justify-content: center; gap: 8px; padding: 12px; }
@media print { body.doc { background: #fff; } }

.bill { background: var(--hs-surface); max-width: 148mm; margin: 16px auto; padding: 14px 18px; border: 1px solid var(--hs-line); border-radius: var(--hs-radius); box-shadow: var(--hs-shadow-sm); }
.bill .copy + .copy { border-top: 1px dashed var(--hs-line-strong); margin-top: 14px; padding-top: 14px; }
@media (max-width: 600px) { .bill { margin: 16px; } }
@media print { .bill { border: 0; box-shadow: none; margin: 0 auto; } }

.fee-bill { border: 1px solid var(--hs-line-strong); border-radius: var(--hs-radius-sm); padding: 10px 12px; margin-bottom: 12px; break-inside: avoid; background: var(--hs-surface); }
.bill-sheet { display: none; }
@media print {
  body.print-bills .bill-list, body.print-bills .search-panel, body.print-bills .alert { display: none !important; }
  body.print-bills .bill-sheet { display: block; }
  body.print-bills .fee-bill:not(.chosen) { display: none; }
  .bill-list .form-check-input { display: none; }
}

/* Exam admit cards. */
.card-sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 980px; margin: 16px auto; }
.exam-card { background: var(--hs-surface); border: 2px solid var(--hs-navy); border-radius: var(--hs-radius); padding: 10px 12px; break-inside: avoid; }
.exam-card .photo { width: 78px; height: 96px; border: 1px dashed var(--hs-line-strong); display: grid; place-items: center; color: var(--hs-faint); font-size: 11px; }
.exam-card .title { background: var(--hs-navy); color: #fff; border-radius: var(--hs-radius-sm); text-align: center; padding: 3px; margin: 6px 0; }
@media (max-width: 700px) { .card-sheet { grid-template-columns: 1fr; padding: 0 16px; } }
/* Printed: eight cards to an A4 page, two across and four down. */
@media print {
    .card-sheet { margin: 0; max-width: none; gap: 3mm; grid-auto-rows: 64mm; }
    .exam-card { height: 64mm; padding: 2.5mm 4mm; font-size: 8.5pt; overflow: hidden; }
    .exam-card .small, .exam-card .table { font-size: 8.5pt; }
    .exam-card .table th, .exam-card .table td { padding: 0.5mm 1.5mm; }
    .exam-card .photo { width: 54px; height: 66px; }
    .exam-card .title { margin: 2px 0; padding: 1px; }
    .exam-card:nth-child(8n) { break-after: page; }
}

/* Identity cards, CR80 (85.6 × 54 mm). */
.id-sheet { display: flex; flex-wrap: wrap; gap: 8mm; justify-content: center; padding: 8mm 16px; }
.id-sheet .pair { display: flex; gap: 4mm; flex-wrap: wrap; justify-content: center; }
/* The identity card (85.6 × 54 mm): a white head with the marks on both sides, a thin blue line, the details beside the photo, a blue strip at the foot. */
.id-card { width: 85.6mm; height: 54mm; display: flex; flex-direction: column; background: var(--hs-surface); color: var(--hs-navy); border-radius: 3mm; overflow: hidden; box-shadow: var(--hs-shadow); position: relative; font-size: 7.4pt; break-inside: avoid; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.id-card .band { position: relative; padding: 2mm 2.5mm 1.6mm; display: flex; align-items: center; justify-content: space-between; font-size: 6.6pt; line-height: 1.4; font-weight: 600; }
.id-card .band b { font-size: 7.4pt; }
.id-card .accent { height: 1.1mm; background: var(--hs-gradient); flex: none; }
.id-card .body { display: flex; align-items: center; gap: 3mm; padding: 1.5mm 3mm 7mm; flex: 1; }
.id-card .photo { width: 18mm; height: 18mm; border-radius: 50%; border: .5mm solid var(--hs-blue); background: var(--hs-mist); display: grid; place-items: center; color: var(--hs-faint); overflow: hidden; flex: none; }
.id-card .photo.rect { border-radius: 1.5mm; width: 17mm; height: 22mm; }
.id-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.id-card dl { margin: 0; flex: 1; display: grid; grid-template-columns: auto 1fr; gap: .9mm 3mm; align-content: center; }
.id-card dt { color: var(--hs-muted); font-weight: 500; font-size: 6.8pt; } .id-card dd { margin: 0; font-weight: 700; font-size: 8.4pt; }
.id-card dd.code { justify-self: start; background: var(--hs-mist); color: var(--hs-blue); border-radius: .8mm; padding: 0 1.4mm; font-size: 7pt; }
.id-card .foot { position: absolute; bottom: 0; inset-inline: 0; height: 5mm; background: var(--hs-gradient); color: #fff; padding: 0 3mm; display: flex; align-items: center; justify-content: space-between; font-size: 6.4pt; font-weight: 500; }
.id-card.back .note { padding: 3mm 3.5mm 7mm; white-space: pre-line; line-height: 1.7; flex: 1; font-size: 7.2pt; }
.id-card .code { font-family: monospace; letter-spacing: .3mm; direction: ltr; }
@media print { .id-sheet { padding: 0; } .id-card { box-shadow: none; border: .2mm solid var(--hs-line-strong); } }

/* A whole-school timetable on one sheet. */
.timetable-sheet { width: 100%; border-collapse: collapse; font-size: 11px; }
.timetable-sheet th, .timetable-sheet td { border: 1px solid var(--hs-line-strong); padding: 3px; text-align: center; vertical-align: middle; }
.timetable-sheet th { background: var(--hs-mist); color: var(--hs-navy); }
.timetable-sheet td small { display: block; color: var(--hs-muted); font-size: 10px; }

/* The attendance register in the Ministry format. */
.gov-register { font-size: 10px; }
.gov-register td, .gov-register th { padding: 1px 2px !important; }
.gov-register .day { min-width: 15px; }

/* Report cards: --sheet-bg, --print-font, --print-size, --sheet-width, --line-one, --line-two. */
.rs-card { background: var(--sheet-bg, #fff); font-family: var(--print-font, var(--hs-font)), var(--hs-font); font-size: var(--print-size, 13px); border: 2px solid var(--hs-navy); border-radius: var(--hs-radius-sm); padding: 12px 14px; margin: 0 auto 16px; max-width: var(--sheet-width, 210mm); }
.rs-card table { font-size: inherit; margin-bottom: 0; }
.rs-card .col-one td, .rs-card .col-one th { line-height: calc(1.5 * var(--line-one, 1)); }
.rs-card .col-two td, .rs-card .col-two th { line-height: calc(1.5 * var(--line-two, 1)); }
.rs-card .photo { width: 72px; height: 88px; border: 1px dashed var(--hs-line-strong); display: grid; place-items: center; color: var(--hs-faint); overflow: hidden; }
.rs-card .photo img { width: 100%; height: 100%; object-fit: cover; }
@media print { .rs-card { break-after: page; border-width: 1px; margin: 0; max-width: none; } }

/* Mark and attendance sheets («شقه»): --print-font, --print-size. */
.shoqa { font-family: var(--print-font, var(--hs-font)), var(--hs-font); font-size: var(--print-size, 12px); }
.shoqa table { font-size: inherit; margin-bottom: 0; }
.shoqa .head-table td { border: 0; padding: 1px 4px; }
.shoqa .main-table td, .shoqa .main-table th { padding: 2px 4px; height: 22px; }
.shoqa .foot { padding: 8px 4px 2px; }
@media print { .shoqa-sheet { break-after: page; } }

/* Result tables made here (not from a Ministry workbook): --print-font, --print-size, --cell-y, --cell-x, --page-margin. */
.official { font-family: var(--print-font, var(--hs-font)), var(--hs-font); font-size: var(--print-size, 10px); }
.official.bold { font-weight: 600; }
.official table { font-size: inherit; margin-bottom: 0; }
.official .table td, .official .table th { padding: var(--cell-y, 2px) var(--cell-x, 3px); }
.official .page { margin-right: var(--page-margin, 0); }
.official .fail { color: var(--hs-danger); font-weight: 700; }
.official .blocked { background: repeating-linear-gradient(45deg, #fff, #fff 3px, var(--hs-line-strong) 3px, var(--hs-line-strong) 4px); }
@media print {
  .official .page { break-after: page; }
  .official.both-sides .page:nth-child(even) { margin-right: 0; margin-left: var(--page-margin, 0); }
}

/* Cover of the result tables: --print-font, --print-size, --sheet-width, --sheet-height. */
.cover-page { font-family: var(--print-font, var(--hs-font)), var(--hs-font); font-size: var(--print-size, 16px); border: 3px double var(--hs-navy); border-radius: var(--hs-radius-sm); padding: 28px; margin: 0 auto 18px; background: #fff; max-width: var(--sheet-width, 210mm); min-height: var(--sheet-height, 260mm); display: flex; flex-direction: column; justify-content: space-between; }
@media print { .cover-page { break-after: page; margin: 0; max-width: none; min-height: 92vh; } }

/* A Ministry sheet shown in the page (tabs over a frame), and the «لیست» editor of a result table. */
.rt-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.rt-tabs .nav-link { white-space: nowrap; padding: .4rem .8rem; }
.rt-frame { display: block; width: 100%; height: calc(100vh - 250px); min-height: 420px; border: 1px solid var(--hs-line); border-top: 0; background: var(--hs-line); border-radius: 0 0 var(--hs-radius) var(--hs-radius); }
.rt-list-wrap { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); background: var(--hs-surface); }
.rt-list { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.rt-list th, .rt-list td { border: 1px solid var(--hs-line); border-width: 0 0 1px 1px; padding: 0; text-align: center; white-space: nowrap; }
.rt-list thead th { position: sticky; background: var(--hs-mist); color: var(--hs-navy); z-index: 2; padding: 3px 4px; font-weight: 700; }
.rt-list thead tr:nth-child(1) th { top: 0; }
.rt-list thead tr:nth-child(2) th { top: 25px; }
.rt-list .sticky-col { position: sticky; right: 0; background: var(--hs-surface-2); z-index: 1; min-width: 34px; }
.rt-list thead .sticky-col { z-index: 3; }
.rt-list input { border: 0; background: transparent; padding: 3px 4px; font-size: 12px; text-align: center; outline: none; }
.rt-list input:focus { background: var(--hs-warning-soft); box-shadow: inset 0 0 0 1px var(--hs-warning); }
.rt-list input.changed { background: var(--hs-mist); }
.rt-list input.bad { background: var(--hs-danger-soft); box-shadow: inset 0 0 0 1px var(--hs-danger); }
.rt-list .w-num { width: 46px; } .rt-list .w-name { width: 112px; text-align: right; } .rt-list .w-remark { width: 200px; text-align: right; }
.rt-list .g-mid { background: var(--hs-warning-soft); } .rt-list .g-ann { background: var(--hs-success-soft); }
.rt-details input.changed, .rt-map select.changed { background: var(--hs-mist); }
.rt-details input.bad, .rt-map select.bad { background: var(--hs-danger-soft); }
.rt-map select { font-size: 12px; }

/* ==== 17. Chips: a row of choices (subjects of a class, a quick value) =================== */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 20px; border: 1px solid var(--hs-line-strong); background: var(--hs-surface); color: var(--hs-navy); font-size: var(--hs-fs-xs); font-weight: 600; text-decoration: none; cursor: pointer; font-family: var(--hs-font); }
.chip:hover { border-color: var(--hs-sky); color: var(--hs-blue); background: var(--hs-mist); }
.chip.active { background: var(--hs-blue); border-color: var(--hs-blue); color: #fff; }

/* A small form inside a dialog or page (a payment, a quick entry). */
.form-panel { background: var(--hs-surface-2); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); padding: 12px; margin: 0; }
.page-tag { font-size: var(--hs-fs-xs); font-weight: 600; color: var(--hs-muted); background: var(--hs-surface); border: 1px solid var(--hs-line-strong); border-radius: 20px; padding: 2px 10px; }
/* The fixed code of a page, said when reporting a problem. */
.page-code { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--hs-faint); border: 1px dashed var(--hs-line-strong); border-radius: var(--hs-radius-sm); padding: 1px 6px; direction: ltr; }

/* ==== 18. The new list (sample: «همه متعلمین»; every list gets it once approved) ===========
 * Search as you type and a few filters in one row; the rest behind «فلترهای بیشتر». Counts per
 * status as tabs, active filters as chips, a quiet table, a side panel, and a bar for chosen rows. */
.search-field { position: relative; flex: 1 1 240px !important; max-width: 380px !important; margin: 0; }
.search-field i { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--hs-faint); pointer-events: none; }
.search-field input { padding-inline-start: 36px; }
.list-bar .badge { padding: 2px 7px; }
.more-filters { flex-basis: 100%; }
.filter-more { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; padding-top: 10px; border-top: 1px dashed var(--hs-line-strong); }
.filter-more > .row { display: contents; }
.filter-checks { display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 6px 16px; }

.segments { display: flex; flex-wrap: wrap; gap: 0 18px; margin: 6px 0 10px; border-bottom: 1px solid var(--hs-line); font-size: var(--hs-fs-sm); }
.seg { display: inline-flex; align-items: baseline; gap: 6px; padding: 8px 0 9px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--hs-muted); text-decoration: none; white-space: nowrap; }
.seg b { font-weight: 700; color: var(--hs-text); font-variant-numeric: tabular-nums; }
.seg:hover { color: var(--hs-blue); }
.seg.active { color: var(--hs-blue); border-bottom-color: var(--hs-blue); font-weight: 700; }
.seg.active b { color: var(--hs-blue); }
.seg.empty { opacity: .5; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.filter-chips:empty { display: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding-block: 3px; padding-inline: 10px 4px; border-radius: 20px; background: var(--hs-mist); color: var(--hs-navy); font-size: var(--hs-fs-xs); text-decoration: none; }
.filter-chip .x { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--hs-muted); font-size: 10px; }
.filter-chip:hover .x { background: var(--hs-mist-2); color: var(--hs-danger); }
.filter-chip.clear-all { background: transparent; color: var(--hs-muted); text-decoration: underline; padding-inline: 4px; }

/* A quiet list: no shading, the header in grey type, the person in one cell. */
.list-v2 { box-shadow: none; }
.list-v2 .data-table thead th { background: var(--hs-surface); color: var(--hs-muted); font-weight: 600; text-align: start; border-bottom: 1px solid var(--hs-line-strong); }
.list-v2 .data-table tbody tr[data-row-dialog] { cursor: pointer; }
.list-v2 .data-table td { padding-block: 9px; }
.data-table .col-check { width: 1%; padding-inline: 2px; }
.person-cell { min-width: 220px; line-height: 1.5; }
.person-name { font-weight: 700; color: var(--hs-navy); }
.person-sub { color: var(--hs-muted); font-size: var(--hs-fs-xs); margin-inline-start: 4px; }
.person-meta { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.tag-muted { font-size: 11px; color: var(--hs-warning); }
/* A name in a short list inside a cell (the classes of a teacher, the days of a week). */
.tag { display: inline-block; margin: 1px 0 1px 4px; padding: 1px 8px; border-radius: 20px; background: var(--hs-mist); color: var(--hs-navy); font-size: var(--hs-fs-xs); white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hs-faint); flex: none; }
.status.ok::before { background: var(--hs-success); }
.status.bad::before { background: var(--hs-danger); }
.status.info::before { background: var(--hs-blue); }
.status.warn::before { background: var(--hs-warning); }
.num-cell { direction: ltr; text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
body.list-loading [data-live-region] { opacity: .55; transition: opacity .15s; }

/* The bar for chosen rows. */
.bulk-bar { position: fixed; bottom: 18px; left: 50%; z-index: 1025; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--hs-navy); color: #fff; border-radius: var(--hs-radius); box-shadow: var(--hs-shadow-lg); transform: translate(-50%, 160%); transition: transform .2s; }
.bulk-bar.show { transform: translate(-50%, 0); }
.bulk-bar .bulk-count { padding-inline: 8px 6px; font-size: var(--hs-fs-sm); white-space: nowrap; }
.bulk-bar .btn-secondary { --bs-btn-bg: transparent; --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .28); --bs-btn-hover-bg: rgba(255, 255, 255, .1); --bs-btn-hover-color: #fff; --bs-btn-hover-border-color: rgba(255, 255, 255, .5); }
@media print { .bulk-bar, .list-bar, .segments, .filter-chips { display: none !important; } }


/* ==== 19. A person's record: head, index, parts, facts; its form as a paper file =====
 * <x-record-head>, <x-record-section>, <x-facts> draw a record (students/partials/show);
 * <x-file-tabs> and <x-form-block> draw its form (students/partials/wizard). */
.modal-header:has(> .record-head) { background: var(--hs-surface-2); padding: 18px 22px; }
.record-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.record-avatar { width: 58px; height: 58px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--hs-navy); color: #fff; font-size: 21px; font-weight: 800; box-shadow: 0 0 0 3px var(--hs-surface), 0 0 0 4px var(--hs-line-strong); }
.record-avatar img { width: 100%; height: 100%; object-fit: cover; }
.record-titles { min-width: 0; display: grid; gap: 1px; }
.record-name { font-size: 19px !important; margin: 0; line-height: 1.45; }
.record-lineage { color: var(--hs-muted); font-size: var(--hs-fs-sm); }
.record-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 6px; font-size: var(--hs-fs-sm); }
.record-code { border: 0; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.record-code:hover { background: var(--hs-mist-2); }
.record-fact { display: inline-flex; align-items: center; gap: 6px; color: var(--hs-muted); }
.record-fact i { color: var(--hs-faint); }

.modal-body.record { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0 30px; align-items: start; padding: 0 22px; }
.record-index { position: sticky; top: 0; display: grid; gap: 2px; padding: 18px 0; }
.record-index a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--hs-radius-sm); color: var(--hs-text); text-decoration: none; font-size: var(--hs-fs-sm); }
.record-index a:hover { background: var(--hs-mist); color: var(--hs-navy); }
.record-index a i { color: var(--hs-faint); }
.record-index a small { margin-inline-start: auto; color: var(--hs-success); font-variant-numeric: tabular-nums; }
.record-index a.has-gaps small { color: var(--hs-warning); }
.record-progress { display: grid; gap: 8px; padding: 0 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--hs-line); font-size: var(--hs-fs-sm); color: var(--hs-muted); }
.record-progress b { color: var(--hs-navy); }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--hs-mist-2); overflow: hidden; }
.meter i { display: block; height: 100%; width: var(--fill, 0%); background: var(--hs-blue); border-radius: inherit; }

.record-main { min-width: 0; padding-bottom: 8px; }
.record-section { padding: 20px 0; border-bottom: 1px solid var(--hs-line); scroll-margin-top: 4px; }
.record-section:last-child { border-bottom: 0; }
.record-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.record-section-icon { width: 30px; display: grid; place-items: center; flex: none; color: var(--hs-blue); font-size: 17px; }
.record-section-head h6 { margin: 0; font-size: 15px; font-weight: 800; color: var(--hs-navy); }
.record-count { font-size: var(--hs-fs-xs); font-variant-numeric: tabular-nums; color: var(--hs-warning); }
.record-count.is-full { color: var(--hs-success); }
.record-count.is-note { color: var(--hs-muted); }
.record-edit { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: var(--hs-radius-sm); font-size: var(--hs-fs-sm); font-weight: 600; color: var(--hs-blue); text-decoration: none; }
.record-edit:hover { background: var(--hs-mist); }
.record-section-body { display: grid; gap: 18px; padding-inline-start: 40px; }
.is-empty { color: var(--hs-faint) !important; font-weight: 400 !important; font-size: var(--hs-fs-sm); }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 28px; margin: 0; }
.facts.facts-wide { grid-template-columns: 1fr; }
.fact { min-width: 0; }
.fact dt { margin-bottom: 2px; font-size: var(--hs-fs-xs); font-weight: 500; color: var(--hs-muted); }
.fact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.name-pairs { width: 100%; max-width: 560px; border-collapse: collapse; }
.name-pairs th, .name-pairs td { padding: 8px 10px; border-bottom: 1px solid var(--hs-line); text-align: start; }
.name-pairs thead th { font-size: var(--hs-fs-xs); font-weight: 600; color: var(--hs-faint); border-bottom-color: var(--hs-line-strong); }
.name-pairs tbody th { width: 120px; font-size: var(--hs-fs-xs); font-weight: 500; color: var(--hs-muted); }
.name-pairs td { font-weight: 600; }
.name-pairs [dir="ltr"] { text-align: left; }

.record-family { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; background: var(--hs-surface-2); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); font-size: var(--hs-fs-sm); }
.record-family > i { color: var(--hs-blue); }
.record-family > a { margin-inline-start: auto; font-weight: 600; text-decoration: none; }
.parents, .places { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.parent h6 { margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--hs-line-strong); font-size: var(--hs-fs-sm); font-weight: 800; color: var(--hs-navy); }
.parent .facts { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.place { display: grid; gap: 4px; }
.place-label { font-size: var(--hs-fs-xs); color: var(--hs-muted); }
.place-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 600; }
.place-path i { font-size: 11px; color: var(--hs-faint); }
.flags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.flags li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border: 1px solid var(--hs-line); border-radius: 99px; color: var(--hs-faint); font-size: var(--hs-fs-sm); }
.flags li.on { border-color: transparent; background: var(--hs-success-soft); color: var(--hs-success); font-weight: 600; }
.contacts { list-style: none; margin: 0; padding: 0; }
.contacts li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--hs-line); }
.contacts li:last-child { border-bottom: 0; }
.contacts a { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-variant-numeric: tabular-nums; }

/* The form of a record: its parts are the tabs of a paper file, the open one joins the sheet. */
.modal-body.form-file { background: var(--hs-surface-2); padding: 14px 18px 18px; }
.file-tabs { position: relative; z-index: 1; display: flex; gap: 2px; margin-bottom: -1px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; }
.file-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-bottom: 0; border-radius: var(--hs-radius) var(--hs-radius) 0 0; color: var(--hs-muted); font-size: var(--hs-fs-sm); font-weight: 600; text-decoration: none; white-space: nowrap; }
a.file-tab:hover { background: var(--hs-mist); color: var(--hs-navy); }
.file-tab.is-current { background: var(--hs-surface); border-color: var(--hs-line); color: var(--hs-navy); box-shadow: inset 0 3px 0 var(--hs-blue); }
.file-tab.is-current i { color: var(--hs-blue); }
.file-tab.is-locked { color: var(--hs-faint); opacity: .75; cursor: not-allowed; }
.form-sheet { background: var(--hs-surface); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); padding: 4px 24px; box-shadow: var(--hs-shadow-sm); }
.form-sheet > .record-family { margin-top: 18px; }
.form-block { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 12px 28px; padding: 20px 0; border-bottom: 1px solid var(--hs-line); }
.form-sheet .form-block:last-child { border-bottom: 0; }
.form-block-title { display: grid; gap: 4px; align-content: start; }
.form-block-title > span { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--hs-navy); }
.form-block-title i { color: var(--hs-blue); }
.form-block-title small { font-size: var(--hs-fs-xs); line-height: 1.8; color: var(--hs-muted); }
.form-block .form-label { margin-bottom: 4px; font-size: var(--hs-fs-xs); font-weight: 600; color: var(--hs-muted); }
.field-action { display: flex; align-items: flex-end; }
.field-action .btn { width: 100%; }
.choices { display: inline-flex; gap: 3px; padding: 3px; background: var(--hs-surface-2); border: 1px solid var(--hs-line); border-radius: var(--hs-radius-sm); }
.choice { position: relative; margin: 0; cursor: pointer; }
.choice input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.choice span { display: block; padding: 5px 20px; border-radius: 4px; font-size: var(--hs-fs-sm); font-weight: 600; color: var(--hs-muted); }
.choice:has(input:checked) span { background: var(--hs-surface); color: var(--hs-navy); box-shadow: var(--hs-shadow-sm), inset 0 0 0 1px var(--hs-line-strong); }
.choice:has(input:focus-visible) span { box-shadow: var(--hs-ring); }
.toggles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.modal-footer > .step-nav { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.step-pos { padding-inline-end: 4px; font-size: var(--hs-fs-sm); color: var(--hs-muted); }

@media (max-width: 767.98px) {
  .modal-body.record { display: block; padding: 0 16px; }
  .record-index { position: static; display: flex; min-width: 0; overflow-x: auto; padding: 12px 0 4px; border-bottom: 1px solid var(--hs-line); }
  .record-index a { white-space: nowrap; }
  .record-progress { display: none; }
  .record-section-body { padding-inline-start: 0; }
  .parents, .places, .toggles, .form-block { grid-template-columns: 1fr; }
  .form-sheet { padding: 4px 14px; }
}
@media print { .record-index, .record-edit, .record-code i { display: none !important; } .modal-body.record { display: block; } }

/* A record that is not a person (crud/show): its facts on one sheet, who recorded it under them. */
.modal-body.record-sheet { padding: 22px 26px; }
.record-sheet .facts { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 32px; }
.record-audit { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 22px 0 0; padding-top: 12px; border-top: 1px solid var(--hs-line); font-size: var(--hs-fs-xs); color: var(--hs-muted); }
.record-audit i { color: var(--hs-faint); }
/* In a list: the first column names the row; who recorded and changed it is one quiet column. */
.data-table td.cell-title { font-weight: 700; color: var(--hs-navy); }
.audit-cell { font-size: var(--hs-fs-xs); color: var(--hs-muted); line-height: 1.6; white-space: nowrap; }
.audit-cell span { display: block; }
.audit-cell .audit-edit { color: var(--hs-faint); }
.record-list h6 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: var(--hs-fs-sm); font-weight: 800; color: var(--hs-navy); }
.record-list h6 a { color: var(--hs-blue); font-size: 13px; }
.record-list ul { margin: 0; padding-inline-start: 18px; font-size: var(--hs-fs-sm); }
.record-list li { padding: 2px 0; }
/* The buttons under a form on a page (not in a dialog). */
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0 18px; border-top: 1px solid var(--hs-line); }
@media (max-width: 575.98px) {
  .search-panel > .row > *, .search-panel .filter-field, .list-bar .filter-field, .search-field { flex: 1 1 100% !important; max-width: none !important; }
  .filter-field > .form-select, .filter-field > .form-control { flex: 1 1 auto; }
}

/* ==== 20. A student's fees (finance/student-fees) ======================================
 * Part of the student's file (the tabs .record-tabs): the months of the year in a table, and a
 * payment panel listing the months ticked with their amounts and total; one bill pays them all. */
.fee-who { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: -8px 0 12px; color: var(--hs-muted); font-size: var(--hs-fs-sm); }
.record-tabs { margin-bottom: 18px; font-size: var(--hs-fs); }
.fee-done { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fee-done > .btn { margin-inline-start: auto; }
.fee-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.fee-table tr.is-now > td { background: var(--hs-mist); }
.fee-table .status { margin-inline-end: 8px; }
.fee-bill-link { display: inline-block; margin-inline-end: 8px; font-size: var(--hs-fs-xs); white-space: nowrap; }
.fee-pay { position: sticky; top: 0; display: grid; gap: 12px; padding: 16px; background: var(--hs-surface); border: 1px solid var(--hs-line); border-radius: var(--hs-radius); box-shadow: var(--hs-shadow-sm); }
.fee-pay .section-title { margin: 0; }
.fee-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.fee-lines { margin: 0; padding: 0; list-style: none; }
.fee-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px dashed var(--hs-line-strong); font-size: var(--hs-fs-sm); }
.fee-lines li.is-empty { justify-content: center; color: var(--hs-faint); border-bottom: 0; }
.fee-lines b { font-variant-numeric: tabular-nums; }
.fee-total { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; border-radius: var(--hs-radius-sm); background: var(--hs-navy); color: #fff; font-size: var(--hs-fs-sm); }
.fee-total b { margin-inline-start: auto; font-size: 22px; font-variant-numeric: tabular-nums; }
.fee-section { margin-top: 28px; }
.data-table tr.is-new > td { background: var(--hs-success-soft); }
.bill-lines tfoot th { background: var(--hs-surface-2); }
@media (max-width: 991.98px) { .fee-grid { grid-template-columns: 1fr; } .fee-pay { position: static; } }
@media print { .fee-pay, .record-tabs, .fee-done { display: none !important; } .fee-grid { grid-template-columns: 1fr; } }
.bill-lines td, .bill-lines th { white-space: nowrap; }
.bill-lines .bill-unit th { padding: 2px 6px; font-size: 11px; font-weight: 500; color: var(--hs-muted); }

/* A bill's number in a payment form (<x-bill-number>): the system gives it, so it reads as fixed. */
.form-control.bill-number, .form-control.bill-number:focus { background-color: var(--hs-surface-2); border-style: dashed; color: var(--hs-navy); font-weight: 700; box-shadow: none; cursor: not-allowed; }
/* A person's ID in a column of its own (beside <x-person-cell>). */
.id-cell { direction: ltr; unicode-bidi: isolate; text-align: right; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: var(--hs-fs-xs); color: var(--hs-muted); }

/* ==== Print: every page of the app prints only its document, on A4 (one place for all pages) ==========
   The menu, the page's name and tools, the filters and the list's controls stay out of the paper; the page's own
   document (a sheet, a table, a report with its head) fills it. A sheet that is wider than a portrait page says so
   with .paper-a4-landscape, and the pages that print cards or bills have their own rules above. */
@page { size: A4 portrait; margin: 8mm; }
body[data-print-paper="landscape"] { page: a4-landscape; } body[data-print-paper="portrait"] { page: a4-portrait; }
@media print {
  html, body, body.app, body.app.design-next { height: auto !important; overflow: visible !important; background: #fff !important; }
  .app-header, .app-nav, .nav-backdrop, .hs-top, .nx-top, .nx-areas, .nx-mega, .nx-scrim, .nx-tabs, .nx-sentence, .nx-file-tools, .nx-entry-bar,
  .crumbs, .page-top, .page-head, .toolbar, .filters, .search-panel, .filter-chips, .list-bar, .list-foot, .bulk-bar, .segments, .pagination, .per-page,
  .row-actions, .row-menu, .row-menu-toggle, .toast-container, .modal, .alert, .no-print { display: none !important; }
  .app-main { position: static !important; inset: auto !important; margin: 0 !important; }
  .content-wrapper { height: auto !important; overflow: visible !important; padding: 0 !important; }
  .table-scroll { overflow: visible !important; border: 0 !important; box-shadow: none !important; }
  .data-table, .main-table { width: 100%; font-size: 9pt; }
  .table { --bs-table-border-color: #777; }
  .table > :not(caption) > * > * { border-color: #777 !important; }
  thead { display: table-header-group; }
  tr, .card, .report-head { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .general-results { font-size: 10px; }
}

/* A student's record on one A4 sheet (students/sheet): head, photo and identity, then the parts as tables. */
.rec-sheet { background: #fff; box-sizing: border-box; width: 210mm; max-width: 100%; min-height: 297mm; display: flex; flex-direction: column; margin: 12px auto; padding: 8mm; box-shadow: var(--hs-shadow-sm); font-size: 8.2pt; line-height: 1.3; color: var(--hs-navy); }
.rec-title { background: var(--hs-navy); color: #fff; text-align: center; font-weight: 700; padding: 1.2mm; border-radius: 1mm; margin-bottom: 3mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rec-top { display: flex; gap: 4mm; align-items: flex-start; margin-bottom: 2mm; }
.rec-top .rec-table { flex: 1; }
.rec-photo { width: 22mm; height: 27mm; border: .3mm solid #777; display: grid; place-items: center; color: var(--hs-faint); flex: none; overflow: hidden; }
.rec-photo img { width: 100%; height: 100%; object-fit: cover; }
.rec-part { font-weight: 800; border-bottom: .5mm solid var(--hs-navy); margin: 1.6mm 0 .6mm; padding-bottom: .1mm; }
.rec-table { width: 100%; border-collapse: collapse; margin-bottom: .6mm; table-layout: fixed; }
.rec-table.rec-3 th:first-child { width: 20%; }
.rec-table th, .rec-table td { border: .25mm solid #777; padding: .25mm 1.6mm; vertical-align: middle; }
.rec-table th { background: #eef2fa; font-weight: 600; width: 17%; white-space: nowrap; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.rec-table td { width: 33%; }
.rec-table .blank { display: inline-block; min-width: 20mm; height: 3mm; }
.rec-grid th, .rec-grid td { width: auto; }
.rec-grid th:first-child, .rec-grid td:first-child { width: 17%; }
.rec-inner { width: 100%; border-collapse: collapse; }
.rec-inner th, .rec-inner td { border: 0; border-bottom: .2mm dotted #999; }
.rec-inner th { background: none; width: 30%; }
.rec-sign { display: flex; justify-content: space-between; gap: 10mm; margin-top: auto; padding: 8mm 8mm 0; }
.rec-sign > div { flex: 1; text-align: center; break-inside: avoid; }
.rec-body { flex: 1; display: flex; flex-direction: column; }
.rec-section { display: flex; flex-direction: column; flex: var(--rows, 1) 1 auto; }
.rec-section .rec-table { flex: 1 1 auto; }
.rec-sign b { display: block; font-weight: 700; }
.rec-sign span { display: block; min-height: 1.3em; }
.rec-sign i { display: block; height: 16mm; border-bottom: .3mm solid #333; margin-bottom: 1mm; }
/* A record with many parts (an employee) is set smaller so that it still ends on the one sheet with its signatures. */
.rec-dense { font-size: 7.2pt; line-height: 1.2; }
.rec-dense .rec-table th, .rec-dense .rec-table td { padding: .1mm 1.4mm; }
.rec-dense .rec-table .blank { height: 2.4mm; }
.rec-dense .rec-part { margin: 1mm 0 .4mm; }
.rec-dense .rec-photo { width: 19mm; height: 23mm; }
.rec-dense .rec-sign { padding-top: 3mm; } .rec-dense .rec-sign i { height: 11mm; }
@media print { .rec-sheet { margin: 0; width: 100%; max-width: none; min-height: 281mm; padding: 0; box-shadow: none; break-inside: avoid; } .rec-table, .rec-part { break-inside: avoid; } }

/* The sheet around a page on paper: the head of the school and the page's name above, the signatures below. A page that
   brings its own head or is itself a sheet (reports, the Ministry's tables, cards, bills) does not get this one. */
.print-only { display: none; }
@media print {
  .print-only { display: block; }
  .print-head .rec-title { margin: 2mm 0 1mm; }
  .print-meta { text-align: left; font-size: 8pt; color: #555; margin-bottom: 2mm; }
  .print-foot { display: flex !important; justify-content: space-between; gap: 10mm; padding: 8mm 8mm 0; break-inside: avoid; }
  .print-foot > div { flex: 1; text-align: center; }
  .print-foot b { display: block; }
  .print-foot span { display: block; min-height: 1.3em; }
  .print-foot i { display: block; height: 16mm; border-bottom: .3mm solid #333; margin-bottom: 1mm; }
  .content-wrapper:has(> :not(.print-head, .print-foot) :is(.report-head, .rt-grid, .shoqa, .shoqa-sheet, .cover-page, .rs-card, .bill, .id-sheet, .card-sheet, .rec-sheet, .rt-sheet), > :is(.report-head, .rt-grid, .shoqa, .shoqa-sheet, .cover-page, .rs-card, .bill, .id-sheet, .card-sheet, .rec-sheet, .rt-sheet)) > .print-head,
  .content-wrapper:has(> :not(.print-head, .print-foot) :is(.report-head, .rt-grid, .shoqa, .shoqa-sheet, .cover-page, .rs-card, .bill, .id-sheet, .card-sheet, .rec-sheet, .rt-sheet), > :is(.report-head, .rt-grid, .shoqa, .shoqa-sheet, .cover-page, .rs-card, .bill, .id-sheet, .card-sheet, .rec-sheet, .rt-sheet)) > .print-foot { display: none !important; }
}
