/* EduExSaas base styles: blue brand bar, neutral content surfaces, blue accent with orange highlights.
   Bootstrap 5.3 variables are overridden here. */
:root {
    --app-bg: #f5f6f8;
    --app-surface: #ffffff;
    --app-border: #e3e6ea;
    --app-text: #1f2933;
    --app-muted: #6b7480;
    --app-accent: #0f4fa8;
    --app-accent-hover: #0c4290;
    --app-accent-active: #0a3777;
    --app-accent-soft: #eaf1fb;
    --app-focus-ring: 0 0 0 .2rem rgba(15, 79, 168, .15);

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-border-color: var(--app-border);
    --bs-primary: #0f4fa8;
    --bs-primary-rgb: 15, 79, 168;
    --bs-link-color: #0f4fa8;
    --bs-link-color-rgb: 15, 79, 168;
    --bs-link-hover-color: #0a3777;
    --bs-link-hover-color-rgb: 10, 55, 119;
    --app-brand: #0f4fa8;
    --app-orange: #f26b1d;
    --app-orange-hover: #dc5c12;
    --bs-body-font-size: .925rem;
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--app-bg); }

/* ---------- navigation ---------- */
.app-navbar { background: var(--app-brand); padding: .7rem 0; }
.app-brand { display: inline-flex; align-items: center; gap: .75rem; padding: .45rem .9rem; border: 1px solid rgba(255, 255, 255, .25);
    border-radius: .5rem; background: rgba(255, 255, 255, .06); margin-right: 1.5rem; }
.app-brand .brand-company { font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; color: #fff; line-height: 1; }
.app-brand .brand-accent { color: var(--app-orange); }
.app-brand .brand-product { font-weight: 600; font-size: 1rem; color: rgba(255, 255, 255, .9); padding-left: .75rem; border-left: 1px solid rgba(255, 255, 255, .35); }
.app-navbar .nav-link { color: rgba(255, 255, 255, .9); font-weight: 600; padding: .5rem 1rem !important; border-radius: .4rem; margin: 0 .1rem; }
.app-navbar .nav-link i { margin-right: .45rem; }
.app-navbar .nav-link:hover, .app-navbar .nav-link:focus { color: #fff; background: rgba(255, 255, 255, .1); }
.app-navbar .nav-link.active { color: #fff; background: rgba(255, 255, 255, .18); }
.user-pill { display: inline-flex; align-items: center; gap: .45rem; color: #fff; font-weight: 500; font-size: .85rem;
    padding: .4rem .9rem; border-radius: 2rem; background: rgba(0, 0, 0, .12); border: 1px solid rgba(255, 255, 255, .2); }
.user-pill i { color: var(--app-orange); font-size: 1rem; }
.btn-nav-outline { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255, 255, 255, .55); --bs-btn-hover-color: var(--app-brand);
    --bs-btn-hover-bg: #fff; --bs-btn-hover-border-color: #fff; --bs-btn-active-bg: #fff; --bs-btn-active-color: var(--app-brand); padding: .35rem .8rem; }
.btn-signout { --bs-btn-color: #fff; --bs-btn-bg: var(--app-orange); --bs-btn-border-color: var(--app-orange); --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--app-orange-hover); --bs-btn-hover-border-color: var(--app-orange-hover); --bs-btn-active-bg: var(--app-orange-hover);
    --bs-btn-active-color: #fff; font-weight: 600; padding: .35rem .9rem; }

/* ---------- sidebar ---------- */
/* The sidebar is attached to the left edge under the navbar and runs the full height; content fills the rest. */
.app-navbar-inner { padding-left: 1.5rem; padding-right: 1.5rem; }
.app-shell { display: flex; align-items: stretch; min-height: calc(100vh - var(--app-navbar-height, 64px)); }
.app-content { flex: 1 1 auto; min-width: 0; }
.app-sidebar { flex: 0 0 250px; width: 250px; background: var(--app-surface); border-right: 1px solid var(--app-border); }
.app-sidebar-inner { padding: 1rem .75rem; }
@media (min-width: 992px) { .app-sidebar-inner { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; } }
.sidebar-title { display: flex; align-items: center; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--app-muted);
    padding: .25rem .6rem .7rem; border-bottom: 1px solid var(--app-border); margin-bottom: .5rem; }
.sidebar-title i { color: var(--app-brand); margin-right: .45rem; }
.sidebar-title .btn-close { margin-left: auto; font-size: .8rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .15rem; }
.sidebar-link { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border-radius: .4rem; color: #374151;
    text-decoration: none; font-weight: 500; }
.sidebar-link i { color: var(--app-muted); font-size: 1rem; }
.sidebar-link:hover { background: #f3f5f8; color: var(--app-text); }
.sidebar-link.active { background: var(--app-accent-soft); color: var(--app-brand); font-weight: 600; box-shadow: inset 3px 0 0 var(--app-brand); }
.sidebar-link.active i { color: var(--app-brand); }
/* nested levels: each level indents a little more; headings and toggles collapse their children */
.sidebar-link { padding-left: calc(.7rem + var(--depth, 0) * 1rem); }
.sidebar-children .sidebar-link { font-size: .9rem; padding-top: .45rem; padding-bottom: .45rem; }
.sidebar-heading { width: 100%; border: 0; background: none; text-align: left; }
.sidebar-heading .sidebar-chevron, .sidebar-toggle i { margin-left: auto; font-size: .75rem; transition: transform .15s ease; }
.sidebar-heading.collapsed .sidebar-chevron, .sidebar-toggle.collapsed i { transform: rotate(-90deg); }
.sidebar-group-head { display: flex; align-items: center; }
.sidebar-group-head .sidebar-link { flex: 1 1 auto; min-width: 0; }
.sidebar-toggle { border: 0; background: none; color: var(--app-muted); padding: .35rem .5rem; border-radius: .4rem; }
.sidebar-toggle:hover { background: #f3f5f8; }
.sidebar-children { display: flex; flex-direction: column; gap: .1rem; }
.sidebar-children:not(.show) { display: none; }
/* Phones and tablets: the sidebar becomes a slide-in drawer (offcanvas-lg) opened from the sticky menu bar. */
.app-mobilebar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .5rem 1rem;
    background: var(--app-surface); border-bottom: 1px solid var(--app-border); box-shadow: 0 2px 6px rgba(15, 79, 168, .06); }
.app-menu-btn { display: inline-flex; align-items: center; gap: .4rem; flex-shrink: 0; border: 0; border-radius: .45rem; padding: .4rem .8rem;
    background: var(--app-brand); color: #fff; font-weight: 600; font-size: .85rem; }
.app-menu-btn i { font-size: 1.15rem; line-height: 1; }
.app-menu-btn:hover, .app-menu-btn:focus-visible { background: var(--app-accent-active); }
.app-mobilebar-title { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .82rem; font-weight: 600; color: var(--app-brand); }
.app-mobilebar-title > * { white-space: nowrap; }
.app-mobilebar-page { overflow: hidden; text-overflow: ellipsis; color: var(--app-text); font-weight: 500; }
.app-mobilebar-page::before { content: "\F285"; font-family: bootstrap-icons; font-size: .65rem; color: var(--app-muted); margin-right: .4rem; }
@media (max-width: 991.98px) {
    .app-shell { flex-direction: column; min-height: 0; }
    .app-sidebar { flex: none; width: 0; height: 0; border: 0; }
    .app-sidebar-inner.offcanvas-lg { --bs-offcanvas-width: min(300px, 86vw); --bs-offcanvas-bg: var(--app-surface); overflow-y: auto;
        padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
    .sidebar-link { padding-top: .65rem; padding-bottom: .65rem; } /* bigger touch targets */
}

/* ---------- page structure ---------- */
.app-main { padding: 1.5rem 1.5rem 2.5rem; max-width: 1320px; margin: 0 auto; }
.app-sidebar + .app-content .app-main { max-width: none; margin: 0; }
@media (max-width: 575.98px) { .app-main { padding: 1rem .75rem 2rem; } }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-title { font-size: 1.3rem; font-weight: 600; margin: 0; }
.page-subtitle { color: var(--app-muted); font-size: .875rem; margin: .15rem 0 0; }
.section-title { font-size: 1rem; font-weight: 600; margin: 0; }

.card { border-color: var(--app-border); border-radius: .5rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: var(--app-surface); border-bottom-color: var(--app-border); padding: .85rem 1.25rem; }
.card-body { padding: 1.25rem; }
.card-footer { background: #fafbfc; border-top-color: var(--app-border); }

.stat-label { color: var(--app-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 600; margin: 0; }

.detail-list { margin: 0; }
.detail-list dt { color: var(--app-muted); font-weight: 500; }
.detail-list dd { margin-bottom: .75rem; }

.form-actions { display: flex; gap: .5rem; padding-top: .5rem; }

/* ---------- buttons ---------- */
.btn { font-weight: 500; }
.btn-primary {
    --bs-btn-bg: var(--app-accent); --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-bg: var(--app-accent-hover); --bs-btn-hover-border-color: var(--app-accent-hover);
    --bs-btn-active-bg: var(--app-accent-active); --bs-btn-active-border-color: var(--app-accent-active);
    --bs-btn-disabled-bg: var(--app-accent); --bs-btn-disabled-border-color: var(--app-accent);
    --bs-btn-focus-shadow-rgb: 15, 79, 168;
}
.btn-outline-primary {
    --bs-btn-color: var(--app-accent); --bs-btn-border-color: var(--app-accent);
    --bs-btn-hover-color: var(--app-accent-active); --bs-btn-hover-bg: var(--app-accent-soft); --bs-btn-hover-border-color: var(--app-accent-hover);
    --bs-btn-active-color: var(--app-accent-active); --bs-btn-active-bg: #dce7f7; --bs-btn-active-border-color: var(--app-accent-active);
    --bs-btn-focus-shadow-rgb: 15, 79, 168;
}
.btn-outline-secondary {
    --bs-btn-color: #4b5563; --bs-btn-border-color: #d5dae0;
    --bs-btn-hover-color: #1f2933; --bs-btn-hover-bg: #f1f3f5; --bs-btn-hover-border-color: #c3c9d0;
    --bs-btn-active-color: #1f2933; --bs-btn-active-bg: #e9ecef; --bs-btn-active-border-color: #c3c9d0;
}
.btn-light {
    --bs-btn-bg: #fff; --bs-btn-border-color: #d5dae0; --bs-btn-color: #374151;
    --bs-btn-hover-bg: #f1f3f5; --bs-btn-hover-border-color: #c3c9d0;
    --bs-btn-active-bg: #e9ecef; --bs-btn-active-border-color: #c3c9d0;
}
.btn-danger {
    --bs-btn-bg: #a94a46; --bs-btn-border-color: #a94a46;
    --bs-btn-hover-bg: #933f3b; --bs-btn-hover-border-color: #933f3b;
    --bs-btn-active-bg: #7f3532; --bs-btn-active-border-color: #7f3532;
}
.btn-outline-danger {
    --bs-btn-color: #a94a46; --bs-btn-border-color: #e6c9c7;
    --bs-btn-hover-color: #7f3532; --bs-btn-hover-bg: #fbf0ef; --bs-btn-hover-border-color: #dcb2b0;
    --bs-btn-active-color: #7f3532; --bs-btn-active-bg: #f6e3e2; --bs-btn-active-border-color: #dcb2b0;
}
.table-actions { white-space: nowrap; text-align: right; }
.table-actions .btn, .table-actions form { margin-left: .25rem; }
.table-actions form { display: inline; }
.btn-icon { padding: .2rem .45rem; line-height: 1.2; }

/* ---------- forms ---------- */
.form-label { font-weight: 500; font-size: .85rem; color: #3b4652; margin-bottom: .3rem; }
.form-control, .form-select { border-color: #d5dae0; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #7fa3d6; box-shadow: var(--app-focus-ring); }
.form-check-input:checked { background-color: var(--app-accent); border-color: var(--app-accent); }
.field-validation-error, .validation-summary-errors { color: #a94a46; font-size: .85rem; }
.validation-summary-errors ul { margin: 0 0 .75rem; padding-left: 1.1rem; }
.validation-summary-valid { display: none; }

/* ---------- tables ---------- */
.table { --bs-table-hover-bg: #f8f9fb; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; border-bottom-color: #edf0f2; }
.table thead th {
    background: #f8f9fb; color: var(--app-muted); font-weight: 600; font-size: .75rem;
    text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--app-border); white-space: nowrap;
}

/* ---------- badges ---------- */
.badge-soft { display: inline-block; padding: .2em .55em; font-size: .78rem; font-weight: 500; border-radius: .35rem; white-space: nowrap;
    background: #eef1f4; color: #475260; border: 1px solid #e1e5ea; margin-right: .25rem; }
.badge-soft-success { background: #edf5ef; color: #3d6b4a; border-color: #d6e8db; }
.badge-soft-warning { background: #fbf5e8; color: #85621f; border-color: #efe1c3; }
.badge-soft-danger { background: #fbf0ef; color: #8f3f3b; border-color: #efd6d4; }

/* ---------- alerts ---------- */
.alert { border-radius: .5rem; }
.alert-info { background: #eef3f8; color: #2f4a63; border-color: #d9e3ec; }
.alert-warning { background: #fbf6ea; color: #6f5418; border-color: #efe3c6; }
.alert-danger { background: #fbf0ef; color: #7f3532; border-color: #efd6d4; }

/* ---------- notice after save ---------- */
.app-notice { display: flex; align-items: center; gap: .85rem; background: #f2f6fb; border: 1px solid #d9e3ef; color: var(--app-text);
    padding: .8rem 3rem .8rem 1rem; }
.app-notice-icon { width: 2.25rem; height: 2.25rem; flex-shrink: 0; border-radius: .5rem; background: var(--app-brand); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.app-notice-title { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--app-brand); }

/* ---------- list page header card ---------- */
.page-header-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    background: var(--app-surface); border: 1px solid var(--app-border); border-radius: .5rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.page-header-main { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.page-header-icon { width: 2.75rem; height: 2.75rem; flex-shrink: 0; border-radius: .55rem; background: var(--app-accent-soft);
    color: var(--app-brand); display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.page-header-card .breadcrumb { margin: 0 0 .1rem; font-size: .8rem; --bs-breadcrumb-item-active-color: var(--app-text); }
.page-header-card .breadcrumb a { color: var(--app-muted); text-decoration: none; }
.page-header-card .breadcrumb a:hover { color: var(--app-brand); }

/* ---------- list card: blue toolbar band, light blue headers, tinted rows, light blue footer with paging ---------- */
.list-card { overflow: hidden; background: var(--app-surface); border: 0; border-radius: .65rem; box-shadow: 0 2px 10px rgba(15, 79, 168, .10); }
/* DataTables' Bootstrap 5 layout: a toolbar row, the table row (.dt-layout-table) and a footer row */
.list-card .dt-container > .row { margin: 0 !important; padding: .8rem 1.25rem; align-items: center; }
.list-card .dt-container > .row > * { padding: 0; }
.list-card .dt-container > .row:first-child { background: linear-gradient(90deg, var(--app-brand) 0%, #1a5fc0 100%); }
.list-card .dt-container > .row.dt-layout-table { padding: 0; }
.list-card .dt-container > .row:last-child { background: #eef4fc; border-top: 1px solid #d3e0f2; padding: .75rem 1.25rem; }
.list-card .dt-layout-table > * { overflow-x: auto; }
.list-card table.dataTable { margin: 0 !important; border-collapse: collapse !important; }
.list-card table.dataTable > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.list-card table.dataTable > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.list-card .table-wide { min-width: 960px; }
/* the first data column (after the # column, when there is one) */
.list-card .table-wide > tbody > tr > td:first-child:not(.dt-sl), .list-card .table-wide > tbody > tr > td.dt-sl + td { min-width: 11rem; }
/* wide lists: tighter cells so they fit without side scrolling on a laptop screen */
.list-card .table-wide > :not(caption) > * > * { padding-left: .5rem; padding-right: .5rem; }
.list-card .table-wide > :not(caption) > * > *:first-child { padding-left: 1.25rem; }
.list-card .table-wide > :not(caption) > * > *:last-child { padding-right: 1.25rem; }
.list-card .table-wide .dt-filter-row .form-control-sm, .list-card .table-wide .dt-filter-row .form-select-sm { min-width: 3.5rem; }
.list-card table.dataTable td.table-actions { width: 1%; }
.list-card .table-wide > thead > tr:first-child > th:is(.dt-orderable-asc, .dt-orderable-desc) { padding-right: 1.4rem; }
/* when a wide list must scroll sideways, the action buttons stay pinned on the right */
.list-card .table-wide > tbody > tr > td.table-actions, .list-card .table-wide > thead > tr > th:last-child { position: sticky; right: 0; z-index: 1; }
.list-card .table-wide > tbody > tr > td.table-actions { background-color: var(--bs-table-bg); box-shadow: -6px 0 8px -6px rgba(15, 79, 168, .25); }

/* toolbar: title, record count, "Filtered" chip, search */
.dt-toolbar-title { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1rem; color: #fff; }
.dt-toolbar-title .bi { font-size: 1.05rem; opacity: .9; }
.dt-count { background: var(--app-orange); color: #fff; font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px; }
.dt-filtered { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; color: #dbe7f8;
    border: 1px dashed rgba(255, 255, 255, .5); border-radius: 999px; padding: .1rem .55rem; }
.dt-filtered .btn-link { color: #fff; font-size: .75rem; font-weight: 600; text-decoration: none; }
.dt-container .dt-search { position: relative; }
.dt-container .dt-search::before { content: "\F52A"; font-family: bootstrap-icons; position: absolute; left: .75rem; top: 50%;
    transform: translateY(-50%); color: #8aa6cf; font-size: .85rem; pointer-events: none; z-index: 1; }
.dt-container .dt-search input { min-width: 260px; padding-left: 2.1rem; border-radius: 999px; background: #fff; border: 0; }

/* column headers and the filter row */
.list-card table.dataTable thead tr:first-child th { background: #dfe9f7; color: var(--app-brand); font-size: .73rem; font-weight: 700;
    letter-spacing: .06em; padding-top: .75rem; padding-bottom: .75rem; border-bottom: 2px solid var(--app-brand); }
.dt-filter-row th { background: #eef4fc !important; border-bottom: 1px solid #d3e0f2 !important; padding: .45rem .5rem !important;
    text-transform: none !important; letter-spacing: 0 !important; vertical-align: middle; }
.dt-filter-row .form-control-sm, .dt-filter-row .form-select-sm { min-width: 6rem; font-size: .8rem; font-weight: 400; border-color: #c9d8ee; background-color: #fff; }
.dt-filter-row .dt-filter-active { border-color: var(--app-orange) !important; box-shadow: 0 0 0 .15rem rgba(242, 107, 29, .15) !important; }
.dt-filter-clear { padding: 0; text-decoration: none; font-size: .8rem; font-weight: 600; color: var(--app-orange); }
.dt-filter-clear:hover { color: var(--app-orange-hover); }

/* rows: blue-tinted stripes; hover in light blue with an orange edge */
.list-card .table { --bs-table-bg: #fff; }
.list-card table.dataTable > tbody > tr > td { padding-top: .7rem; padding-bottom: .7rem; border-bottom-color: #e3ebf6; }
.list-card table.dataTable > tbody > tr:nth-child(even) > td { --bs-table-bg: #f4f8fd; }
.list-card table.dataTable.table-hover > tbody > tr:hover > * { box-shadow: none; background-color: #e3edfa; }
.list-card table.dataTable.table-hover > tbody > tr:hover > *:first-child { box-shadow: inset 4px 0 0 var(--app-orange); }
.list-card table.dataTable th.dt-sl, .list-card table.dataTable td.dt-sl { width: 1%; white-space: nowrap; text-align: left; padding-right: .5rem; }
.list-card table.dataTable td.dt-sl { font-weight: 600; font-size: .85rem; font-variant-numeric: tabular-nums; }
.dt-name { display: inline-flex; align-items: center; gap: .7rem; }
.dt-badge { width: 2rem; height: 2rem; border-radius: 50%; background: var(--app-brand); color: #fff; display: inline-flex;
    align-items: center; justify-content: center; font-weight: 700; font-size: .75rem; flex-shrink: 0; }
.dt-primary { font-weight: 600; color: #12305e; }
.dt-empty-value { color: #a9b8cc; }

/* row buttons: solid blue for edit, orange for delete */
.list-card .table-actions .btn { width: 2rem; height: 2rem; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: .45rem; }
.list-card .table-actions .btn-outline-secondary { background: #dfe9f7; color: var(--app-brand); }
.list-card .table-actions .btn-outline-secondary:hover { background: var(--app-brand); color: #fff; }
.list-card .table-actions .btn-outline-primary { background: var(--app-brand); color: #fff; }
.list-card .table-actions .btn-outline-primary:hover { background: var(--app-accent-active); color: #fff; }
.list-card .table-actions .btn-outline-danger { background: #fde8dc; color: #d4540f; }
.list-card .table-actions .btn-outline-danger:hover { background: var(--app-orange); color: #fff; }
.list-card .table-actions .btn-outline-success { background: #e2f1e6; color: #2f6b40; }
.list-card .table-actions .btn-outline-success:hover { background: #2f6b40; color: #fff; }

/* no rows */
.list-card td.dt-empty { padding: 0 !important; background: #fff !important; }
.dt-empty-state { padding: 3rem 1rem; text-align: center; }
.dt-empty-icon { width: 3.5rem; height: 3.5rem; border-radius: 50%; background: var(--app-brand); color: #fff; display: inline-flex;
    align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: .75rem; }
.dt-empty-title { font-weight: 600; font-size: 1rem; color: #12305e; }
.dt-empty-text { color: #5d7598; font-size: .875rem; margin: .25rem 0 1rem; }
.dt-empty-state .btn-outline-secondary { border-color: var(--app-orange); color: var(--app-orange); }
.dt-empty-state .btn-outline-secondary:hover { background: var(--app-orange); color: #fff; }

/* ---------- DataTables ---------- */
.dt-container .dt-layout-end { gap: 1rem; }
.dt-container .dt-length select { width: auto; display: inline-block; }
/* keep "10 per page" on one line when the page-size select is a select2 */
.dt-container .dt-length { display: flex; align-items: center; gap: .5rem; }
.dt-container .dt-length .select2-container { width: auto !important; min-width: 5rem; }
.dt-container .dt-length label { margin: 0; white-space: nowrap; color: #3a5a88; font-size: .85rem; }
.dt-container .dt-info { color: #3a5a88; font-size: .85rem; font-weight: 500; }
.dt-container .pagination { gap: .25rem; --bs-pagination-focus-box-shadow: var(--app-focus-ring); }
.dt-container .pagination .page-link { min-width: 2rem; text-align: center; font-size: .85rem; padding: .35rem .6rem;
    border: 1px solid #c9d8ee; border-radius: .45rem !important; color: var(--app-brand); background: #fff; }
.dt-container .pagination .page-item.active .page-link { background: var(--app-orange); border-color: var(--app-orange); color: #fff; }
.dt-container .pagination .page-item.disabled .page-link { color: #a9b8cc; background: #f6f9fd; border-color: #dfe7f2; }
.dt-container .pagination .page-item:not(.active):not(.disabled) .page-link:hover { background: var(--app-brand); border-color: var(--app-brand); color: #fff; }
.dt-container div.dt-processing > div:last-child > div { background: var(--app-orange); }
.list-card table.dataTable thead > tr > th.dt-orderable-asc:hover, .list-card table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: none; color: #0a3777; }

/* ---------- select2 (bootstrap-5 theme) ---------- */
.select2-container--bootstrap-5 .select2-selection { border-color: #d5dae0; }
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection { border-color: #7fa3d6; box-shadow: var(--app-focus-ring); }
.select2-container--bootstrap-5 .select2-dropdown { border-color: #7fa3d6; }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--app-accent-soft); color: var(--app-text); }
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--selected { background: var(--app-accent); color: #fff; }
.select2-container--bootstrap-5 .select2-selection--multiple .select2-selection__rendered .select2-selection__choice { background: var(--app-accent-soft); border-color: #d5dee7; color: var(--app-text); }

/* ---------- dashboard ---------- */
.page-intro { padding-bottom: 1.25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--app-border); }
.page-intro h1 { font-size: 1.75rem; font-weight: 700; margin: 0 0 .35rem; }
.page-intro p { color: var(--app-muted); margin: 0; font-size: 1rem; }
.module-card { padding: 1.75rem; height: 100%; }
.module-card p { color: #4b5563; line-height: 1.7; margin: 1.25rem 0 1.5rem; }
.module-icon { width: 3.75rem; height: 3.75rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.6rem; }
.module-title { font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.tone-blue .module-icon { background: #eaf1fb; color: var(--app-brand); }
.tone-blue .module-title { color: var(--app-brand); }
.tone-orange .module-icon { background: #fef1e8; color: var(--app-orange); }
.tone-orange .module-title { color: var(--app-orange); }
.btn-module { --bs-btn-padding-x: 1.5rem; --bs-btn-padding-y: .6rem; border-width: 2px; font-weight: 600; }
.overview-title { font-size: .95rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 1.25rem; }
.overview-tile { border: 1px solid var(--app-border); border-radius: .5rem; background: #fafbfc; padding: 1.1rem 1.25rem; height: 100%; }
.overview-value { font-size: 1.8rem; font-weight: 700; line-height: 1.2; margin: 0; }
.overview-label { color: var(--app-muted); font-size: .88rem; margin: .2rem 0 0; }
.text-brand { color: var(--app-brand); }
.text-orange { color: var(--app-orange); }
.text-green { color: #16865a; }
.text-violet { color: #7a3fd1; }

/* ---------- sign-in ---------- */
.auth-card { max-width: 420px; margin: 3rem auto 0; }

/* ---------- role menu access ---------- */
.permission-matrix { max-width: 640px; }
.permission-matrix thead th { text-transform: none; letter-spacing: 0; font-size: .8rem; }
.permission-matrix td:first-child { font-weight: 500; }

/* ---------- admin menu tree ---------- */
.menu-tree-cell { display: inline-flex; align-items: center; padding-left: calc(var(--depth, 0) * 1.4rem); }
.menu-tree-branch { color: var(--app-muted); margin-right: .45rem; }

/* ---------- school logo / signature ---------- */
.school-image { max-height: 80px; max-width: 220px; object-fit: contain; border: 1px solid var(--app-border); border-radius: .4rem; padding: .35rem; background: #fff; }

/* ---------- attendance summary grid (one column per day) ---------- */
.list-card table.att-summary { min-width: 1100px; }
.list-card table.att-summary > :not(caption) > * > * { padding-left: .35rem; padding-right: .35rem; }
.list-card table.att-summary > :not(caption) > * > *:first-child { padding-left: 1rem; }
.list-card table.att-summary > :not(caption) > * > *:last-child { padding-right: 1rem; }
.list-card table.att-summary > tbody > tr > td { padding-top: .45rem; padding-bottom: .45rem; white-space: nowrap; }
.list-card table.att-summary th.att-day, .list-card table.att-summary td.att-day { width: 1.9rem; min-width: 1.9rem; text-align: center; padding-left: .1rem !important; padding-right: .1rem !important; letter-spacing: 0; }
.list-card table.att-summary th.att-day { line-height: 1.1; }
.att-day-no { display: block; }
.att-day-name { display: block; font-size: .6rem; font-weight: 600; opacity: .7; text-transform: none; }
.list-card table.att-summary th.att-weekend { background: #cfdcf0; }
.list-card table.att-summary td.att-total, .list-card table.att-summary th:nth-last-child(-n+4) { text-align: center; }
.att-cell { display: inline-flex; align-items: center; justify-content: center; min-width: 1.45rem; height: 1.45rem; border-radius: .35rem; font-size: .7rem; font-weight: 700; color: #a9b8cc; }
.att-cell.att-P { background: #e2f1e6; color: #2f6b40; }
.att-cell.att-L { background: #fff1d6; color: #a15c00; }
.att-cell.att-A { background: #fde2e1; color: #b42318; }
.att-cell.att-Lv { background: #dcebfb; color: var(--app-brand); }
.att-pct { display: inline-block; min-width: 3.4rem; padding: .15rem .45rem; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.att-pct-good { background: #e2f1e6; color: #2f6b40; }
.att-pct-fair { background: #fff1d6; color: #a15c00; }
.att-pct-poor { background: #fde2e1; color: #b42318; }
.att-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding: .7rem 1.25rem; font-size: .8rem; color: #4b6283; border-top: 1px solid #d3e0f2; background: #f7faff; }
.att-legend .att-cell { margin-right: .3rem; }
/* the four totals stay pinned on the right while the days scroll sideways */
.list-card table.att-summary > * > tr > :nth-last-child(-n+4) { position: sticky; z-index: 1; width: 3.8rem; min-width: 3.8rem; max-width: 3.8rem; padding-left: .2rem !important; padding-right: .2rem !important; }
.list-card table.att-summary > thead > tr > th:nth-last-child(-n+4) { padding-right: 1.1rem !important; }
.list-card table.att-summary > * > tr > :nth-last-child(1) { right: 0; width: 5.4rem; min-width: 5.4rem; max-width: 5.4rem; }
.list-card table.att-summary > * > tr > :nth-last-child(2) { right: 5.4rem; }
.list-card table.att-summary > * > tr > :nth-last-child(3) { right: 9.2rem; }
.list-card table.att-summary > * > tr > :nth-last-child(4) { right: 13rem; box-shadow: -6px 0 8px -6px rgba(15, 79, 168, .25); }
.list-card table.att-summary > tbody > tr > td:nth-last-child(-n+4) { background-color: var(--bs-table-bg); }
.list-card table.att-summary > thead > tr > th:nth-last-child(-n+4) { background-color: #dfe9f7; }

/* ---------- report filter bar: compact, every filter and Search on one row on a desktop ---------- */
.report-filters .card-body { padding: .6rem 1rem .7rem; }
.report-filters .form-label { font-size: .72rem; font-weight: 600; color: #4b6283; margin-bottom: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.report-filters input[type=date].form-control-sm { min-width: 8.5rem; }

/* Exam marking: the small editor tables of the setup forms, and the marks entry sheet. */
.editor-table th { font-size: .78rem; font-weight: 600; color: #4b6283; background: #f3f7fd; }
.marks-sheet .mark-input { width: 5.5rem; margin: 0 auto; text-align: right; }
.marks-sheet th { white-space: nowrap; }

/* ---------- Student profile ---------- */
.profile-search { position: relative; max-width: 340px; }
.profile-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050; background: #fff; border: 1px solid #cbd5e0; border-radius: .375rem; box-shadow: 0 8px 24px rgba(15, 23, 42, .12); max-height: 340px; overflow-y: auto; }
.profile-search-results a { display: block; padding: .45rem .85rem; color: #2d3748; text-decoration: none; border-bottom: 1px solid #edf2f7; font-size: .85rem; }
.profile-search-results a:hover { background: #eef4fb; }
.profile-search-empty { padding: .75rem; color: #a0aec0; font-size: .8rem; text-align: center; }
.profile-name { font-size: 1.35rem; font-weight: 700; color: #263248; line-height: 1.2; }
.profile-sub { font-size: 1.05rem; color: #4a5568; margin-top: .15rem; }
.profile-photo { width: 120px; height: 140px; object-fit: cover; flex-shrink: 0; }
.profile-section { border-top: 1px solid #e2e8f0; padding-top: .75rem; margin-top: .75rem; }
.profile-section h6 { font-weight: 700; color: #263248; margin-bottom: .5rem; }
.profile-section .form-control[readonly] { background: #f5f8fc; }
.profile-filters .select2-container { width: 100% !important; }
.profile-meta { font-size: .875rem; margin-bottom: .5rem; }
.profile-note { text-align: center; color: #a0aec0; margin: 1.25rem 0; }
.profile-sheet { font-size: .8rem; }
.profile-sheet thead th, .profile-sheet tfoot th { background: #eaf2fb; }
.profile-attendance td, .profile-attendance th { padding: .2rem .3rem; }
.profile-sheet > :not(caption) > * > * { padding: .3rem .4rem; }
.profile-sheet thead th { text-transform: none; letter-spacing: 0; font-size: .78rem; }

/* ---------- Dashboards (School, Library, Rent, Asset, Home, Administration): one shared look ---------- */
/* Stat card: soft tone gradient, icon, decorative sparkline, sub figures on the right. Tone set by .tone-* on the card. */
.dash-stat { --tone: #2f5f9e; --tone-soft: #dfe9f7; --tone-tint: #e9f1fc;
    position: relative; display: flex; align-items: center; gap: .9rem; height: 100%; padding: 1rem 1.1rem;
    border: 1px solid #dde6f2; border-radius: .75rem; background: linear-gradient(115deg, #ffffff 0%, #fbfcfe 35%, var(--tone-tint) 100%);
    box-shadow: 0 2px 8px rgba(15, 79, 168, .07); color: var(--app-text); text-decoration: none; transition: box-shadow .15s ease, transform .15s ease;
    container-type: inline-size; }
a.dash-stat:hover { color: var(--app-text); box-shadow: 0 6px 18px rgba(15, 79, 168, .14); transform: translateY(-2px); }
.dash-stat .dash-icon { width: 2.75rem; height: 2.75rem; flex: none; border-radius: .65rem; display: grid; place-items: center; font-size: 1.2rem;
    background: var(--tone-soft); color: var(--tone); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7); }
.dash-stat .dash-main { flex: 1 1 auto; min-width: 0; }
.dash-stat .dash-split { flex-shrink: 0; }
.dash-stat .dash-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; margin: 0; color: #18283b; white-space: nowrap; }
.dash-stat .dash-label { color: #4f5d6d; font-size: .82rem; line-height: 1.3; margin: .1rem 0 0; }
.dash-stat .dash-note { color: var(--app-muted); font-size: .74rem; margin: .15rem 0 0; }
.dash-stat .dash-spark { flex: 0 40 2.9rem; min-width: 1.6rem; width: 2.9rem; height: 1.5rem; background: var(--tone); opacity: .8;
    -webkit-mask: var(--spark) no-repeat center / contain; mask: var(--spark) no-repeat center / contain;
    --spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 15 7 10 12 13 19 6 25 9 32 3 39 5'/%3E%3C/svg%3E"); }
.dash-stat .dash-spark.spark-2 { --spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 13 7 9 12 12 18 5 24 10 30 7 39 3'/%3E%3C/svg%3E"); }
.dash-stat .dash-spark.spark-3 { --spark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 14 10 13 15 4 20 12 28 10 33 13 39 12'/%3E%3C/svg%3E"); }
.dash-stat .dash-split { display: flex; flex-direction: column; gap: .25rem; text-align: right; font-size: .76rem; color: #5b6878; white-space: nowrap; }
.dash-stat .dash-split b { font-size: .95rem; margin-right: .3rem; color: var(--app-brand); }
.dash-stat .dash-split .present b, .dash-stat .dash-split .good b { color: #2f8a52; }
.dash-stat .dash-split .absent b, .dash-stat .dash-split .bad b { color: #c0413b; }
.dash-stat .dash-split .warn b { color: #b7741a; }
.dash-stat.tone-blue { --tone: #2f5f9e; --tone-soft: #dfe9f7; --tone-tint: #e6effb; }
.dash-stat.tone-violet { --tone: #6a4fb3; --tone-soft: #ebe5f9; --tone-tint: #ece9fa; }
.dash-stat.tone-teal { --tone: #2a807a; --tone-soft: #dcf1ef; --tone-tint: #e2f3f2; }
.dash-stat.tone-amber { --tone: #a5690f; --tone-soft: #f9ecd3; --tone-tint: #fbf1df; }
.dash-stat.tone-coral { --tone: #b4553c; --tone-soft: #f8e3dc; --tone-tint: #fbebe6; }
.dash-stat.tone-green { --tone: #3a7d4e; --tone-soft: #dff0e4; --tone-tint: #e5f4ea; }
.dash-stat.tone-orange { --tone: #d9601a; --tone-soft: #fde7d8; --tone-tint: #fdeee3; }
.dash-stat.dash-muted .dash-value { color: var(--app-muted); }
/* Plain white action card, like "Download summary". */
.dash-stat.dash-action { background: #fff; border-color: #cbd8ea; }
.dash-stat.dash-action .dash-value { font-size: 1rem; }
/* Narrow cards drop the sparkline first, then shrink the icon and figure, so numbers never overlap. */
@container (max-width: 290px) { .dash-stat .dash-spark { display: none; } }
@container (max-width: 270px) { .dash-stat .dash-icon { width: 2.3rem; height: 2.3rem; font-size: 1rem; } .dash-stat .dash-value { font-size: 1.3rem; } }

/* Filter bar and notice on a dashboard. */
.dash-filter { background: linear-gradient(115deg, #ffffff 0%, #f3f7fd 100%); border-color: #dde6f2; border-radius: .75rem; }
.dash-alert { background: linear-gradient(90deg, #fdf3df 0%, #fbe7c6 100%); border-color: #f1d29c; color: #5f4410; border-radius: .75rem; }
.dash-alert > i { color: #c9761a; }

/* Table card (Design B): white panel, orange bar beside the title, list-style column headers (light blue, blue underline), orange hover edge. */
.dash-card { overflow: hidden; border: 1px solid #dde6f2; border-radius: .75rem; box-shadow: 0 2px 8px rgba(15, 79, 168, .06); }
.dash-card > .card-header { display: flex; align-items: center; gap: .5rem; padding: .8rem 1rem .6rem; background: #fff; border-bottom: 0; color: var(--app-text); }
.dash-card > .card-header .section-title { color: #18283b; font-size: .98rem; font-weight: 600; margin-right: auto; padding-left: .7rem; border-left: 4px solid var(--app-orange); }
.dash-card > .card-header .section-title i { color: var(--app-orange); margin-right: .3rem !important; }
.dash-card > .card-header a { color: var(--app-orange); font-size: .78rem; font-weight: 500; text-decoration: none; padding: .15rem .65rem;
    border: 1px solid #f6c7a8; border-radius: 999px; white-space: nowrap; }
.dash-card > .card-header a:hover { background: var(--app-orange); color: #fff; }
.dash-card .table { --bs-table-striped-bg: #f5f8fd; --bs-table-hover-bg: #eef4fc; }
.dash-card .table thead th { background: #dfe9f7; color: var(--app-brand); border-bottom: 2px solid var(--app-brand); font-size: .72rem; font-weight: 600; letter-spacing: .05em; padding-top: .55rem; padding-bottom: .55rem; }
.dash-card .table tbody tr:nth-child(even) > * { background: #f7f9fd; }
.dash-card .table tbody tr:hover > *:first-child { box-shadow: inset 4px 0 0 var(--app-orange); }
.dash-card .table tbody tr.dash-total > * { background: #e8f0fb; color: var(--app-brand); font-weight: 700; }
.dash-card .table a { color: var(--app-brand); font-weight: 500; text-decoration: none; }
.dash-card .table a:hover { text-decoration: underline; }
.dash-card .dash-empty { padding: 1.4rem 1rem; text-align: center; color: var(--app-muted); font-size: .88rem; }
.dash-card .dash-empty i { display: block; font-size: 1.4rem; color: #b6c4d8; margin-bottom: .25rem; }

/* Rounded badge (outlined pill) and progress bar used inside dashboard tables. */
.dash-pill { display: inline-block; min-width: 3.6rem; padding: .12rem .7rem; border: 2px solid #c7d3e3; border-radius: 999px;
    font-size: .8rem; font-weight: 600; line-height: 1.3; text-align: center; color: #3f5068; background: #fff; white-space: nowrap; }
.dash-pill-orange { border-color: var(--app-orange); color: #b9500f; }
.dash-pill-success { border-color: #5bb27d; color: #2f7a4b; background: #f2faf5; }
.dash-pill-danger { border-color: #e07a74; color: #a8392f; background: #fdf3f2; }
.dash-pill-warning { border-color: #e5b45a; color: #8c5d10; background: #fdf8ee; }
.dash-pill-info { border-color: #7fa9de; color: #2f5f9e; background: #f2f7fd; }
.dash-bar { display: flex; align-items: center; gap: .5rem; min-width: 8rem; }
.dash-bar .dash-bar-track { flex: 1; height: .85rem; border-radius: 999px; background: #e3eaf4; overflow: hidden; }
.dash-bar .dash-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #12408a 0%, #1f5fbf 100%); }
.dash-bar .dash-bar-text { font-size: .78rem; font-weight: 600; color: #1d3c66; min-width: 1.5rem; text-align: right; }
.dash-dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; background: #c7ced6; }
.dash-dot.success { background: #2f9e5b; } .dash-dot.danger { background: #d0453f; } .dash-dot.warning { background: #d99a1e; } .dash-dot.info { background: #3b82c4; }
.dash-face { width: 2.1rem; height: 2.1rem; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; background: #e3ecf8; color: #2f5f9e; font-size: .75rem; font-weight: 600; }
.dash-table-wrap { max-height: 22rem; overflow-y: auto; }
.dash-table-wrap thead th { position: sticky; top: 0; z-index: 1; }
.dash-past { color: var(--app-muted); }
.dash-who { font-size: .72rem; color: var(--app-muted); margin-left: .25rem; }

/* ---------- Responsive: phones (< 576px) and tablets (< 992px) ---------- */
/* A content table that has no scroll box of its own is wrapped in .table-scroll by site.js, so it scrolls sideways
   instead of widening the page. Prints show the whole table. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.list-card .dt-layout-table > *, .table-responsive, .dash-table-wrap { -webkit-overflow-scrolling: touch; }
@media print {
    .table-scroll, .table-responsive, .list-card .dt-layout-table > * { overflow: visible !important; }
    .app-mobilebar, .app-sidebar, .app-navbar { display: none !important; }
}
.app-main img { max-width: 100%; }
.app-main .card-body img.school-image { height: auto; }

/* navbar: the collapsed menu (below 992px) lists the modules full width with the user buttons under them */
@media (max-width: 991.98px) {
    .app-navbar { padding: .5rem 0; }
    .app-navbar-inner { padding-left: 1rem; padding-right: 1rem; }
    .app-brand { margin-right: .5rem; padding: .35rem .7rem; }
    .app-navbar .navbar-collapse { margin-top: .6rem; padding-top: .5rem; border-top: 1px solid rgba(255, 255, 255, .18);
        max-height: calc(100vh - 4.5rem); overflow-y: auto; }
    .app-navbar .navbar-nav .nav-link { margin: .1rem 0; }
    .app-navbar-user { padding: .5rem 0 .25rem; }
    .app-navbar-user .user-pill { margin-right: auto; }
}
@media (min-width: 992px) { .app-navbar .nav-link, .app-navbar-user .btn, .user-pill { white-space: nowrap; } .app-navbar-user { flex-wrap: nowrap !important; flex-shrink: 0; } }
/* small laptops / landscape tablets (992-1399px): one compact row, the user name shortens instead of wrapping */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .app-navbar .nav-link { padding: .45rem .6rem !important; white-space: nowrap; font-size: .88rem; }
    .app-navbar .nav-link i { margin-right: .3rem; }
    .app-brand { margin-right: .75rem; }
    .app-navbar-user { flex-wrap: nowrap !important; flex-shrink: 0; }
    .app-navbar-user .user-pill { font-size: 0; gap: 0; padding: .4rem .55rem; } /* icon only; the name is in its tooltip */
    .app-navbar-user .btn { white-space: nowrap; padding-left: .6rem; padding-right: .6rem; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .app-brand .brand-product { display: none; }
    .app-navbar .nav-link i { display: none; }
}
@media (max-width: 575.98px) {
    .app-brand .brand-company { font-size: 1.15rem; }
    .app-brand .brand-product { font-size: .85rem; padding-left: .55rem; }
    .app-brand { gap: .55rem; }
}
@media (max-width: 359.98px) { .app-brand .brand-product { display: none; } }

/* page structure */
@media (max-width: 991.98px) { .app-main { padding: 1.1rem 1rem 2rem; } }
@media (max-width: 575.98px) {
    .app-main { padding: .85rem .75rem 1.75rem; }
    .page-header-card { padding: .85rem 1rem; gap: .75rem; }
    .page-header-icon { width: 2.4rem; height: 2.4rem; font-size: 1.1rem; }
    .page-title { font-size: 1.12rem; }
    .page-header-card > .d-flex { width: 100%; }
    .page-header-card > .d-flex > .btn, .page-header-card > .d-flex > .dropdown { flex: 1 1 auto; }
    .page-header-card > .d-flex > .dropdown > .btn { width: 100%; }
    .card-body { padding: 1rem; }
    .card-header { padding: .75rem 1rem; }
    .page-intro h1 { font-size: 1.4rem; }
    .module-card { padding: 1.25rem; }
    .auth-card { margin-top: 1.5rem; }
    .app-notice { padding-right: 2.5rem; }
}

/* forms: buttons wrap; on a phone the Save / Cancel row fills the width */
.form-actions { flex-wrap: wrap; }
@media (max-width: 575.98px) {
    .form-actions > .btn, .form-actions > a.btn { flex: 1 1 auto; }
    .report-filters .col-lg-auto > .btn { flex: 1 1 auto; }
    .report-filters input[type=date].form-control-sm { min-width: 0; }
    /* 16px inputs stop iOS Safari from zooming the page when a field gets focus */
    .form-control, .form-select, .select2-container--bootstrap-5 .select2-selection { font-size: 1rem; }
    .form-control-sm, .form-select-sm, .select2-container--bootstrap-5 .select2-selection.select2--small { font-size: .95rem; }
}

/* lists (DataTables): toolbar and footer stack, search fills the width, the table scrolls sideways */
.list-card .dt-container > .row { row-gap: .6rem; }
@media (max-width: 767.98px) {
    .list-card .dt-container > .row { padding: .7rem 1rem; }
    .list-card .dt-container > .row:last-child { padding: .7rem 1rem; }
    .list-card .dt-container > .row > :is(.dt-layout-start, .dt-layout-end) { width: 100%; justify-content: center; }
    .list-card .dt-container > .row:first-child > .dt-layout-start { justify-content: flex-start; }
    .dt-toolbar-title { flex-wrap: wrap; row-gap: .35rem; }
    .dt-container .dt-search { width: 100%; }
    .dt-container .dt-search input { min-width: 0; width: 100% !important; margin-left: 0 !important; }
    .dt-container .dt-layout-end { flex-wrap: wrap; justify-content: center; gap: .6rem; }
    .dt-container .dt-info { text-align: center; }
    .list-card table.dataTable > :not(caption) > * > *:first-child { padding-left: .85rem; }
    .list-card table.dataTable > :not(caption) > * > *:last-child { padding-right: .85rem; }
}
@media (max-width: 575.98px) {
    /* First / Last drop out of the pager; Prev, the page numbers and Next stay */
    .dt-container .pagination .page-item:has(> .page-link.first, > .page-link.last) { display: none; }
    .dt-container .pagination { flex-wrap: wrap; justify-content: center; }
    .dt-container .pagination .page-link { min-width: 2.1rem; padding: .4rem .55rem; }
    .list-card .table-actions .btn { width: 2.2rem; height: 2.2rem; }
    .coa-toolbar .form-control { width: 100% !important; }
}

/* dashboards: one stat card per row on a phone, two on a tablet (the grid classes already do it); headers wrap */
.dash-card > .card-header { flex-wrap: wrap; row-gap: .4rem; }
@media (max-width: 575.98px) {
    .dash-stat { padding: .85rem .95rem; }
    .dash-stat .dash-value { font-size: 1.35rem; }
    .dash-table-wrap { max-height: 18rem; }
    .overview-value { font-size: 1.5rem; }
}

/* printable previews (ID cards, certificates, statements, vouchers, receipts) keep their paper size and scroll inside their card */
@media screen and (max-width: 860px) { .idcard-grid { grid-template-columns: repeat(auto-fill, 242px); gap: 24px; } }
@media (max-width: 575.98px) {
    .st, .vp, .ar, .yc { font-size: 11.5px; }
    .st-head, .vp-head, .ar-head { flex-wrap: wrap; }
    .vp-signs, .ar-signs { gap: 1rem; }
    .vp-signs > div, .ar-signs > div { padding: 0 4px; }
}

/* modals: near full screen on a phone */
@media (max-width: 575.98px) {
    .modal-dialog { margin: .5rem; }
    .modal-body { padding: 1rem; }
}

/* installed app (standalone window): keep content clear of the phone's notch and home bar */
@media (display-mode: standalone) {
    .app-navbar { padding-top: max(.5rem, env(safe-area-inset-top)); }
    .app-main { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
}

/* idle sign-out warning (wwwroot/js/session-guard.js) */
.session-warning { position: fixed; inset: 0; z-index: 2000; display: none; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 23, 42, .45); }
.session-warning.show { display: flex; }
.session-warning-card { width: 100%; max-width: 380px; background: var(--app-surface); border-radius: 14px; padding: 1.5rem; text-align: center; box-shadow: 0 18px 40px rgba(15, 23, 42, .25); }
.session-warning-card h2 { font-size: 1.15rem; font-weight: 600; margin: .5rem 0 .35rem; }
.session-warning-card p { color: var(--app-muted); margin-bottom: 1.1rem; }
.session-warning-icon { width: 52px; height: 52px; margin: 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--app-accent); background: rgba(15, 79, 168, .1); }
