/* =====================================================================
   Student Evaluation System - styles
   Themes are selected with <html data-theme="...">; each theme only sets
   a handful of CSS variables that the rest of the stylesheet consumes.
   ===================================================================== */

:root,
[data-theme="ocean"] {
    --brand: #2563eb;
    --brand-rgb: 37, 99, 235;
    --brand-dark: #1d4ed8;
    --brand-soft: #e8f0fe;
    --accent: #06b6d4;
    --page-bg: #f4f7fb;
    --nav-bg: linear-gradient(120deg, #1e3a8a, #2563eb);
}

[data-theme="emerald"] {
    --brand: #059669;
    --brand-rgb: 5, 150, 105;
    --brand-dark: #047857;
    --brand-soft: #e6f6f0;
    --accent: #84cc16;
    --page-bg: #f3f8f5;
    --nav-bg: linear-gradient(120deg, #064e3b, #059669);
}

[data-theme="royal"] {
    --brand: #7c3aed;
    --brand-rgb: 124, 58, 237;
    --brand-dark: #6d28d9;
    --brand-soft: #f1eafd;
    --accent: #ec4899;
    --page-bg: #f7f5fc;
    --nav-bg: linear-gradient(120deg, #4c1d95, #7c3aed);
}

[data-theme="sunset"] {
    --brand: #ea580c;
    --brand-rgb: 234, 88, 12;
    --brand-dark: #c2410c;
    --brand-soft: #fdeee4;
    --accent: #eab308;
    --page-bg: #fbf7f3;
    --nav-bg: linear-gradient(120deg, #9a3412, #ea580c);
}

[data-theme="rose"] {
    --brand: #db2777;
    --brand-rgb: 219, 39, 119;
    --brand-dark: #be185d;
    --brand-soft: #fce8f1;
    --accent: #f97316;
    --page-bg: #fbf5f8;
    --nav-bg: linear-gradient(120deg, #831843, #db2777);
}

[data-theme="midnight"] {
    --brand: #38bdf8;
    --brand-rgb: 56, 189, 248;
    --brand-dark: #0ea5e9;
    --brand-soft: rgba(56, 189, 248, .12);
    --accent: #a78bfa;
    --page-bg: #0f172a;
    --nav-bg: linear-gradient(120deg, #020617, #1e293b);
}

/* ---------- Bootstrap bridge ---------- */
:root {
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-dark);
    --bs-body-font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
    --bs-border-radius: .6rem;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #0f172a;
    --bs-tertiary-bg: #1e293b;
    --bs-secondary-bg: #1e293b;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}

[data-theme="midnight"] .btn-primary { --bs-btn-color: #0f172a; --bs-btn-hover-color: #0f172a; }

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--brand);
}

.nav-link { color: var(--brand); }
.nav-link:hover, .nav-link:focus { color: var(--brand-dark); }

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: rgba(var(--brand-rgb), .6);
    box-shadow: 0 0 0 .2rem rgba(var(--brand-rgb), .2);
}

.text-bg-primary { background-color: var(--brand) !important; }
.progress-bar { background-color: var(--brand); }

/* ---------- layout ---------- */
body {
    background: var(--page-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > form { flex: 1; display: flex; flex-direction: column; }
main { flex: 1; }

.app-navbar {
    background: var(--nav-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
}

.app-navbar .navbar-brand,
.app-navbar .nav-link { color: rgba(255, 255, 255, .88); }
.app-navbar .nav-link:hover,
.app-navbar .nav-link.active,
.app-navbar .navbar-brand:hover { color: #fff; }
.app-navbar .nav-link.active { font-weight: 700; }
.app-navbar .navbar-toggler { border-color: rgba(255, 255, 255, .4); }
.app-navbar .navbar-toggler-icon { filter: invert(1); }
/* phones: menu, name, search and account stay on one line (the name gives way) */
.app-navbar .nav-more { border: 0; padding: .25rem .4rem; color: #fff; font-size: 1.6rem; line-height: 1; box-shadow: none; }
@media (max-width: 991.98px) {
    .app-navbar .navbar-brand { min-width: 0; flex: 0 1 auto; margin-inline-end: .25rem; }
    .app-navbar .navbar-brand > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .app-navbar .gsearch-open { padding-inline: .4rem !important; }
}
@media (max-width: 380px) {
    .app-navbar .navbar-brand { font-size: 1.05rem; }
}
/* wide screens: every label on one line; what does not fit goes under «المزيد» (app.js App.initNavOverflow) */
@media (min-width: 992px) {
    .app-navbar .navbar-collapse { min-width: 0; }
    .app-navbar .navbar-nav { flex-wrap: nowrap; }
    .app-navbar .navbar-nav .nav-link { white-space: nowrap; padding-inline: .6rem; }
    .app-navbar .navbar-nav .nav-link > .bi { margin-inline-end: .15rem; }
    .app-navbar .nav-ovf-hide { display: none !important; }
    .app-navbar .dropdown-menu { max-height: calc(100vh - 5rem); overflow-y: auto; }
}

.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.15rem;
}

.app-footer {
    padding: 18px 0;
    border-top: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.card {
    border: 1px solid rgba(0, 0, 0, .05);
    border-radius: 14px;
}
[data-bs-theme="dark"] .card { border-color: rgba(255, 255, 255, .08); }

.card-header {
    background: transparent;
    font-weight: 600;
    padding: .85rem 1.1rem;
}

.table > thead th {
    font-size: .82rem;
    font-weight: 700;
    color: var(--bs-secondary-color);
    background: var(--bs-tertiary-bg);
    white-space: nowrap;
}

.search-box { max-width: 260px; }

/* ---------- auth pages ---------- */
.auth-wrapper { display: flex; justify-content: center; padding: 3vh 0; }
.auth-card { width: 100%; max-width: 460px; border-radius: 18px; }
.auth-icon {
    width: 68px; height: 68px; margin: 0 auto; border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand); font-size: 2rem;
}

/* ---------- dashboard ---------- */
.stat-card {
    display: flex; align-items: center; gap: 14px;
    background: var(--bs-body-bg); border-radius: 14px; padding: 16px;
    border: 1px solid rgba(0, 0, 0, .05); height: 100%;
}
.stat-card > i {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand); font-size: 1.35rem;
}
.stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: .8rem; color: var(--bs-secondary-color); }

.class-card { transition: transform .15s ease, box-shadow .15s ease; border-top: 4px solid var(--brand); }
.class-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .08); }
.class-card.archived { opacity: .7; border-top-color: var(--bs-secondary-color); }
.class-stats { display: flex; flex-wrap: wrap; gap: 14px; color: var(--bs-secondary-color); font-size: .9rem; margin-top: 12px; }

.empty-state { text-align: center; padding: 48px 16px; }
.empty-state > i { font-size: 3rem; color: var(--brand); opacity: .6; display: block; margin-bottom: 12px; }

.class-tabs .nav-link { padding: .35rem .8rem; }

.add-row { background: var(--bs-tertiary-bg); padding: 12px; border-radius: 10px; }

/* ---------- import ---------- */
.sample-table { background: var(--bs-tertiary-bg); padding: 10px; border-radius: 8px; font-size: .85rem; }
.preview-table { max-height: 480px; overflow: auto; }
.mapping-box { background: var(--brand-soft); padding: 12px; border-radius: 10px; }

/* ---------- photo -> table ---------- */
.photo-preview { background: var(--bs-tertiary-bg); border-radius: 10px; padding: 8px; text-align: center; }
.photo-preview img { max-width: 100%; max-height: 420px; border-radius: 6px; }
.photo-grid-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--bs-border-color); border-radius: 10px; }
.photo-grid thead th { position: sticky; top: 0; background: var(--bs-tertiary-bg); z-index: 1; }

/* ---------- session sheet ---------- */
.sheet-wrap { max-height: calc(100vh - 220px); overflow: auto; }
.sheet-table { min-width: 720px; }
.sheet-table thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; }
.sheet-table .col-num { width: 44px; }
.sheet-table .col-name { min-width: 190px; position: sticky; inset-inline-start: 0; background: var(--bs-body-bg); z-index: 1; }
.sheet-table thead .col-name { z-index: 3; background: var(--bs-tertiary-bg); }
.sheet-table .col-att { width: 200px; }
.sheet-table .col-crit { width: 105px; text-align: center; }
.sheet-table .col-crit.is-custom { background: rgba(var(--brand-rgb), .07); }
.sheet-table .col-total { width: 90px; text-align: center; font-weight: 700; }
.sheet-table .col-note { min-width: 200px; }
.sheet-table input.student-note { font-size: .85rem; }
.session-notes { resize: vertical; }
.session-note-preview { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crit-name { white-space: normal; line-height: 1.2; color: var(--bs-body-color); }
.crit-meta { font-weight: 400; font-size: .75rem; }
.sheet-table input.score { text-align: center; max-width: 80px; margin: 0 auto; }
.sheet-table input.score.is-invalid { background-image: none; padding-inline-end: .5rem; }

.att-group { display: inline-flex; gap: 4px; }
.btn-att {
    --c: #6c757d;
    min-width: 38px; padding: .2rem .45rem; font-size: .85rem; font-weight: 700;
    border: 1px solid var(--c); color: var(--c); background: transparent; border-radius: 8px;
}
.btn-att-1 { --c: #198754; }
.btn-att-2 { --c: #dc3545; }
.btn-att-3 { --c: #d97706; }
.btn-att-4 { --c: #0d6efd; }
.btn-check:checked + .btn-att { background: var(--c); color: #fff; border-color: var(--c); }
.btn-att:hover { background: rgba(0, 0, 0, .04); color: var(--c); }

tr.att-row-2 td { background: rgba(220, 53, 69, .06); }
tr.att-row-2 .student-name { text-decoration: line-through; text-decoration-color: rgba(220, 53, 69, .6); }

.att-summary { display: flex; flex-wrap: wrap; gap: 8px; }
.att-chip { padding: 4px 10px; border-radius: 20px; font-size: .82rem; background: var(--bs-tertiary-bg); }
.att-chip.att-1 { color: #198754; }
.att-chip.att-2 { color: #dc3545; }
.att-chip.att-3 { color: #d97706; }
.att-chip.att-4 { color: #0d6efd; }

.custom-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--brand-soft); color: var(--brand-dark);
    padding: 4px 6px 4px 12px; border-radius: 20px; font-size: .9rem;
}
[dir="rtl"] .custom-chip { padding: 4px 12px 4px 6px; }
.chip-remove { color: var(--bs-secondary-color); }
.chip-remove:hover { color: #dc3545; }
.max-input { max-width: 80px; }

.save-bar {
    position: sticky; bottom: 0; z-index: 10;
    margin: 16px -12px 0; padding: 12px 0;
    background: var(--bs-body-bg); border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -6px 16px rgba(0, 0, 0, .06);
}

/* ---------- reports ---------- */
.report-meta li { margin-bottom: 2px; }
.report-table th { text-align: center; vertical-align: middle; }
.report-table td a { text-decoration: none; font-weight: 600; }
.pct { font-weight: 700; }
.pct-high { color: #198754; }
.pct-mid { color: #0d6efd; }
.pct-low { color: #d97706; }
.pct-fail { color: #dc3545; }
.quick-range { text-decoration: none; }
.view-options input { margin-inline-end: 6px; }
.view-options label { margin-inline-end: 22px; }
.find-results { max-height: 360px; overflow: auto; }
.report-group { margin-bottom: 28px; }
.report-group-title { font-size: 1.05rem; font-weight: 700; padding: 8px 12px; margin-bottom: 6px;
    background: var(--brand-soft); border-inline-start: 4px solid var(--brand); border-radius: 6px; }

/* ---------- admin ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 20px; }
.bar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar { width: 100%; max-width: 38px; background: linear-gradient(180deg, var(--accent), var(--brand)); border-radius: 6px 6px 0 0; }
.bar-value { font-size: .75rem; font-weight: 700; margin-bottom: 4px; }
.bar-label { font-size: .72rem; color: var(--bs-secondary-color); margin-top: 6px; }

/* ---------- settings ---------- */
.lang-options input { margin-inline-end: 6px; }
.lang-options label { margin-inline-end: 24px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.theme-option {
    position: relative; cursor: pointer; border: 2px solid var(--bs-border-color);
    border-radius: 12px; padding: 10px; text-align: center; transition: border-color .15s;
}
.theme-option input { position: absolute; opacity: 0; }
.theme-option:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .2); }
.theme-swatch { display: flex; height: 34px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.theme-swatch span { flex: 1; }
.theme-name { font-size: .85rem; font-weight: 600; }
[data-theme-preview="ocean"] .theme-swatch span:nth-child(1) { background: #1e3a8a; }
[data-theme-preview="ocean"] .theme-swatch span:nth-child(2) { background: #2563eb; }
[data-theme-preview="ocean"] .theme-swatch span:nth-child(3) { background: #06b6d4; }
[data-theme-preview="emerald"] .theme-swatch span:nth-child(1) { background: #064e3b; }
[data-theme-preview="emerald"] .theme-swatch span:nth-child(2) { background: #059669; }
[data-theme-preview="emerald"] .theme-swatch span:nth-child(3) { background: #84cc16; }
[data-theme-preview="royal"] .theme-swatch span:nth-child(1) { background: #4c1d95; }
[data-theme-preview="royal"] .theme-swatch span:nth-child(2) { background: #7c3aed; }
[data-theme-preview="royal"] .theme-swatch span:nth-child(3) { background: #ec4899; }
[data-theme-preview="sunset"] .theme-swatch span:nth-child(1) { background: #9a3412; }
[data-theme-preview="sunset"] .theme-swatch span:nth-child(2) { background: #ea580c; }
[data-theme-preview="sunset"] .theme-swatch span:nth-child(3) { background: #eab308; }
[data-theme-preview="rose"] .theme-swatch span:nth-child(1) { background: #831843; }
[data-theme-preview="rose"] .theme-swatch span:nth-child(2) { background: #db2777; }
[data-theme-preview="rose"] .theme-swatch span:nth-child(3) { background: #f97316; }
[data-theme-preview="midnight"] .theme-swatch span:nth-child(1) { background: #020617; }
[data-theme-preview="midnight"] .theme-swatch span:nth-child(2) { background: #1e293b; }
[data-theme-preview="midnight"] .theme-swatch span:nth-child(3) { background: #38bdf8; }

@media (max-width: 575.98px) {
    .search-box { max-width: 100%; }
    .sheet-table .col-att { width: auto; }
    .btn-att { min-width: 32px; padding: .15rem .3rem; }
}

/* ---------- sharing student lists ---------- */
.share-item { padding: 14px 16px; border-bottom: 1px solid var(--bs-border-color); }
.share-item:last-child { border-bottom: 0; }
.share-item.pending { background: var(--brand-soft); border-inline-start: 4px solid var(--brand); }
.share-message { background: var(--bs-tertiary-bg); border-radius: 8px; padding: 6px 10px; font-size: .9rem; white-space: pre-line; }

/* ---------- notifications ---------- */
.notif-badge { position: absolute; top: 2px; inset-inline-end: -2px; font-size: .62rem; padding: .22em .45em; }
.notif-item { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--bs-border-color); }
.notif-item:last-child { border-bottom: 0; }
.notif-item.unread { background: var(--brand-soft); border-inline-start: 4px solid var(--brand); }
.notif-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-soft); color: var(--brand); font-size: 1.1rem;
}
.notif-body { white-space: pre-line; margin-top: 2px; }
.target-options input { margin-inline-end: 6px; }
.target-options label { margin-inline-end: 22px; }
.user-list { max-height: 280px; overflow: auto; border: 1px solid var(--bs-border-color); border-radius: 10px; padding: 8px 12px; }
.user-checks li { padding: 4px 0; }
.user-checks input { margin-inline-end: 8px; }

/* ---------- subscriptions ---------- */
.payment-info { white-space: pre-line; background: var(--bs-tertiary-bg); border-radius: .5rem; padding: .75rem 1rem; }
.sub-facts dd { margin-bottom: .35rem; }

/* ---------- schools & classroom visits ---------- */
.visit-items td:first-child { min-width: 14rem; }
.score-group .btn { min-width: 2.25rem; }
.score-number { max-width: 8rem; margin-inline-start: auto; }
.visit-text { white-space: pre-line; background: var(--bs-tertiary-bg); border-radius: .5rem; padding: .6rem .8rem; min-height: 2.5rem; }
.signature-line { border-bottom: 1px solid var(--bs-border-color); height: 2.5rem; margin: 0 2rem; }
.kind-options input { margin-inline-end: .35rem; }
.form-editor input[type=number] { max-width: 6rem; }
@media (max-width: 575.98px) {
    .visit-items td { display: block; border: 0; }
    .visit-items tr { border-bottom: 1px solid var(--bs-border-color); display: block; padding: .25rem 0; }
    .score-number { margin-inline-start: 0; }
}

/* ---------- school logo & roster ---------- */
.brand-logo { height: 34px; width: 34px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.school-logo-preview img { max-width: 100%; max-height: 160px; object-fit: contain; }
.report-logo { max-height: 72px; max-width: 160px; object-fit: contain; }

/* ---------- written visits ---------- */
.visit-note { min-height: 3.5rem; }
.visit-observation { white-space: pre-line; }

/* ---------- visit reports ---------- */
.print-only { display: none; }
.visit-block { break-inside: avoid; }
.visit-block-head { border-bottom: 2px solid var(--bs-primary); padding-bottom: .25rem; }

@media print {
    .no-print, .save-bar, .alerts { display: none !important; }
    /* no screen-height body or phone tab-bar room on paper: they added a blank last page */
    body { background: #fff; min-height: 0 !important; display: block !important; padding-bottom: 0 !important; }
    body > form { display: block !important; }
    main.py-4 { padding-top: 0 !important; padding-bottom: 0 !important; }
    .visit-report { border: 0 !important; box-shadow: none !important; font-size: 11px; line-height: 1.35; }
    .visit-report .card-body { padding: 0; }
    .visit-report .report-logo { max-height: 48px; margin-bottom: .2rem !important; }
    .visit-report .h4 { font-size: 1.1rem; }
    .visit-report .text-center.mb-3 { margin-bottom: .5rem !important; }
    /* the details stay in three columns on paper (the page is narrower than the md breakpoint) */
    .visit-meta { --bs-gutter-y: .15rem; margin-bottom: .5rem !important; }
    .visit-meta > .col-6 { flex: 0 0 33.333%; max-width: 33.333%; }
    .visit-report-items { margin-bottom: .5rem !important; }
    .visit-report-items th, .visit-report-items td { padding: .12rem .35rem; }
    .visit-report-items tr, .visit-text { break-inside: avoid; }
    .visit-text { background: none; border: 1px solid #ccc; padding: .3rem .5rem; min-height: 0; }
    .visit-signatures { break-inside: avoid; margin-top: .8rem !important; }
    .signature-line { height: 1.6rem; border-bottom-color: #555; }
    .print-only { display: block !important; }
    .visit-summary { font-size: 12px; }
}

/* timetable: a period that is not a school period on that day (shorter day) */
.tt-closed { background: repeating-linear-gradient(135deg, var(--bs-tertiary-bg, #f1f3f5) 0 6px, transparent 6px 12px) !important; }

/* ---------- phones: what the page is for comes first ----------
   .m-stack wraps a page's sections; on phones its .m-later children (counts,
   settings) move below the main list. .m-swipe turns a grid of cards into one
   row that scrolls sideways, so a long grid doesn't push the content down. */
@media (max-width: 767.98px) {
    .m-stack { display: flex; flex-direction: column; gap: 1.5rem; }
    .m-stack > :not(.row) { margin-top: 0 !important; margin-bottom: 0 !important; }
    .m-stack > .row { margin-bottom: 0 !important; }
    .m-stack > .m-later { order: 10; }
    .m-swipe { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; padding-bottom: .4rem; }
    .m-swipe > * { flex: 0 0 auto; width: 46%; scroll-snap-align: start; }
    .m-swipe > .col-12 { width: 100%; }
    .m-fold-body:not(.open) { display: none; }
}
@media (min-width: 768px) { .m-fold-toggle { display: none; } }

/* student follow-up: the row of links between its four pages (scrolls sideways on phones) */
.follow-nav { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: .4rem; padding-bottom: .15rem; -webkit-overflow-scrolling: touch; }
.follow-nav .nav-link { border: 1px solid rgba(var(--brand-rgb), .3); background: var(--bs-body-bg); padding: .3rem .85rem; font-size: .9rem; }
.follow-nav .nav-link.active { color: #fff; border-color: var(--brand); }
@media (max-width: 575.98px) {
    .follow-stats .stat-card { flex-direction: column; text-align: center; gap: 4px; padding: 10px 6px; }
    .follow-stats .stat-card > i { display: none; }
}

/* ---------- management side menu (school account, principal, vice principals) ----------
   On wide screens a fixed column beside the page; on phones and tablets it slides in
   (Bootstrap offcanvas-lg) from the menu button in the top bar. */
@media (min-width: 992px) {
    .app-shell { display: flex; align-items: flex-start; }
    .app-sidebar { flex: 0 0 248px; width: 248px; position: sticky; top: 62px; height: calc(100vh - 62px); overflow-y: auto;
                   border-inline-end: 1px solid var(--bs-border-color); background: var(--bs-body-bg); }
    .app-content { flex: 1 1 auto; min-width: 0; }
}
.app-sidebar { --bs-offcanvas-width: 270px; }
/* on phones the slide-in menu scrolls on its own (it is taller than the screen) */
@media (max-width: 991.98px) {
    .app-sidebar .side-nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
                             padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
}
.side-nav { padding: .75rem .6rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.side-group { font-size: .72rem; font-weight: 700; letter-spacing: .02em; color: var(--bs-secondary-color);
              text-transform: uppercase; margin: .9rem .6rem .3rem; }
.side-link { display: flex; align-items: center; gap: .65rem; padding: .45rem .7rem; border-radius: .55rem;
             color: var(--bs-body-color); text-decoration: none; font-size: .93rem; line-height: 1.3; }
.side-link > i { font-size: 1.05rem; color: var(--brand); width: 1.2rem; text-align: center; flex-shrink: 0; }
.side-link:hover { background: var(--brand-soft); color: var(--bs-body-color); }
.side-link.active { background: var(--brand); color: #fff; font-weight: 600; }
.side-link.active > i { color: #fff; }

/* ---------- management home ---------- */
.mng-tile { display: flex; align-items: center; gap: .8rem; padding: .9rem 1rem; border-radius: .9rem; height: 100%;
            background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); text-decoration: none; color: var(--bs-body-color); }
a.mng-tile:hover { border-color: var(--brand); color: var(--bs-body-color); }
.mng-tile .mng-ico { width: 2.6rem; height: 2.6rem; border-radius: .75rem; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0;
                     background: var(--brand-soft); color: var(--brand); }
.mng-tile.warn .mng-ico { background: rgba(234, 88, 12, .12); color: #ea580c; }
.mng-tile.bad .mng-ico { background: rgba(220, 38, 38, .12); color: #dc2626; }
.mng-tile.good .mng-ico { background: rgba(5, 150, 105, .12); color: #059669; }
.mng-tile .mng-val { font-size: 1.45rem; font-weight: 700; line-height: 1.1; }
.mng-tile .mng-lbl { font-size: .82rem; color: var(--bs-secondary-color); }
.mng-short { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; text-align: center;
             padding: 1rem .5rem; border-radius: .9rem; height: 100%; text-decoration: none; color: var(--bs-body-color);
             background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); font-size: .88rem; font-weight: 600; }
.mng-short > i { font-size: 1.6rem; color: var(--brand); }
.mng-short:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--bs-body-color); }
@media (max-width: 575.98px) {
    .mng-tile { padding: .7rem .75rem; gap: .5rem; }
    .mng-tile .mng-ico { display: none; }
    .mng-tile .mng-val { font-size: 1.3rem; }
    .mng-tile .mng-lbl { font-size: .78rem; line-height: 1.3; display: block; }
}
.mng-tile.warn .mng-val { color: #ea580c; }
.mng-tile.bad .mng-val { color: #dc2626; }

/* printing a page of the management side menu layout: the page alone, full width */
@media print {
    .app-sidebar { display: none !important; }
    .app-shell { display: block !important; }
    .app-content > main { padding: 0 !important; max-width: none !important; }
}

/* ===== Timetable map: one card per step of the work ===== */
.tt-hub-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 991.98px) { .tt-hub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tt-step {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .25rem;
    padding: .9rem 1rem .8rem; border-radius: .9rem; text-decoration: none; color: var(--bs-body-color);
    background: var(--bs-body-bg); border: 1px solid var(--bs-border-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .04); transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.tt-step:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(var(--brand-rgb), .14); border-color: rgba(var(--brand-rgb), .45); color: var(--bs-body-color); }
.tt-step:focus-visible { outline: 3px solid rgba(var(--brand-rgb), .45); outline-offset: 2px; }
.tt-step-no {
    position: absolute; top: .6rem; inset-inline-end: .7rem; font-size: .72rem; font-weight: 700;
    color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); border-radius: 999px; padding: .05rem .5rem;
}
.tt-step-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem;
    border-radius: .8rem; font-size: 1.4rem; color: var(--brand); background: rgba(var(--brand-rgb), .1); margin-bottom: .2rem;
}
.tt-step-title { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.tt-step-text { font-size: .8rem; color: var(--bs-secondary-color); line-height: 1.35; }
.tt-step-status { margin-top: .35rem; font-size: .76rem; font-weight: 600; color: var(--bs-secondary-color); }
.tt-step.is-ok .tt-step-status { color: #15803d; }
.tt-step.is-warn .tt-step-status { color: #b45309; }
.tt-step.is-warn { border-color: rgba(217, 119, 6, .45); }
.tt-step.active { border: 2px solid var(--brand); background: linear-gradient(rgba(var(--brand-rgb), .08), rgba(var(--brand-rgb), .08)), var(--bs-body-bg); box-shadow: 0 6px 18px rgba(var(--brand-rgb), .16); }
.tt-step.active .tt-step-icon { color: #fff; background: var(--brand); }
.tt-step.active .tt-step-no { color: #fff; background: var(--brand); }
[data-bs-theme="dark"] .tt-step.is-ok .tt-step-status { color: #4ade80; }
[data-bs-theme="dark"] .tt-step.is-warn .tt-step-status { color: #fbbf24; }
@media (max-width: 575.98px) {
    .tt-hub-grid { gap: .5rem; }
    .tt-step { padding: .7rem .75rem; }
    .tt-step-text { display: none; }
    .tt-step-icon { width: 2.2rem; height: 2.2rem; font-size: 1.1rem; }
    .tt-step-title { font-size: .9rem; }
}
@media print { .tt-hub { display: none !important; } }

/* ===== Staff list on phones: a card per staff member, labelled action buttons ===== */
@media (max-width: 767.98px) {
    .staff-table thead { display: none; }
    .staff-table, .staff-table tbody { display: block; }
    .staff-table tbody { padding: .5rem; }
    .staff-table tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .75rem;
        padding: .85rem .9rem .7rem; margin-bottom: .75rem; border: 1px solid var(--bs-border-color);
        border-radius: .9rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .staff-table tr:last-child { margin-bottom: 0; }
    .staff-table td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
    .staff-table td.st-name { grid-column: 1; grid-row: 1; }
    .staff-table td.st-name .fw-semibold { font-size: 1.02rem; }
    .staff-table td.st-status { grid-column: 2; grid-row: 1; text-align: end; max-width: 8.5rem; }
    .staff-table td.st-status .small { font-size: .72rem; line-height: 1.3; margin-top: .2rem; }
    .staff-table td.st-name .font-monospace { white-space: nowrap; }
    .staff-table td.st-role .badge { margin-inline-end: .45rem; }
    .staff-table td.st-role, .staff-table td.st-activity { grid-column: 1 / -1; }
    .staff-table td.st-role .small, .staff-table td.st-activity .small { display: inline-block; margin-inline-end: .6rem; }
    .staff-table td.st-activity { color: var(--bs-secondary-color); padding-bottom: .2rem !important; }
    .staff-table td.st-actions {
        grid-column: 1 / -1; display: flex; gap: .4rem; text-align: center !important;
        padding-top: .6rem !important; margin-top: .2rem; border-top: 1px solid var(--bs-border-color-translucent) !important;
    }
    .staff-table td.st-actions .btn {
        flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: .1rem; padding: .3rem .15rem; border-radius: .65rem; font-size: 1.1rem; line-height: 1;
    }
    .staff-table td.st-actions .btn::after { content: attr(data-label); font-size: .68rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .staff-table tr:has(td[colspan]) { display: block; border: 0; box-shadow: none; }
    .staff-tools .btn { flex: 1 1 auto; }
}

/* ===== Visit form items on phones: a card per item, labelled buttons; departments as chips ===== */
@media (max-width: 767.98px) {
    .form-editor thead { display: none; }
    .form-editor, .form-editor tbody { display: block; width: 100%; }
    .form-editor tr {
        display: grid; grid-template-columns: minmax(0, 1fr); gap: .45rem; position: relative;
        padding: .8rem .85rem .7rem; margin-bottom: .75rem; border: 1px solid var(--bs-border-color);
        border-radius: .9rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .form-editor td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; width: auto !important; }
    .form-editor td.vf-no {
        position: absolute; top: .55rem; inset-inline-end: .75rem; font-weight: 700; font-size: .75rem;
        background: var(--bs-tertiary-bg); border-radius: 999px; padding: .05rem .55rem;
    }
    .form-editor td.vf-sec::before, .form-editor td.vf-item::before {
        content: attr(data-label); display: block; font-size: .75rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .2rem;
    }
    .form-editor td .form-control { font-size: .95rem; padding: .45rem .6rem; }
    .form-editor td.vf-act {
        display: flex; gap: .4rem; padding-top: .55rem !important; margin-top: .1rem;
        border-top: 1px solid var(--bs-border-color-translucent) !important;
    }
    .form-editor td.vf-act .btn {
        flex: 1 1 0; margin: 0 !important; min-height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: .1rem; border-radius: .65rem; font-size: 1.1rem; line-height: 1;
    }
    .form-editor td.vf-act .btn::after { content: attr(data-label); font-size: .7rem; font-weight: 600; }
    #btnAddItem { width: 100%; min-height: 44px; }
    .vf-scopes { display: flex; flex-direction: row; overflow-x: auto; gap: .4rem; padding-bottom: .25rem; box-shadow: none !important; scrollbar-width: thin; }
    .vf-scopes .list-group-item {
        flex: 0 0 auto; width: auto; border-radius: 999px !important; border: 1px solid var(--bs-border-color) !important;
        margin: 0 !important; padding: .4rem .8rem; gap: .5rem; white-space: nowrap;
    }
    .vf-tools .btn { flex: 1 1 auto; }
    .vf-tools > span { flex-basis: 100%; }
}
.form-editor .vf-text { resize: none; overflow: hidden; min-height: calc(1.5em + .5rem + 2px); }

/* ===== Session sheet on phones: a card per student ===== */
.sheet-fill { display: none; }
@media (max-width: 767.98px) {
    .sheet-fill { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .4rem; align-items: center; padding: .6rem .75rem; border-bottom: 1px solid var(--bs-border-color); }
    .sheet-fill > * { flex: 0 0 auto; white-space: nowrap; }
    .sheet-wrap { max-height: none; overflow: visible; }
    .sheet-table { min-width: 0; }
    .sheet-table thead { display: none; }
    .sheet-table, .sheet-table tbody { display: block; }
    .sheet-table tbody { padding: .5rem; }
    .sheet-table tr {
        display: flex; flex-wrap: wrap; align-items: flex-start; gap: .5rem .5rem;
        padding: .75rem .8rem; margin-bottom: .7rem; border: 1px solid var(--bs-border-color);
        border-radius: .9rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .sheet-table td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; position: static !important; width: auto !important; min-width: 0 !important; }
    .sheet-table td.col-num { order: 1; flex: 0 0 auto; font-size: .78rem; font-weight: 700; background: var(--bs-tertiary-bg) !important; border-radius: 999px; padding: .1rem .5rem !important; margin-top: .15rem; }
    .sheet-table td.col-name { order: 2; flex: 1 1 0; }
    .sheet-table td.col-name .student-name { font-size: 1.02rem; }
    .sheet-table td.col-total { order: 3; flex: 0 0 auto; text-align: center; }
    .sheet-table td.col-total .row-total { display: inline-block; min-width: 3rem; padding: .25rem .6rem; border-radius: .6rem; background: rgba(var(--brand-rgb), .1); color: var(--brand); font-size: 1rem; }
    .sheet-table td.col-total::before { content: attr(data-label); display: block; font-size: .65rem; font-weight: 600; color: var(--bs-secondary-color); }
    .sheet-table td.col-att { order: 4; flex: 1 1 100%; }
    .sheet-table td.col-att .att-group { display: flex; width: 100%; gap: .35rem; }
    .sheet-table td.col-att .btn-att { flex: 1 1 0; min-width: 0; min-height: 42px; font-size: 0; display: flex; align-items: center; justify-content: center; padding: .2rem .15rem; }
    .sheet-table td.col-att .btn-att::after { content: attr(title); font-size: .85rem; font-weight: 700; white-space: nowrap; }
    .sheet-table td.col-crit { order: 5; flex: 1 1 5.5rem; max-width: calc(50% - .25rem); text-align: start; }
    .sheet-table td.col-crit:only-of-type { max-width: none; }
    .sheet-table td.col-crit::before, .sheet-table td.col-note::before {
        content: attr(data-label); display: block; font-size: .72rem; font-weight: 600; color: var(--bs-secondary-color);
        margin-bottom: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .sheet-table input.score { max-width: none; width: 100%; min-height: 40px; font-size: 1rem; }
    .sheet-table td.col-note { order: 6; flex: 1 1 100%; }
    .sheet-table input.student-note { min-height: 38px; }
    .sheet-table tr.att-row-2 { background: rgba(220, 53, 69, .06); border-color: rgba(220, 53, 69, .35); }
}

/* ===== Attendance lists (today's absence, absence over a period) on phones: a card per student ===== */
@media screen and (max-width: 767.98px) {
    .att-list thead { display: none; }
    .att-list, .att-list tbody { display: block; }
    .att-list tbody { padding: .5rem; }
    .att-list tr {
        display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem;
        padding: .75rem .85rem; margin-bottom: .6rem; border: 1px solid var(--bs-border-color);
        border-inline-start-width: 4px; border-radius: .85rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .att-list tr:last-child { margin-bottom: 0; }
    .att-list td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
    .att-list td.att-no { display: none; }
    .att-list td.att-name { flex: 1 1 0; min-width: 0; font-size: 1.02rem; }
    .att-list td.att-class { order: 3; flex: 0 0 100%; font-size: .85rem; color: var(--bs-secondary-color); }
    .att-list tr:has(td[colspan]) { display: block; border-inline-start-width: 1px; box-shadow: none; }
    .att-list tr:has(td[colspan]) td { text-align: center; }
    /* today: status on the side, subject and teacher underneath */
    .att-daily td.att-status .badge { font-size: .85rem; padding: .4em .75em; }
    .att-daily td.att-name { flex: 1 1 calc(100% - 6rem); }
    .att-daily td.att-status { flex: 0 0 auto; }
    .att-daily td.att-class { flex: 0 0 auto; }
    .att-daily td.att-subject, .att-daily td.att-teacher { order: 4; font-size: .85rem; }
    .att-daily td.att-class::after { content: "·"; margin-inline-start: .6rem; }
    .att-daily td.att-subject { flex: 1 1 auto; }
    .att-daily td.att-teacher { flex: 0 0 100%; color: var(--bs-secondary-color); }
    .att-daily tr.att-s2 { border-inline-start-color: var(--bs-danger); }
    .att-daily tr.att-s3 { border-inline-start-color: var(--bs-warning); }
    .att-daily tr.att-s4, .att-daily tr.att-s1 { border-inline-start-color: var(--bs-info); }
    /* period: four labelled counters side by side, then the last absence */
    .att-period tr { border-inline-start-color: rgba(var(--brand-rgb), .45); }
    .att-period tr:has(td.att-days.text-danger) { border-inline-start-color: var(--bs-danger); }
    .att-period td.att-issues:empty { display: none; }
    .att-period td.att-num {
        order: 5; flex: 1 1 0; min-width: 0; text-align: center; font-size: 1.15rem; font-weight: 700;
        padding: .35rem .2rem !important; border-radius: .6rem; background: var(--bs-tertiary-bg) !important;
    }
    .att-period td.att-num::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 600; color: var(--bs-secondary-color); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .att-period td.att-days.text-danger { background: rgba(var(--bs-danger-rgb), .1) !important; }
    .att-period td.att-last { order: 6; flex: 0 0 100%; font-size: .8rem; color: var(--bs-secondary-color); text-align: start; }
    .att-period td.att-last::before { content: attr(data-label) ": "; }
}

/* ===== Teachers on phones: quick-access icons fixed at the bottom ===== */
.tabbar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 1030; display: flex;
    padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); background: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color); box-shadow: 0 -4px 14px rgba(0, 0, 0, .07);
}
.tabbar-item {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: .1rem;
    padding: .2rem .1rem; border-radius: .7rem; color: var(--bs-secondary-color); text-decoration: none;
}
.tabbar-icon { position: relative; font-size: 1.25rem; line-height: 1; padding: .2rem .9rem; border-radius: 1rem; }
.tabbar-label { font-size: .68rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar-item.active { color: var(--brand); }
.tabbar-item.active .tabbar-icon { background: rgba(var(--brand-rgb), .12); }
.tabbar-badge {
    position: absolute; top: -.15rem; inset-inline-end: .35rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem;
    border-radius: 1rem; background: var(--bs-danger); color: #fff; font-size: .62rem; font-weight: 700; line-height: 1.05rem; text-align: center;
}
@media (max-width: 991.98px) {
    body:has(.tabbar) { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
    body:has(.tabbar) .save-bar { bottom: calc(3.6rem + env(safe-area-inset-bottom)); }
}
@media print { .tabbar { display: none !important; } }

/* ===== Session sheet: student issues ===== */
.issue-quick { padding: 0 .3rem; line-height: 1.2; color: var(--bs-secondary-color); border: 0; position: relative; vertical-align: baseline; }
.issue-quick:hover, .issue-quick:focus { color: var(--bs-danger); }
.issue-quick.has-open { color: var(--bs-danger); }
.issue-count { font-size: .65rem; font-weight: 700; margin-inline-start: .1rem; }
.sheet-issues .issue-cats label { margin-inline-end: .6rem; }
.sheet-issues .issue-list .list-group-item { padding: .6rem .8rem; }
.sheet-issues { scroll-margin-top: 4.5rem; }

/* reports: attendance in one cell, notes column */
.report-table td.rep-att { min-width: 9rem; }
.rep-att-i { display: inline-block; white-space: nowrap; font-size: .78rem; padding: .05rem .4rem; margin: .1rem .1rem; border-radius: .5rem; background: var(--bs-tertiary-bg); }
.rep-att-i:nth-child(1) { color: #198754; }
.rep-att-i:nth-child(2) { color: #dc3545; }
.rep-att-i:nth-child(3) { color: #b45309; }
.rep-att-i:nth-child(4) { color: #0369a1; }
.report-table td.rep-notes { text-align: start; font-size: .8rem; min-width: 12rem; white-space: normal; }
.rep-note + .rep-note { border-top: 1px dashed var(--bs-border-color); margin-top: .2rem; padding-top: .2rem; }
.health-always { cursor: default; opacity: .85; }

/* ===== Lists with row actions on phones: a card per row, labelled buttons side by side =====
   cells: cr-main (top), cr-side (top, other side), cr-hide (not on phones), cr-actions (buttons);
   any other cell is a full-width line, prefixed with its data-label when it has one */
@media screen and (max-width: 767.98px) {
    .card-rows thead, .card-rows tr:first-child:has(th):not(:has(td)):not(:has(th[colspan])) { display: none; }
    .card-rows, .card-rows tbody { display: block; width: 100%; }
    .card-rows tbody { padding: .5rem; }
    .card-rows tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .75rem;
        padding: .85rem .9rem .7rem; margin-bottom: .75rem; border: 1px solid var(--bs-border-color);
        border-radius: .9rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .card-rows tr:last-child { margin-bottom: 0; }
    .card-rows td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; text-align: start !important; }
    .card-rows td { grid-column: 1 / -1; }
    .card-rows td.cr-hide { display: none; }
    .card-rows td[data-label]:not(.cr-actions):not(:empty)::before { content: attr(data-label) ": "; color: var(--bs-secondary-color); font-size: .8rem; }
    .card-rows td.cr-main { grid-column: 1; grid-row: 1; }
    .card-rows td.cr-main .fw-semibold { font-size: 1.02rem; }
    .card-rows td.cr-side { grid-column: 2; grid-row: 1; text-align: end !important; }
    .card-rows td.cr-full { grid-column: 1 / -1; }
    .card-rows td.cr-full > div, .card-rows td.cr-full > a { display: inline-block; margin-inline-end: .6rem; }
    .card-rows td.cr-actions {
        grid-column: 1 / -1; display: flex; gap: .4rem;
        padding-top: .6rem !important; margin-top: .2rem; border-top: 1px solid var(--bs-border-color-translucent) !important;
    }
    .card-rows td.cr-actions .btn {
        flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: .1rem; padding: .3rem .15rem; border-radius: .65rem; font-size: 1.1rem; line-height: 1;
    }
    .card-rows td.cr-actions > :not(.btn) { flex: 0 0 auto; align-self: center; }
    .card-rows td.cr-actions .btn:not([data-label]) { flex-direction: row; font-size: .9rem; gap: .35rem; }
    .card-rows td.cr-actions .btn::after { content: attr(data-label); font-size: .68rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
    .card-rows tr:has(td[colspan]) { display: block; border: 0; box-shadow: none; }
    .card-rows .table-responsive, .table-responsive:has(> .card-rows) { overflow: visible; }
}
@media screen and (max-width: 767.98px) { .card-rows td.cr-actions:not(:has(.btn)) { display: none; } }
@media screen and (max-width: 767.98px) {
    .card-rows td.vr-num { grid-column: auto; text-align: center !important; padding: .3rem !important; border-radius: .6rem; background: var(--bs-tertiary-bg) !important; }
    .card-rows td.vr-num::before { display: block; content: attr(data-label) !important; }
}

/* the platform administration inside another account */
.imp-bar {
    position: sticky; top: 0; z-index: 1040; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .45rem 1rem; background: #b45309; color: #fff; font-size: .9rem; font-weight: 600;
}
.imp-bar ~ .app-navbar { top: 2.6rem; }

/* timetable check on phones: a card per finding, the suggestions under it with full-width buttons */
@media screen and (max-width: 767.98px) {
    .tt-chk td.tt-chk-who:empty, .tt-chk td.tt-chk-when:empty, .tt-chk td.tt-chk-sug:empty { display: none; }
    .tt-chk td.tt-chk-who, .tt-chk td.tt-chk-when { grid-column: auto; display: inline-block; font-size: .85rem; }
    .tt-chk td.tt-chk-who a { font-weight: 600; }
    .tt-chk tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tt-chk td.cr-main { grid-column: 1; }
    .tt-chk td.cr-side { grid-column: 2; text-align: end !important; font-weight: 600; }
    .tt-chk td.tt-chk-sug { grid-column: 1 / -1; padding-top: .5rem !important; border-top: 1px solid var(--bs-border-color-translucent) !important; }
    .tt-chk .tt-sug li { flex-wrap: wrap; background: var(--bs-tertiary-bg); border-radius: .6rem; padding: .45rem .55rem; margin-bottom: .4rem !important; }
    .tt-chk .tt-sug li .btn { flex: 1 1 100%; padding: .4rem !important; margin-top: .35rem; font-size: .85rem; }
}

/* subject rules: a card per subject on phones (periods to avoid / prefer as numbered boxes, then limit and room) */
.tt-rules td.rl-head { display: none; }
@media screen and (max-width: 767.98px) {
    .tt-rules thead { display: none; }
    .tt-rules, .tt-rules tbody { display: block; }
    .tt-rules tbody { padding: .5rem; }
    .tt-rules tr {
        display: flex; flex-wrap: wrap; align-items: flex-end; gap: .3rem; padding: .75rem .85rem; margin-bottom: .6rem;
        border: 1px solid var(--bs-border-color); border-radius: .85rem; background: var(--bs-body-bg); box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    }
    .tt-rules td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; }
    .tt-rules td.rl-name { flex: 0 0 100%; font-size: 1.02rem; white-space: normal !important; }
    .tt-rules td.rl-head { display: block; flex: 0 0 100%; font-size: .78rem; font-weight: 600; margin-top: .35rem; }
    .tt-rules td.rl-p { flex: 1 1 1.9rem; min-width: 0; max-width: 2.6rem; text-align: center; border: 1px solid var(--bs-border-color) !important; border-radius: .5rem; padding: .2rem 0 .3rem !important; }
    .tt-rules td.rl-p::before { content: attr(data-p); display: block; font-size: .7rem; color: var(--bs-secondary-color); }
    .tt-rules td.rl-p .form-check-input { width: 1.25rem; height: 1.25rem; margin: 0; }
    .tt-rules td.rl-max, .tt-rules td.rl-room { flex: 1 0 45%; margin-top: .5rem; }
    .tt-rules td.rl-max::before, .tt-rules td.rl-room::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .15rem; }
    .tt-rules td.rl-max input { width: 100% !important; }
    .table-responsive:has(> .tt-rules) { overflow: visible; }
}

/* card rows: header cells used as row titles, and labels above fields */
@media screen and (max-width: 767.98px) {
    .card-rows tbody th { display: block; grid-column: 1 / -1; padding: 0 !important; border: 0 !important; background: transparent !important; text-align: start !important; }
    .card-rows tr:has(> th[colspan]:only-child) { display: block; border: 0; box-shadow: none; background: transparent; padding: .4rem .2rem 0; margin-bottom: .3rem; font-weight: 700; }
    .card-rows td[data-label]:has(select, input:not([type=checkbox]):not([type=hidden]), textarea)::before { display: block; margin-bottom: .15rem; }
    .card-rows td .form-select, .card-rows td .form-control { max-width: 100%; }
    .card-rows td.text-center { text-align: start !important; }
    .card-rows td:empty { display: none; }
}

/* constraints of all teachers on phones: a card per teacher, each day a line of numbered periods */
@media screen and (max-width: 767.98px) {
    .tt-tr thead { display: none; }
    .tt-tr, .tt-tr tbody { display: block; }
    .tt-tr tbody { padding: .5rem; }
    .tt-tr tr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .3rem; padding: .75rem .85rem; margin-bottom: .6rem;
        border: 1px solid var(--bs-border-color); border-radius: .85rem; background: var(--bs-body-bg); }
    .tt-tr tr.table-light { display: block; border: 0; background: transparent; padding: .4rem .2rem 0; margin-bottom: .2rem; }
    .tt-tr tr.table-light th { border: 0 !important; background: transparent !important; font-weight: 700; }
    .tt-tr th, .tt-tr td { display: block; padding: 0 !important; border: 0 !important; background: transparent !important; text-align: start !important; }
    .tt-tr .tt-all-name { flex: 0 0 100%; font-size: 1.02rem; position: static !important; }
    .tt-tr td.tr-lim { flex: 1 0 45%; }
    .tt-tr td.tr-lim::before { content: attr(data-label); display: block; font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .15rem; }
    .tt-tr td.tr-lim .form-select { width: 100%; }
    .tt-tr td.tr-day { flex: 0 0 100%; display: flex; align-items: center; gap: .4rem; margin-top: .45rem; font-size: .8rem; font-weight: 600; }
    .tt-tr td.tr-day::before { content: attr(data-label); }
    .tt-tr td.tr-p { flex: 1 1 1.9rem; min-width: 0; max-width: 2.6rem; text-align: center !important; border: 1px solid var(--bs-border-color) !important; border-radius: .5rem; padding: .2rem 0 .3rem !important; }
    .tt-tr td.tr-p::before { content: attr(data-p); display: block; font-size: .7rem; color: var(--bs-secondary-color); }
    .tt-tr td.tr-p .form-check-input { width: 1.2rem; height: 1.2rem; margin: 0; }
    .table-responsive:has(> .tt-tr) { overflow: visible; }
}

/* a teacher's week on phones: a card per day, its periods one under the other */
@media screen and (max-width: 767.98px) {
    .tt-week thead { display: none; }
    .tt-week, .tt-week tbody { display: block; border: 0; }
    .tt-week tr { display: block; margin-bottom: .6rem; border: 1px solid var(--bs-border-color); border-radius: .85rem; overflow: hidden; background: var(--bs-body-bg); }
    .tt-week tr.table-primary { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(var(--brand-rgb), .2); }
    .tt-week th { display: block; padding: .5rem .8rem !important; border: 0 !important; background: var(--bs-tertiary-bg) !important; font-size: 1rem; }
    .tt-week tr.table-primary th { background: rgba(var(--brand-rgb), .12) !important; color: var(--brand); }
    .tt-week td { display: flex; align-items: center; gap: .6rem; padding: .4rem .8rem !important; border: 0 !important; border-top: 1px solid var(--bs-border-color-translucent) !important; text-align: start !important; }
    .tt-week td::before { content: attr(data-p); flex: 0 0 4.6rem; font-size: .78rem; color: var(--bs-secondary-color); }
    .tt-week td > div { display: inline; }
    .tt-week td .small { margin-inline-start: .3rem; }
    .tt-week td.tt-free::after { content: "—"; color: var(--bs-secondary-color); }
    .tt-week td.tt-closed { display: none; }
    .table-responsive:has(> .tt-week) { overflow: visible; }
}
@media screen and (max-width: 767.98px) { .card-rows td.cr-half { grid-column: auto; } }

/* duty roster: the departments' day columns only count when sharing by department */
.duty-depts.by-each .dept-day { display: none; }
.duty-days .btn.active { color: #fff; }
/* a long list in a table and its 🔍 button on one line */
.app-search-wrap { display: flex; align-items: center; gap: .25rem; }
.app-search-wrap > select { flex: 1 1 auto; min-width: 0; }
.app-search-wrap + .app-search-wrap, .app-search-wrap + .form-select { margin-top: .25rem; }

/* duty roster on phones and tablets (iPad upright and sideways, any touch screen up to 1366px):
   each day a card, its places with their names in full; one place under the other on a phone,
   side by side in as many columns as fit on a tablet */
@media (max-width: 1199.98px), (any-pointer: coarse) and (max-width: 1366.98px) {
    .duty-grid thead { display: none; }
    .duty-grid, .duty-grid tbody, .duty-grid tr, .duty-grid th, .duty-grid td { display: block; width: 100%; }
    .duty-grid { border: 0; }
    .duty-grid tr { border: 1px solid var(--bs-border-color); border-radius: .8rem; margin: .6rem; width: auto; overflow: hidden; background: var(--bs-body-bg); }
    .duty-grid tr:not([style*="none"]) { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
    .duty-grid tr > th { grid-column: 1 / -1; background: var(--brand-soft); color: var(--brand); font-size: 1.05rem; padding: .5rem .8rem; border: 0; }
    .duty-grid tr > td { width: auto; border: 0; border-top: 1px solid var(--bs-border-color-translucent); padding: .45rem .8rem .55rem; }
    .duty-grid td::before { content: attr(data-label); display: block; font-size: .8rem; font-weight: 600; color: var(--bs-secondary-color); margin-bottom: .2rem; }
    .duty-grid td.duty-head-cell::before { color: var(--bs-primary); }
    .duty-grid .form-select { font-size: .95rem; }
    .duty-days { width: 100%; }
    .duty-days .btn { flex: 1 1 auto; }
}

/* duty roster: day buttons, and the staff options (one line per teacher on phones) */
.duty-days { display: flex; flex-wrap: wrap; gap: .3rem; }
.duty-staff-wrap { max-height: 24rem; overflow: auto; }
.duty-staff .duty-opt { display: inline-flex; align-items: center; gap: .3rem; margin: 0; cursor: pointer; }
@media (max-width: 767.98px) {
    .duty-days { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .duty-staff-wrap { max-height: 60vh; }
    .duty-staff thead { display: none; }
    .duty-staff, .duty-staff tbody { display: block; }
    .duty-staff tr { display: grid; grid-template-columns: repeat(3, auto) 1fr; align-items: center; gap: .15rem .9rem;
                     padding: .55rem .8rem; border-bottom: 1px solid var(--bs-border-color); }
    .duty-staff td { display: block; border: 0; padding: 0; text-align: start !important; }
    .duty-staff td:first-child { grid-column: 1 / -1; }
    .duty-staff td.duty-count { text-align: end !important; color: var(--bs-secondary-color); white-space: nowrap; }
}

/* printed sheets scaled to one page (App.fitPrint works out --fit); a little room at the sides so a
   table's outer border, which reaches half its width past the table, is never cut at the page's edge */
[data-fit] { padding-inline: 4px; }
@media print {
    [data-fit] { zoom: var(--fit, 1); width: var(--fit-w, auto); max-width: none; }
    /* the signature line at the foot of the page (a sheet longer than a page ends with it as usual) */
    [data-fit] { display: flex; flex-direction: column; min-height: var(--fit-h, 0); }
    [data-fit] > .print-footer { margin-top: auto !important; padding-top: 1.5rem; }
}
@media print { .app-search, .app-search-btn { display: none !important; } }

/* training course: the search above a tab's lists, and the role buttons of a person */
.trn-search { position: sticky; top: .5rem; z-index: 5; }
.trn-role > .btn { flex: 1 1 0; white-space: nowrap; }
.trn-gname { background: var(--bs-body-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230d6efd' viewBox='0 0 16 16'%3E%3Cpath d='M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293z'/%3E%3C/svg%3E") no-repeat left .75rem center; padding-left: 2.4rem; }
[dir=ltr] .trn-gname { background-position: right .75rem center; padding-left: .75rem; padding-right: 2.4rem; }
@media screen and (max-width: 767.98px) {
    .card-rows tr.trn-head { display: block; border: 0; box-shadow: none; padding: .6rem .25rem .2rem; margin-bottom: .4rem; background: transparent; }
    .card-rows tr.trn-head th { display: block; border: 0; background: transparent; padding: 0; }
    .card-rows tr.trn-head .btn { min-height: 38px; }
    .card-rows td.cr-full > .trn-role { display: flex; margin-inline-end: 0; }
    .trn-role > .btn { min-height: 44px; display: flex; align-items: center; justify-content: center; }
}

/* ===== Side menu: groups fold away (app.js remembers which) ===== */
.side-sec { display: flex; flex-direction: column; gap: 2px; }
.side-nav button.side-group { display: flex; align-items: center; gap: .4rem; width: calc(100% - 1.2rem); background: none; border: 0;
                              padding: .2rem 0; cursor: pointer; text-align: start; }
.side-nav button.side-group:hover { color: var(--bs-body-color); }
.side-group > i { font-size: .7rem; margin-inline-start: auto; transition: transform .15s; }
.side-sec.closed .side-group > i { transform: rotate(90deg); }
[dir="rtl"] .side-sec.closed .side-group > i { transform: rotate(-90deg); }
.side-sec.closed .side-items { display: none; }
.side-items { display: flex; flex-direction: column; gap: 2px; }

/* ===== Search in the top bar ===== */
.gsearch { position: relative; flex: 0 1 22rem; margin-inline: 1rem auto; }
.gsearch .form-control { padding-inline-start: 2rem; background-color: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25);
                         color: #fff; border-radius: 2rem; }
.gsearch .form-control::placeholder { color: rgba(255, 255, 255, .75); }
.gsearch .form-control:focus { background-color: var(--bs-body-bg); color: var(--bs-body-color); border-color: var(--bs-body-bg); }
.gsearch .form-control:focus::placeholder { color: var(--bs-secondary-color); }
.gsearch-ico { position: absolute; inset-inline-start: .75rem; top: 50%; transform: translateY(-50%); color: rgba(255, 255, 255, .8); pointer-events: none; }
.gsearch:focus-within .gsearch-ico { color: var(--bs-secondary-color); }
.gsearch-menu { position: absolute; top: calc(100% + .35rem); inset-inline: 0; min-width: 18rem; max-height: 70vh; overflow-y: auto; z-index: 1060;
                background: var(--bs-body-bg); color: var(--bs-body-color); border: 1px solid var(--bs-border-color); border-radius: .8rem;
                box-shadow: 0 12px 32px rgba(0, 0, 0, .18); padding: .35rem; }
.gsearch-head { font-size: .72rem; font-weight: 700; color: var(--bs-secondary-color); padding: .45rem .6rem .2rem; }
.gsearch-item { display: flex; align-items: center; gap: .6rem; padding: .45rem .6rem; border-radius: .55rem; color: var(--bs-body-color); text-decoration: none; }
.gsearch-item > i { color: var(--brand); }
.gsearch-item .gs-sub { font-size: .78rem; color: var(--bs-secondary-color); margin-inline-start: auto; white-space: nowrap; }
.gsearch-item:hover, .gsearch-item.on { background: var(--brand-soft); color: var(--bs-body-color); }
.gsearch-note { padding: .7rem .6rem; color: var(--bs-secondary-color); font-size: .88rem; }
@media (max-width: 991.98px) {
    .gsearch { display: none; position: absolute; top: 100%; inset-inline: 0; margin: 0; padding: .5rem 1rem .75rem; background: var(--nav-bg);
               box-shadow: 0 8px 16px rgba(0, 0, 0, .15); }
    .gsearch.open { display: block; }
    .gsearch .form-control { font-size: 1rem; padding-top: .45rem; padding-bottom: .45rem; }
    .gsearch-ico { inset-inline-start: 1.75rem; top: 1.45rem; transform: none; }
    .gsearch-menu { inset-inline: 1rem; min-width: 0; }
}

/* ===== Management home: quiet zeros, the step of each "needs attention" line, set-up steps ===== */
.mng-tile.zero .mng-val { color: var(--bs-secondary-color); font-weight: 600; }
.mng-tile.zero .mng-ico { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.mng-act { font-size: .78rem; font-weight: 600; color: var(--brand); white-space: nowrap; padding: .15rem .6rem; border-radius: 1rem;
           background: var(--brand-soft); }
.setup-n { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .82rem; font-weight: 700;
           background: var(--brand-soft); color: var(--brand); }
.setup-done .setup-n { background: rgba(5, 150, 105, .14); color: #059669; }
.setup-done > .me-auto { color: var(--bs-secondary-color); text-decoration: line-through; }

/* ===== Small charts (App_Code/MiniCharts.cs) ===== */
.mc-cols { display: flex; align-items: stretch; gap: 4px; height: 11rem; padding-top: 1.4rem; }
.mc-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: .3rem; position: relative; outline: none; }
.mc-col .mc-track { flex: 1; display: flex; align-items: flex-end; border-bottom: 1px solid var(--bs-border-color); position: relative; }
.mc-ghost { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 2rem; border-radius: 4px 4px 0 0;
            background: var(--bs-secondary-bg); border: 1px dashed var(--bs-border-color); border-bottom: 0; }
.mc-col .mc-bar { width: 100%; max-width: 2rem; margin-inline: auto; background: var(--brand); border-radius: 4px 4px 0 0; position: relative; min-height: 2px; z-index: 1; }
.mc-col.faint .mc-bar { opacity: .45; }
.mc-col.empty .mc-track { background: repeating-linear-gradient(45deg, transparent 0 5px, var(--bs-tertiary-bg) 5px 7px); border-radius: 4px 4px 0 0; }
.mc-col.empty .mc-bar { display: none; }
.mc-end { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.mc-lbl { font-size: .66rem; color: var(--bs-secondary-color); text-align: center; white-space: nowrap; overflow: hidden; direction: ltr; }
.mc-col:hover .mc-track, .mc-col:focus .mc-track { background-color: var(--brand-soft); }
.mc-bars { display: flex; flex-direction: column; gap: .55rem; }
.mc-row { display: grid; grid-template-columns: minmax(6rem, 34%) 1fr auto; align-items: center; gap: .6rem; color: var(--bs-body-color); text-decoration: none; }
a.mc-row:hover .mc-name { color: var(--brand); }
.mc-name { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-row .mc-track { height: .7rem; border-radius: 4px; overflow: hidden; }
.mc-row .mc-track.whole { background: var(--bs-secondary-bg); }
.mc-row .mc-bar { display: block; height: 100%; background: var(--brand); border-radius: 4px; min-width: 2px; }
.mc-num { font-size: .8rem; font-weight: 600; color: var(--bs-secondary-color); min-width: 3rem; text-align: end; }
.mc-empty { padding: .5rem 0; }
[data-tip]:hover::after, .mc-col[data-tip]:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + .4rem); left: 50%; transform: translateX(-50%);
    z-index: 5; background: var(--bs-emphasis-color); color: var(--bs-body-bg); font-size: .75rem; padding: .3rem .55rem; border-radius: .4rem;
    white-space: nowrap; pointer-events: none; }
.mc-row[data-tip] { position: relative; }
.mc-row[data-tip]:hover::after { bottom: auto; top: calc(100% + .2rem); }
.mc-cols .mc-col:first-child[data-tip]:hover::after { left: auto; right: 0; transform: none; }
.mc-cols .mc-col:last-child[data-tip]:hover::after { left: 0; transform: none; }

/* the management's bottom bar: its menu button looks like the links */
button.tabbar-item { background: none; border: 0; font: inherit; }

/* the timetable's import from aSc: its own colour so it is found at first sight */
.btn-asc { --bs-btn-color: #fff; --bs-btn-bg: #7c3aed; --bs-btn-border-color: #7c3aed; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #6d28d9;
    --bs-btn-hover-border-color: #6d28d9; --bs-btn-active-color: #fff; --bs-btn-active-bg: #5b21b6; --bs-btn-active-border-color: #5b21b6;
    font-weight: 600; box-shadow: 0 2px 8px rgba(124, 58, 237, .35); }

/* the school follow-up of an educational district (District/ pages) */
.df-bar { height: .45rem; min-width: 4rem; }
.df-rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.df-rate .btn { padding: .35rem .2rem; font-size: .85rem; white-space: nowrap; }
.df-item { padding: .7rem 0; border-bottom: 1px solid var(--bs-border-color-translucent); }
.df-item:last-child { border-bottom: 0; }
.df-item.df-missing { background: rgba(var(--bs-danger-rgb), .07); border-radius: .5rem; padding-inline: .5rem; }
.df-item-text { font-weight: 600; margin-bottom: .4rem; }
.df-steps { display: flex; gap: .3rem; margin-bottom: .5rem; }
.df-steps button { flex: 1; border: 0; background: none; padding: 0; text-align: center; font-size: .75rem; color: var(--bs-secondary-color); }
.df-steps button::before { content: ""; display: block; height: .35rem; border-radius: 1rem; background: var(--bs-secondary-bg); margin-bottom: .25rem; }
.df-steps button.on { color: var(--bs-primary); font-weight: 700; }
.df-steps button.on::before, .df-steps button.done::before { background: var(--bs-primary); }
.df-step[hidden] { display: none !important; }
.df-issue-on { background: var(--bs-warning-bg-subtle); }
.df-action { border: 1px solid var(--bs-border-color); border-radius: .6rem; padding: .6rem; margin-bottom: .6rem; background: var(--bs-body-bg); }
@media (max-width: 575.98px) { .df-rate .btn { font-size: .78rem; } }

/* ---------- exit-permit card on the home pages ---------- */
.ep-home { border-color: var(--brand); border-width: 1.5px; }
.ep-home .card-body { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.ep-home-head { display: flex; align-items: center; gap: .8rem; margin-inline-end: auto; text-decoration: none; color: var(--bs-body-color); }
.ep-home-head:hover { color: var(--bs-body-color); }
.ep-home-ico { width: 3rem; height: 3rem; border-radius: .9rem; display: grid; place-items: center; font-size: 1.5rem; flex-shrink: 0;
               background: var(--brand-soft); color: var(--brand); }
.ep-home-title { display: block; font-size: 1.15rem; font-weight: 700; }
.ep-home-sub { display: block; font-size: .85rem; color: var(--bs-secondary-color); }
.ep-home-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 575.98px) {
    .ep-home-head { width: 100%; }
    .ep-home-btns { width: 100%; }
    .ep-home-btns .btn { flex: 1 1 100%; }
}

/* ===== Home pages (management and teachers): a header card with the figures, today, then the places in labelled icon sections ===== */
.home-wrap { max-width: 1180px; margin-inline: auto; }
.home-hero { background: var(--nav-bg); color: #fff; border-radius: 1.25rem; padding: 1.15rem 1.15rem 1rem; margin-bottom: 1.1rem;
             box-shadow: 0 10px 28px rgba(var(--brand-rgb), .22); }
.home-hero-head { display: flex; align-items: center; gap: .85rem; }
.home-hero-logo { width: 3.4rem; height: 3.4rem; border-radius: 1rem; background: #fff; object-fit: contain; padding: .3rem; flex-shrink: 0; }
.home-hero-noimg { display: grid; place-items: center; font-size: 1.6rem; color: var(--brand); }
.home-hero-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 .15rem; line-height: 1.35; color: #fff; }
.home-hero-sub { margin: 0; font-size: .92rem; opacity: .88; }
.home-hero-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: .6rem; margin-top: 1rem; }
.home-big { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .7rem .8rem; border-radius: 1rem;
            background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .3); color: #fff; text-decoration: none;
            font-weight: 700; font-size: 1rem; }
.home-big:hover { background: rgba(255, 255, 255, .24); color: #fff; }
.home-big.main { background: #fff; color: var(--brand-dark); border-color: #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.home-big.main:hover { color: var(--brand); }
.home-big-ico { width: 2.1rem; height: 2.1rem; border-radius: .7rem; display: grid; place-items: center; font-size: 1.1rem;
                background: rgba(255, 255, 255, .2); }
.home-big.main .home-big-ico { background: var(--brand-soft); color: var(--brand); }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: .9rem; }
@media (min-width: 992px) { .home-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); } }
.home-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .1rem;
             padding: .55rem .35rem; border-radius: .9rem; background: var(--bs-body-bg); color: var(--bs-body-color); text-decoration: none; }
.home-stat:hover { color: var(--bs-body-color); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7); }
.home-stat-val { font-size: 1.3rem; font-weight: 800; line-height: 1.2; display: flex; align-items: center; gap: .35rem; }
.home-stat-val > i { font-size: .95rem; color: var(--brand); }
.home-stat-lbl { font-size: .74rem; color: var(--bs-secondary-color); line-height: 1.3; }
.home-stat.warn .home-stat-val { color: #ea580c; }
.home-stat.bad .home-stat-val { color: #dc2626; }
.home-stat.good .home-stat-val { color: #059669; }
.home-stat.warn .home-stat-val > i, .home-stat.bad .home-stat-val > i, .home-stat.good .home-stat-val > i { color: inherit; }
.home-stat.zero .home-stat-val { color: var(--bs-secondary-color); font-weight: 700; }
@media (max-width: 575.98px) {
    .home-hero { border-radius: 1.1rem; padding: 1rem .85rem .85rem; }
    .home-hero-title { font-size: 1.15rem; }
    .home-hero-logo { width: 3rem; height: 3rem; }
    .home-stat-val > i { display: none; }
    .home-stat-val { font-size: 1.15rem; }
    .home-stat-lbl { font-size: .68rem; }
    .home-big { font-size: .95rem; padding: .6rem; }
}

.home-today { border-radius: 1.1rem; border: 1px solid var(--bs-border-color); }
.home-today-title { font-size: 1.08rem; font-weight: 800; margin-bottom: .5rem; }
.home-today-title > i { color: var(--brand); }
.home-today .list-group-item { background: transparent; padding-inline: .2rem; }

.home-sec { margin-top: 1.4rem; }
.home-sec-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 .7rem; display: flex; align-items: center; gap: .5rem; }
.home-sec-title::before { content: ""; width: .3rem; height: 1.1rem; border-radius: 1rem; background: var(--brand); }
.home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; }
@media (min-width: 768px) { .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; } }
@media (min-width: 992px) {
    .home-secs { display: flex; flex-wrap: wrap; column-gap: 1.75rem; }
    .home-secs > .home-sec { flex: 1 1 calc(var(--n, 6) * 150px); min-width: 0; }
    .home-grid { grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); }
}
.home-app { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .5rem; text-align: center;
            padding: .9rem .35rem .75rem; min-height: 6.6rem; border-radius: 1rem; background: var(--bs-body-bg);
            border: 1px solid var(--bs-border-color); color: var(--bs-body-color); text-decoration: none;
            font-size: .86rem; font-weight: 700; line-height: 1.35; transition: transform .12s, border-color .12s, box-shadow .12s; }
.home-app:hover { color: var(--bs-body-color); border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(var(--brand-rgb), .14); }
.home-app-ico { position: relative; width: 3rem; height: 3rem; border-radius: .95rem; display: grid; place-items: center;
                font-size: 1.45rem; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.home-app-badge { position: absolute; top: -.4rem; inset-inline-end: -.5rem; min-width: 1.35rem; height: 1.35rem; padding: 0 .3rem;
                  border-radius: 1rem; background: #dc2626; color: #fff; font-size: .72rem; font-weight: 700; display: grid; place-items: center;
                  border: 2px solid var(--bs-body-bg); }
@media (max-width: 575.98px) { .home-app { font-size: .8rem; min-height: 6.2rem; } }

/* iPhone / iPad printing (app.js App.initIosPrint): a PDF of the page, then the share sheet */
.ios-print { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .55); display: flex; align-items: flex-end; justify-content: center; padding: 1rem; }
.ios-print[hidden] { display: none; }
.ios-print-card { background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #111); border-radius: 1rem; padding: 1.1rem; width: 100%; max-width: 26rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.ios-print-title { font-weight: 700; font-size: 1.1rem; margin-bottom: .5rem; }
.ios-print-msg { margin-bottom: .9rem; }
