:root {
    --cem-blue: #2563eb;
    --cem-teal: #0f9f8f;
    --cem-bg: #edf5f7;
    --cem-panel: #f7fbfa;
    --cem-card: #ffffff;
    --cem-line: #d2dfdf;
    --cem-line-strong: #aec2c3;
    --cem-header: #edf7f5;
    --cem-ink: #0f172a;
    --cem-muted: #5e6f78;
    --cem-soft: #eef7f6;
    --cem-good: #16a34a;
    --cem-bad: #dc2626;
    --cem-warn: #f59e0b;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--cem-ink);
    font-family: Inter, Outfit, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(180deg, #0f766e 0 132px, transparent 132px),
        radial-gradient(circle at 22px 22px, rgba(15, 118, 110, 0.09) 2px, transparent 2px),
        var(--cem-bg);
    background-size: auto, 34px 34px, auto;
}

.cem-topbar,
.cem-shell {
    width: min(1540px, calc(100% - 24px));
    margin-inline: auto;
}

.cem-topbar {
    min-height: 84px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    color: #fff;
}

.cem-progress-wrap {
    width: min(1540px, calc(100% - 24px));
    margin: -4px auto 10px;
    padding: 9px 12px 10px;
    border: 1px solid rgba(174, 194, 195, 0.84);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

body.cem-progress-active .cem-progress-wrap {
    opacity: 1;
    transform: translateY(0);
}

.cem-progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    color: var(--cem-muted);
    font-size: 0.76rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cem-progress-meta strong {
    color: #0f766e;
}

.cem-progress-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #d7e8e6;
}

.cem-progress-track span {
    width: 0%;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, var(--cem-teal));
    box-shadow: 0 0 18px rgba(20, 184, 166, 0.5);
    transition: width 220ms ease;
}

.cem-brand,
.cem-top-actions,
.cem-back {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cem-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.16);
    font-size: 1.55rem;
}

.cem-brand p,
.cem-brand h1 {
    margin: 0;
}

.cem-brand p {
    max-width: min(64vw, 620px);
    overflow: hidden;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cem-brand h1 {
    font-size: 1.35rem;
    line-height: 1.1;
}

.cem-back,
.cem-year-chip,
.cem-icon-btn,
.cem-mobile-back,
.cem-action {
    min-height: 38px;
    border: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 900;
    text-decoration: none;
}

.cem-back,
.cem-year-chip {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    padding: 8px 12px;
}

.cem-shell {
    min-height: calc(100vh - 104px);
    margin-bottom: 120px;
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(300px, 380px) minmax(0, 1fr);
    border: 1px solid rgba(15, 23, 42, 0.18);
    border-radius: 10px;
    overflow: visible;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.cem-panel {
    min-width: 0;
    min-height: 0;
    background: var(--cem-panel);
}

.cem-directory,
.cem-exam-panel {
    height: calc(100vh - 104px);
    max-height: 820px;
    position: sticky;
    top: 10px;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    border-right: 1px solid var(--cem-line);
}

.cem-result-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 104px);
    overflow: visible;
    background:
        linear-gradient(rgba(247, 251, 250, 0.94), rgba(247, 251, 250, 0.94)),
        radial-gradient(circle at 16px 16px, rgba(15, 118, 110, 0.08) 2px, transparent 2px);
    background-size: auto, 32px 32px;
}

.cem-panel-head,
.cem-result-head {
    min-height: 72px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, #fbfdfc 0%, var(--cem-header) 100%);
    border-bottom: 1px solid var(--cem-line);
}

.cem-panel-head p,
.cem-panel-head h2,
.cem-result-head p,
.cem-result-head h2 {
    margin: 0;
}

.cem-panel-head p,
.cem-result-head p {
    color: var(--cem-muted);
    font-size: 0.74rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cem-panel-head h2,
.cem-result-head h2 {
    font-size: 1.05rem;
    line-height: 1.2;
}

.cem-result-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.cem-collapse-panel {
    margin: 12px;
    border: 1px solid var(--cem-line-strong);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.055);
}

.cem-collapse-head {
    width: 100%;
    min-height: 46px;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    color: var(--cem-ink);
    background: linear-gradient(180deg, #ffffff, #f2f8f7);
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 950;
    text-align: left;
}

.cem-collapse-head span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cem-collapse-head > i {
    color: var(--cem-teal);
    flex: 0 0 auto;
}

.cem-collapse-body {
    display: block;
}

.cem-collapse-body.is-collapsed {
    display: none;
}

.cem-action {
    cursor: pointer;
    color: #155e75;
    background: #fff;
    border: 1px solid #bfd4d5;
    padding: 8px 12px;
}

.cem-result-back {
    color: #0f766e;
    background: #d9f7ef;
    border-color: #a9e8dc;
}

.cem-icon-btn,
.cem-mobile-back {
    cursor: pointer;
    color: #0f766e;
    background: #d9f7ef;
    border: 1px solid #a9e8dc;
}

.cem-icon-btn {
    width: 38px;
    padding: 0;
}

.cem-mobile-back {
    display: none;
    padding: 0 12px;
}

.cem-search {
    margin: 10px 12px;
    min-height: 42px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: var(--cem-muted);
    background: #fff;
    border: 1px solid var(--cem-line-strong);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.03);
}

.cem-search input {
    width: 100%;
    min-height: 40px;
    border: 0;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--cem-ink);
    font: inherit;
    padding: 0;
}

.cem-class-list,
.cem-exam-list,
.cem-student-list {
    min-height: 0;
    overflow: auto;
    padding: 0 8px 12px;
}

.cem-collapse-body .cem-student-list {
    overflow: visible;
    padding: 0 8px 12px;
}

.cem-class-card,
.cem-exam-card,
.cem-student-card {
    width: 100%;
    margin: 8px 0;
    border: 1px solid var(--cem-line);
    border-left: 4px solid transparent;
    border-radius: 10px;
    background: var(--cem-card);
    color: inherit;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.035);
}

.cem-class-card:hover,
.cem-exam-card:hover,
.cem-student-card:hover {
    border-color: var(--cem-line-strong);
    background: #fbfefc;
}

.cem-class-card.is-active,
.cem-exam-card.is-active,
.cem-student-card.is-active {
    border-color: rgba(15, 159, 143, 0.56);
    border-left-color: var(--cem-teal);
    background: #effdfa;
    box-shadow: 0 10px 28px rgba(15, 159, 143, 0.13);
}

.cem-class-select,
.cem-section-btn,
.cem-exam-select,
.cem-student-main {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.cem-class-main,
.cem-student-main,
.cem-exam-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
}

.cem-class-name,
.cem-exam-name,
.cem-student-name {
    display: block;
    color: var(--cem-ink);
    font-weight: 950;
}

.cem-class-meta,
.cem-exam-meta,
.cem-student-meta {
    display: block;
    margin-top: 4px;
    color: var(--cem-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.cem-class-tools {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cem-count {
    min-width: 34px;
    min-height: 34px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    color: #0b4f48;
    background: #d8f3ec;
    font-weight: 950;
}

.cem-expand {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    color: #0f766e;
    background: #edf8f6;
    border: 1px solid #d6e9e6;
    cursor: pointer;
}

.cem-sections {
    display: none;
    padding: 0 10px 10px;
}

.cem-class-card.is-open .cem-sections {
    display: grid;
    gap: 8px;
}

.cem-section-btn {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fbfa;
    border: 1px solid #e0e9e7;
}

.cem-section-btn.is-active {
    color: #0f766e;
    background: #d9f7ef;
    border-color: #a9e8dc;
}

.cem-empty,
.cem-loading {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    padding: 24px;
    color: var(--cem-muted);
    text-align: center;
}

.cem-empty i,
.cem-loading i {
    color: #0f766e;
    font-size: 2rem;
}

.cem-empty h3,
.cem-empty p,
.cem-loading p {
    margin: 0;
}

.cem-empty-compact {
    min-height: 96px;
    margin: 0 12px 12px;
    border: 1px dashed #a9d8d4;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.72);
}

.cem-exam-picker {
    padding: 12px;
    background: linear-gradient(135deg, rgba(232, 246, 243, .88), rgba(238, 245, 255, .56));
}

.cem-picker-head,
.cem-marks-grid-head,
.cem-detail-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.cem-picker-head span,
.cem-marks-grid-head span,
.cem-detail-title span {
    display: block;
    color: var(--cem-muted);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cem-picker-head strong,
.cem-marks-grid-head strong {
    display: block;
    margin-top: 2px;
    color: var(--cem-ink);
    font-size: 1rem;
    font-weight: 950;
}

.cem-picker-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.cem-exam-chip-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
}

.cem-exam-chip {
    min-width: 0;
    min-height: 64px;
    border: 1px solid var(--cem-line);
    border-left: 4px solid #94a3b8;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.055);
}

.cem-exam-chip.pass { border-left-color: var(--cem-good); }
.cem-exam-chip.fail { border-left-color: var(--cem-bad); }
.cem-exam-chip.missing { border-left-color: var(--cem-warn); }

.cem-exam-chip.is-selected {
    border-color: var(--cem-teal);
    background: linear-gradient(135deg, #effdfa, #ffffff);
    box-shadow: 0 10px 24px rgba(15, 159, 143, 0.12);
}

.cem-exam-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cem-chip-box {
    width: 30px;
    height: 30px;
    border: 2px solid #8bcfc7;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #fff;
    background: #fff;
    flex: 0 0 30px;
}

.cem-exam-chip input:checked + .cem-chip-box {
    border-color: var(--cem-teal);
    background: var(--cem-teal);
}

.cem-chip-copy {
    min-width: 0;
}

.cem-chip-copy strong,
.cem-chip-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cem-chip-copy strong {
    color: var(--cem-ink);
    font-weight: 950;
}

.cem-chip-copy small {
    margin-top: 3px;
    color: var(--cem-muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.cem-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
}

.cem-summary-card {
    border: 1px solid var(--cem-line);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.cem-summary-card span {
    display: block;
    color: var(--cem-muted);
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cem-summary-card strong {
    display: block;
    margin-top: 6px;
    color: var(--cem-ink);
    font-size: 1.28rem;
    overflow-wrap: anywhere;
}

.cem-marks-grid {
    margin: 0;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: #fff;
    box-shadow: none;
}

.cem-marks-grid-head {
    margin: 0;
    padding: 12px 14px;
    border-bottom: 1px solid var(--cem-line);
    background: linear-gradient(180deg, #ffffff, #f2f8f7);
}

.cem-marks-grid-head small,
.cem-detail-title small {
    color: var(--cem-muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.cem-grid-scroll {
    max-height: 340px;
    overflow: auto;
    scrollbar-color: #86b7ad #eef6f4;
    scrollbar-width: thin;
}

.cem-grid-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.cem-grid-scroll::-webkit-scrollbar-track {
    background: #eef6f4;
}

.cem-grid-scroll::-webkit-scrollbar-thumb {
    border: 2px solid #eef6f4;
    border-radius: 999px;
    background: #86b7ad;
}

.cem-marks-table {
    width: 100%;
    min-width: 920px;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--cem-ink);
    font-size: 0.82rem;
}

.cem-marks-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 10px;
    color: #43545c;
    background: #eef5f3;
    font-size: 0.72rem;
    font-weight: 950;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.cem-marks-table td {
    border-top: 1px solid #e1e9e8;
    padding: 10px;
    vertical-align: top;
    font-weight: 850;
}

.cem-marks-table tbody tr.pass {
    background: linear-gradient(90deg, rgba(220, 252, 231, .5), #fff 34%);
}

.cem-marks-table tbody tr.fail {
    background: linear-gradient(90deg, rgba(254, 226, 226, .62), #fff 34%);
}

.cem-marks-table tbody tr.missing {
    background: linear-gradient(90deg, rgba(254, 243, 199, .62), #fff 34%);
}

.cem-marks-table td strong {
    display: block;
    font-size: 0.95rem;
}

.cem-marks-table td small {
    display: block;
    margin-top: 2px;
    color: var(--cem-muted);
    font-size: 0.72rem;
    font-weight: 850;
}

.cem-grid-big {
    color: #0f766e;
    font-size: 1rem;
    font-weight: 950;
}

.cem-grid-status {
    width: fit-content;
    display: inline-flex;
    margin-top: 5px;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.68rem;
    font-weight: 950;
}

.cem-grid-status.pass { color: #166534; background: #dcfce7; }
.cem-grid-status.fail { color: #991b1b; background: #fee2e2; }
.cem-grid-status.missing { color: #92400e; background: #fef3c7; }

.cem-subject-mark {
    display: grid;
    gap: 1px;
    min-width: 68px;
}

.cem-subject-mark b {
    color: var(--cem-ink);
    font-size: 0.98rem;
}

.cem-subject-mark small,
.cem-subject-mark em {
    color: var(--cem-muted);
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 850;
}

.cem-subject-mark.risk b {
    color: #dc2626;
}

.cem-subject-mark.ok b {
    color: #0f766e;
}

.cem-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
}

.cem-chart-card {
    min-height: 224px;
    border: 1px solid var(--cem-line);
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    min-width: 0;
    overflow: hidden;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.055);
}

.cem-card-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.cem-card-title span {
    color: var(--cem-ink);
    font-weight: 950;
}

.cem-card-title small {
    color: var(--cem-muted);
    font-weight: 800;
}

.cem-chart-card canvas {
    width: 100% !important;
    height: 164px !important;
}

.cem-student-search {
    margin-top: 0;
}

.cem-section-empty {
    padding: 8px 4px;
}

.cem-student-row {
    border-left-color: #14b8a6;
}

.cem-student-row:nth-child(even) {
    background: #f8fbfa;
}

.cem-student-row.boy {
    border-left-color: #2563eb;
    background: linear-gradient(90deg, rgba(37, 99, 235, .08), #fff 42%);
}

.cem-student-row.girl {
    border-left-color: #db2777;
    background: linear-gradient(90deg, rgba(219, 39, 119, .08), #fff 42%);
}

.cem-student-row.neutral {
    border-left-color: var(--cem-teal);
    background: linear-gradient(90deg, rgba(15, 159, 143, .09), #fff 42%);
}

.cem-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #075985;
    background: #dbeafe;
    font-weight: 950;
    text-transform: uppercase;
}

.cem-student-row.girl .cem-avatar {
    color: #9d174d;
    background: #fce7f3;
}

.cem-student-row.neutral .cem-avatar {
    color: #0f766e;
    background: #d9f7ef;
}

.cem-student-row-text,
.cem-exam-card-copy {
    min-width: 0;
    flex: 1;
}

.cem-student-card {
    position: relative;
    border-left-color: #94a3b8;
}

.cem-exam-marks-card {
    padding-left: 42px;
}

.cem-exam-marks-card.is-selected {
    border-color: var(--cem-teal);
    background: linear-gradient(90deg, rgba(217, 247, 239, .76), #fff 38%);
}

.cem-exam-selectbar {
    position: sticky;
    top: 0;
    z-index: 3;
    min-height: 46px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 -8px 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--cem-line);
    background: rgba(247, 251, 250, .96);
    backdrop-filter: blur(10px);
}

.cem-exam-selectbar span {
    margin-left: auto;
    color: var(--cem-muted);
    font-size: 0.78rem;
    font-weight: 900;
}

.cem-detail-title {
    margin: 0 0 8px;
    padding: 10px 6px 2px;
}

.cem-mini-action {
    min-height: 30px;
    border: 1px solid #bfd4d5;
    border-radius: 999px;
    padding: 5px 10px;
    color: #155e75;
    background: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 950;
    cursor: pointer;
}

.cem-exam-check {
    position: absolute;
    top: 14px;
    left: 12px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.cem-exam-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.cem-exam-check span {
    width: 22px;
    height: 22px;
    border: 2px solid #8bcfc7;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: #fff;
    box-shadow: 0 6px 16px rgba(15, 159, 143, .12);
}

.cem-exam-check span::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    opacity: 0;
    transform: rotate(-45deg) translate(1px, -1px);
}

.cem-exam-check input:checked + span {
    border-color: var(--cem-teal);
    background: var(--cem-teal);
}

.cem-exam-check input:checked + span::after {
    opacity: 1;
}

.cem-student-card.result-pass {
    border-left-color: var(--cem-good);
}

.cem-student-card.result-fail {
    border-left-color: var(--cem-bad);
}

.cem-student-card.result-missing {
    border-left-color: var(--cem-warn);
}

.cem-student-main {
    align-items: flex-start;
}

.cem-rank {
    min-width: 36px;
    height: 36px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #0b4f48;
    background: #d8f3ec;
    font-weight: 950;
}

.cem-score {
    text-align: right;
}

.cem-score strong {
    display: block;
    color: var(--cem-ink);
    font-size: 1rem;
}

.cem-score span {
    display: block;
    margin-top: 3px;
    color: var(--cem-muted);
    font-size: 0.76rem;
    font-weight: 850;
}

.cem-status {
    display: inline-flex;
    margin-top: 6px;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.72rem;
    font-weight: 950;
}

.cem-status.pass { color: #166534; background: #dcfce7; }
.cem-status.fail { color: #991b1b; background: #fee2e2; }
.cem-status.missing { color: #92400e; background: #fef3c7; }

.cem-subjects {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    padding: 0 12px 12px;
}

.cem-student-card.is-expanded .cem-subjects {
    display: grid;
}

.cem-exam-summary-line {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #b7d6d5;
    border-radius: 12px;
    background: #eef8f5;
    padding: 9px 10px;
    color: #115e59;
    font-size: 0.8rem;
    font-weight: 900;
}

.cem-subject-pill {
    border: 1px solid var(--cem-line);
    border-radius: 12px;
    background: #f8fbfa;
    padding: 9px;
}

.cem-subject-pill b {
    display: block;
    color: var(--cem-ink);
    font-size: 0.85rem;
}

.cem-subject-pill span {
    display: block;
    margin-top: 4px;
    color: var(--cem-muted);
    font-size: 0.76rem;
    font-weight: 850;
}

.cem-subject-pill.is-risk {
    border-color: #fed7aa;
    background: #fff7ed;
}

.cem-subject-pill.is-risk b {
    color: #9a3412;
}

@media (max-width: 1100px) {
    .cem-shell {
        grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
    }
    .cem-results {
        grid-column: 1 / -1;
        min-height: 520px;
    }
}

@media (max-width: 720px) {
    body {
        background:
            linear-gradient(180deg, #0f766e 0 160px, transparent 160px),
            var(--cem-bg);
    }
    .cem-topbar {
        width: calc(100% - 20px);
        min-height: 78px;
        align-items: flex-start;
        padding-top: 10px;
    }
    .cem-progress-wrap {
        width: calc(100% - 16px);
        margin: -2px auto 8px;
        border-radius: 14px;
        padding: 8px 10px;
    }
    .cem-progress-meta {
        font-size: 0.66rem;
    }
    .cem-brand-mark {
        width: 44px;
        height: 44px;
    }
    .cem-brand h1 {
        font-size: 1.12rem;
    }
    .cem-top-actions {
        display: grid;
        justify-items: end;
        gap: 6px;
    }
    .cem-back span,
    .cem-year-chip {
        font-size: 0.76rem;
    }
    .cem-shell {
        width: calc(100% - 16px);
        height: calc(100dvh - 94px);
        min-height: 0;
        display: block;
        border-radius: 18px;
    }
    .cem-sidebar,
    .cem-exams,
    .cem-results {
        height: 100%;
    }
    .cem-exams,
    .cem-results {
        display: none;
    }
    .cem-shell.show-exams .cem-sidebar,
    .cem-shell.show-results .cem-sidebar,
    .cem-shell.show-results .cem-exams {
        display: none;
    }
    .cem-shell.show-exams .cem-exams,
    .cem-shell.show-results .cem-results {
        display: block;
    }
    .cem-shell.show-results .cem-results {
        height: auto;
    }
    .cem-shell.show-results {
        height: auto;
        min-height: calc(100dvh - 94px);
        overflow: visible;
    }
    .cem-mobile-back {
        display: inline-flex;
    }
    .cem-directory,
    .cem-exam-panel,
    .cem-result-panel {
        border-right: 0;
    }
    .cem-result-panel {
        height: auto;
        min-height: calc(100dvh - 94px);
        overflow: visible;
    }
    .cem-result-head {
        position: sticky;
        top: 0;
        z-index: 8;
        min-height: 88px;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-content: start;
        padding: 12px 14px 8px;
    }
    .cem-result-head h2 {
        font-size: 1rem;
        line-height: 1.18;
    }
    .cem-result-actions {
        display: grid;
        grid-template-columns: 1.3fr 1fr 1fr;
        gap: 8px;
    }
    .cem-action {
        min-height: 40px;
        padding: 8px 10px;
        border-radius: 12px;
        font-size: 0.78rem;
    }
    .cem-exam-picker {
        padding: 10px;
    }
    .cem-picker-head,
    .cem-marks-grid-head {
        align-items: flex-start;
        flex-direction: column;
    }
    .cem-picker-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .cem-exam-chip-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .cem-exam-chip {
        min-height: 58px;
        border-radius: 14px;
        padding: 9px;
    }
    .cem-grid-scroll {
        max-height: none;
        overflow: visible;
    }
    .cem-marks-table {
        min-width: 0;
        display: block;
        font-size: 0.86rem;
    }
    .cem-marks-table thead {
        display: none;
    }
    .cem-marks-table tbody,
    .cem-marks-table tr,
    .cem-marks-table td {
        display: block;
        width: 100%;
    }
    .cem-marks-table tr {
        margin: 10px;
        width: calc(100% - 20px);
        border: 1px solid var(--cem-line);
        border-left: 5px solid var(--cem-teal);
        border-radius: 12px;
        overflow: hidden;
        background: #fff !important;
        box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
    }
    .cem-marks-table tr.fail {
        border-left-color: var(--cem-bad);
    }
    .cem-marks-table tr.missing {
        border-left-color: var(--cem-warn);
    }
    .cem-marks-table td {
        min-height: 42px;
        display: grid;
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        border-top: 1px solid #e7efed;
        padding: 9px 10px;
    }
    .cem-marks-table td:first-child {
        border-top: 0;
        background: #f8fbfa;
    }
    .cem-marks-table td::before {
        content: attr(data-label);
        color: var(--cem-muted);
        font-size: 0.68rem;
        font-weight: 950;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
    .cem-subject-mark {
        min-width: 0;
    }
    .cem-chart-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px 10px 10px;
    }
    .cem-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 8px 12px 10px;
    }
    .cem-summary-card {
        min-height: 66px;
        border-radius: 12px;
        padding: 9px 10px;
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    }
    .cem-summary-card span {
        font-size: 0.62rem;
        letter-spacing: 0.04em;
    }
    .cem-summary-card strong {
        margin-top: 4px;
        font-size: 0.98rem;
        line-height: 1.15;
    }
    .cem-chart-card {
        min-height: 178px;
        border-radius: 12px;
        padding: 10px;
    }
    .cem-chart-card canvas {
        height: 126px !important;
    }
    .cem-card-title {
        margin-bottom: 6px;
    }
    .cem-card-title span {
        font-size: 0.88rem;
    }
    .cem-card-title small {
        display: none;
    }
    .cem-student-main {
        gap: 8px;
    }
    .cem-score {
        min-width: 76px;
    }
    .cem-subjects {
        grid-template-columns: 1fr;
    }
    .cem-collapse-panel {
        margin: 10px;
        border-radius: 12px;
    }
    .cem-collapse-head {
        min-height: 42px;
        padding: 10px 12px;
        font-size: 0.84rem;
    }
    .cem-collapse-body .cem-student-list {
        overflow: visible;
        padding-bottom: 18px;
    }
}

@media print {
    .cem-topbar,
    .cem-sidebar,
    .cem-exams,
    .cem-result-actions,
    .cem-search {
        display: none !important;
    }
    body {
        background: #fff;
    }
    .cem-shell {
        width: 100%;
        height: auto;
        min-height: 0;
        display: block;
        border: 0;
        box-shadow: none;
    }
    .cem-results,
    .cem-result-panel {
        display: block;
        height: auto;
    }
}
