@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap');
:root {
    --accent: #1e40af; --accent-hover: #1d4ed8; --primary-text: #1f2937; --muted-text: #6b7280;
    --border-color: #d1d5db; --bg: #f3f4f6; --card-bg: #ffffff; --success: #059669;
    --warn: #f59e0b; --danger: #dc2626; --header-bg: #eff6ff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --page-w: 210mm; --page-h: 297mm;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUpIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(15px); } }

html { scroll-behavior: smooth; }
body { margin: 0; background-color: var(--bg); font-family: var(--font-sans); color: var(--primary-text); font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }

.page-container { max-width: 1400px; margin: 0 auto; padding: 0 24px; animation: fadeIn 0.5s ease-out; }
.page-header { position: sticky; top: 16px; z-index: 100; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); padding: 12px 16px; border-radius: 12px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 1px solid var(--border-color); display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
main { padding-top: 16px; }

.toolbar-group { display: flex; gap: 10px; align-items: center; }
.toolbar-group.main-actions { flex: 1 1 auto; }
.toolbar-group.secondary-actions { flex-shrink: 0; }
.group { display: flex; gap: 10px; align-items: center; }
.group label { font-size: 13px; color: var(--muted-text); font-weight: 500; }

select, input[type=text], input[type=number], input[type=date], input[type=email], input[type=password] { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 8px; min-width: 160px; background: var(--card-bg); font-family: var(--font-sans); font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1); }
select:disabled, input:disabled { background-color: #f3f4f6; color: #9ca3af; cursor: not-allowed; opacity: 1; }

button, a.btn { padding: 9px 16px; background-color: var(--accent); color: white; border: none; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 13px; transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s; }
button:hover, a.btn:hover { background-color: var(--accent-hover); box-shadow: 0 4px 12px rgba(30, 64, 175, 0.15); }
button:active, a.btn:active { transform: translateY(1px); }
button.secondary, a.btn.secondary { background-color: #f3f4f6; color: #374151; border: 1px solid var(--border-color); }
button.secondary:hover, a.btn.secondary:hover { background-color: #e5e7eb; }
button.ghost { background: transparent; color: var(--accent); border: 1px solid #bfd5ff; }
button.ghost:hover { background: #e0f2fe; }
button.danger { background-color: var(--danger); color: white; }
button.danger:hover { background-color: #b91c1c; }
button:disabled, a.btn[aria-disabled="true"] { background-color: #e5e7eb; color: #9ca3af; cursor: not-allowed; box-shadow: none; transform: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: #e0f2fe; color: var(--accent); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; border: 1px solid rgba(30, 64, 175, 0.1); }

.hamburger-btn { background: transparent; border: none; padding: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; transition: background-color 0.2s; }
.hamburger-btn:hover { background-color: #f3f4f6; }
.hamburger-btn .icon { width: 24px; height: 24px; color: var(--primary-text); }

.nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.nav-backdrop.open { opacity: 1; visibility: visible; }

.nav-drawer { position: fixed; top: 0; left: 0; height: 100%; width: 280px; background: var(--card-bg); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); z-index: 1001; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease-in-out; overflow-y: auto; }
.nav-drawer.open { transform: translateX(0); }
.nav-header { padding: 16px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.nav-header h3 { margin: 0; font-size: 18px; color: var(--accent); }
.nav-links { list-style: none; padding: 16px 0; margin: 0; flex-grow: 1; overflow-y: auto; }
.nav-links li a { display: flex; align-items: center; gap: 12px; padding: 12px 20px; text-decoration: none; color: var(--primary-text); font-weight: 600; font-size: 14px; border-left: 3px solid transparent; transition: background-color 0.2s, border-color 0.2s; }
.nav-links li a:hover { background-color: #f9fafb; border-left-color: var(--accent); }
.nav-links li a .icon { width: 24px; height: 24px; }
.nav-links li a.danger-link { color: var(--danger); }
.nav-links li a.danger-link:hover { background-color: #fef2f2; border-left-color: var(--danger); }
.nav-links .separator { height: 1px; background-color: var(--border-color); margin: 12px 20px; }

#drop_zone { border: 2px dashed var(--border-color); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; transition: background-color 0.2s; flex-grow: 1; }
#drop_zone.dragover { background-color: #e0f2fe; border-color: var(--accent); }
#drop_zone p { margin: 0; color: var(--muted-text); font-weight: 500; }
#drop_zone p small { display: block; font-size: 12px; margin-top: 4px; }
#filename { font-weight: 600; color: var(--accent); margin-top: 8px; font-size: 13px; }

.panel { background: var(--card-bg); border-radius: 12px; padding: 24px; border: 1px solid var(--border-color); margin-bottom: 20px; animation: slideUpIn 0.5s ease-out forwards; }
.panel h3 { margin: 0 0 16px 0; font-size: 18px; color: var(--primary-text); }
.two-col { display: grid; grid-template-columns: 1fr 400px; gap: 24px; }

#statusBar { position: sticky; top: calc(16px + 65px + 12px); z-index: 50; background: var(--card-bg); border-radius: 10px; padding: 8px 16px; border: 1px solid var(--border-color); font-size: 13px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#statusBar .left { font-weight: 600; }
#statusBar.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
#statusBar.warn { background: #fffbeb; border-color: #fde68a; color: #854d0e; }
#statusBar.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Report View CSS optimized for Display */
.sheet {
    width: 100%;
    min-height: 420px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    box-sizing: border-box;
}

.school-head { display: flex; justify-content: center; align-items: center; line-height: 1; margin-bottom: 10px; padding: 10px 0; border-bottom: 2px solid #e5e7eb; }
.school-head h1 { margin: 0; font-size: 24px; font-weight: 800; color: var(--primary-text); letter-spacing: -0.5px; }
.school-head .addr { font-size: 12px; color: var(--muted-text); margin-top: 2px; }
.school-head .motto { margin-top: 4px; font-weight: 700; color: var(--accent); font-size: 14px; }
.key { font-size: 11px; color: var(--muted-text); text-align: center; margin: 8px 0; padding: 4px 8px; background: #f9fafb; border-radius: 4px; }
.title { text-align: center; font-weight: 700; margin: 10px 0 16px; font-size: 16px; text-transform: uppercase; color: var(--primary-text); }

.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; border: 1px solid var(--border-color); padding: 12px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; background: #fcfcfc; }
.meta div { display: flex; gap: 8px; align-items: center; }
.meta label { font-weight: 700; min-width: 110px; color: var(--primary-text); }

table.report { width: 100%; border-collapse: collapse; font-size: 11.5px; table-layout: fixed; margin-bottom: 12px; }
table.report th, table.report td { border: 1px solid #d1d5db; padding: 7px 4px; text-align: center; word-break: break-word; }
table.report th { background-color: var(--header-bg); font-weight: 700; color: var(--primary-text); }
table.report thead th:first-child { width: 18%; min-width: 18%; }
table.report tbody td { padding: 9px 4px; }
table.report tbody tr:nth-child(even) { background-color: #f9fafb; }
table.report td.label { text-align: left; padding-left: 10px; font-weight: 700; color: #374151; }

.grade-ee, .grade-ee1, .grade-ee2 { color: #28a745; font-weight: 700; }
.grade-me, .grade-me1, .grade-me2 { color: #007bff; font-weight: 700; }
.grade-ae, .grade-ae1, .grade-ae2 { color: #ffbf00; font-weight: 700; }
.grade-be, .grade-be1, .grade-be2 { color: #6c757d; font-weight: 700; }

.performance-section { display: flex; align-items: flex-start; gap: 15px; margin: 15px 0; }
.performance-label { font-weight: 800; color: var(--primary-text); font-size: 12px; flex-shrink: 0; width: 35%; line-height: 1.3; padding-top: 5px; }

.label-style-1 { color: #8433FF; }
.label-style-2 { color: #007bff; }
.label-style-3 { color: #28a745; }

.mini-chart-wrap { margin: 0; flex-grow: 1; position: relative; height: 90px; display: flex; gap: 5px; }
.y-axis-labels { display: flex; flex-direction: column; justify-content: space-between; font-size: 9px; font-weight: 500; color: var(--muted-text); height: 70px; margin-top: 5px; text-align: right; flex-shrink: 0; width: 30px; }
.mini-chart { flex-grow: 1; display: flex; justify-content: space-around; align-items: flex-end; position: relative; height: 70px; width: 100%; border-bottom: 1px solid #333; border-left: 1px solid #333; margin-top: 5px; padding: 0 5%; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; border-top: 1px dashed #d1d5db; z-index: 0; }
.bar-item { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; position: relative; height: 100%; width: 30%; margin: 0; text-align: center; z-index: 1; }
.chart-bar { height: var(--bar-height); width: 100%; min-height: 3px; border-radius: 4px 4px 0 0; transition: height 0.5s ease-out; }

.bar-generic-1 { background: linear-gradient(to top, #007bff, #5aa5ff); box-shadow: 0 -2px 4px rgba(0, 123, 255, 0.3); }
.bar-generic-2 { background: linear-gradient(to top, #28a745, #5cb85c); box-shadow: 0 -2px 4px rgba(40, 167, 69, 0.3); }
.bar-generic-3 { background: linear-gradient(to top, #ffc107, #ffd54f); box-shadow: 0 -2px 4px rgba(255, 193, 7, 0.3); }
.bar-generic-4 { background: linear-gradient(to top, #dc3545, #e06e78); box-shadow: 0 -2px 4px rgba(220, 53, 69, 0.3); }
.bar-generic-5 { background: linear-gradient(to top, #6f42c1, #9b72d9); box-shadow: 0 -2px 4px rgba(111, 66, 193, 0.3); }

.bar-value { font-size: 10px; font-weight: 700; color: var(--primary-text); margin-bottom: 2px; white-space: nowrap; text-shadow: 0 0 2px white; }

.chart-labels {
    position: absolute;
    bottom: 5px;
    left: 35px;
    right: 0;
    display: flex;
    justify-content: space-around;
    padding: 0 5%;
}

.chart-label {
    width: auto;
    text-align: center;
    font-weight: 600;
    line-height: 1.1;
    font-size: 10px;
    white-space: nowrap;
    transform: translateY(80%);
}

.comments-row, .sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; font-size: 12px; }
.comments-block { display: flex; flex-direction: column; gap: 4px; }
.comments-block>div:first-child { font-weight: 700; margin-bottom: 0px; color: var(--accent); border-bottom: 1px dashed #e5e7eb; padding-bottom: 4px; font-size: 13px; }
.comments-block>div:nth-child(2) { min-height: 30px; line-height: 1.3; color: var(--primary-text); }

.sign-row { margin-top: 10px; padding: 5px 0; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.sign-row.foot-dates { margin-top: 10px; padding: 5px 0; border: none; border-bottom: 1px solid var(--border-color); }
.sign { border: none; border-bottom: 1px solid #9ca3af; padding: 0; border-radius: 0; min-height: 20px; background: transparent; line-height: 1.2; font-size: 11px; display: flex; align-items: flex-end; padding-bottom: 2px; }
.sign b { color: #374151; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.sign .signature-font { font-family: 'Dancing Script', cursive; font-size: 20px; color: #223c8a; padding: 0 5px; }

/* PERFECT 1:1 PRINT MEDIA CASCADE */
@media print {
    @page { size: A4 portrait; margin: 5mm; } 
    html, body, main, #mainContent, #batchContainer {
        background: #fff !important; 
        margin: 0 !important; 
        padding: 0 !important;
        width: 100% !important;
        -webkit-print-color-adjust: exact; print-color-adjust: exact;
    }
    .page-header, .panel, #statusBar, .toasts, .nav-drawer, .nav-backdrop, #firebaseAuthOverlay { display: none !important; }
    #batchContainer { display: block !important; }

    .sheet { 
        width: 100% !important; 
        margin: 0 !important; 
        padding: 5mm !important; 
        border: none !important; 
        border-radius: 0 !important; 
        box-shadow: none !important; 
        box-sizing: border-box !important; 
        overflow: visible !important; 
        page-break-inside: auto !important; 
        break-inside: auto !important; 
        page-break-after: always;
        break-after: page;
        height: auto !important; 
    }
    
    .sheet:last-child {
        page-break-after: auto !important;
        break-after: auto !important;
    }

    .school-head h1 { font-size: 18px !important; margin-bottom: 2px !important; }
    .school-head .addr { font-size: 11px !important; margin-top: 0 !important; }
    .school-head .motto { font-size: 12px !important; margin-top: 2px !important; }
    .title { font-size: 14px !important; margin: 6px 0 10px !important; }
    
    table.report { font-size: 10.5px !important; margin-bottom: 8px !important; }
    table.report th, table.report td { padding: 6px 3px !important; border-color: #000 !important; } 
    .meta { font-size: 11px !important; padding: 6px !important; margin-bottom: 8px !important; gap: 4px 10px !important; }
    .comments-block>div:nth-child(2) { min-height: 35px !important; font-size: 11px !important; } 
    .mini-chart-wrap { height: 75px !important; } 
    .mini-chart { height: 50px !important; padding-bottom: 4px !important; }
    .chart-bar { min-height: 2px !important; }
    .bar-value { font-size: 9px !important; margin-bottom: 1px !important; }
    .chart-labels, .chart-label { font-size: 9px !important; }
    .comments-row, .sign-row { margin-top: 12px !important; gap: 10px !important; } 
    .sign { min-height: 22px !important; padding-bottom: 0 !important; font-size: 11px !important; } 
    .sign-row.foot-dates { margin-top: 12px !important; }
}

@media print {
    .sheet table, .sheet thead, .sheet tbody, .sheet tr, .sheet td, .sheet th { page-break-inside: avoid !important; break-inside: avoid !important; }
    .comments-row, .sign-row, .meta, .performance-section { page-break-inside: avoid !important; break-inside: avoid !important; }
    img, svg { max-width: 100% !important; max-height: 120mm !important; height: auto !important; }
}

.sheet, .sheet table, .sheet tr, .sheet td {
    page-break-inside: avoid;
    break-inside: avoid;
}
.sheet {
    height: auto !important;
    overflow: visible !important;
}

.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 12px; z-index: 9999; width: 90vw; max-width: 400px; align-items: center; }
.toast { background: #27272a; color: white; padding: 12px 16px; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); font-size: 14px; display: flex; align-items: center; gap: 8px; font-weight: 500; animation: toastIn 0.4s ease-out; width: 100%; box-sizing: border-box; justify-content: center; text-align: center; }
.toast.exiting { animation: toastOut 0.4s ease-in forwards; }
.toast.success { background-color: var(--success); }
.toast.error { background-color: var(--danger); }
.toast.warn { background-color: var(--warn); color: #1e293b; }

dialog { border-radius: 12px; padding: 0; border: 1px solid var(--border-color); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); max-width: 740px; width: 90%; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
dialog[open] { animation: slideUpIn 0.4s ease-out; }
.dlg-hd { padding: 16px 20px; font-weight: 700; font-size: 16px; border-bottom: 1px solid var(--border-color); }
.dlg-bd { padding: 20px; line-height: 1.6; }
.dlg-ft { padding: 12px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid #f9fafb; background: #f9fafb; }
#errorDlg .dlg-hd { background: #fef2f2; color: var(--danger); }
#confirmDlg .dlg-hd { background: #fffbeb; color: #854d0e; }
pre.err { background: #f9fafb; border: 1px solid var(--border-color); padding: 12px; max-height: 240px; overflow: auto; border-radius: 6px; font-size: 13px; white-space: pre-wrap; }

.la-grid { display: grid; grid-template-columns: 1fr 120px auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.la-grid > label { font-weight: 600; font-size: 12px; color: var(--muted-text); padding-bottom: 4px; }
.la-grid-header { border-bottom: 1px solid var(--border-color); }
.la-item input[type="text"] { width: 100%; }
.la-item .key-display { font-family: monospace; font-size: 13px; color: var(--muted-text); padding: 8px 12px; background: #f9fafb; border-radius: 8px; border: 1px solid var(--border-color); }

.details-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.details-form .input-group { display: flex; flex-direction: column; gap: 6px; }
.details-form label { font-weight: 600; font-size: 13px; color: var(--primary-text); }
.details-form input, .details-form select { width: 100%; }

.user-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.user-badge.admin { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.user-badge.user { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

@media (max-width: 960px) {
    .page-container { padding: 0 16px; margin: 0 auto; }
    .page-header { flex-direction: column; align-items: stretch; top: 0; border-radius: 0; }
    #statusBar { top: 150px; }
    .two-col { grid-template-columns: 1fr; }
    .panel { padding: 16px; }
}
@media (max-width: 768px) {
    #statusBar { top: 200px; }
    .toolbar-group { flex-wrap: wrap; }
    .details-form { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .toast { font-size: 13px; padding: 10px; }
    .user-badge { max-width: 180px; font-size: 11px; }
}

/* Role-based UI Hiding */
body.user-mode .restricted-action { display: none !important; }
body.user-mode #livePreviewContainer { display: none !important; }
body.user-mode .two-col { grid-template-columns: 1fr !important; }

#firebaseAuthOverlay { position: fixed; inset: 0; background: rgba(243, 244, 246, 0.95); z-index: 9999; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.auth-card { background: white; padding: 32px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 100%; max-width: 400px; text-align: center; border: 1px solid var(--border-color); }
.auth-card h2 { color: var(--accent); margin-top: 0; font-size: 22px; font-weight: 800; }
.auth-card p { color: var(--muted-text); font-size: 14px; margin-bottom: 24px; }
.auth-card .input-group { text-align: left; margin-bottom: 16px; }

/* ADD MARKS PANEL STYLES */
.am-section { background: #fcfcfc; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.am-title { margin: 0 0 14px 0; font-size: 13px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }
.am-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 12px; }
.am-grid-3 .input-group { display: flex; flex-direction: column; gap: 6px; }
.am-grid-3 label { font-size: 12px; font-weight: 700; color: var(--primary-text); }
.am-grid-3 input, .am-grid-3 select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); font-size: 14px; width: 100%; box-sizing: border-box; background: #fff; font-family: var(--font-sans); }
.am-grid-3 input:focus, .am-grid-3 select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1); }

.am-btn-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.am-btn { padding: 8px 16px; border-radius: 99px; border: 1px solid var(--border-color); background: #f9fafb; color: var(--muted-text); font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; flex: 1 1 auto; text-align: center; }
.am-btn.active { background: #e0f2fe; color: var(--accent); border-color: #bae6fd; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.am-btn:hover:not(.active) { background: #e5e7eb; color: var(--primary-text); }

.grade-group { display: none; }
.grade-group.active { display: flex; animation: fadeIn 0.3s; }

.am-subjects-grid { display: grid; grid-template-columns: 1fr; gap: 8px; max-height: 380px; overflow-y: auto; padding-right: 4px; margin-bottom: 12px; }
.am-subject-row { display: flex; align-items: center; justify-content: space-between; background: #fff; padding: 8px 14px; border-radius: 8px; border: 1px solid #e5e7eb; }
.am-subject-name { font-size: 13px; font-weight: 700; color: var(--primary-text); flex: 1; text-align: left; }
.am-subject-input-wrapper { display: flex; align-items: center; justify-content: flex-end; gap: 8px; width: 140px; }
.am-subject-input { width: 70px; text-align: center; padding: 8px; border-radius: 8px; border: 1px solid var(--border-color); font-size: 15px; font-weight: 800; color: var(--accent); background: #f9fafb; transition: all 0.2s; }
.am-subject-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1); background: #fff; }
.am-outof-label { font-size: 12px; color: var(--muted-text); font-weight: 600; white-space: nowrap; margin: 0; }

.am-split-view { display: flex; gap: 16px; flex-direction: column; }
@media (min-width: 768px) {
    .am-split-view { flex-direction: row; align-items: flex-start; }
    .am-learner-list-wrap { width: 220px; flex-shrink: 0; }
    .am-marks-entry { flex: 1; }
}
.am-learner-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; padding-right: 4px; }
.am-learner-item { padding: 12px 14px; background: #fff; border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.am-learner-item:hover { border-color: #93c5fd; background: #f0fdf4; }
.am-learner-item.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 6px rgba(30, 64, 175, 0.2); }
.am-learner-item .status { width: 10px; height: 10px; border-radius: 50%; background: #d1d5db; box-shadow: inset 0 1px 2px rgba(0,0,0,0.1); }
.am-learner-item.has-marks .status { background: #34d399; }
.am-learner-item.active .status { border: 2px solid #fff; }

.add-marks-flow { display: flex; flex-direction: column; }

/* Grid View Styles */
.am-grid-table-container::-webkit-scrollbar { width: 8px; height: 8px; }
.am-grid-table-container::-webkit-scrollbar-thumb { background-color: #cbd5e1; border-radius: 4px; }
#amGridTable th {
    background: var(--header-bg);
    color: var(--primary-text);
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
}
#amGridTable td.learner-name-cell {
    text-align: left;
    font-weight: 600;
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 5;
    min-width: 180px;
    border-right: 2px solid var(--border-color);
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
}
#amGridTable tr:hover td.learner-name-cell {
    background: #f9fafb;
}
.grid-score-input {
    width: 100%;
    min-width: 60px;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    background: #f9fafb;
    transition: all 0.2s;
    box-sizing: border-box;
}
.grid-score-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    background: #fff;
}
.grid-score-input:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Assigned Subjects (Teacher Management) Custom Styles */
.subject-checkboxes-container { border: 1px solid var(--border-color); border-radius: 8px; background: #fcfcfc; }
.grade-subject-panels .grade-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; max-height: 250px; overflow-y: auto; padding: 12px; }
.subject-pill { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; user-select: none; }
.subject-pill.selected { border-color: var(--accent); background: #e0f2fe; color: var(--accent); }
.subject-pill input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.grade-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 8px; border-bottom: 1px solid var(--border-color); background: #f9fafb; border-radius: 8px 8px 0 0; }
.grade-tabs::-webkit-scrollbar { height: 4px; }
.grade-tabs::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }