/* Paper pages: money receipts and marksheets. White on screen and on paper. */
:root {
    --ink: #1f2430;
    --muted: #6b7280;
    --line: #d9dce3;
    --brand: #0B2A4A;
    --soft: #eef2f8;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
.paper-body {
    background: #eceef3; color: var(--ink);
    font-family: 'Hind Siliguri', system-ui, sans-serif; font-size: 14px; line-height: 1.55;
    padding: 72px 12px 32px;
}

/* Toolbar */
.paper-toolbar {
    position: fixed; inset: 0 0 auto 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
    padding: 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.paper-toolbar form { margin: 0; }
.paper-btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px; cursor: pointer;
    border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font: inherit; font-weight: 500;
}
.paper-btn:hover { border-color: var(--brand); color: var(--brand); }
.paper-btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.paper-btn-primary:hover { color: #fff; filter: brightness(1.08); }
.paper-btn-danger { color: #c0262d; }
.paper-alert {
    max-width: 794px; margin: 0 auto 12px; padding: 10px 14px; border-radius: 10px;
    background: #e8f8ef; color: #146c43; border: 1px solid #b7e4c7;
}

/* A sheet of paper */
.paper {
    position: relative; max-width: 794px; margin: 0 auto 18px; padding: 34px 38px 22px; background: #fff;
    border-radius: 6px; box-shadow: 0 10px 30px rgba(20, 20, 50, .12); overflow: hidden;
}
.paper::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 6px;
    background: linear-gradient(90deg, var(--brand), #C9A23F);
}
.paper-head { display: flex; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.paper-logo { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.paper-logo-empty { display: grid; place-items: center; border-radius: 14px; background: var(--soft); color: var(--brand); font-size: 30px; }
.paper-school { flex: 1; text-align: center; }
.paper-school h1 { margin: 0 0 2px; font-size: 24px; font-weight: 700; letter-spacing: .2px; }
.paper-school div { color: var(--muted); font-size: 12.5px; }
.paper-school span { margin: 0 6px; white-space: nowrap; }
.paper-stamp {
    position: absolute; top: 20px; right: 24px; padding: 2px 10px; font-size: 11px; border: 1px solid var(--line);
    border-radius: 999px; color: var(--muted);
}
.paper-title { text-align: center; margin: 16px 0 14px; }
.paper-title span {
    display: inline-block; padding: 4px 22px; border-radius: 999px; background: var(--ink); color: #fff;
    font-weight: 600; font-size: 15px; letter-spacing: .3px;
}
.paper-info { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 13.5px; }
.paper-info th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 8px 4px 0; white-space: nowrap; width: 1%; }
.paper-info td { padding: 4px 16px 4px 0; font-weight: 600; }
.paper-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.paper-table th, .paper-table td { border: 1px solid var(--line); padding: 7px 9px; }
.paper-table thead th { background: var(--soft); font-weight: 600; text-align: left; }
.paper-table tfoot th { background: #fafafa; }
.paper-table .num { text-align: right; white-space: nowrap; }
.paper-table .center { text-align: center; }
.paper-table .fail { color: #c0262d; font-weight: 600; }
.paper-foot {
    margin-top: 22px; padding-top: 8px; border-top: 1px dashed var(--line); text-align: center; color: var(--muted); font-size: 11px;
}
.muted { color: var(--muted); }

/* Receipt */
.receipt-meta { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 13.5px; }
.receipt-meta span { color: var(--muted); margin-right: 6px; }
.receipt-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 14px; font-size: 13px; }
.receipt-note { margin-top: 8px; padding: 6px 10px; background: var(--soft); border-radius: 8px; font-size: 12px; }
.receipt-sign { text-align: center; min-width: 170px; }
.sign-line { border-top: 1px solid var(--ink); padding-top: 4px; font-weight: 600; }

/* Marksheet */
.ms-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.ms-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; text-align: center; }
.ms-box small { display: block; color: var(--muted); font-size: 11.5px; }
.ms-box b { font-size: 20px; }
.ms-box.ok b { color: #138a4a; }
.ms-box.bad b { color: #c0262d; }
.ms-scale { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 11px; color: var(--muted); }
.ms-signs { display: flex; justify-content: space-between; gap: 30px; margin-top: 48px; font-size: 12.5px; }
.ms-signs div { flex: 1; text-align: center; border-top: 1px solid var(--ink); padding-top: 4px; }

@media (max-width: 600px) {
    .paper { padding: 26px 16px 16px; }
    .paper-head { flex-direction: column; text-align: center; }
    .paper-school h1 { font-size: 20px; }
    .ms-summary { grid-template-columns: repeat(2, 1fr); }
    .paper-table { font-size: 12px; }
    .paper-table th, .paper-table td { padding: 5px; }
}

@page { size: A4; margin: 12mm; }
@media print {
    .paper-body { background: #fff; padding: 0; }
    .paper-toolbar, .paper-alert { display: none !important; }
    .paper { box-shadow: none; max-width: none; margin: 0; padding: 0 0 8px; border-radius: 0; page-break-after: always; break-after: page; }
    .paper:last-of-type { page-break-after: auto; break-after: auto; }
    .paper::before { display: none; }
    .receipt + .receipt { margin-top: 0; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ID cards (85.6 x 54 mm) */
.idcards { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.idcard {
    width: 85.6mm; height: 54mm; border-radius: 3.2mm; overflow: hidden; background: #fff; position: relative;
    box-shadow: 0 10px 30px rgba(20, 20, 50, .15); display: flex; flex-direction: column; font-size: 8.5pt; line-height: 1.35;
}
.idcard-top { display: flex; align-items: center; gap: 2mm; padding: 2mm 3mm; background: linear-gradient(90deg, var(--brand), #1F4C99); color: #fff; }
.idcard-top img { width: 7mm; height: 7mm; border-radius: 50%; object-fit: cover; background: #fff; }
.idcard-top b { font-size: 9pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idcard-body { flex: 1; display: flex; gap: 3mm; padding: 2.5mm 3mm; align-items: center; }
.idcard-photo { width: 21mm; height: 25mm; border-radius: 2mm; object-fit: cover; border: .6mm solid var(--soft); flex-shrink: 0; }
.idcard-photo-empty { display: grid; place-items: center; background: var(--soft); color: var(--brand); font-size: 20pt; font-weight: 700; }
.idcard-info { display: flex; flex-direction: column; min-width: 0; }
.idcard-name { font-size: 10.5pt; }
.idcard-role { color: #A07A1F; font-weight: 600; margin-bottom: 1mm; }
.idcard-strip { height: 4.5mm; background: #1f2430; color: #fff; text-align: center; font-size: 7.5pt; font-weight: 600; letter-spacing: .1em; line-height: 4.5mm; text-transform: uppercase; }
.idcard-back-body { flex: 1; padding: 4mm; font-size: 8pt; color: #374151; }
.idcard-back-body p { margin: 0 0 1.5mm; }
.idcard-sign { margin-top: 5mm; border-top: 1px solid #1f2430; width: 32mm; margin-left: auto; text-align: center; padding-top: .5mm; font-size: 7.5pt; }
@media print { .idcard { box-shadow: none; border: .2mm solid #d9dce3; } .idcards { justify-content: flex-start; } }

/* Routine on paper */
.paper-wide { max-width: 1100px; }
.routine-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.routine-table th, .routine-table td { border: 1px solid var(--line); padding: 6px 4px; text-align: center; vertical-align: middle; }
.routine-table thead th { background: var(--soft); }
.routine-table thead th small, .routine-table td small { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
.routine-table .routine-day { text-align: left; font-weight: 600; background: #fafafa; white-space: nowrap; }
.routine-table td b { display: block; }
.routine-table .routine-break { background: #fbf6e8; width: 26px; }
.routine-table .routine-break span { writing-mode: vertical-rl; font-weight: 600; color: #8A6A1C; }
.paper-wide { page: wide; }
@page wide { size: A4 landscape; margin: 10mm; }

/* ---------- Toolbar filters (class / section / side) ---------- */
.paper-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.paper-filter select { font: inherit; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.paper-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.paper-seg button { font: inherit; border: 0; background: #fff; padding: 6px 14px; cursor: pointer; }
.paper-seg button.on { background: var(--brand); color: #fff; }

/* ---------- Student ID card (54 x 85.6 mm, portrait) ----------
   Plain colours only (no color-mix), so the PNG download renders it exactly. */
.sid {
    --sid-muted: #6b7280;
    position: relative; width: 54mm; height: 85.6mm; border-radius: 3mm; overflow: hidden; background: #fff;
    display: flex; flex-direction: column; align-items: center; font-size: 7pt; line-height: 1.35; color: #1f2430;
    box-shadow: 0 10px 30px rgba(20, 20, 50, .16);
}
.sid-head {
    position: relative; width: 100%; height: 21mm; flex-shrink: 0; display: flex; align-items: flex-start; gap: 2mm; padding: 2.6mm 3mm 0;
    background: var(--sid-ink, #0B2A4A); color: #fff; border-bottom: .9mm solid var(--sid-accent, #C9A23F);
    border-radius: 0 0 50% 50% / 0 0 4mm 4mm;
}
.sid-head::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(0,0,0,.18)); pointer-events: none; }
.sid-logo { position: relative; z-index: 1; width: 9mm; height: 9mm; border-radius: 50%; background: #fff; display: grid; place-items: center; flex-shrink: 0; color: var(--sid-ink, #0B2A4A); font-size: 11pt; overflow: hidden; }
.sid-logo img { width: 100%; height: 100%; object-fit: contain; }
.sid-school { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; }
.sid-school b { font-size: 8pt; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sid-school small { font-size: 5.8pt; opacity: .85; margin-top: .3mm; }
.sid-ribbon { position: relative; z-index: 2; margin-top: -2.6mm; }
.sid-ribbon span {
    display: inline-block; padding: .5mm 3.5mm; border-radius: 999px; background: var(--sid-accent, #C9A23F); color: var(--sid-accent-ink, #1A1405);
    font-size: 5.8pt; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
}
.sid-photo {
    width: 22mm; height: 26mm; margin-top: 1.6mm; border-radius: 2.6mm; overflow: hidden; flex-shrink: 0; padding: .6mm;
    border: .45mm solid var(--sid-accent, #C9A23F); background: #fff;
}
.sid-photo-img { display: block; width: 100%; height: 100%; border-radius: 1.8mm; background: #eef2f8 center / cover no-repeat; }
.sid-photo span { width: 100%; height: 100%; border-radius: 1.8mm; background: #eef2f8; display: flex; align-items: center; justify-content: center; font-size: 20pt; font-weight: 700; color: var(--sid-ink, #0B2A4A); }
.sid-name { margin-top: 1.8mm; padding: 0 3mm; text-align: center; font-size: 9.6pt; font-weight: 700; line-height: 1.2; color: var(--sid-ink, #0B2A4A); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sid-subname { font-size: 6.2pt; color: var(--sid-muted); text-align: center; padding: 0 3mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sid-info { width: calc(100% - 8mm); margin: 1.4mm auto 0; border-collapse: collapse; font-size: 6.8pt; }
.sid-info th { text-align: left; color: var(--sid-muted); font-weight: 500; width: 12mm; padding: .45mm 0; }
.sid-info td { font-weight: 600; padding: .45mm 0; }
.sid-info tr + tr th, .sid-info tr + tr td { border-top: .2mm dotted #d5dae3; }
.sid-inline { float: right; }
.sid-inline em { font-style: normal; color: var(--sid-muted); font-weight: 500; margin-right: .8mm; }
.sid-blood { color: #c0262d; font-weight: 700; }
.sid-foot {
    margin-top: auto; width: 100%; flex-shrink: 0; padding: 1.1mm 2mm; text-align: center; font-size: 5.6pt; font-weight: 600;
    background: var(--sid-ink, #0B2A4A); color: #fff; border-top: .8mm solid var(--sid-accent, #C9A23F); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sid-back-head {
    width: 100%; flex-shrink: 0; padding: 2.4mm 3mm; text-align: center; font-size: 7.4pt; font-weight: 700; line-height: 1.25;
    background: var(--sid-ink, #0B2A4A); color: #fff; border-bottom: .8mm solid var(--sid-accent, #C9A23F);
}
.sid-back-body { flex: 1; width: 100%; padding: 2.8mm 3.4mm 2mm; display: flex; flex-direction: column; min-height: 0; }
.sid-guardian { display: grid; grid-template-columns: 11mm 1fr; gap: .6mm 1.5mm; margin: 0; font-size: 6.8pt; }
.sid-guardian dt { color: var(--sid-muted); font-weight: 500; }
.sid-guardian dd { margin: 0; font-weight: 600; word-break: break-word; }
.sid-rules { margin: 2.2mm 0 0; padding-left: 3.4mm; font-size: 6pt; line-height: 1.45; color: #374151; }
.sid-back-row { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 2mm; }
.sid-qr { width: 15mm; height: 15mm; padding: .7mm; border: .3mm solid #e3e7ee; border-radius: 1mm; image-rendering: pixelated; background: #fff; }
.sid-sign { flex: 1; text-align: center; max-width: 25mm; }
.sid-sign img { display: block; max-height: 8mm; max-width: 24mm; margin: 0 auto -.5mm; }
.sid-sign span { display: block; border-top: .3mm solid #1f2430; padding-top: .5mm; font-size: 6.2pt; font-weight: 600; }
.sid-sign small { display: block; font-size: 5.6pt; color: var(--sid-muted); }
.sid-pairs { display: flex; flex-direction: column; gap: 22px; align-items: center; }
.sid-pair { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.sid-note { max-width: 760px; margin: 0 auto 14px; text-align: center; color: var(--muted); font-size: 13px; }
.sid-sheet {
    width: 210mm; max-width: 100%; margin: 0 auto 18px; padding: 10mm 6mm; background: #fff; border-radius: 6px; box-shadow: 0 10px 30px rgba(20, 20, 50, .12);
    display: grid; grid-template-columns: repeat(3, 54mm); justify-content: center; gap: 7mm 9mm;
}
.sid-sheet .sid { box-shadow: none; border: .2mm solid #d9dce3; }
.sid-blank { visibility: hidden; }
@media (max-width: 640px) {
    .sid-sheet { grid-template-columns: repeat(auto-fill, 54mm); padding: 12px; }
}
@media print {
    .sid { box-shadow: none; border: .2mm solid #d9dce3; }
    .sid-note { display: none; }
    .sid-sheet { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; break-after: page; page-break-after: always; }
    .sid-sheet:last-of-type { break-after: auto; page-break-after: auto; }
    .sid-pairs { display: block; }
    .sid-pair { break-inside: avoid; margin-bottom: 8mm; justify-content: flex-start; }
}

/* ---------- Admission form (A4) ---------- */
.adm-paper-top { display: flex; gap: 18px; align-items: flex-start; margin: 14px 0 4px; }
.adm-paper-title { flex: 1; min-width: 0; }
.adm-paper-title h2 { display: inline-block; margin: 0; padding: 4px 24px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 17px; letter-spacing: .3px; }
.adm-paper-title p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; }
.adm-paper-class { margin-top: 12px; font-size: 13.5px; }
.adm-paper-class > span { color: var(--muted); margin-right: 6px; }
.adm-paper-boxes { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 7px; }
.adm-paper-boxes label { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.adm-paper-boxes i { width: 12px; height: 12px; border: 1px solid var(--ink); border-radius: 2px; display: inline-block; }
.adm-paper-photo { width: 32mm; height: 38mm; flex-shrink: 0; border: 1px dashed #9aa3b2; border-radius: 4px; display: grid; place-items: center; text-align: center; font-size: 10.5px; color: var(--muted); padding: 6px; overflow: hidden; }
.adm-paper-photo img { width: 100%; height: 100%; object-fit: cover; }
.adm-paper-h { font-size: 13.5px; margin: 14px 0 6px; padding: 3px 10px; background: var(--soft); border-left: 3px solid var(--brand); }
.adm-paper-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 18px; }
.adm-paper-field { display: flex; align-items: flex-end; gap: 6px; font-size: 13px; min-height: 25px; }
.adm-paper-field.wide { grid-column: span 3; }
.adm-paper-field > span { color: var(--muted); white-space: nowrap; }
.adm-paper-field > span::after { content: ':'; }
.adm-paper-field b { font-weight: 600; }
.adm-line { flex: 1; border-bottom: 1px dotted #6b7280; height: 18px; }
.adm-paper-note { font-size: 13px; margin: 0; }
.adm-paper-declare { margin: 18px 0 0; font-size: 12.5px; }
.adm-paper-office { margin-top: 20px; padding: 10px 14px 14px; border: 1px dashed #9aa3b2; border-radius: 8px; }
.adm-paper-office h4 { margin: 0 0 6px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.adm-paper-office .adm-paper-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 600px) {
    .adm-paper-top { flex-direction: column-reverse; align-items: center; text-align: center; }
    .adm-paper-grid, .adm-paper-office .adm-paper-grid { grid-template-columns: 1fr; }
    .adm-paper-field.wide { grid-column: span 1; }
    .adm-paper-field { flex-wrap: wrap; }
}

/* ---------- QR verification page ---------- */
.verify-card { max-width: 640px; }
.verify-state { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 12px; margin: 18px 0; }
.verify-state i { font-size: 40px; line-height: 1; }
.verify-state b { display: block; font-size: 17px; }
.verify-state span { font-size: 13px; }
.verify-state.is-valid { background: #e8f8ef; color: #146c43; }
.verify-state.is-invalid { background: #fdecec; color: #b42318; }
.verify-who { display: flex; gap: 16px; align-items: flex-start; }
.verify-who img { width: 90px; height: 108px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.verify-who h2 { margin: 0 0 6px; font-size: 20px; }.sid-back-id { margin: auto 0; padding: 1.4mm 0; text-align: center; border-top: .2mm dashed #d5dae3; border-bottom: .2mm dashed #d5dae3; }
.sid-back-id small { display: block; font-size: 5.6pt; color: var(--sid-muted); letter-spacing: .08em; }
.sid-back-id b { display: block; font-size: 11pt; letter-spacing: .14em; color: var(--sid-ink, #0B2A4A); }
.sid-back-id + .sid-back-row { margin-top: 0; }
/* Staff / teacher card: designation under the name, the accent band in the header */
.sid-role { margin-top: .4mm; padding: .3mm 2.6mm; border-radius: 999px; background: var(--sid-ink, #0B2A4A); color: #fff; font-size: 6.4pt; font-weight: 600; max-width: calc(100% - 8mm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sid-staff .sid-head { background: var(--sid-ink, #0B2A4A); }
.sid-staff .sid-ribbon span { background: var(--sid-accent, #C9A23F); }