/* ========================================================
   CR e-ReKOD — Lembaran Gaya Moden & Responsif
   Versi spesifikasi: 1.1
   Sesuai untuk Desktop, Tablet dan Telefon (360px)
   ======================================================== */

:root {
    --primary: #1e3a8a;          /* Royal Navy */
    --primary-light: #3b82f6;    /* Vibrant Blue */
    --primary-dark: #172554;     /* Deep Midnight */
    --accent: #4f46e5;           /* Indigo */
    --success: #10b981;          /* Emerald Green */
    --success-light: #d1fae5;
    --warning: #f59e0b;          /* Amber */
    --warning-light: #fef3c7;
    --danger: #ef4444;           /* Coral Red */
    --danger-light: #fee2e2;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--neutral-50);
    color: var(--neutral-900);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* ========================================================
   HEADER & NAVBAR
   ======================================================== */
.app-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 0 20px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-badge {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
}

.brand-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 6px;
}

/* NAV TABS */
.main-nav {
    display: flex;
    gap: 4px;
}

.nav-tab {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: none;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.nav-tab.active {
    background: white;
    color: var(--primary);
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

/* ========================================================
   CONTAINER UTAMA
   ======================================================== */
.app-container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    flex: 1;
}

.ra-detailed-view-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.tab-pane {
    display: none;
    animation: fadeIn 0.2s ease-in-out;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================================
   KAD & ELEMEN REKOD AKHIR
   ======================================================== */
.ra-card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ra-card:hover {
    box-shadow: var(--shadow-md);
}

.ra-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--neutral-200);
}

.ra-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-800);
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-word;
}

/* BAHAGIAN A: IDENTITI MURID */
.ra-identity-card {
    border-left: 6px solid var(--primary);
    background: linear-gradient(to right, #ffffff, #f8fafc);
}

.ra-identity-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--neutral-200);
}

.ra-badge-school {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary);
    background: var(--neutral-100);
    padding: 3px 10px;
    border-radius: 9999px;
    margin-bottom: 6px;
    max-width: 100%;
}

.ra-title-main {
    font-size: 19px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: -0.2px;
    word-break: break-word;
    line-height: 1.3;
}

.mobile-break {
    display: none;
}

@media (max-width: 480px) {
    .mobile-break {
        display: inline;
    }
}

.ra-subtitle-subject {
    font-size: 14px;
    color: var(--neutral-600);
    font-weight: 600;
}

.ra-identity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px 20px;
}

.ra-identity-item {
    display: flex;
    flex-direction: column;
}

.ra-identity-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-600);
    text-transform: uppercase;
}

.ra-identity-item span {
    font-size: 15px;
    font-weight: 600;
    color: var(--neutral-900);
}

.ra-identity-item span.value-highlight {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
}

/* BAHAGIAN B: TIGA INDIKATOR UTAMA */
.ra-section-header {
    margin: 24px 0 12px;
}

.ra-section-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--neutral-800);
}

.ra-indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.ra-indicator-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 18px;
    border-top: 4px solid var(--primary-light);
}

.ra-indicator-card:nth-child(2) {
    border-top-color: var(--accent);
}

.ra-indicator-card:nth-child(3) {
    border-top-color: var(--success);
}

.ra-indicator-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.ra-indicator-title h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--neutral-800);
}

.ind-icon {
    font-size: 18px;
}

/* VISUAL CIRCULAR PROGRESS */
.ra-indicator-visual {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding: 10px;
    background: var(--neutral-50);
    border-radius: var(--radius-md);
}

.circular-progress {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: conic-gradient(var(--color, var(--primary)) var(--val, 0%), var(--neutral-200) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.circular-progress::before {
    content: "";
    position: absolute;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
}

.circular-progress .progress-text {
    position: relative;
    font-size: 15px;
    font-weight: 800;
    color: var(--neutral-900);
    z-index: 1;
}

.circular-progress.disabled .progress-text {
    color: var(--neutral-600);
    font-size: 13px;
}

.ra-visual-text {
    flex: 1;
}

.visual-status-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--neutral-800);
}

.visual-status-desc {
    font-size: 12px;
    color: var(--neutral-600);
    margin-top: 2px;
}

.ra-stat-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}

.ra-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px dashed var(--neutral-200);
}

.ra-stat-row:last-child {
    border-bottom: none;
}

.ra-sub-section {
    background: var(--neutral-50);
    padding: 10px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
}

.sub-section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--neutral-700);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.mini-exam-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-exam-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.exam-title-text {
    color: var(--neutral-700);
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exam-score-text {
    font-weight: 600;
    color: var(--neutral-900);
}

.ra-indicator-footer {
    font-size: 11px;
    color: var(--neutral-600);
    margin-top: 10px;
    font-style: italic;
}

/* BAHAGIAN C: REKOD PBD */
.ra-pbd-card {
    border-left: 6px solid #8b5cf6;
    overflow: hidden;
    max-width: 100%;
}

.ra-pbd-body {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.ra-pbd-pill {
    background: #ede9fe;
    color: #6d28d9;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
}

.pbd-empty-box {
    text-align: center;
    padding: 30px 20px;
    background: var(--neutral-50);
    border: 1px dashed var(--neutral-300);
    border-radius: var(--radius-md);
}

.pbd-empty-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.pbd-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-800);
}

.pbd-empty-desc {
    font-size: 13px;
    color: var(--neutral-600);
    max-width: 480px;
    margin: 4px auto 0;
}

.pbd-records-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
    margin-bottom: 8px;
}

.pbd-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pbd-table th, .pbd-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--neutral-200);
}

.pbd-table th {
    background: var(--neutral-100);
    font-weight: 700;
    color: var(--neutral-700);
    font-size: 12px;
    text-transform: uppercase;
}

.tp-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 800;
    font-size: 13px;
}

.tp-badge.confirmed {
    background: #dbeafe;
    color: var(--primary);
    border: 1px solid #bfdbfe;
}

.tp-badge.proposed {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.pbd-guideline-note {
    font-size: 12px;
    color: var(--neutral-600);
    margin-top: 12px;
    font-style: italic;
}

/* BAHAGIAN D: SKOR KESELURUHAN */
.ra-overall-card {
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid #bbf7d0;
}

.ra-mode-pill {
    background: #e0f2fe;
    color: #0369a1;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
}

.ra-overall-score-box {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
}

.ra-overall-score-box .circular-progress {
    width: 90px;
    height: 90px;
}

.ra-overall-score-box .circular-progress::before {
    width: 68px;
    height: 68px;
}

.ra-overall-score-box .circular-progress .progress-text {
    font-size: 18px;
}

.overall-label-box .overall-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--neutral-900);
}

.overall-label-box .overall-subtitle {
    font-size: 13px;
    color: var(--neutral-600);
    font-weight: 600;
}

.ra-overall-warning {
    background: var(--warning-light);
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ra-overall-note {
    font-size: 13px;
    color: var(--neutral-700);
    margin-bottom: 12px;
    font-weight: 500;
}

.ra-overall-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.breakdown-item {
    background: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--neutral-200);
    font-size: 13px;
    display: flex;
    gap: 6px;
}

.breakdown-item.valid {
    border-color: #86efac;
    background: #f0fdf4;
}

.breakdown-item.invalid {
    border-color: var(--neutral-300);
    opacity: 0.8;
}

.breakdown-val {
    font-weight: 700;
}

.ra-disclaimer-note {
    font-size: 11px;
    color: var(--neutral-600);
    font-style: italic;
}

/* ========================================================
   BAHAGIAN D: PENGIRAAN PRESTASI MENGIKUT FASA (5 KAD)
   ======================================================== */
.ra-phase-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ra-phase-card {
    background: #ffffff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    padding: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ra-phase-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ra-phase-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.ra-phase-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase-card-icon {
    font-size: 20px;
    line-height: 1;
}

.phase-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
    line-height: 1.2;
}

.phase-card-subtitle {
    font-size: 11px;
    color: var(--neutral-500);
    margin-top: 2px;
}

.ra-phase-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
}

.phase-primary-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
}

.stat-number-box {
    display: flex;
    flex-direction: column;
}

.stat-big-val {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.1;
}

.stat-big-val.unassessed {
    font-size: 16px;
    color: #94a3b8 !important;
    font-weight: 700;
}

.stat-sub-label {
    font-size: 10px;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 2px;
}

.formula-pill {
    background: #e2e8f0;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.stat-badge-info {
    font-size: 12px;
    color: var(--neutral-700);
}

.phase-progress-bar-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 9999px;
    overflow: hidden;
}

.phase-progress-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

.phase-breakdown-rows {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
}

.phase-mini-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 6px;
    border-radius: 4px;
    background: #f8fafc;
}

.phase-mini-row.valid {
    background: #f0fdf4;
}

.phase-mini-row.invalid {
    background: #fef2f2;
}

.phase-mini-row .mini-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--neutral-700);
}

.phase-mini-row .bullet {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.phase-mini-row .mini-val {
    font-weight: 600;
    color: var(--neutral-900);
}

.phase-card-footer {
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    font-size: 11px;
    line-height: 1.4;
}

.phase-footer-note {
    font-size: 11px;
    display: block;
}

.phase-footer-note.text-success {
    color: #15803d;
    font-weight: 600;
}

.phase-footer-note.text-warning {
    color: #b45309;
    font-weight: 600;
}

/* Tema Khusus 5 Kad */
.card-fasa-latihan {
    border-top: 4px solid #0d9488;
}

/* ========================================================
   DASHBOARD PINGAT PENCAPAIAN MURID & GARIS PENCAPAIAN
   ======================================================== */
.card-fasa-latihan.dashboard-achievement-card {
    grid-column: 1 / -1;
    border-top: 4px solid #0d9488;
    background: #ffffff;
    border-radius: var(--radius-md, 12px);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.05);
    padding: 20px 24px;
}

.achieve-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
}

.achieve-profile-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.achieve-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.achieve-id-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.achieve-student-name {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.achieve-meta-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #64748b;
}

.achieve-pill {
    background: #f1f5f9;
    padding: 2px 9px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.achieve-pill strong {
    color: #0f172a;
    font-weight: 600;
}

.btn-achieve-meta {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.btn-achieve-meta:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}

.achieve-quote-row {
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
    font-style: italic;
    padding-left: 62px;
}

.achieve-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 16px 0 18px 0;
}

.achieve-body-grid {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 24px;
    align-items: center;
}

.achieve-medal-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.achieve-medal-graphic {
    display: flex;
    align-items: center;
    justify-content: center;
}

.achieve-medal-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin-top: 2px;
}

.achieve-medal-percent {
    font-size: 12.5px;
    font-weight: 700;
    color: #15803d;
    background: #dcfce7;
    padding: 2px 10px;
    border-radius: 999px;
    display: inline-block;
    border: 1px solid #bbf7d0;
}

.achieve-content-col {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.achieve-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.achieve-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.achieve-stat-card.card-completed { border-left: 4px solid #10b981; }
.achieve-stat-card.card-remaining { border-left: 4px solid #ef4444; }
.achieve-stat-card.card-topics { border-left: 4px solid #3b82f6; }

.stat-card-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #64748b;
    text-transform: uppercase;
}

.stat-card-val {
    font-size: 17px;
    font-weight: 800;
}

.stat-card-val.text-completed { color: #059669; }
.stat-card-val.text-remaining { color: #dc2626; }
.stat-card-val.text-topics { color: #2563eb; }

/* Milestone Achievement Line */
.milestone-line-wrapper {
    padding: 4px 6px 2px 6px;
}

.milestone-progress-track {
    position: relative;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    margin: 14px 10px 26px 10px;
}

.milestone-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #10b981, #059669, #0284c7);
    transition: width 0.5s ease;
}

.milestone-pin {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 2;
    pointer-events: none;
}

.milestone-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
    transition: all 0.25s ease;
}

.milestone-dot.dot-active {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.dot-check {
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.milestone-pin-label {
    position: absolute;
    top: 24px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    color: #64748b;
}

.milestone-pin.reached .milestone-pin-label {
    color: #0f172a;
    font-weight: 800;
}

.milestone-sub-caption {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #64748b;
    margin-top: 10px;
    padding: 0 2px;
}

.milestone-sub-caption strong {
    color: #0f172a;
}

/* 3-Phases Mini Summary Strip */
.achieve-phases-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    justify-content: space-between;
    font-size: 12px;
}

.achieve-phase-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.phase-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.phase-color-dot.dot-gold { background: #f59e0b; }
.phase-color-dot.dot-rose { background: #e11d48; }
.phase-color-dot.dot-blue { background: #2563eb; }

@media (max-width: 900px) {
    .achieve-body-grid {
        grid-template-columns: 1fr;
    }
    .achieve-quote-row {
        padding-left: 0;
    }
}

@media (max-width: 600px) {
    .achieve-stats-row {
        grid-template-columns: 1fr;
    }
    .achieve-phases-strip {
        flex-direction: column;
        gap: 6px;
    }
    .achieve-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.card-fasa-1 {
    border-top: 4px solid #f59e0b;
    background: linear-gradient(180deg, #fffdf8 0%, #ffffff 100%);
}

.card-fasa-2 {
    border-top: 4px solid #e11d48;
    background: linear-gradient(180deg, #fffbfc 0%, #ffffff 100%);
}

.card-fasa-3 {
    border-top: 4px solid #2563eb;
    background: linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
}

.card-prestasi-keseluruhan {
    border-top: 4px solid #4f46e5;
    background: linear-gradient(180deg, #f8faff 0%, #ffffff 100%);
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.08);
}

/* ========================================================
   SENARAI MURID & KAWALAN PILIHAN KELAS
   ======================================================== */
.ra-controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: white;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 240px;
}

.control-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--neutral-700);
    white-space: nowrap;
}

.form-select, .form-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid var(--neutral-300);
    border-radius: var(--radius-sm);
    background-color: white;
    color: var(--neutral-800);
    outline: none;
    transition: border-color 0.2s;
}

.form-select:focus, .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.15);
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
    align-items: stretch;
}

.student-card {
    background: #ffffff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 195px;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.student-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -2px rgba(0, 0, 0, 0.08);
}

.student-card.selected {
    box-shadow: 0 0 0 2px var(--primary), 0 8px 20px -2px rgba(37, 99, 235, 0.18);
}

.student-card-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    flex: 1;
}

/* Avatar Murid 1:1 Nisbah & Kamera Aksen */
.student-avatar-container,
.student-avatar {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #f1f5f9;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2.5px solid var(--primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    user-select: none;
}

.student-avatar-container:hover,
.student-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.student-photo-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.avatar-camera-btn {
    position: absolute;
    bottom: -3px;
    right: -3px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
    transition: background 0.15s, transform 0.15s;
}

.student-avatar-container:hover .avatar-camera-btn {
    background: #f8fafc;
    transform: scale(1.15);
}

/* Kolum Maklumat Murid */
.student-info-col,
.student-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.student-name-full,
.student-name {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
    margin: 0;
    word-break: break-word;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.student-class-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 700;
    border: 1px solid transparent;
    width: fit-content;
    line-height: 1.25;
    letter-spacing: 0.2px;
}

.student-meta-row,
.student-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 3px;
    font-size: 11.5px;
}

.student-id-badge {
    font-weight: 700;
    background: #f8fafc;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.student-ic-badge {
    color: #64748b;
    font-weight: 500;
}

/* Kaki Kad (Tindakan) */
.student-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    margin-top: 10px;
    border-top: 1px solid #f1f5f9;
    gap: 8px;
}

.btn-card-papar,
.view-btn-pill {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 12px;
    padding: 4px 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s, transform 0.15s;
}

.btn-card-papar:hover,
.view-btn-pill:hover {
    color: var(--primary-dark);
    transform: translateX(3px);
}

.btn-student-action {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 6px;
    padding: 3px 9px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-student-action:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

/* BUTANG DETAIL TOP BAR */
.ra-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* ========================================================
   JADUAL DATA & MODUL-MODUL LAIN
   ======================================================== */
.module-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.module-header-bar h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--neutral-900);
}

.module-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-responsive-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-bottom: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 600px;
}

.data-table th, .data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--neutral-200);
    text-align: left;
}

.data-table th {
    background: var(--neutral-100);
    font-weight: 700;
    color: var(--neutral-700);
}

.status-cycle-btn {
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.status-cycle-btn:hover {
    opacity: 0.85;
}

.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: white; }
.badge-danger { background: var(--danger); color: white; }
.badge-primary { background: var(--primary); color: white; }
.badge-neutral { background: var(--neutral-200); color: var(--neutral-700); }

.score-input {
    width: 64px;
    padding: 4px 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid var(--neutral-300);
    border-radius: 4px;
}

.form-select-sm, .form-input-sm {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--neutral-300);
    border-radius: 4px;
}

.module-tip-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}

/* ========================================================
   TETAPAN (SETTINGS)
   ======================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.settings-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.settings-card.full-width {
    grid-column: 1 / -1;
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--neutral-200);
}

.settings-desc {
    font-size: 13px;
    color: var(--neutral-600);
    margin-bottom: 16px;
}

.form-group-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 12px;
}

.form-group-row label {
    font-size: 13px;
    font-weight: 600;
    color: var(--neutral-800);
}

.form-group-row input {
    width: 80px;
    text-align: center;
}

.alert-success {
    background: var(--success-light);
    border: 1px solid #86efac;
    color: #166534;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin: 12px 0;
}

.alert-danger {
    background: var(--danger-light);
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin: 12px 0;
}

.settings-btn-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.toggle-control-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.radio-option-card {
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.radio-option-card.active {
    border-color: var(--primary);
    background: #f0f7ff;
}

.radio-option-card label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

/* ========================================================
   BUTANG & UTILITI
   ======================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--neutral-200); color: var(--neutral-800); }
.btn-secondary:hover { background: var(--neutral-300); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-muted { color: var(--neutral-600); }
.font-bold { font-weight: 700; }

.toast-notice {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--neutral-900);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.25s ease;
    z-index: 9999;
}

.toast-notice.show {
    opacity: 1;
    transform: translateY(0);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--neutral-600);
    background: white;
    border-radius: var(--radius-md);
    border: 1px dashed var(--neutral-300);
}

.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--primary);
    font-weight: 600;
}

/* ========================================================
   RESPONSIF TELEFON (360PX - KES 10)
   ======================================================== */
@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
    }

    .header-inner {
        height: auto;
        padding: 10px 0;
        flex-wrap: wrap;
    }

    .brand-wrapper {
        gap: 8px;
    }

    .brand-logo-badge {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .brand-title {
        font-size: 16px;
    }

    .brand-subtitle {
        font-size: 10px;
    }

    .mobile-menu-btn {
        display: block;
    }

    .main-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .main-nav.open {
        display: flex;
    }

    .nav-tab {
        width: 100%;
        padding: 10px 12px;
        border-radius: 4px;
    }

    .app-container {
        padding: 0 10px;
        margin: 14px auto;
    }

    .ra-card {
        padding: 14px;
        border-radius: var(--radius-md);
    }

    .ra-indicators-grid {
        grid-template-columns: 1fr; /* Kad menegak di telefon */
        gap: 14px;
    }

    .ra-identity-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ra-identity-item span.value-highlight {
        font-size: 16px;
    }

    .ra-title-main {
        font-size: 16px;
    }

    .ra-overall-score-box {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .ra-overall-breakdown {
        flex-direction: column;
    }

    .ra-phase-cards-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .phase-primary-stat {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .ra-controls-bar {
        padding: 12px;
    }

    .control-item {
        min-width: 100%;
    }

    .student-grid {
        grid-template-columns: 1fr;
    }
}

/* Khas untuk skrin 360px */
@media (max-width: 380px) {
    .brand-title {
        font-size: 15px;
    }

    .brand-subtitle {
        font-size: 9.5px;
    }

    .ra-card {
        padding: 12px 10px;
    }

    .ra-title-main {
        font-size: 14px;
        line-height: 1.35;
        word-break: break-word;
    }

    .ra-badge-school {
        font-size: 9.5px;
        padding: 2px 8px;
    }

    .ra-subtitle-subject {
        font-size: 12px;
    }

    .circular-progress {
        width: 60px;
        height: 60px;
    }

    .circular-progress::before {
        width: 44px;
        height: 44px;
    }

    .circular-progress .progress-text {
        font-size: 12px;
    }

    .ra-overall-score-box .circular-progress {
        width: 76px;
        height: 76px;
    }

    .ra-overall-score-box .circular-progress::before {
        width: 56px;
        height: 56px;
    }

    .ra-overall-score-box .circular-progress .progress-text {
        font-size: 15px;
    }

    .overall-label-box .overall-title {
        font-size: 15px;
    }

    .overall-label-box .overall-subtitle {
        font-size: 11px;
    }

    .ra-stat-row {
        font-size: 12px;
    }

    .ra-card-header h3 {
        font-size: 14px;
    }

    .ra-mode-pill, .ra-pbd-pill {
        font-size: 10px;
        padding: 3px 8px;
    }
}

/* ========================================================
   GKT MASTERY TRACKER — MODUL SENARAI SEMAK 2026
   ======================================================== */
.mastery-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.mastery-header-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--neutral-200);
}

.mastery-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--neutral-200);
}

.mastery-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mastery-title-icon {
    font-size: 32px;
    line-height: 1;
}

.mastery-header-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
}

.mastery-actions-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.mastery-selectors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* Ringkasan Profil & Lencana Murid */
.mastery-summary-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
}

.student-profile-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--neutral-200);
}

.student-info-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.student-avatar-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}

.student-profile-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--neutral-900);
    margin-bottom: 4px;
}

.student-meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.meta-tag {
    background: var(--neutral-100);
    color: var(--neutral-700);
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--neutral-200);
}

.student-profile-notes {
    font-size: 12px;
    color: var(--neutral-600);
    margin-top: 6px;
}

/* Showcase Lencana & Kemajuan */
.mastery-badges-showcase {
    margin-top: 16px;
}

.overall-progress-block {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.badge-large-display {
    border-radius: var(--radius-md);
    border: 2px solid;
    padding: 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 170px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.badge-big-icon {
    font-size: 34px;
    margin-bottom: 4px;
    line-height: 1;
}

.badge-big-label {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.2px;
}

.badge-big-sub {
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-700);
}

.overall-progress-details {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.overall-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.ov-stat-item {
    background: var(--neutral-50);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--neutral-200);
    display: flex;
    flex-direction: column;
}

.ov-label {
    font-size: 11px;
    color: var(--neutral-600);
    text-transform: uppercase;
    font-weight: 600;
}

.ov-val {
    font-size: 16px;
    font-weight: 700;
}

/* Milestone Track Bar */
.milestone-track-container {
    width: 100%;
    padding: 12px 0 20px 0;
}

.milestone-track-bg {
    width: 100%;
    height: 10px;
    background: var(--neutral-200);
    border-radius: 999px;
    position: relative;
}

.milestone-track-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 50%, #d97706 75%, #7c3aed 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.milestone-marker {
    position: absolute;
    top: -3px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.milestone-marker.mark-25 { left: 25%; }
.milestone-marker.mark-50 { left: 50%; }
.milestone-marker.mark-75 { left: 75%; }
.milestone-marker.mark-100 { left: 100%; }

.marker-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--neutral-300);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.milestone-marker.reached .marker-dot {
    border-color: #10b981;
    background: #10b981;
}

.marker-text {
    position: absolute;
    top: 18px;
    font-size: 10px;
    font-weight: 700;
    color: var(--neutral-600);
    white-space: nowrap;
}

.milestone-marker.reached .marker-text {
    color: var(--neutral-900);
}

/* Senarai 10 Topik GKT */
.mastery-topics-header {
    margin-top: 10px;
}

.mastery-topics-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--neutral-900);
    margin-bottom: 2px;
}

.mastery-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
    gap: 18px;
}

.topic-mastery-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--neutral-200);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s ease;
}

.topic-mastery-card.topic-completed {
    border-color: #10b981;
    background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60px);
}

.topic-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.topic-title-group {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.topic-number-badge {
    background: var(--neutral-100);
    color: var(--primary);
    border: 1px solid var(--neutral-300);
    font-size: 13px;
    font-weight: 800;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.topic-completed .topic-number-badge {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.topic-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--neutral-900);
    line-height: 1.25;
}

.topic-count-text {
    font-size: 12px;
    color: var(--neutral-600);
    margin-top: 2px;
}

.topic-badge-status {
    flex-shrink: 0;
}

.topic-unlocked-badge {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.topic-unlocked-badge .badge-icon {
    font-size: 18px;
    line-height: 1;
}

.topic-unlocked-badge .badge-lbl {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.topic-unlocked-badge .badge-date {
    font-size: 10px;
    color: #15803d;
}

.topic-progress-pill {
    background: var(--neutral-100);
    color: var(--neutral-700);
    border: 1px solid var(--neutral-200);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.topic-progress-track {
    width: 100%;
    height: 6px;
    background: var(--neutral-200);
    border-radius: 999px;
    overflow: hidden;
}

.topic-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.25s ease;
}

.topic-batch-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
}

.btn-link {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.btn-link:hover {
    opacity: 0.8;
}

.action-divider {
    color: var(--neutral-300);
}

/* Grid Kotak Semakan Latihan */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
    margin-top: 4px;
}

.exercise-box {
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--neutral-300);
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    padding: 2px;
}

.exercise-box .ex-label {
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.exercise-box .ex-check {
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    margin-top: 2px;
}

.exercise-box.pending {
    color: var(--neutral-600);
}

.exercise-box.pending:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.exercise-box.completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #059669;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.3);
}

.exercise-box.completed:hover {
    filter: brightness(0.92);
    transform: translateY(-1px);
}

/* MODAL KASTAM (ADMIN, BACKUP & META) */
.custom-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.custom-modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.custom-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--neutral-200);
    background: var(--neutral-50);
}

.custom-modal-header h3 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--neutral-600);
    cursor: pointer;
}

.custom-modal-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
}

.custom-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--neutral-200);
    background: var(--neutral-50);
    gap: 10px;
}

.admin-topics-form-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.admin-topic-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-row-num {
    width: 60px;
    font-size: 12px;
    font-weight: 700;
    color: var(--neutral-600);
}

.admin-sum-notice {
    margin-top: 16px;
    padding: 10px;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: right;
}

/* KAD GKT MASTERY DI REKOD AKHIR */
.ra-mastery-card {
    border-left: 5px solid #7c3aed;
}

.ra-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.ra-mastery-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ra-mastery-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    background: var(--neutral-50);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
}

.ra-mastery-progress-track {
    width: 100%;
    height: 8px;
    background: var(--neutral-200);
    border-radius: 999px;
    overflow: hidden;
}

.ra-mastery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #10b981 50%, #d97706 75%, #7c3aed 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.ra-mastery-topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--neutral-100);
    border: 1px solid var(--neutral-200);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.topic-chip.chip-completed {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.chip-idx {
    font-weight: 800;
    color: var(--primary);
}

.chip-completed .chip-idx {
    color: #166534;
}

.chip-title {
    font-weight: 500;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip-ratio {
    font-size: 11px;
    font-weight: 700;
    color: var(--neutral-600);
}

.chip-completed .chip-ratio {
    color: #15803d;
}

.chip-tick {
    color: #16a34a;
    font-weight: 900;
}

.ra-mastery-action-bar {
    margin-top: 4px;
}

/* ========================================================
   RESPONSIF TELEFON (VIEWPORT 360px)
   ======================================================== */
@media (max-width: 600px) {
    .mastery-topics-grid {
        grid-template-columns: 1fr;
    }

    .overall-progress-block {
        flex-direction: column;
        align-items: stretch;
    }

    .badge-large-display {
        width: 100%;
    }

    .exercise-grid {
        grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
        gap: 4px;
    }

    .exercise-box {
        height: 34px;
    }

    .exercise-box .ex-label {
        font-size: 10px;
    }

    .student-profile-strip {
        flex-direction: column;
        align-items: flex-start;
    }

    .milestone-marker .marker-text {
        font-size: 9px;
    }

    .custom-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .custom-modal-footer button {
        width: 100%;
    }
}

/* ========================================================
   REKOD ENAM PEPERIKSAAN (TINGKATAN 4 & TINGKATAN 5)
   ======================================================== */
.ra-six-exams-card {
    border-left: 5px solid #2563eb;
}

.ra-six-exams-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ra-form-cohort-section {
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}

.cohort-header {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ra-exams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    padding: 14px;
}

.ra-exam-box {
    background: white;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all 0.2s ease;
}

.ra-exam-box.has-score {
    border-left: 4px solid #2563eb;
    background: #f8fafc;
}

.ra-exam-box.unassessed {
    border-left: 4px solid var(--neutral-300);
    background: #fcfcfc;
}

.exam-box-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--neutral-800);
}

.exam-box-score {
    font-size: 17px;
    font-weight: 800;
    color: var(--neutral-900);
}

.exam-box-score .max-text {
    font-size: 12px;
    font-weight: 500;
    color: var(--neutral-600);
}

.exam-box-percent {
    margin-top: 2px;
}

.exam-box-notes {
    font-size: 11px;
    color: var(--neutral-600);
    margin-top: 4px;
    border-top: 1px dashed var(--neutral-200);
    padding-top: 4px;
}

/* ========================================================
   MODUL IMPORT SENARAI MURID (EXCEL / CSV)
   ======================================================== */
.import-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.import-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.import-modal-dialog {
    background: #ffffff;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from { transform: translateY(20px) scale(0.98); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.import-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.import-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.import-modal-title span {
    font-size: 28px;
}

.import-modal-title h3 {
    margin: 0;
    font-size: 18px;
    color: var(--primary);
}

.import-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #64748b;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 4px;
}

.import-modal-close:hover {
    color: #0f172a;
    background: #e2e8f0;
}

.import-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.import-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* DROPZONE */
.import-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-md);
    padding: 24px 20px;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.import-dropzone.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.dropzone-inner {
    text-align: center;
    cursor: pointer;
    padding: 20px 0;
}

.template-download-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding: 10px 16px;
    background: #ffffff;
    border-radius: var(--radius-sm);
    border: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.btn-link {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    padding: 0 4px;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.import-guidelines-box {
    margin-top: 16px;
    padding: 14px 16px;
    background: #ffffff;
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    font-size: 13px;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
}

.import-guidelines-box ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.import-guidelines-box li {
    margin-bottom: 4px;
}

/* PRATONTON STATS & OPTIONS */
.preview-stats-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.stat-pill {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-pill.stat-total { background: #f1f5f9; color: #334155; }
.stat-pill.stat-new { background: #dcfce7; color: #166534; }
.stat-pill.stat-update { background: #dbeafe; color: #1e40af; }
.stat-pill.stat-rejected { background: #fee2e2; color: #991b1b; }

.import-options-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.import-tabs-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.import-tab-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
}

.import-tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.import-preview-table-wrap {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.row-invalid {
    background: #fff5f5 !important;
}

.row-warning {
    background: #fffbeb !important;
}

.duplicate-decision-box {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 4px;
}

.import-error-msg {
    font-size: 11px;
    color: #dc2626;
    margin-top: 4px;
    font-weight: 600;
}

.import-warning-msg {
    font-size: 11px;
    color: #d97706;
    margin-top: 4px;
}

.status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.status-aktif {
    background: #dcfce7;
    color: #166534;
}

.status-pill.status-arkib {
    background: #e2e8f0;
    color: #475569;
}

/* LAPORAN RINGKASAN */
.report-card {
    padding: 24px;
    background: white;
    border-radius: var(--radius-md);
    text-align: center;
}

.report-header h3 {
    color: var(--primary);
    margin: 8px 0 4px;
}

.report-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.metric-card {
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid #e2e8f0;
}

.metric-card.metric-new { background: #f0fdf4; border-color: #bbf7d0; }
.metric-card.metric-update { background: #eff6ff; border-color: #bfdbfe; }
.metric-card.metric-rejected { background: #fef2f2; border-color: #fecaca; }
.metric-card.metric-classes { background: #f5f3ff; border-color: #ddd6fe; }

.metric-value {
    font-size: 28px;
    font-weight: 800;
}

.metric-new .metric-value { color: #166534; }
.metric-update .metric-value { color: #1e40af; }
.metric-rejected .metric-value { color: #991b1b; }
.metric-classes .metric-value { color: #6b21a8; }

.metric-label {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-top: 4px;
}

.report-rejected-box {
    margin-top: 20px;
    text-align: left;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 14px;
}

.report-rejected-box h4 {
    margin: 0;
    color: #991b1b;
}

.table-compact {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table-compact th {
    background: #f8fafc;
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.table-compact td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

/* RESPONSIF IMPORT 360PX */
@media (max-width: 600px) {
    .import-modal-dialog {
        max-height: 96vh;
        margin: 0;
    }

    .import-options-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .report-metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========================================================
   PENGURUSAN MURID MANUAL (TAMBAH & HAPUS / NYAHAKTIF)
   ======================================================== */
.ra-actions-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.manage-alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}

.manage-alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.manage-alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.manage-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.audit-stat-item {
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px;
    border-bottom: 1px dashed #f1f5f9;
}

.audit-stat-label {
    color: #475569;
}

.audit-stat-val {
    color: #0f172a;
    font-weight: 700;
}

.btn-student-action {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1.2;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.btn-student-action:hover {
    border-color: #ef4444;
    color: #dc2626;
    background: #fef2f2;
}

.badge-status-inactive {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.student-card.student-card-inactive {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    opacity: 0.88;
}

.student-card.student-card-inactive:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

/* ========================================================
   PENILAIAN PENGHANTARAN LATIHAN 3 FASA
   ======================================================== */
.mastery-phase-section {
    background: #ffffff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
}

.mastery-phase-title-strip {
    margin-bottom: 16px;
}

.phase-section-main-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
}

.mastery-phase-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.phase-overview-card {
    background: #ffffff;
    border: 1.5px solid var(--neutral-200);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.phase-overview-card:hover {
    border-color: var(--primary-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.phase-overview-card.active-filter {
    border-color: var(--primary-600);
    background: #eff6ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.phase-overview-card.phase-card-1 { border-top: 4px solid #2563eb; }
.phase-overview-card.phase-card-2 { border-top: 4px solid #0d9488; }
.phase-overview-card.phase-card-3 { border-top: 4px solid #7c3aed; }
.phase-overview-card.phase-card-overall { border-top: 4px solid #16a34a; background: #f0fdf4; }

.phase-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.phase-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.phase-badge-1 { background: #dbeafe; color: #1d4ed8; }
.phase-badge-2 { background: #ccfbf1; color: #0f766e; }
.phase-badge-3 { background: #ede9fe; color: #6d28d9; }
.phase-badge.badge-overall { background: #dcfce7; color: #15803d; }

.phase-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
}

.phase-status-pill.status-completed { background: #dcfce7; color: #166534; }
.phase-status-pill.status-in_progress { background: #dbeafe; color: #1e40af; }
.phase-status-pill.status-not_started { background: #f1f5f9; color: #475569; }
.phase-status-pill.status-unopened { background: #fef3c7; color: #b45309; }
.phase-status-pill.status-badge { background: #ede9fe; color: #5b21b6; }

.phase-card-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 4px 0 2px;
}

.phase-card-topics-desc {
    font-size: 12px;
    color: var(--neutral-500);
    margin-bottom: 10px;
    line-height: 1.3;
}

.phase-card-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.phase-count-highlight {
    font-size: 13px;
    color: var(--neutral-700);
}

.phase-pct-highlight {
    font-size: 15px;
    font-weight: 700;
}

.phase-bar-track {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.phase-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.phase-bar-fill.fill-1 { background: #2563eb; }
.phase-bar-fill.fill-2 { background: #0d9488; }
.phase-bar-fill.fill-3 { background: #7c3aed; }
.phase-bar-fill.fill-overall { background: #16a34a; }

.phase-card-sub-info {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--neutral-500);
}

/* Penapis Butang Fasa */
.mastery-phase-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
}

.filter-bar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--neutral-700);
}

.filter-buttons-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-filter-phase {
    background: #ffffff;
    border: 1px solid var(--neutral-300);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-700);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-filter-phase:hover {
    background: var(--neutral-100);
    border-color: var(--neutral-400);
}

.btn-filter-phase.active {
    background: var(--primary-600);
    color: #ffffff;
    border-color: var(--primary-600);
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

/* Pengepala Kumpulan Fasa dalam Grid Topik */
.phase-group-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-top: 14px;
    margin-bottom: 4px;
}

.phase-group-header.phase-group-1 {
    background: #eff6ff;
    border-left: 4px solid #2563eb;
}

.phase-group-header.phase-group-2 {
    background: #f0fdfa;
    border-left: 4px solid #0d9488;
}

.phase-group-header.phase-group-3 {
    background: #faf5ff;
    border-left: 4px solid #7c3aed;
}

.phase-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.phase-group-title h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--neutral-800);
}

.phase-header-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
}

.phase-header-badge.badge-1 { background: #2563eb; color: #ffffff; }
.phase-header-badge.badge-2 { background: #0d9488; color: #ffffff; }
.phase-header-badge.badge-3 { background: #7c3aed; color: #ffffff; }

.phase-group-meta {
    font-size: 12px;
    color: var(--neutral-600);
    font-weight: 500;
}

.phase-tag-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.phase-tag-1 { background: #dbeafe; color: #1e40af; }
.phase-tag-2 { background: #ccfbf1; color: #0f766e; }
.phase-tag-3 { background: #ede9fe; color: #6d28d9; }

/* Status Topik Belum Dibuka */
.topic-mastery-card.topic-unopened {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.topic-unopened-alert-strip {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: #92400e;
    margin: 8px 0;
}

.exercise-box.box-unopened {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #cbd5e1;
}

.chip-unopened {
    opacity: 0.7;
    border-style: dashed !important;
}

/* ========================================================
   SUSUN SEMULA MODUL PENGHANTARAN LATIHAN (3 PANEL FASA)
   ======================================================== */

/* Panel Fasa Utama */
.phase-panels-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.phase-panel {
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.phase-panel:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
}

/* Fasa 1 — Tema Kuning / Emas */
.phase-panel-1 {
    background: #fffdf5;
    border: 1.5px solid #fde68a;
    border-left: 6px solid #f59e0b;
}

/* Fasa 2 — Tema Merah / Jambu atau Merah */
.phase-panel-2 {
    background: #fff5f5;
    border: 1.5px solid #fecdd3;
    border-left: 6px solid #e11d48;
}

/* Fasa 3 — Tema Biru */
.phase-panel-3 {
    background: #f8faff;
    border: 1.5px solid #bfdbfe;
    border-left: 6px solid #2563eb;
}

/* Pengepala Panel Fasa */
.phase-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}

.phase-panel-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.phase-panel-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-fasa-1 {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-fasa-2 {
    background: #ffe4e6;
    color: #9f1239;
    border: 1px solid #fecdd3;
}

.badge-fasa-3 {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.phase-panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
}

.phase-panel-subtitle {
    font-size: 12px;
    color: var(--neutral-500);
    margin-top: 2px;
}

.phase-panel-summary-tag {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: #ffffff;
    border: 1px solid var(--neutral-200);
    color: var(--neutral-700);
}

.tag-fasa-1 { color: #b45309; border-color: #fde68a; }
.tag-fasa-2 { color: #be123c; border-color: #fecdd3; }
.tag-fasa-3 { color: #1d4ed8; border-color: #bfdbfe; }

/* Grid Kad Topik dalam Panel Fasa */
.phase-topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.phase-topic-card {
    background: #ffffff;
    border: 1.5px solid var(--neutral-200);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
    overflow: hidden;
}

.phase-topic-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px -1px rgba(0, 0, 0, 0.08);
}

.phase-topic-card.highlight-topic-card {
    outline: 3px solid #3b82f6;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.35);
}

.phase-topic-card-p1:hover { border-color: #f59e0b; }
.phase-topic-card-p2:hover { border-color: #e11d48; }
.phase-topic-card-p3:hover { border-color: #2563eb; }

.topic-card-top-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.topic-card-header-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.topic-num-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.num-badge-p1 { background: #fef3c7; color: #92400e; }
.num-badge-p2 { background: #ffe4e6; color: #9f1239; }
.num-badge-p3 { background: #dbeafe; color: #1e40af; }

.topic-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 2px 0 0;
    line-height: 1.3;
}

.topic-card-stats-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 12px;
}

.topic-card-count {
    color: var(--neutral-600);
}

.topic-card-percent {
    font-weight: 700;
    font-size: 13px;
}

.p1-text { color: #d97706; }
.p2-text { color: #e11d48; }
.p3-text { color: #2563eb; }

.topic-card-bar-track {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.topic-card-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.fill-p1 { background: linear-gradient(90deg, #f59e0b, #d97706); }
.fill-p2 { background: linear-gradient(90deg, #f43f5e, #e11d48); }
.fill-p3 { background: linear-gradient(90deg, #3b82f6, #1d4ed8); }

.topic-batch-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 6px;
    padding-top: 4px;
    font-size: 11px;
}

.topic-batch-actions .btn-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
}

.topic-batch-actions .btn-link:hover {
    text-decoration: underline;
}

.topic-card-exercises-section {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
}

/* ========================================================
   PAPARAN TERPERINCI LATIHAN (DETAIL VIEW)
   ======================================================== */
.mastery-detail-view-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mastery-detail-top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: #ffffff;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
}

.detail-top-context {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--neutral-700);
}

.detail-phase-pill {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.pill-p1 { background: #fef3c7; color: #92400e; }
.pill-p2 { background: #ffe4e6; color: #9f1239; }
.pill-p3 { background: #dbeafe; color: #1e40af; }

.mastery-topic-detail-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1.5px solid var(--neutral-200);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mastery-topic-detail-card.card-p1 {
    border-top: 5px solid #f59e0b;
}

.mastery-topic-detail-card.card-p2 {
    border-top: 5px solid #e11d48;
}

.mastery-topic-detail-card.card-p3 {
    border-top: 5px solid #2563eb;
}

.detail-header-block {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
}

.detail-phase-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 4px;
}

.tag-p1 { color: #b45309; }
.tag-p2 { color: #be123c; }
.tag-p3 { color: #1d4ed8; }

.detail-topic-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--neutral-900);
    margin: 0 0 6px 0;
}

.detail-student-name-tag {
    font-size: 13px;
    color: var(--neutral-600);
}

.detail-status-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
}

.detail-status-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--neutral-600);
}

.detail-progress-section {
    background: #f8fafc;
    border-radius: 8px;
    padding: 14px 18px;
    border: 1px solid var(--neutral-200);
}

.detail-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.detail-stat-count {
    font-size: 14px;
    color: var(--neutral-700);
}

.detail-stat-percent {
    font-size: 18px;
    font-weight: 800;
}

.detail-bar-track {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.detail-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.detail-action-links {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    padding: 4px 0;
}

.detail-exercise-instruction {
    font-size: 13px;
    color: var(--neutral-600);
    margin-bottom: 10px;
    font-weight: 500;
}

.exercise-grid-detail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 10px;
}

.exercise-btn {
    min-height: 48px;
    border-radius: 8px;
    border: 1.5px solid var(--neutral-300);
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    padding: 4px;
}

.exercise-btn .ex-btn-label {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.exercise-btn .ex-btn-icon {
    font-size: 12px;
    line-height: 1;
    font-weight: 800;
    margin-top: 3px;
}

.exercise-btn.pending {
    color: var(--neutral-700);
}

.exercise-btn.pending:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.exercise-btn.completed {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.exercise-btn.completed:hover {
    background: #bbf7d0;
    border-color: #4ade80;
    transform: translateY(-2px);
}

.exercise-btn.btn-unopened {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
}

/* Responsif Mobile 360px - 768px */
@media (max-width: 768px) {
    .phase-topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 12px;
    }
    .exercise-grid-detail {
        grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .phase-panel {
        padding: 12px;
    }
    .phase-topics-grid {
        grid-template-columns: 1fr;
    }
    .phase-topic-card {
        padding: 12px;
    }
    .exercise-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 4px;
    }
    .exercise-box {
        height: 36px;
    }
    .mastery-topic-detail-card {
        padding: 16px;
    }
    .detail-topic-title {
        font-size: 17px;
    }
    .exercise-grid-detail {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 6px;
    }
    .exercise-btn {
        min-height: 42px;
    }
}

/* ========================================================
   CETAKAN (PRINT STYLES)
   ======================================================== */
@media print {
    body {
        background: white;
        color: black;
    }

    .app-header,
    .main-nav,
    .ra-controls-bar,
    .ra-detail-topbar,
    .settings-btn-actions,
    .toast-notice {
        display: none !important;
    }

    .app-container {
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .ra-card {
        border: 1px solid #ccc;
        box-shadow: none !important;
        break-inside: avoid;
        margin-bottom: 12px;
        padding: 12px;
    }

    .ra-indicators-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px;
    }

    .circular-progress {
        box-shadow: none;
    }

    /* Cetakan Khusus Analisis Peperiksaan */
    body.print-exam-only .app-header,
    body.print-exam-only .main-nav,
    body.print-exam-only .module-header-bar,
    body.print-exam-only .table-responsive-card:not(#exam-analysis-container),
    body.print-exam-only .module-tip-box,
    body.print-exam-only .no-print,
    body.print-exam-only .toast-notice {
        display: none !important;
    }

    body.print-exam-only #exam-analysis-print-area {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }

    body.print-exam-only .exam-print-official-header {
        display: block !important;
    }

    body.print-exam-only .exam-analysis-table {
        font-size: 8.5pt !important;
        width: 100% !important;
    }

    body.print-exam-only .exam-analysis-table th,
    body.print-exam-only .exam-analysis-table td {
        border: 1px solid #000000 !important;
        padding: 3px 2px !important;
    }
}

/* ========================================================
   MODUL ANALISIS PRESTASI PEPERIKSAAN (TABURAN GRED SPM)
   ======================================================== */
.exam-analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
}

.exam-analysis-table th,
.exam-analysis-table td {
    border: 1px solid #cbd5e1;
    padding: 5px 3px;
    text-align: center;
    vertical-align: middle;
}

.exam-analysis-table thead tr.th-row-level-1 th {
    font-weight: 700;
    font-size: 11.5px;
    background: #f1f5f9;
    color: #1e293b;
}

.exam-analysis-table thead tr.th-row-level-2 th {
    font-weight: 600;
    font-size: 10px;
    background: #f8fafc;
    color: #475569;
}

/* Kategori Lajur Mengikut Warna */
.exam-analysis-table .th-calon {
    background: #f1f5f9;
    color: #1e293b;
}

.exam-analysis-table .th-grade.grade-cemerlang {
    background: #e0f2fe;
    color: #0369a1;
}

.exam-analysis-table .th-grade.grade-kepujian {
    background: #fef3c7;
    color: #92400e;
}

.exam-analysis-table .th-grade.grade-lulus {
    background: #f3f4f6;
    color: #374151;
}

.exam-analysis-table .th-lulus {
    background: #dcfce7 !important;
    color: #15803d !important;
    font-weight: 800;
}

.exam-analysis-table .th-gagal {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    font-weight: 800;
}

.exam-analysis-table .th-gpmp {
    background: #ede9fe !important;
    color: #5b21b6 !important;
    font-weight: 800;
}

.exam-analysis-table .th-sub.sub-lulus {
    background: #ecfdf5 !important;
    color: #065f46 !important;
    font-weight: 700;
}

.exam-analysis-table .th-sub.sub-gagal {
    background: #fff1f2 !important;
    color: #9f1239 !important;
    font-weight: 700;
}

/* Sel Data */
.exam-analysis-table .td-num {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.exam-analysis-table .td-pct {
    font-size: 10px;
    color: #475569;
}

.exam-analysis-table .td-lulus {
    background: #f0fdf4;
    color: #166534;
}

.exam-analysis-table .td-gagal {
    background: #fff5f5;
    color: #dc2626;
}

.exam-analysis-table .td-gpmp {
    background: #faf5ff;
    color: #6b21a8;
    font-weight: 800;
}

.exam-analysis-table tbody tr:hover {
    background: #f8fafc;
}

.exam-analysis-table .tr-aggregate {
    background: #eef2ff !important;
    border-top: 2px solid #3b82f6;
}

.exam-analysis-table .tr-aggregate td {
    font-weight: 700;
}

.exam-analysis-table .tr-student-avg {
    background: #f8fafc !important;
    border-top: 1px solid #cbd5e1;
}

.exam-print-official-header {
    display: none;
}

