/* =========================================================
   EduManage Web - Light & Clean Professional Theme
   Navy / White palette
   ========================================================= */

:root {
    --navy: #14213D;
    --navy-light: #1F3157;
    --navy-soft: #EAF0FB;
    --gold: #C9A24B;
    --bg: #F4F6FA;
    --card: #FFFFFF;
    --border: #E3E8F0;
    --text-dark: #1B1F2A;
    --text-muted: #6B7280;
    --success: #2E9E5B;
    --success-bg: #E3F6EA;
    --danger: #D64550;
    --danger-bg: #FCEAEA;
    --warning: #E0A53B;
    --warning-bg: #FCF1DE;
    --sidebar-width: 235px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
}

a { text-decoration: none; color: inherit; }

/* =========================================================
   LOGIN PAGE: moved to assets/css/login.css
   (login.php loads it right after this file)
   ========================================================= */


/* ===================== APP SHELL ===================== */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--navy);
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 26px 22px 18px;
}
.sidebar-logo .title { color: rgb(255, 255, 255); font-size: 18px; font-weight: bold; }
.sidebar-logo .sub { color: var(--gold); font-size: 10px; letter-spacing: 0.5px; }

.sidebar hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 0; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 22px;
    color: #C7D1E6;
    font-size: 18px;
    cursor: pointer;
    border-left: 4px solid transparent;
}
.nav-link:hover { background: var(--navy-light); color: white; }
.nav-link.active {
    background: var(--navy-light);
    color: white;
    font-weight: bold;
    border-left-color: var(--gold);
}

.sidebar-footer { padding: 10px 0 18px; margin-top: 12px; }

.topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-width);
    height: 64px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    z-index: 90;
}
.topbar h1 { font-size: 19px; font-weight: bold; margin: 0; flex: 1; }
.topbar .user-block { text-align: right; }
.topbar .user-name { font-size: 13px; font-weight: bold; }
.topbar .user-role { font-size: 11px; color: var(--text-muted); }

.content {
    margin-left: var(--sidebar-width);
    margin-top: 64px;
    padding: 24px 28px 50px;
}

.menu-toggle { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
    .sidebar.open { transform: translateX(0); }
    .topbar, .content { margin-left: 0; left: 0; }
    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px; height: 36px;
        border-radius: 8px;
        background: var(--navy-soft);
        color: var(--navy);
        font-size: 18px;
        margin-right: 12px;
        cursor: pointer;
        border: none;
    }
}

/* ===================== CARDS ===================== */

.page-header { margin-bottom: 18px; }
.page-header h2 { margin: 0 0 2px; font-size: 22px; }
.page-header p { margin: 0; color: var(--text-muted); font-size: 12.5px; }

.section-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 18px;
    box-shadow: 0 2px 10px rgba(20,33,61,0.05);
}

.section-title { font-size: 16px; font-weight: bold; margin: 0 0 14px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(20,33,61,0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.stat-label { font-size: 11.5px; color: var(--text-muted); font-weight: bold; letter-spacing: 0.3px; }
.stat-value { font-size: 24px; font-weight: bold; }

/* ===================== BUTTONS ===================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 7px;
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
}
.btn-sm { padding: 6px 13px; font-size: 11.5px; border-radius: 6px; }

.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); }

.btn-secondary { background: var(--navy-soft); color: var(--navy); }
.btn-secondary:hover { background: #dde6f8; }

.btn-gold { background: var(--gold); color: white; }
.btn-gold:hover { filter: brightness(0.93); }

.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f9d9da; }

.btn-edit { background: var(--navy-soft); color: var(--navy); }
.btn-edit:hover { background: #dde6f8; }

/* ===================== FORMS ===================== */

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: bold; margin-bottom: 5px; }

.form-control, select.form-control, textarea.form-control {
    width: 100%;
    background: #FAFBFD;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--navy); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.search-bar {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
}
.search-bar .form-control { max-width: 320px; }

/* ===================== TABLES ===================== */

.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data-table th {
    background: var(--navy-soft);
    color: var(--navy);
    text-align: left;
    padding: 11px 12px;
    font-size: 11.5px;
    font-weight: bold;
    white-space: nowrap;
}
table.data-table th:first-child { border-radius: 8px 0 0 0; }
table.data-table th:last-child { border-radius: 0 8px 0 0; }
table.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data-table tr:hover td { background: #FBFCFE; }

.photo-thumb {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--border);
}
.photo-frame {
    width: 90px; height: 90px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--border);
    background: #F4F6FA;
}

/* ===================== BADGES ===================== */

.badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
}
.badge-active, .badge-present { background: var(--success-bg); color: var(--success); }
.badge-inactive, .badge-absent { background: var(--danger-bg); color: var(--danger); }
.badge-late { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--navy-soft); color: var(--navy); }

/* ===================== ALERTS / FLASH ===================== */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: #92660b; }

/* ===================== TABS ===================== */

.tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.tab-link {
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--navy-soft);
    color: var(--navy);
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
}
.tab-link.active { background: var(--navy); color: white; }

/* ===================== LIST PAGES ON PHONES ===================== */
/* Reusable pattern for any list page (Students, Teachers, Classes, Fees...):
     1. <div class="page-header page-header--actions"> ... <div class="spacer"></div> buttons </div>
     2. <div class="section-card list-card"> wrapping the table
     3. <table class="data-table stack-mobile"> and on each <td> a data-label="..." plus, where it fits:
          m-photo   the picture, top-left of the card
          m-title   the main name, next to the picture
          m-sub     a small line under the name
          m-badge   a status badge, top-right of the card
          m-actions the row of buttons along the bottom
     On desktop none of this changes anything; the normal table stays. */

.page-header--actions { display: flex; align-items: center; gap: 8px; }
.page-header--actions .spacer { flex: 1; }
.search-bar .search-select { max-width: 200px; }

@media (max-width: 768px) {

    /* Page title on its own line, action buttons share the next one */
    .page-header--actions { flex-wrap: wrap; }
    .page-header--actions > div:first-child { flex: 1 1 100%; margin-bottom: 6px; }
    .page-header--actions .spacer { display: none; }
    .page-header--actions .btn { flex: 1 1 0; justify-content: center; padding: 11px 12px; }

    /* Search bar: fields full width; 16px text stops iPhones zooming in on focus */
    .search-bar { gap: 10px; }
    .search-bar .form-control { max-width: none; flex: 1 1 100%; font-size: 16px; }
    .search-bar .btn { padding: 11px 22px; }

    /* The rows become the cards, so drop the big white box around them */
    .section-card.list-card { padding: 0; background: transparent; border: 0; box-shadow: none; }
    .list-card .table-wrap { overflow: visible; }

    /* Table -> stack of cards. The header row stays for screen readers but is invisible. */
    table.data-table.stack-mobile thead {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip: rect(0 0 0 0); white-space: nowrap;
    }
    table.data-table.stack-mobile,
    table.data-table.stack-mobile tbody { display: block; width: 100%; }

    table.data-table.stack-mobile tr {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr) auto;
        column-gap: 12px;
        padding: 14px;
        margin-bottom: 12px;
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 1px 6px rgba(20, 33, 61, 0.05);
    }

    /* Every cell: label on the left, value on the right */
    table.data-table.stack-mobile td {
        grid-column: 1 / -1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        min-width: 0;
        padding: 7px 0;
        border: 0;
        text-align: right;
        font-size: 13px;
    }
    table.data-table.stack-mobile td::before {
        content: attr(data-label);
        flex-shrink: 0;
        color: var(--text-muted);
        font-size: 11.5px;
        font-weight: 700;
        text-align: left;
    }
    table.data-table.stack-mobile tr:hover td { background: transparent; }

    /* Card header: picture | name + small line | badge */
    table.data-table.stack-mobile td.m-photo { grid-column: 1; grid-row: 1 / span 2; padding: 0; justify-content: flex-start; }
    table.data-table.stack-mobile td.m-title { grid-column: 2; grid-row: 1; padding: 0; align-self: end; justify-content: flex-start; text-align: left; font-size: 15px; font-weight: 700; }
    table.data-table.stack-mobile td.m-sub   { grid-column: 2; grid-row: 2; padding: 2px 0 0; align-self: start; justify-content: flex-start; text-align: left; font-size: 12px; color: var(--text-muted); }
    table.data-table.stack-mobile td.m-badge { grid-column: 3; grid-row: 1; padding: 0; align-self: start; }

    table.data-table.stack-mobile td.m-photo::before,
    table.data-table.stack-mobile td.m-title::before,
    table.data-table.stack-mobile td.m-sub::before,
    table.data-table.stack-mobile td.m-badge::before,
    table.data-table.stack-mobile td.m-actions::before,
    table.data-table.stack-mobile td.m-empty::before { content: none; }

    table.data-table.stack-mobile .photo-thumb { width: 48px; height: 48px; }

    /* Buttons along the bottom of the card */
    table.data-table.stack-mobile td.m-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
        margin-top: 8px;
        padding: 12px 0 0;
        border-top: 1px solid var(--border);
    }
    table.data-table.stack-mobile td.m-actions .btn { flex: 1 1 auto; justify-content: center; }

    table.data-table.stack-mobile td.m-empty { justify-content: center; text-align: center; color: var(--text-muted); }
}

/* ===================== INLINE FORMS ("Add new ..." bars) ===================== */
/* A row of fields plus a button that becomes one full-width column on phones:
     <div class="inline-form">
         <div class="form-group"><label class="form-label">..</label><input class="form-control field-md"></div>
         ...
         <button class="btn btn-primary">..</button>
     </div>
   Field widths on desktop: field-sm 140px, field-130, field-150, field-160, field-170, field-190, field-md 200px, field-lg 220px, field-260.
   Keep these width rules ABOVE the phone @media block below, or they will beat its width:100%. */

.inline-form { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .form-group { margin-bottom: 0; }
.inline-form .field-sm { width: 140px; }
.inline-form .field-md { width: 200px; }
.inline-form .field-lg { width: 220px; }
.inline-form .field-160 { width: 160px; }
.inline-form .field-190 { width: 190px; }
.inline-form .field-130 { width: 130px; }
.inline-form .field-260 { width: 260px; }
.inline-form .field-150 { width: 150px; }
.inline-form .field-170 { width: 170px; }

@media (max-width: 768px) {
    .inline-form { flex-direction: column; align-items: stretch; }
    .inline-form .form-group { width: 100%; }
    .inline-form .form-control { width: 100%; font-size: 16px; }
    .inline-form .btn { width: 100%; justify-content: center; padding: 12px 18px; }

    /* Cards: hide a labelled line when its value is blank (e.g. a class with no section) */
    table.data-table.stack-mobile td:empty { display: none; }

    /* Cards with no picture (Classes etc.): add class "stack-mobile--plain" to the table.
       Put m-title on the main cell; it gets the whole top line. */
    table.data-table.stack-mobile.stack-mobile--plain tr { grid-template-columns: minmax(0, 1fr); }
    table.data-table.stack-mobile.stack-mobile--plain td.m-title {
        grid-column: 1; grid-row: auto; padding: 0 0 6px; font-size: 16px;
    }

    /* Optional: show the card title as a bright pill (add class "m-title--pill" to the title cell).
       To change the colour, edit the two hex values in the gradient. */
    table.data-table.stack-mobile td.m-title.m-title--pill {
        justify-self: start;          /* shrink to the text instead of stretching across the card */
        padding: 5px 14px;
        margin-bottom: 8px;
        font-size: 15px;
        letter-spacing: 0.2px;
        color: #fff;
        background: linear-gradient(135deg, #2EAE6B, #1D8A52);
        border-radius: 999px;
    }
}

/* ===================== TWO-COLUMN GRIDS, CHECKLISTS, STACKED FORMS ===================== */
/* <div class="grid-2">                       two equal cards side by side
   <div class="grid-2 grid-2--wide-right">    left card 1fr, right card 1.3fr
   Both become a single column on phones.
   <div class="check-list"><label class="check-item"><input type="checkbox"> ...</label></div>
                                              scrolling box of checkboxes, bigger tap targets on phones
   <form class="stack-form">                  fields already stacked; on phones buttons go full width */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.grid-2--wide-right { grid-template-columns: 1fr 1.3fr; }
.grid-2 > * { min-width: 0; }                 /* lets cards shrink instead of pushing the page sideways */
.grid-2 > .section-card { margin-bottom: 0; }

.check-list {
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
}
.check-item { display: block; font-size: 13px; padding: 3px 0; }

@media (max-width: 768px) {
    .grid-2,
    .grid-2--wide-right { grid-template-columns: 1fr; }

    .check-list { max-height: 240px; }
    .check-item { font-size: 14px; padding: 8px 0; }
    .check-item input { width: 18px; height: 18px; margin: 0 8px 0 0; vertical-align: middle; }

    .stack-form .form-control { font-size: 16px; }
    .stack-form .btn { width: 100%; justify-content: center; padding: 12px 18px; }
    .stack-form .btn + .btn { margin-top: 10px; }
}

/* ===================== FORM FIELDS INSIDE TABLES (Attendance etc.) ===================== */
/* Table whose cells hold inputs/selects. On phones each row becomes a card with the fields stacked:
     <table class="data-table stack-mobile stack-mobile--form">
     <td class="m-title" data-label="..">        the row's name, full width on top
     <td class="m-field m-half" data-label="..">  a field with its label above; m-half = two fields per line
     <td class="m-field" data-label="..">         a field on its own full-width line
   Widths: .form-control.w-90 / w-110 / w-150 / w-160 apply on desktop only; on phones fields fill the card.
   <div class="fee-row"> keeps "GHS" + amount + status on one line.
   <div class="save-bar"> holds the Save button; on phones it sticks to the bottom of the screen.
   Add "section-card--tight" to the card to use less padding on phones. */

.form-control.w-90  { width: 90px; }
.form-control.w-110 { width: 110px; }
.form-control.w-150 { width: 150px; }
.form-control.w-160 { width: 160px; }

.fee-row { display: flex; gap: 8px; align-items: center; }
.fee-row .fee-prefix { font-size: 12.5px; color: var(--text-muted); flex-shrink: 0; }

.save-bar { margin-top: 14px; text-align: right; }

@media (max-width: 768px) {
    .section-card--tight { padding: 12px; }

    /* Fields inside cards: full width, big enough to tap, 16px so iPhones don't zoom */
    table.data-table.stack-mobile .form-control { width: 100%; font-size: 16px; min-height: 44px; }
    table.data-table.stack-mobile .fee-row .form-control { width: auto; flex: 1 1 0; min-width: 0; }

    table.data-table.stack-mobile.stack-mobile--form tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    table.data-table.stack-mobile.stack-mobile--form td.m-title {
        grid-column: 1 / -1; grid-row: auto; padding: 0 0 8px; font-size: 15px;
    }
    table.data-table.stack-mobile td.m-field {
        flex-direction: column; align-items: stretch; justify-content: flex-start;
        gap: 5px; text-align: left;
    }
    table.data-table.stack-mobile.stack-mobile--form td.m-half { grid-column: auto; }

    /* Save button stays reachable at the bottom of the screen */
    .section-card--tight .save-bar {
        position: sticky; bottom: 0; z-index: 5;
        margin: 14px -12px -12px; padding: 12px;
        text-align: center;
        background: #fff;
        border-top: 1px solid var(--border);
        border-radius: 0 0 12px 12px;
    }
    .save-bar .btn { width: 100%; justify-content: center; padding: 13px 18px; font-size: 14px; }

    /* ---- Colour cues so a teacher can read the list at a glance ---- */

    /* Card edge and status dropdown follow the chosen status */
    table.data-table.stack-mobile.stack-mobile--form tr[data-status="Present"] { border-left: 5px solid #2EAE6B; }
    table.data-table.stack-mobile.stack-mobile--form tr[data-status="Absent"]  { border-left: 5px solid #D64550; }
    table.data-table.stack-mobile.stack-mobile--form tr[data-status="Late"]    { border-left: 5px solid #E0A53B; }

    .form-control.status-select[data-value="Present"] { background: #E3F6EA; border-color: #9AD6B2; color: #1D7A46; font-weight: 700; }
    .form-control.status-select[data-value="Absent"]  { background: #FCEAEA; border-color: #F0B4B8; color: #B3303B; font-weight: 700; }
    .form-control.status-select[data-value="Late"]    { background: #FCF1DE; border-color: #EBCB8B; color: #92660B; font-weight: 700; }

    /* Student name sits on a soft navy bar */
    table.data-table.stack-mobile.stack-mobile--form td.m-title {
        padding: 9px 12px; margin-bottom: 8px;
        color: var(--navy); background: var(--navy-soft); border-radius: 8px;
    }

    /* The two fees get two different tints so they are never mixed up */
    table.data-table.stack-mobile td.m-fee { padding: 9px 10px 10px; margin-top: 6px; border-radius: 8px; }
    table.data-table.stack-mobile td.m-fee--canteen { background: #FFF7E6; }
    table.data-table.stack-mobile td.m-fee--canteen::before { color: #9A6B00; }
    table.data-table.stack-mobile td.m-fee--extra { background: #EEF3FF; }
    table.data-table.stack-mobile td.m-fee--extra::before { color: #2E4FA8; }

    /* "Paid" turns green */
    .form-control.canteen-status[data-value="Paid"],
    .form-control.extra-class-status[data-value="Paid"] { background: #E3F6EA; border-color: #9AD6B2; color: #1D7A46; font-weight: 700; }
}

/* ---- Attendance colour cues on desktop (same colours as the phone cards) ---- */
@media (min-width: 769px) {
    table.data-table.stack-mobile--form tr[data-status="Present"] td:first-child { box-shadow: inset 4px 0 0 #2EAE6B; }
    table.data-table.stack-mobile--form tr[data-status="Absent"]  td:first-child { box-shadow: inset 4px 0 0 #D64550; }
    table.data-table.stack-mobile--form tr[data-status="Late"]    td:first-child { box-shadow: inset 4px 0 0 #E0A53B; }

    .form-control.status-select[data-value="Present"] { background: #E3F6EA; border-color: #9AD6B2; color: #1D7A46; font-weight: 700; }
    .form-control.status-select[data-value="Absent"]  { background: #FCEAEA; border-color: #F0B4B8; color: #B3303B; font-weight: 700; }
    .form-control.status-select[data-value="Late"]    { background: #FCF1DE; border-color: #EBCB8B; color: #92660B; font-weight: 700; }

    table.data-table.stack-mobile--form tr td.m-fee--canteen { background: #FFF7E6; }
    table.data-table.stack-mobile--form tr td.m-fee--extra   { background: #EEF3FF; }

    .form-control.canteen-status[data-value="Paid"],
    .form-control.extra-class-status[data-value="Paid"] { background: #E3F6EA; border-color: #9AD6B2; color: #1D7A46; font-weight: 700; }
}

/* ===================== CARD ACTION BUTTONS IN A GRID ===================== */
/* Add "m-actions--grid" next to "m-actions" on the actions cell to get two buttons per line on phones.
   A delete <form> holding a button can carry class "form-as-inline" so it sits inline on desktop. */

.form-as-inline { display: inline; }

@media (max-width: 768px) {
    table.data-table.stack-mobile td.m-actions.m-actions--grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    table.data-table.stack-mobile td.m-actions--grid .btn { width: 100%; justify-content: center; }
    table.data-table.stack-mobile td.m-actions--grid .form-as-inline { display: block; }
}

/* ===================== SCORE ENTRY ===================== */
/* <table class="data-table stack-mobile stack-mobile--form score-table">
   Exam columns: td.m-score.m-score--ca (amber) / td.m-score.m-score--exam (blue); live results: td.m-stat.
   JavaScript sets data-band + --gc on each row (green for the top grade down to red) as scores are typed. */

.score-table th.th-ca   { background: #FFF3DC; color: #A86A0F; }
.score-table th.th-exam { background: #E6EEFF; color: #2563C9; }
.score-table th.th-stat { background: #E3F6EA; color: #1D8A52; }
.score-table td.final-score { font-weight: 700; }

@media (min-width: 769px) {
    .score-table td.m-score--ca   { background: #FFFBF2; }
    .score-table td.m-score--exam { background: #F5F8FF; }
    .score-table tr[data-band] td:first-child { box-shadow: inset 4px 0 0 var(--gc); }
}

@media (max-width: 768px) {
    table.data-table.stack-mobile.score-table tr[data-band] { border-left: 5px solid var(--gc); }

    table.data-table.stack-mobile td.m-score { padding: 9px 10px 10px; margin-top: 6px; border-radius: 8px; }
    table.data-table.stack-mobile td.m-score--ca { background: #FFF7E6; }
    table.data-table.stack-mobile td.m-score--ca::before { color: #9A6B00; }
    table.data-table.stack-mobile td.m-score--exam { background: #EEF3FF; }
    table.data-table.stack-mobile td.m-score--exam::before { color: #2E4FA8; }

    /* Final score and rank: read-only results, always start on their own line */
    table.data-table.stack-mobile td.m-stat {
        flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 3px;
        margin-top: 6px; padding: 9px 10px; text-align: left;
        font-size: 18px; font-weight: 700; color: var(--navy);
        background: #F4F6FA; border-radius: 8px;
    }
    table.data-table.stack-mobile.stack-mobile--form td.m-stat.final-score { grid-column: 1; }
}

/* ===================== PRINTABLE (report cards / receipts) ===================== */

.print-page {
    background: white;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
}
.print-actions { max-width: 800px; margin: 0 auto 16px; display: flex; justify-content: flex-end; gap: 10px; }

@media print {
    .sidebar, .topbar, .print-actions, .no-print { display: none !important; }
    .content { margin: 0; padding: 0; }
    .print-page { border: none; box-shadow: none; max-width: 100%; }
    body { background: white; }
}
