@font-face{font-family:'Cairo';font-style:normal;font-weight:400;font-display:swap;src:url(/vendor/cairo/cairo-arabic-400-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Cairo';font-style:normal;font-weight:400;font-display:swap;src:url(/vendor/cairo/cairo-latin-400-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Cairo';font-style:normal;font-weight:700;font-display:swap;src:url(/vendor/cairo/cairo-arabic-700-normal.woff2) format('woff2');unicode-range:U+0600-06FF,U+0750-077F,U+0870-088E,U+0890-0891,U+0898-08E1,U+08E3-08FF,U+200C-200E,U+2010-2011,U+204F,U+2E41,U+FB50-FDFF,U+FE70-FE74,U+FE76-FEFC}
@font-face{font-family:'Cairo';font-style:normal;font-weight:700;font-display:swap;src:url(/vendor/cairo/cairo-latin-700-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root{
  --bg:#f4f6f9; --surface:#fff; --ink:#1b2430; --muted:#5f6b7a; --line:#dde3ea;
  --brand:#1f4e79; --brand-2:#2e6da4; --brand-soft:#e8f0f8;
  --ok:#1e7b4f; --ok-soft:#e7f4ed; --err:#b3261e; --err-soft:#fbeceb; --warn:#8a5a00; --warn-soft:#fff4dc;
  --radius:12px;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--bg);color:var(--ink);font-family:'Cairo',Tahoma,Arial,sans-serif;font-size:15px;line-height:1.6}
.hidden{display:none!important}
a{color:var(--brand-2)}
.wrap{max-width:1080px;margin:0 auto;padding:18px 16px 40px;position:relative;z-index:1}
.narrow{max-width:440px}

/* top bar */
.top{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.top h1{font-size:22px;margin:0;color:var(--brand)}
.top .sub{margin:0;color:var(--muted);font-size:13px}
.top .who{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.badge{background:var(--brand-soft);color:var(--brand);border-radius:999px;padding:3px 12px;font-size:13px;font-weight:600}
.badge.demo{background:var(--warn-soft);color:var(--warn)}
.badge.live{background:var(--ok-soft);color:var(--ok)}
.inline{display:inline}

/* boxes */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px;margin-bottom:16px}
.panel h2{margin:0 0 4px;font-size:18px;color:var(--brand)}
.panel h3{margin:0 0 8px;font-size:15px}
.lead{margin:0 0 14px;color:var(--muted);font-size:13px}
.flash{border-radius:var(--radius);padding:10px 14px;margin-bottom:14px;font-size:14px;white-space:pre-line;border:1px solid}
.flash.ok{background:var(--ok-soft);color:#14532d;border-color:#b9dfc8}
.flash.err{background:var(--err-soft);color:#7f1d1d;border-color:#f0c4c0}
.flash.warn{background:var(--warn-soft);color:#5a3d00;border-color:#f0d9a5}
.secret{display:inline-block;direction:ltr;font-family:Consolas,monospace;font-size:16px;background:#fff;border:1px dashed currentColor;border-radius:6px;padding:2px 10px;margin-inline-start:6px;user-select:all}
.copy{direction:ltr;text-align:left;font-family:Consolas,monospace;font-size:13px;background:#f7f9fb;border:1px solid var(--line);border-radius:8px;padding:8px 10px;word-break:break-all;user-select:all}

/* forms */
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:12px 14px}
.grid label,.field{display:flex;flex-direction:column;gap:4px;font-size:13px;font-weight:600;color:var(--muted)}
.grid label.wide{grid-column:1/-1}
.check{display:flex!important;flex-direction:row!important;align-items:center;gap:8px;font-weight:600;color:var(--ink)!important;font-size:14px!important;cursor:pointer}
input[type=text],input[type=password],input[type=number],input[type=search],input[type=url],select{font:inherit;color:var(--ink);background:#fff;border:1px solid var(--line);border-radius:8px;padding:8px 10px;min-height:40px;width:100%}
input.ltr{direction:ltr;text-align:left}
input:focus,select:focus{outline:2px solid var(--brand-2);outline-offset:0;border-color:var(--brand-2)}
select:disabled{background:#f2f4f7;color:#9aa4b1}
input[type=checkbox],input[type=radio]{width:18px;height:18px;accent-color:var(--brand)}
.hint{font-weight:400;font-size:12px;color:var(--muted)}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px;align-items:center}
.btn{font:inherit;font-weight:700;border:1px solid var(--brand);background:var(--brand);color:#fff;border-radius:8px;padding:8px 18px;min-height:40px;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-decoration:none}
.btn:hover{background:var(--brand-2);border-color:var(--brand-2)}
.btn.ghost{background:#fff;color:var(--brand)}
.btn.ghost:hover{background:var(--brand-soft)}
.btn.danger{background:#fff;color:var(--err);border-color:#e3b4b0}
.btn.sm{padding:4px 12px;min-height:32px;font-size:13px}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn:focus-visible,.card:focus-visible,a:focus-visible{outline:3px solid var(--brand-2);outline-offset:2px}

/* tables */
.tbl-wrap{overflow-x:auto}
table.list{width:100%;border-collapse:collapse;font-size:14px}
.list th,.list td{border-bottom:1px solid var(--line);padding:8px;text-align:right;vertical-align:middle}
.list th{color:var(--muted);font-weight:600;font-size:13px;background:#f7f9fb}
.list td.num{font-variant-numeric:tabular-nums}
.muted{color:var(--muted)}
.pager{display:flex;gap:6px;flex-wrap:wrap;margin-top:12px}

/* login */
.login-card{max-width:400px;margin:40px auto}
.login-card .school{text-align:center;margin-bottom:16px}
.login-card .school img{max-height:64px;max-width:200px}
.login-card .school h1{margin:6px 0 0;font-size:20px;color:var(--brand)}

/* report cards */
.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin-bottom:18px}
.card{all:unset;cursor:pointer;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 16px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:6px;transition:border-color .15s,box-shadow .15s,transform .15s}
.card:hover{border-color:var(--brand-2);box-shadow:0 4px 16px rgba(31,78,121,.10);transform:translateY(-1px)}
.card.active{border-color:var(--brand);box-shadow:0 0 0 2px var(--brand) inset}
.card svg{width:44px;height:44px;color:var(--brand)}
.card h3{margin:4px 0 0;font-size:16px}
.card p{margin:0;color:var(--muted);font-size:13px}
.status{margin-top:12px;font-size:14px;min-height:1px;white-space:pre-line}
.status.info{color:var(--brand)}
.status.ok{color:var(--ok)}
.status.err{color:var(--err)}
.status.warn{color:var(--warn)}
details.debug{margin-top:10px;font-size:12px;color:var(--muted)}
details.debug pre{white-space:pre-wrap;direction:ltr;text-align:left;background:#f7f9fb;border:1px solid var(--line);border-radius:8px;padding:8px;max-height:260px;overflow:auto}
.subjects{margin-top:16px;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.subj-head{display:flex;justify-content:space-between;align-items:center;background:#f7f9fb;padding:8px 12px;border-bottom:1px solid var(--line);gap:10px;flex-wrap:wrap}
.subj-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:4px 12px;padding:10px 12px}
.subj-list .check{font-weight:400!important;padding:3px 0}
.multi{margin-top:12px;display:flex;gap:18px;flex-wrap:wrap;font-size:14px}
.drop{display:block;border:2px dashed #b9c6d4;border-radius:var(--radius);padding:26px 16px;text-align:center;color:var(--muted);cursor:pointer;background:#fafcfe;transition:border-color .15s,background .15s}
.drop.over{border-color:var(--brand);background:var(--brand-soft)}
.drop strong{color:var(--brand)}
.drop input{display:none}
.preview{margin-top:16px;border:1px solid var(--line);border-radius:10px;padding:12px;background:#eef1f5;overflow:auto;max-height:640px}
.pv-wrap{overflow:hidden;margin:0 auto 12px;box-shadow:0 1px 6px rgba(0,0,0,.15);background:#fff}
.pv-table{border-collapse:collapse;font-size:13px;background:#fff;min-width:100%}
.pv-table th,.pv-table td{border:1px solid var(--line);padding:4px 8px;white-space:nowrap}
.pv-table th{background:#f2f5f8}
.busy{position:fixed;inset:0;background:rgba(244,246,249,.94);z-index:1000;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;font-weight:600;color:var(--brand)}
.spinner{width:38px;height:38px;border:4px solid var(--brand-soft);border-top-color:var(--brand);border-radius:50%;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.spinner{animation-duration:3s}.card{transition:none}}
.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 18px;border-radius:10px;font-size:14px;z-index:1100;max-width:90vw;box-shadow:0 6px 20px rgba(0,0,0,.2)}
.toast.err{background:var(--err)}
.toast.ok{background:var(--ok)}

/* printable A4 pages (rendered off-screen, captured into the PDF) */
#renderHost{position:absolute;top:0;left:0;z-index:-5;pointer-events:none}
.page{width:1123px;height:794px;padding:26px 30px 18px;background:#fff;color:#111;font-family:'Cairo',Tahoma,Arial,sans-serif;display:flex;flex-direction:column;overflow:hidden;direction:rtl;line-height:1.35}
.page.portrait{width:794px;height:1123px}
.pg-head{display:flex;justify-content:space-between;align-items:center;gap:16px;border-bottom:2px solid #1f4e79;padding-bottom:8px;margin-bottom:8px}
.pg-head .h-r,.pg-head .h-l{flex:1;font-size:13px}
.pg-head .h-l{text-align:left}
.pg-head .h-c{flex:1.4;text-align:center}
.pg-head .school{font-size:17px;font-weight:700;color:#1f4e79}
.pg-head .title{font-size:18px;font-weight:700}
.pg-head .sub{font-size:13px;color:#333;margin-top:2px}
.pg-head .meta{font-size:13px;color:#333}
table.sheet{width:100%;border-collapse:collapse;table-layout:fixed;font-size:11.5px}
.sheet th,.sheet td{border:1px solid #555;padding:2px 3px;text-align:center;vertical-align:middle;overflow:hidden}
.sheet td{height:21px}
.sheet th{background:#e3ebf3;font-weight:700}
.sheet th.dn{font-size:9px;font-weight:600;padding:2px 0}
.sheet th.dd{font-size:11px}
.sheet td.nm{text-align:right;white-space:nowrap;padding-right:6px}
.sheet .we{border-left:2px solid #1f4e79}
.sheet td.ab{color:#b3261e;font-weight:700}
.sheet td.hf{color:#8a5a00;font-weight:700}
.sheet td.pd{color:#5b3a8a;font-weight:700}
.sheet td.tot{font-weight:700;background:#f6f8fa}
.sheet tbody tr:nth-child(even) td{background-color:#fafbfc}
.sheet tbody tr:nth-child(even) td.tot{background:#f0f3f6}
.sheet.csv td{text-align:right;white-space:normal;overflow-wrap:anywhere;height:auto;padding:5px 7px;line-height:1.5}
.sheet.csv th{padding:6px 7px;font-size:1em}
.sheet.csv td.num{text-align:center}
.sheet.csv td.nw{white-space:nowrap;overflow:visible}
.pg-foot{margin-top:auto;padding-top:10px;display:flex;justify-content:space-between;align-items:flex-end;font-size:12px;gap:16px}
.pg-foot .legend{color:#444}
.pg-foot .num{color:#666;font-size:11px}

@media (max-width:720px){
  .cards{grid-template-columns:1fr}
  .card{flex-direction:row;text-align:right;align-items:center;gap:14px}
  .card svg{width:36px;height:36px;flex:none}
}

/* owner panel (school cards, same layout idea as Meals' owner page) */
details.add-school>summary,details.sc-edit>summary{cursor:pointer;list-style:none}
details.add-school>summary::-webkit-details-marker{display:none}
details.add-school>summary::before{content:'＋';display:inline-block;margin-inline-end:8px;color:var(--brand);font-weight:700}
details.add-school[open]>summary::before{content:'－'}
details.sc-edit{margin-top:12px;border-top:1px solid var(--line);padding-top:10px}
details.sc-edit>summary{color:var(--brand);font-weight:600;font-size:14px}
fieldset.fs{border:1px solid var(--line);border-radius:10px;padding:12px 14px;margin:14px 0 0}
fieldset.fs legend{padding:0 6px;font-weight:700;color:var(--brand);font-size:14px}
.section-h{font-size:18px;color:var(--brand);margin:22px 0 10px}
.school-card .sc-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.sc-logo{width:48px;height:48px;border-radius:10px;object-fit:contain;background:#fff;border:1px solid var(--line);flex:none}
.sc-ph{display:grid;place-items:center;background:var(--brand-soft);color:var(--brand);font-weight:700;font-size:20px}
.sc-title{flex:1;min-width:180px}
.sc-title h3{margin:0;font-size:17px}
.sc-links{display:grid;gap:8px;margin-top:12px}
.sc-links .copy{margin-top:2px}
.topbar-logo{width:40px;height:40px;object-fit:contain;border-radius:8px;background:#fff;border:1px solid var(--line)}
.pg-head .logo{height:46px;max-width:90px;object-fit:contain;margin-inline-end:10px;vertical-align:middle}
.pg-head .h-r{flex:1.5}
.pg-head .h-r .meta{white-space:nowrap}

/* Inside the host system's App Frame (html.in-iframe, set in partials/head.ejs):
   The host sizes the frame to the page's full height, so the page itself never
   scrolls -- no inner scrollbar (same as the canteen), and the PDF preview
   shows at full length instead of in its own scrolling box. */
html.in-iframe, html.in-iframe body{overflow:hidden}
html.in-iframe .preview{max-height:none;overflow:visible}
html.in-iframe .busy{justify-content:flex-start}
html.in-iframe .toast{bottom:auto}

.ltr-box{display:inline-block;direction:ltr;unicode-bidi:isolate}
.fill-step{margin-top:22px;padding-top:16px;border-top:1px solid var(--line,#e3e8ef)}
.fill-step h3{margin:0 0 6px;font-size:16px;color:var(--brand,#1f4e79)}
#fillStatus{white-space:pre-line}
