/* =====================================================
   IDC Subject Scheduling System
   Palette: chalkboard green, ivory paper, brass accent
   ===================================================== */
:root {
    --green-900: #143D2B;
    --green-700: #1F5C45;
    --green-100: #E4EEE8;
    --brass:     #B98A2F;
    --ink:       #22271F;
    --paper:     #F6F5F0;
    --white:     #FFFFFF;
    --line:      #D8D6CC;
    --danger:    #A33B2E;
    --danger-bg: #F6E4E1;
    --ok-bg:     #E1EFE4;
    --radius:    6px;
    --serif:     Georgia, 'Times New Roman', serif;
    --sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Teacher grade entry: compact period fields and review-first AI copilot */
.grade-ai-panel {
    margin: 18px 0;
    overflow: hidden;
    border: 1px solid #cddbd3;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5faf7 0%, #fffdf8 100%);
}

.grade-ai-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 17px 18px 14px;
}

.grade-ai-heading h3 {
    margin: 3px 0 5px;
    color: var(--green-900);
    font-size: 16px;
}

.grade-ai-heading p {
    max-width: 760px;
    margin: 0;
    color: #637067;
    font-size: 12.5px;
    line-height: 1.55;
}

.grade-ai-kicker {
    color: var(--green-700);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.grade-ai-badge {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    color: #285a42;
    background: #dfefe6;
    font-size: 10px;
    font-weight: 800;
}

.grade-ai-badge[data-state="working"] {
    color: #705311;
    background: #f5e9c7;
}

.grade-ai-badge[data-state="warning"] {
    color: #7a3026;
    background: #f5dfdc;
}

.grade-ai-panel details {
    border-top: 1px solid #dfe8e2;
}

.grade-ai-panel summary {
    padding: 11px 18px;
    color: var(--green-700);
    background: rgba(255, 255, 255, .62);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.grade-ai-body {
    padding: 16px 18px 18px;
    border-top: 1px solid #e6ece8;
    background: rgba(255, 255, 255, .72);
}

.grade-ai-body > label {
    display: block;
    margin-bottom: 6px;
    color: var(--green-900);
    font-size: 12px;
    font-weight: 700;
}

.grade-ai-body textarea {
    width: 100%;
    min-height: 88px;
    resize: vertical;
    padding: 10px 11px;
    border: 1px solid #cbd5cf;
    border-radius: 7px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
}

.grade-ai-body textarea:focus {
    outline: 2px solid rgba(31, 92, 69, .22);
    border-color: var(--green-700);
}

.grade-ai-privacy {
    margin: 7px 0 11px;
    color: #70776f;
    font-size: 10.5px;
    line-height: 1.45;
}

.grade-ai-result {
    margin-top: 15px;
    padding: 13px;
    border: 1px solid #d9e2dc;
    border-radius: 8px;
    background: #fff;
}

.grade-ai-result > p:first-child {
    margin: 0 0 8px;
    color: var(--green-900);
    font-size: 12.5px;
    font-weight: 700;
}

.grade-ai-result ul {
    margin: 8px 0 12px;
    padding-left: 20px;
    color: #7a4b21;
    font-size: 11.5px;
    line-height: 1.5;
}

.grade-ai-preview-wrap {
    max-height: 250px;
    margin: 10px 0 13px;
    overflow: auto;
    border: 1px solid #ecece7;
    border-radius: 6px;
}

.grade-period-input {
    width: 82px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;
    font: inherit;
    font-size: 13px;
}

.grade-period-input:focus {
    outline: 2px solid rgba(31, 92, 69, .2);
    border-color: var(--green-700);
}

.grade-period-input.is-ai-draft {
    border-color: #b98a2f;
    background: #fff8e7;
    box-shadow: 0 0 0 2px rgba(185, 138, 47, .14);
}

.grade-final-remark {
    min-width: 70px;
    font-size: 12px;
    font-weight: 650;
}

@media (max-width: 700px) {
    .grade-ai-heading {
        display: grid;
    }

    .grade-ai-badge {
        justify-self: start;
    }
}

/* Notes & Reports: private AI observations requiring human review */
.ai-review-card {
    border-top: 3px solid var(--green-700);
}

.ai-review-card .card-head > div {
    min-width: 0;
}

.ai-review-card .card-head .hint {
    margin: 4px 0 0;
}

.ai-review-list {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.ai-review-item {
    padding: 15px 17px;
    border: 1px solid #dfe6e2;
    border-left: 4px solid #b88b35;
    border-radius: 10px;
    background: #fff;
}

.ai-review-item.severity-high {
    border-left-color: #b54238;
    background: #fffdfc;
}

.ai-review-meta,
.ai-review-student,
.ai-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.ai-review-meta {
    color: #6e756f;
    font-size: 11px;
}

.ai-review-meta strong {
    color: #26372f;
}

.ai-review-severity,
.ai-review-status {
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .4px;
    text-transform: uppercase;
}

.ai-review-severity {
    color: #725119;
    background: #f8edcf;
}

.severity-high .ai-review-severity {
    color: #8e2d27;
    background: #f8deda;
}

.ai-review-status {
    margin-left: auto;
    color: #225b42;
    background: #e2f0e8;
}

.ai-review-status.status-dismissed {
    color: #666d68;
    background: #ecefed;
}

.ai-review-student {
    justify-content: space-between;
    margin-top: 12px;
    color: #69716c;
    font-size: 11px;
}

.ai-review-student > div {
    display: grid;
}

.ai-review-student strong {
    color: #183d2c;
    font-size: 13px;
}

.ai-review-summary {
    margin: 13px 0 8px;
    color: #26342e;
    font-size: 13px;
    line-height: 1.55;
}

.ai-review-item blockquote {
    margin: 0;
    padding: 9px 11px;
    border-left: 3px solid #ccd9d2;
    color: #57625c;
    background: #f7f9f8;
    font-size: 11px;
    line-height: 1.55;
}

.ai-review-actions {
    justify-content: flex-end;
    margin-top: 12px;
}

@media (max-width: 700px) {
    .ai-review-status {
        margin-left: 0;
    }
    .ai-review-student {
        align-items: flex-start;
        flex-direction: column;
    }
    .ai-review-actions {
        justify-content: flex-start;
    }
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: var(--sans);
    font-size: 15px;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .6em; }
code { background: var(--green-100); padding: 1px 5px; border-radius: 3px; }

/* ---------- Top bar ---------- */
.topbar {
    background: var(--green-900);
    color: var(--white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 28px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,.22));
}
.brand-seal {
    width: 44px; height: 44px;
    border: 2px solid var(--brass);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif);
    font-weight: bold; letter-spacing: 1px;
    color: var(--brass);
}
.brand-name { font-family: var(--serif); font-size: 17px; letter-spacing: .5px; }
.brand-sub  { font-size: 12px; opacity: .75; letter-spacing: 1.5px; text-transform: uppercase; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; }

/* ---------- Navigation ---------- */
.mainnav {
    background: var(--green-700);
    padding: 0 28px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}
.mainnav a {
    color: #DCE9E1;
    text-decoration: none;
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
}
.mainnav a:hover { background: rgba(255,255,255,.08); }
.mainnav a.active {
    color: var(--white);
    border-bottom-color: var(--brass);
    font-weight: 600;
}
@media (max-width: 1200px) {
    .mainnav {
        flex-wrap: wrap;
        overflow-x: visible;
        padding: 0 16px;
    }
    .mainnav a { padding: 10px 11px; font-size: 13px; }
}

/* ---------- Layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 28px; }
.page-title {
    font-family: var(--serif);
    font-size: 26px;
    color: var(--green-900);
    border-bottom: 2px solid var(--brass);
    display: inline-block;
    padding-bottom: 6px;
    margin-bottom: 24px;
}
.pagefoot {
    text-align: center;
    font-size: 12px;
    color: #7B7F74;
    padding: 26px 0 34px;
}
.layout-2col { display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start; }
.layout-wide-right { grid-template-columns: 360px 1fr; }
@media (max-width: 900px) { .layout-2col { grid-template-columns: 1fr; } }

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 22px;
}
.card h2 { font-size: 16px; color: var(--green-900); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.empty { color: #6E7268; font-style: italic; }
.steps { line-height: 1.9; padding-left: 20px; }
.hint { font-size: 12.5px; color: #6E7268; margin-top: 10px; }

/* ---------- Stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-top: 3px solid var(--green-700);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.stat-number { font-family: var(--serif); font-size: 30px; color: var(--green-900); }
.stat-label  { font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; color: #6E7268; }

/* ---------- Weekly AI credit budget ---------- */
.ai-credit-card {
    position: relative;
    overflow: hidden;
    border-color: #cbdad1;
    background:
        radial-gradient(circle at 100% 0, rgba(185, 138, 47, .13), transparent 36%),
        var(--white);
}

.ai-credit-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--green-700);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ai-credit-state {
    padding: 5px 9px;
    border-radius: 999px;
    color: #24583d;
    background: #dfeee5;
    font-size: 10px;
    font-weight: 800;
}

.ai-credit-state.is-exhausted {
    color: #7a3026;
    background: #f5dfdc;
}

.ai-credit-summary {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: end;
    margin-top: 17px;
}

.ai-credit-summary > div {
    display: grid;
    gap: 2px;
}

.ai-credit-summary > div strong {
    color: var(--green-900);
    font-family: var(--serif);
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1;
}

.ai-credit-summary > div span,
.ai-credit-summary p,
.ai-credit-summary small {
    color: #6e756f;
    font-size: 11px;
}

.ai-credit-summary p {
    margin: 0;
    text-align: right;
}

.ai-credit-summary small {
    display: block;
    margin-top: 3px;
}

.ai-credit-meter {
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8ece8;
}

.ai-credit-meter span {
    display: block;
    min-width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--green-700), var(--brass));
    transition: width .25s ease;
}

.ai-credit-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 13px;
    color: #6e756f;
    font-size: 10.5px;
}

.ai-credit-details strong {
    color: var(--ink);
    font-weight: 750;
}

.ai-credit-note {
    max-width: 900px;
    margin-bottom: 0;
}

@media (max-width: 620px) {
    .ai-credit-summary {
        display: grid;
        align-items: start;
    }

    .ai-credit-summary p {
        text-align: left;
    }
}

/* ---------- Forms ---------- */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--green-900); }
.field span em { font-weight: 400; color: #6E7268; }
.field input, .field select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 4px;
    font-size: 14px;
    background: var(--white);
    font-family: inherit;
}
.field input:focus, .field select:focus {
    outline: 2px solid var(--green-700);
    outline-offset: 1px;
    border-color: var(--green-700);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 9px 16px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.2;
}
.btn:focus-visible,
.mainnav a:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(185,138,47,.55);
    outline-offset: 2px;
}
.btn:disabled {
    cursor: wait;
    opacity: .62;
}
.btn-primary { background: var(--green-700); color: var(--white); }
.btn-primary:hover { background: var(--green-900); }
.btn-ghost { background: transparent; color: var(--green-700); border-color: var(--green-700); }
.btn-ghost:hover { background: var(--green-100); }
.topbar .btn-ghost { color: #DCE9E1; border-color: rgba(255,255,255,.4); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.1); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-small { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
    text-align: left;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #6E7268;
    border-bottom: 2px solid var(--line);
    padding: 8px 10px;
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid #ECEAE2; vertical-align: middle; }
.data-table tr:hover td { background: #FAF9F5; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions form { display: inline; }
.inline { display: inline; }
.nowrap { white-space: nowrap; }

/* ---------- Alerts ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 14px;
    line-height: 1.55;
}
.alert-success { background: var(--ok-bg); border: 1px solid #9DBFA6; color: #1E4A2C; }
.alert-error   { background: var(--danger-bg); border: 1px solid #D3A198; color: #6E2318; }
.dashboard-health-alert a { color: inherit; font-weight: 700; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        linear-gradient(rgba(20,61,43,.92), rgba(20,61,43,.92)),
        repeating-linear-gradient(45deg, #16452F 0 12px, #143D2B 12px 24px);
    padding: 20px;
}
.login-card {
    background: var(--white);
    border-radius: 8px;
    border-top: 5px solid var(--brass);
    padding: 36px 34px 28px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.login-seal {
    width: 58px; height: 58px;
    margin: 0 auto 12px;
    border: 2px solid var(--brass);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif);
    font-weight: bold;
    color: var(--green-900);
    letter-spacing: 1px;
}
.login-logo {
    display: block;
    width: 92px;
    height: 92px;
    object-fit: contain;
    margin: 0 auto 12px;
    filter: drop-shadow(0 5px 10px rgba(20,61,43,.18));
}
.login-school { font-family: var(--serif); font-size: 19px; color: var(--green-900); margin-bottom: 2px; }
.login-address { font-size: 13px; color: #6E7268; margin: 0; }
.login-rule { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.login-title { font-size: 15px; color: var(--green-900); margin-bottom: 16px; }
.login-card form { text-align: left; }
.login-hint { font-size: 12.5px; color: #6E7268; margin-top: 16px; }

@media (max-width: 720px) {
    .topbar {
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
        flex-wrap: wrap;
    }
    .brand { gap: 10px; }
    .brand-logo { width: 44px; height: 44px; flex-basis: 44px; }
    .brand-name { font-size: 15px; }
    .brand-sub { font-size: 10px; letter-spacing: 1px; }
    .topbar-user {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }
    .mainnav { padding: 0 12px; }
    .mainnav a { padding: 11px 12px; }
    .page { padding: 20px 14px; }
    .card { padding: 17px 16px; overflow-x: auto; }
    .field-row { grid-template-columns: 1fr; }
    .form-actions { flex-wrap: wrap; }
    .data-table { min-width: 640px; }
}

/* ---------- AI report ---------- */
.ai-report { list-style: none; padding: 0; margin: 0; }
.ai-report li {
    padding: 9px 12px 9px 34px;
    border-radius: 4px;
    margin-bottom: 7px;
    font-size: 13.5px;
    position: relative;
    line-height: 1.5;
}
.ai-report li::before { position: absolute; left: 12px; font-weight: bold; }
.ai-ok   { background: var(--ok-bg); }
.ai-ok::before   { content: '✓'; color: #1E4A2C; }
.ai-warn { background: #F7EFDD; }
.ai-warn::before { content: '!'; color: var(--brass); }
.ai-err  { background: var(--danger-bg); }
.ai-err::before  { content: '✕'; color: var(--danger); }

/* =====================================================
   PRINTABLE SCHEDULE SHEET (matches the official form)
   ===================================================== */
.print-page { background: #DDDBD2; }
.print-toolbar {
    max-width: 900px;
    margin: 18px auto 0;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
}
.print-sheet {
    background: var(--white);
    max-width: 900px;
    margin: 14px auto 40px;
    padding: 36px 40px 44px;
    box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.portal-report-print .print-toolbar,
.portal-report-print .print-sheet {
    max-width: 1240px;
}
.portal-report-print .print-sheet {
    min-height: 790px;
    padding: 28px 34px 36px;
}
.portal-report-print .sheet-head {
    margin-bottom: 13px;
}
.portal-report-print .sheet-logo {
    width: 62px;
    height: 62px;
    margin-bottom: 5px;
}
.portal-report-print .sheet-school { font-size: 25px; }
.portal-report-print .sheet-doc { margin-top: 6px; }
.portal-report-print .sheet-subjects { margin-top: 16px; }
.portal-report-print .sheet-subjects h3 { margin: 0 0 8px; }
.portal-report-print .timetable th,
.portal-report-print .timetable td { height: 17px; }
.portal-report-print .timetable thead th { height: 22px; }
.sheet-head { text-align: center; margin-bottom: 18px; }
.sheet-logo {
    display: block;
    width: 78px;
    height: 78px;
    object-fit: contain;
    margin: 0 auto 8px;
}
.sheet-school {
    font-family: var(--serif);
    font-size: 27px;
    letter-spacing: .5px;
    margin: 0;
    color: #000;
}
.sheet-address { margin: 3px 0 0; font-size: 14px; }
.sheet-doc {
    margin: 10px 0 0;
    font-size: 12px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: var(--green-900);
}
.sheet-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 30px;
    border: 1.5px solid #000;
    border-bottom: none;
    padding: 10px 14px;
    font-size: 13.5px;
}
.meta-label { font-weight: 700; }
.meta-value { border-bottom: 1px solid #999; padding: 0 8px; }

/* --- The timetable grid --- */
.timetable {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11.5px;
}
.timetable th, .timetable td {
    border: 1px solid #000;
    padding: 0 4px;
    height: 22px;
    text-align: center;
    overflow: hidden;
}
.timetable thead th {
    font-size: 12.5px;
    font-weight: 700;
    height: 26px;
    background: #F2F1EA;
}
.timetable .time-col {
    width: 76px;
    font-size: 11px;
    text-align: right;
    padding-right: 7px;
    border-left: none;
    border-top: none;
    border-bottom: none;
    background: transparent;
    font-variant-numeric: tabular-nums;
}
.timetable thead .time-col { border: none; background: transparent; }
.timetable td.tt-class {
    background: var(--green-100);
    vertical-align: middle;
    padding: 4px;
}
.tt-subject { display: block; font-weight: 700; font-size: 12px; }
.tt-name    { display: block; font-size: 10.5px; line-height: 1.25; }
.tt-meta    { display: block; font-size: 10.5px; font-weight: 600; margin-top: 2px; }
.tt-room    { display: block; font-size: 10px; color: #444; }

/* --- Subjects + signatures on the sheet --- */
.sheet-subjects { margin-top: 26px; }
.sheet-subjects h3 { font-size: 14px; color: var(--green-900); }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th, .mini-table td { border: 1px solid #444; padding: 6px 9px; text-align: left; }
.mini-table th { background: #F2F1EA; font-size: 12px; }

.sheet-signatures {
    display: flex;
    justify-content: space-between;
    gap: 60px;
    margin-top: 56px;
}
.sig { flex: 1; text-align: center; }
.sig-line { border-bottom: 1.5px solid #000; margin-bottom: 5px; height: 26px; }
.sig-name { font-weight: 700; font-size: 13.5px; }
.sig-role { font-size: 12px; color: #444; }

/* ---------- Print rules ---------- */
@media print {
    body, .print-page { background: var(--white); }
    .no-print { display: none !important; }
    .print-sheet {
        box-shadow: none;
        margin: 0;
        max-width: none;
        padding: 0;
    }
    .timetable td.tt-class {
        background: #E9EFEA !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .page-break { page-break-before: always; }
    @page { size: A4 portrait; margin: 12mm; }
    .portal-report-print .print-sheet {
        page: portal-academic-report;
        min-height: 0;
    }
    .portal-report-print .sheet-logo {
        width: 42px;
        height: 42px;
    }
    .portal-report-print .sheet-head { margin-bottom: 7px; }
    .portal-report-print .sheet-school { font-size: 20px; }
    .portal-report-print .sheet-address { margin-top: 1px; font-size: 10px; }
    .portal-report-print .sheet-doc { margin-top: 2px; font-size: 9px; }
    .portal-report-print .sheet-meta {
        gap: 3px 24px;
        padding: 5px 10px;
        font-size: 10.5px;
    }
    .portal-report-print .sheet-subjects { margin-top: 7px; }
    .portal-report-print .sheet-subjects h3 { margin-bottom: 4px; font-size: 11px; }
    .portal-report-print .sheet-subjects .empty { margin: 2px 0; font-size: 10px; }
    .portal-report-print .timetable { font-size: 8.5px; }
    .portal-report-print .timetable th,
    .portal-report-print .timetable td { height: 13px; padding: 0 2px; }
    .portal-report-print .timetable thead th { height: 17px; font-size: 9.5px; }
    .portal-report-print .timetable .time-col { width: 57px; padding-right: 4px; font-size: 8px; }
    .portal-report-print .timetable td.tt-class { padding: 1px; }
    .portal-report-print .tt-subject { font-size: 9px; }
    .portal-report-print .tt-name,
    .portal-report-print .tt-meta { font-size: 7.5px; line-height: 1.1; margin-top: 1px; }
    .portal-report-print .tt-room { font-size: 7px; line-height: 1.1; }
    @page portal-academic-report { size: A4 landscape; margin: 10mm; }
}

/* ---------- Schedule suggestions & locking ---------- */
.suggest-card { border-left: 4px solid var(--brass); }
.suggest-row { display: flex; flex-wrap: wrap; gap: 10px; }
.suggest-slot {
    border-color: var(--brass);
    color: var(--green-900);
    font-weight: 600;
}
.suggest-slot:hover { background: #F7EFDD; }
.row-locked td { background: #F3F2EC; color: #6E7268; }
.row-locked:hover td { background: #F3F2EC; }

/* ---------- Course section dropdowns ---------- */
.course-groups {
    display: grid;
    gap: 14px;
}

.course-group {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.course-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 13px 15px;
    background: var(--green-100);
    color: var(--green-900);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
}

.course-toggle:hover {
    background: #D7E6DC;
}

.course-toggle-checkbox {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--green-700);
    cursor: pointer;
}

.course-toggle-icon {
    display: inline-block;
    font-size: 11px;
    transition: transform 0.2s ease;
}

.course-toggle-icon.is-open {
    transform: rotate(90deg);
}

.course-toggle-name {
    flex: 1;
    min-width: 0;
}

.course-toggle-count {
    flex-shrink: 0;
    padding: 4px 9px;
    border: 1px solid rgba(20, 61, 43, 0.18);
    border-radius: 999px;
    background: var(--white);
    color: var(--green-900);
    font-size: 11.5px;
    font-weight: 600;
}

.course-section-list {
    padding: 12px;
    background: var(--white);
}

.course-section-list[hidden] {
    display: none;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Prevent action buttons from wrapping badly */
.course-section-list .col-actions {
    min-width: 230px;
}

@media (max-width: 700px) {
    .course-toggle {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .course-toggle-name {
        flex: 1 1 60%;
    }

    .course-section-list {
        padding: 8px;
    }
}
