:root{--red:#c91c2b;--red2:#8f1020;--bg:#f6f7fb;--card:#fff;--text:#1c2430;--muted:#717b8b;--border:#e7e9ef;--shadow:0 10px 32px rgba(26,36,52,.08);--radius:18px}*{box-sizing:border-box}body{margin:0;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:var(--text);background:var(--bg)}button,input,select{font:inherit}button{cursor:pointer;border:0}.hidden{display:none!important}.shell{min-height:100vh;display:flex}.sidebar{width:270px;background:linear-gradient(180deg,var(--red2),var(--red));color:#fff;padding:24px 18px;position:fixed;left:0;top:0;bottom:0;display:flex;flex-direction:column;z-index:10}.brand{display:flex;align-items:center;gap:12px;margin-bottom:28px}.logo{width:46px;height:46px;border-radius:14px;background:#fff1f3;display:flex;align-items:center;justify-content:center;color:var(--red2);font-weight:900;overflow:hidden}.logo img{width:100%;height:100%;object-fit:cover}.brand h2{font-size:17px;margin:0}.brand span{font-size:11px;opacity:.75}.nav{display:flex;flex-direction:column;gap:7px}.nav button{background:transparent;color:#fff;text-align:left;padding:13px 14px;border-radius:12px;opacity:.88}.nav button:hover,.nav button.active{background:rgba(255,255,255,.15);opacity:1}.credit{margin-top:auto;padding:12px;font-size:12px;line-height:1.6;opacity:.88}.main{margin-left:270px;min-height:100vh;width:calc(100% - 270px)}.topbar{height:76px;background:#fff;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:5}.topbar h1{font-size:23px;margin:0}.who{display:flex;align-items:center;gap:10px;color:var(--muted);font-size:13px}.avatar{width:38px;height:38px;border-radius:50%;background:#ffe6ea;color:var(--red2);display:flex;align-items:center;justify-content:center;font-weight:800}.content{padding:28px}.page{display:none}.page.active{display:block}.card{background:var(--card);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:22px;margin-bottom:20px}.grid{display:grid;gap:18px}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}.class-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:16px}.class-box{padding:20px;border-radius:17px;color:#fff;min-height:110px;display:flex;flex-direction:column;justify-content:center;box-shadow:var(--shadow);transition:.2s}.class-box:hover{transform:translateY(-2px)}.class-box strong{font-size:18px}.class-box span{opacity:.9;margin-top:6px}.field{display:flex;flex-direction:column;gap:7px}.field label{font-size:12px;color:var(--muted);font-weight:700}.field input,.field select{width:100%;border:1px solid var(--border);border-radius:11px;padding:11px 12px;outline:none;background:#fff}.field input:focus,.field select:focus{border-color:var(--red);box-shadow:0 0 0 3px rgba(201,28,43,.08)}.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.btn{padding:11px 15px;border-radius:11px;font-weight:800}.btn-primary{background:var(--red);color:#fff}.btn-primary:hover{filter:brightness(.95)}.btn-soft{background:#f1f3f7;color:#3b4554}.btn-danger{background:#feecee;color:#b51628}.btn-small{padding:8px 10px;font-size:12px}.title-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}.title-row h2{margin:0;font-size:18px}.muted{color:var(--muted);font-size:13px}.student-table{width:100%;border-collapse:collapse}.student-table th,.student-table td{padding:12px 10px;border-bottom:1px solid var(--border);text-align:left}.student-table th{font-size:12px;color:var(--muted)}.day-card{border:1px solid var(--border);border-radius:16px;padding:15px}.day-head{display:flex;align-items:center;justify-content:space-between}.plus{width:34px;height:34px;border-radius:10px;background:#ffe8eb;color:var(--red);font-size:24px;line-height:1}.test-item{display:flex;align-items:center;justify-content:space-between;gap:12px;background:#fafbfc;border:1px solid var(--border);border-radius:12px;padding:11px;margin-top:10px}.test-main strong{display:block}.test-main small{color:var(--muted)}.empty{padding:20px;text-align:center;color:var(--muted)}.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at top right,#ffe9ec,#f7f8fb 42%)}.login-card{width:min(440px,100%);background:#fff;border:1px solid var(--border);box-shadow:var(--shadow);border-radius:24px;padding:34px}.login-card .brand{color:var(--text)}.login-card .logo{background:#ffe8eb}.login-card h1{font-size:28px;margin:6px 0}.login-card p{color:var(--muted);font-size:13px;line-height:1.6}.toast{position:fixed;right:20px;bottom:20px;background:#1f2937;color:#fff;padding:13px 16px;border-radius:12px;box-shadow:var(--shadow);z-index:100;max-width:360px}.badge{display:inline-flex;padding:5px 9px;border-radius:20px;background:#fff0f2;color:var(--red2);font-size:11px;font-weight:800}.settings-color{height:45px;padding:4px}.modal{position:fixed;inset:0;background:rgba(13,18,27,.5);display:grid;place-items:center;padding:20px;z-index:50}.modal-card{background:#fff;border-radius:18px;max-width:550px;width:100%;padding:22px}.modal-head{display:flex;justify-content:space-between;align-items:center}.modal-head h3{margin:0}.close{background:#f0f2f5;border-radius:9px;width:34px;height:34px}.week-controls{display:grid;grid-template-columns:1fr 1fr;gap:14px}.report-frame{max-width:820px;margin:auto;background:#fff;border-radius:20px;overflow:hidden;box-shadow:var(--shadow);border:1px solid var(--border)}.report-head{padding:30px;text-align:center;background:linear-gradient(135deg,#fff,#fff3f5);border-bottom:5px solid var(--red)}.report-head img{width:70px;height:70px;border-radius:18px;object-fit:cover}.report-head h2{color:var(--red2);margin:10px 0 5px}.report-meta{display:grid;grid-template-columns:1fr 1fr;padding:22px;gap:10px;background:#fff}.meta-chip{border:1px solid var(--border);border-radius:12px;padding:12px}.meta-chip b{display:block;font-size:11px;color:var(--muted);margin-bottom:3px}.report-day{padding:0 22px 20px}.report-day h3{font-size:14px;color:var(--red2);border-left:4px solid var(--red);padding-left:9px}.report-day table{width:100%;border-collapse:collapse;table-layout:fixed}.report-day th:nth-child(1),.report-day td:nth-child(1){width:48%;text-align:left}.report-day th:nth-child(2),.report-day td:nth-child(2){width:14%;text-align:center}.report-day th:nth-child(3),.report-day td:nth-child(3){width:19%;text-align:center}.report-day th:nth-child(4),.report-day td:nth-child(4){width:19%;text-align:center;white-space:nowrap}.report-day td,.report-day th{padding:9px;border-bottom:1px solid var(--border);font-size:13px;overflow:hidden}.report-day td.status-cell{font-size:11px;white-space:normal;overflow-wrap:anywhere;word-break:normal;line-height:1.15}.report-day th{text-align:left;color:var(--muted)}.warning{padding:12px 14px;background:#fff6dc;border:1px solid #f3dda3;border-radius:12px;color:#765b12;font-size:13px}.setup-link{color:var(--red2);font-size:12px;text-decoration:none;display:block;margin-top:12px}.mobile-toggle{display:none}@media(max-width:1000px){.sidebar{width:230px}.main{margin-left:230px;width:calc(100% - 230px)}.class-grid{grid-template-columns:repeat(3,1fr)}}@media(max-width:760px){.sidebar{transform:translateX(-100%);transition:.25s}.sidebar.open{transform:translateX(0)}.main{margin-left:0;width:100%}.mobile-toggle{display:block;background:#f1f3f7;border-radius:10px;padding:9px 11px}.grid-2,.grid-3,.grid-4,.class-grid,.report-meta,.week-controls{grid-template-columns:1fr 1fr}.topbar{padding:0 15px}.content{padding:15px}.topbar h1{font-size:18px}.grid-2{grid-template-columns:1fr}.class-grid{grid-template-columns:1fr 1fr}}
.image-preview{min-height:90px;border:1px dashed var(--border);border-radius:12px;display:flex;align-items:center;justify-content:center;color:var(--muted);overflow:hidden;padding:6px}.image-preview img{max-width:100%;height:90px;object-fit:cover;border-radius:10px}.table-wrap{overflow:auto}.table-photo{width:36px;height:36px;border-radius:9px;object-fit:cover}.school-brand-row{display:flex;align-items:center;justify-content:center;gap:14px}.school-brand-row img{width:70px;height:70px;border-radius:18px;object-fit:cover}.student-report-photo{width:92px;height:92px;border-radius:50%;object-fit:cover;border:4px solid var(--red);margin-bottom:14px}

.student-name-line{display:flex;align-items:center;gap:10px;margin-top:6px}.student-name-line .student-report-photo{width:48px;height:48px;border-radius:10px;border:2px solid var(--red);margin:0;object-fit:cover;flex:none}
/* Polished student-report preview: intentionally mirrors the PDF structure. */
.report-frame{max-width:820px;margin:24px auto;background:#fff;border:1px solid var(--border);border-radius:22px;overflow:hidden;box-shadow:0 18px 55px rgba(26,36,52,.12)}
.report-head{padding:24px 28px;background:linear-gradient(135deg,#fff,#fff1f3);border-bottom:5px solid var(--red)}
.school-brand-row{display:flex;align-items:center;justify-content:center;gap:16px;text-align:left}.school-brand-row img{width:74px;height:74px;border-radius:18px;object-fit:cover;background:#fff;border:1px solid rgba(0,0,0,.05);box-shadow:0 8px 22px rgba(26,36,52,.08)}
.school-brand-row h2{margin:0 0 5px;color:var(--red2);font-size:25px;line-height:1.15}.school-brand-row div div{font-size:13px;color:var(--muted);font-weight:700;letter-spacing:.02em}
.report-student-card{margin:22px;display:flex;gap:22px;align-items:stretch;border:1px solid var(--border);border-radius:18px;background:#fff;padding:16px;box-shadow:0 8px 28px rgba(26,36,52,.06)}
.report-photo-box{width:124px;min-width:124px;height:124px;border-radius:16px;border:1px solid var(--border);background:#f7f8fa;display:flex;align-items:center;justify-content:center;overflow:hidden;color:var(--muted);font-size:11px;font-weight:800;letter-spacing:.08em}.report-photo-box .student-report-photo{width:100%;height:100%;border:0;border-radius:0;margin:0;object-fit:cover}
.report-student-details{flex:1;padding:3px 4px}.report-label{font-size:10px;color:var(--muted);font-weight:900;letter-spacing:.08em}.report-big-name{font-size:28px;font-weight:900;line-height:1.1;margin:6px 0 20px;color:var(--text)}.report-detail-grid{display:grid;grid-template-columns:1fr 1.4fr;gap:16px}.report-detail-grid strong{display:block;margin-top:6px;font-size:15px;color:var(--text)}
.report-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:0 22px 22px;width:calc(100% - 44px);box-sizing:border-box}.report-summary>div{min-width:0;box-sizing:border-box;overflow:hidden}.report-summary span{display:block;font-size:10px;color:var(--muted);font-weight:900;letter-spacing:.08em}.report-summary b{display:block;font-size:22px;line-height:1.1;margin-top:5px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;letter-spacing:-.01em}
.report-day{padding:0 22px 18px}.report-day h3{margin:0 0 10px;padding:10px 13px;border-left:4px solid var(--red);background:linear-gradient(90deg,#fff2f4,#fff);color:var(--red2);font-size:13px;letter-spacing:.08em}.report-day table{width:100%;table-layout:fixed;border-collapse:separate;border-spacing:0;overflow:hidden;border:1px solid var(--border);border-radius:12px}.report-day th:last-child,.report-day td:last-child{width:15%;white-space:nowrap}.report-day th{background:#f4f5f7;color:#596273;font-weight:900;font-size:11px}.report-day td,.report-day th{padding:11px 12px;border-bottom:1px solid var(--border);font-size:13px;text-align:left}.report-day tr:last-child td{border-bottom:0}.report-day td:nth-child(n+2),.report-day th:nth-child(n+2){text-align:center}
.report-empty{margin:0 22px 22px;padding:18px;border:1px dashed var(--border);border-radius:14px;background:#fafbfc;color:var(--muted);text-align:center;font-size:13px}
.report-footer{display:flex;justify-content:space-between;gap:12px;margin:8px 22px 18px;padding-top:12px;border-top:1px solid var(--border);font-size:11px;color:var(--muted)}
@media(max-width:760px){.report-student-card{margin:15px;gap:14px}.report-photo-box{width:92px;min-width:92px;height:92px}.report-big-name{font-size:21px;margin-bottom:14px}.report-detail-grid{grid-template-columns:1fr}.report-summary{margin:0 15px 18px;grid-template-columns:1fr}.report-day{padding:0 15px 15px}.report-footer{margin-left:15px;margin-right:15px}}

/* Dedicated report filter panel */
.report-filter-card{margin:4px 0 2px;background:#fbfbfc;border:1px solid var(--border);border-radius:16px;padding:16px 18px;box-shadow:0 6px 20px rgba(26,36,52,.04)}
.report-filter-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid var(--border)}
.filter-kicker{font-size:10px;color:var(--red2);font-weight:900;letter-spacing:.1em;margin-bottom:3px}
.report-filter-head strong{font-size:16px;color:var(--text)}
.filter-badge{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;background:#fff0f2;color:var(--red2);font-size:11px;font-weight:900;white-space:nowrap}
@media(max-width:760px){.report-filter-head{align-items:flex-start}.report-filter-card{padding:14px}}
.report-controls-card{margin-bottom:18px}.report-controls-card .title-row{margin-bottom:18px}.report-filter-card{margin:0;background:linear-gradient(180deg,#fff,#fafbfc);border:1px solid var(--border);border-radius:18px;padding:18px 20px;box-shadow:0 8px 24px rgba(26,36,52,.06)}.report-filter-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:16px;padding-bottom:13px;border-bottom:1px solid var(--border)}.filter-kicker{font-size:10px;letter-spacing:.14em;font-weight:900;color:var(--red);margin-bottom:4px}.filter-badge{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;background:#fff0f2;color:var(--red2);font-size:11px;font-weight:800;border:1px solid #f5d3d8}.report-preview-card{padding:18px}.report-preview-label{font-size:10px;letter-spacing:.14em;font-weight:900;color:var(--muted);padding:0 4px 10px;margin-bottom:4px;border-bottom:1px solid var(--border)}.report-preview-card #reportPreview:empty{display:none}

/* Refined report header and four-card summary */
.report-head{padding:18px 22px;background:linear-gradient(135deg,#fff 0%,#fff7f8 55%,#fff0f2 100%);border-bottom:4px solid var(--red);position:relative;overflow:hidden}
.report-head:before{content:"";position:absolute;inset:0 auto 0 0;width:7px;background:var(--red)}
.report-head-inner{display:flex;align-items:center;justify-content:space-between;gap:20px;max-width:100%;}
.school-brand-row{display:flex;align-items:center;justify-content:flex-start;gap:14px;text-align:left;min-width:0}
.report-logo-box{width:72px;height:72px;flex:none;border-radius:18px;background:#fff;border:1px solid #e5e7ec;box-shadow:0 5px 14px rgba(26,36,52,.08);display:flex;align-items:center;justify-content:center;overflow:hidden}
.report-logo-box img{width:62px;height:62px;object-fit:contain;border-radius:12px}
.report-logo-box span{font-size:20px;font-weight:900;color:var(--red2)}
.report-head-copy{min-width:0}
.report-head-copy h2{margin:0 0 5px;font-size:27px;line-height:1.1;color:var(--red2);font-weight:900}
.report-head-copy>div{font-size:14px;color:#536072;margin-bottom:4px}
.report-head-copy small{font-size:11px;color:var(--muted);font-weight:700;letter-spacing:.04em}
.report-badge{flex:none;display:flex;align-items:center;gap:9px;padding:10px 15px;border:1px solid #e2e5eb;border-radius:999px;background:#fff;box-shadow:0 5px 14px rgba(26,36,52,.05);font-size:11px;font-weight:900;color:var(--red2);letter-spacing:.04em}
.report-badge span{display:block;width:6px;height:24px;border-radius:4px;background:var(--red)}
.report-summary{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px!important}
@media(max-width:760px){.report-head{padding:16px}.report-head-inner{align-items:flex-start;flex-direction:column}.report-badge{align-self:flex-start}.report-head-copy h2{font-size:22px}.report-summary{grid-template-columns:1fr 1fr}}

/* Final summary-card sizing fix */
.report-summary{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px!important;width:100%!important;max-width:100%!important;min-width:0!important;}
.report-summary>div{min-width:0!important;width:100%!important;overflow:hidden!important;box-sizing:border-box!important;padding:13px 10px!important;}
.report-summary span{display:block!important;max-width:100%!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:9px!important;line-height:1.2!important;}
.report-summary b{display:block!important;max-width:100%!important;min-width:0!important;width:100%!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:clip!important;font-size:clamp(14px,2vw,20px)!important;line-height:1.15!important;letter-spacing:0!important;}
@media(max-width:900px){.report-summary{grid-template-columns:repeat(2,minmax(0,1fr))!important;}}
@media(max-width:480px){.report-summary{grid-template-columns:1fr!important;}}

.status-options{display:flex;gap:18px;flex-wrap:wrap}.status-check{display:flex;align-items:center;gap:8px;padding:10px 13px;border:1px solid var(--border);border-radius:11px;background:#fafbfc;font-weight:700;color:var(--text);cursor:pointer}.status-check input{width:16px;height:16px;accent-color:var(--red)}.field input:disabled{background:#f0f2f5;color:#9aa1ad;cursor:not-allowed}.badge{white-space:nowrap}

.report-day td.status-negative{color:#d60000!important;font-weight:800;}
.report-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.changelog-list{display:flex;flex-direction:column;gap:14px}.changelog-item{display:grid;grid-template-columns:130px 1fr;gap:18px;padding:18px;border:1px solid var(--border);border-radius:16px;background:#fafbfc}.changelog-item strong{font-size:15px}.changelog-item p{margin:6px 0 0;color:var(--muted);font-size:13px;line-height:1.55}.changelog-version{font-size:11px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;color:var(--red2);padding-top:3px}@media(max-width:760px){.report-actions{justify-content:flex-start}.changelog-item{grid-template-columns:1fr}}

@media(max-width:900px){.report-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}}
@media(max-width:520px){.report-summary{grid-template-columns:1fr;gap:10px;margin-left:15px;margin-right:15px;width:calc(100% - 30px)}}
