*{box-sizing:border-box} :root{--navy:#172b4d;--blue:#2463eb;--ink:#182230;--muted:#667085;--line:#e5eaf1;--bg:#f4f7fb}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.5 Arial,Helvetica,sans-serif}
a{color:var(--blue);text-decoration:none}.topbar{height:66px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 max(22px,calc((100% - 1180px)/2));gap:20px}
.brand{font-weight:800;color:var(--navy);font-size:18px}.topbar nav{display:flex;align-items:center;gap:22px;color:var(--muted)}
.container{max-width:1180px;margin:38px auto;padding:0 22px}.page-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:26px}.page-heading h1{font-size:30px;line-height:1.2;margin:4px 0 8px;color:var(--navy)}.eyebrow{font-size:11px;letter-spacing:1.4px;color:var(--blue);font-weight:800;margin:0}.muted{color:var(--muted);margin:0}.btn{display:inline-flex;justify-content:center;align-items:center;border:0;border-radius:8px;padding:11px 16px;font-weight:700;font-size:14px;cursor:pointer;white-space:nowrap}.primary{background:var(--blue);color:#fff}.secondary{background:#eef2f8;color:var(--navy)}.stats{display:grid;grid-template-columns:repeat(3,1fr);gap:16px;margin-bottom:22px}.stats article,.panel{background:#fff;border:1px solid var(--line);border-radius:12px;padding:22px}.stats span{display:block;color:var(--muted);font-size:13px}.stats strong{display:block;font-size:28px;color:var(--navy);margin-top:5px}.panel{margin-bottom:22px}.panel h2{font-size:18px;color:var(--navy);margin:0 0 18px}.panel-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:15px}.panel-head h2{margin:0}.search,input,select,textarea{font:inherit}.search{border:1px solid var(--line);border-radius:8px;padding:10px 12px;min-width:250px}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;min-width:780px}th,td{text-align:left;padding:14px 12px;border-bottom:1px solid var(--line);vertical-align:middle}th{font-size:12px;text-transform:uppercase;color:var(--muted);letter-spacing:.5px}td small{display:block;color:var(--muted);margin-top:3px}.actions{display:flex;gap:12px;align-items:center;white-space:nowrap}.actions form{display:inline}.link{border:0;background:none;color:var(--blue);padding:0;cursor:pointer;font:inherit}.danger-text{color:#d92d20}.status{padding:4px 9px;border-radius:20px;font-size:12px}.status.draft{background:#fff4db;color:#946200}.status.published{background:#e7f8ee;color:#137a42}.empty{text-align:center;padding:35px 15px;color:var(--muted)}.empty h3{color:var(--navy)}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.field{display:flex;flex-direction:column;gap:6px}.field label,form label{font-weight:700;font-size:13px;color:#344054}.field input,.field select,.field textarea,.auth-card input{width:100%;border:1px solid #d0d5dd;border-radius:8px;padding:11px 12px;background:#fff;min-width:0}.field textarea{resize:vertical}.span-2{grid-column:span 2}.editor .panel{padding:24px}.question-card{border:1px solid var(--line);border-radius:10px;padding:18px;margin:14px 0;background:#fbfcfe}.question-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px;color:var(--navy)}.remove-question{border:0;background:#fff0ef;color:#b42318;padding:7px 10px;border-radius:6px;cursor:pointer}.options-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px;margin:14px 0}.options-grid[hidden]{display:none}.marks-field{max-width:180px}.form-actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin:24px 0 50px}.error,.notice{padding:12px 14px;border-radius:8px;margin:15px 0}.error{background:#fff0ef;color:#b42318}.notice{background:#eaf8ef;color:#137a42}
.auth-body{min-height:100vh;display:grid;place-items:center;padding:20px}.auth-card{width:min(100%,420px);background:#fff;padding:34px;border:1px solid var(--line);border-radius:16px;box-shadow:0 12px 40px #18223012}.auth-card h1{color:var(--navy);margin:12px 0 5px}.auth-card p{color:var(--muted);margin-top:0}.auth-card form{display:grid;gap:10px;margin:25px 0}.auth-card form .btn{margin-top:8px}.auth-card small{color:var(--muted)}.brand-mark{height:44px;width:44px;border-radius:12px;background:var(--blue);color:#fff;display:grid;place-items:center;font-weight:800}
.print-page{background:#e9edf3}.print-toolbar{max-width:210mm;margin:18px auto;display:flex;justify-content:space-between;gap:12px}.paper-a4{width:210mm;min-height:297mm;margin:0 auto 25px;background:#fff;padding:15mm 16mm;color:#111;font-family:"Times New Roman",serif;font-size:12pt;box-shadow:0 2px 14px #00000015}.paper-header{text-align:center;border-bottom:2px solid #111;padding-bottom:10px;margin-bottom:13px}.school-logo{max-width:75px;max-height:65px;object-fit:contain}.paper-header h1{font-size:20pt;margin:3px 0;text-transform:uppercase}.paper-header p{font-size:10pt;margin:2px}.paper-header h2{font-size:15pt;margin:10px 0 3px}.paper-header h3{font-size:12pt;margin:0}.paper-meta{display:grid;grid-template-columns:1fr 1fr;gap:7px 16px;margin:15px 0;font-size:11pt}.paper-instructions{border:1px solid #333;padding:8px;margin:12px 0;font-size:11pt}.section-heading{font-size:12pt;text-decoration:underline;margin:18px 0 12px;break-after:avoid}.print-question{margin:0 0 6px;line-height:1.5;break-inside:avoid}.q-line{display:grid;grid-template-columns:22px 1fr auto;gap:5px;align-items:start}.q-marks{font-size:10pt;white-space:nowrap}.print-options{display:grid;grid-template-columns:1fr 1fr;gap:2px 12px;margin:3px 0 0 27px;line-height:1.5}.answer-space{height:55px;border-bottom:1px dotted #aaa;margin-left:27px}.paper-footer{text-align:center;font-weight:bold;margin-top:30px}
@page{size:A4 portrait;margin:0} @media print{body.print-page{background:#fff}.print-toolbar{display:none}.paper-a4{width:210mm;min-height:297mm;margin:0;box-shadow:none;padding:15mm 16mm;print-color-adjust:exact;-webkit-print-color-adjust:exact}.print-question{break-inside:avoid}.section-heading{break-after:avoid}}
@media(max-width:700px){.topbar{padding:0 16px}.topbar nav{gap:12px}.container{margin:25px auto;padding:0 14px}.page-heading{align-items:flex-start;flex-direction:column}.page-heading h1{font-size:25px}.stats{gap:9px}.stats article{padding:14px}.stats strong{font-size:23px}.stats span{font-size:12px}.panel,.editor .panel{padding:16px}.panel-head{align-items:flex-start;flex-direction:column}.search{width:100%;min-width:0}.form-grid,.options-grid{grid-template-columns:1fr}.span-2{grid-column:span 1}.form-actions{justify-content:stretch}.form-actions .btn{flex:1}.print-toolbar{margin:10px;flex-wrap:wrap}.paper-a4{width:100%;min-height:0;padding:12mm 10mm}.paper-meta{grid-template-columns:1fr 1fr}.paper-header h1{font-size:17pt}}

/* OCR handwritten question scanner */
.ocr-panel{border:1px solid #b9d0ff;background:linear-gradient(180deg,#f8fbff,#fff)}.ocr-tag{font-size:11px;font-weight:800;letter-spacing:.8px;color:#2457bd;background:#e8f0ff;padding:6px 9px;border-radius:20px;white-space:nowrap}.ocr-controls,.ocr-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center;margin:14px 0}.upload-label{cursor:pointer}.ocr-preview-wrap{margin:12px 0;padding:10px;background:#f1f4f9;border:1px dashed #c5cfdd;border-radius:8px;max-height:300px;overflow:auto;text-align:center}.ocr-preview-wrap img{max-width:100%;max-height:270px;object-fit:contain}.ocr-progress{margin:14px 0}.ocr-progress-track{height:9px;border-radius:20px;background:#e7ecf4;overflow:hidden}.ocr-progress-track div{height:100%;width:0;background:#2463eb;transition:width .2s}.ocr-progress small{display:block;color:var(--muted);margin-top:6px}.ocr-result{margin-top:14px}.ocr-result textarea{font-family:Arial,sans-serif;line-height:1.6}.ocr-help{font-size:12px;color:var(--muted);margin:10px 0 0}@media(max-width:600px){.ocr-controls .btn,.ocr-actions .btn{width:100%}.ocr-tag{display:none}}

/* Question picture uploads and print display */
.question-image-field{margin-top:4px}.question-image-input{padding:9px!important;background:#f8fafc!important}.question-image-preview{display:flex;align-items:center;gap:12px;margin-top:8px;padding:9px;border:1px dashed #cbd5e1;border-radius:8px;color:var(--muted);font-size:12px}.question-image-preview img{max-width:180px;max-height:130px;object-fit:contain;border-radius:5px}.print-question-image{margin:5px 0 6px 27px}.print-question-image img{max-width:100%;max-height:115mm;object-fit:contain;display:block}.print-question-image:empty{display:none}

/* Question editor NBSP insertion control */
.question-text-tools{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.question-text-tools label{margin:0}.insert-nbsp{padding:6px 10px;font-size:12px}
