/* =========================================================
   IV Schoolz - Management panel styles (login + dashboard)
   Brand colours: charcoal + gold (logo) and maroon (uniform).
   ========================================================= */

:root {
    --maroon: #8c1d2c;
    --maroon-dark: #6b1421;
    --maroon-soft: #f8e9eb;
    --gold: #c9a04e;
    --gold-soft: #f8f0dd;
    --charcoal: #26252c;
    --charcoal-2: #302f37;
    --bg: #f6f3ee;
    --card: #ffffff;
    --text: #25222a;
    --muted: #77707b;
    --border: #ebe5dc;
    --green: #1f7a45;
    --green-soft: #e3f3e8;
    --blue: #2a5b8f;
    --blue-soft: #e5eef8;
    --orange: #a85a12;
    --orange-soft: #fbeedd;
    --red: #b42332;
    --red-soft: #fbe6e8;
    --radius: 14px;
    --serif: 'Fraunces', Georgia, serif;
    --sans: 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; }
a { color: var(--maroon); }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 18px; border: 1px solid var(--maroon); border-radius: 10px;
    background: var(--maroon); color: #fff;
    font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
    transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--maroon-dark); box-shadow: 0 6px 16px rgba(140, 29, 44, 0.22); }
.btn-block { display: flex; width: 100%; padding: 13px; }
.btn-light { background: #fff; color: var(--text); border-color: var(--border); }
.btn-light:hover { background: #faf7f2; box-shadow: none; }
.btn-danger { background: #fff; color: var(--red); border-color: #f0d3d6; }
.btn-danger:hover { background: var(--red-soft); box-shadow: none; }
.btn-green { background: var(--green); border-color: var(--green); }
.btn-green:hover { background: #18613a; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.inline { display: inline; }

/* ---------- Alerts & badges ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--green-soft); color: var(--green); border-color: #cbe8d4; }
.alert-error { background: var(--red-soft); color: var(--red); border-color: #f3cfd3; }
.alert-info { background: var(--blue-soft); color: var(--blue); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--gold-soft); color: #7a5d1d; text-transform: capitalize; }
.badge-green, .badge-paid, .badge-present, .badge-closed { background: var(--green-soft); color: var(--green); }
.badge-red, .badge-unpaid, .badge-absent, .badge-new { background: var(--red-soft); color: var(--red); }
.badge-orange, .badge-partial, .badge-late, .badge-contacted { background: var(--orange-soft); color: var(--orange); }
.badge-leave { background: var(--blue-soft); color: var(--blue); }
.badge-waived { background: #efe7f7; color: #5f3b8c; }   /* fee fully waived by a concession */

/* ---------- Login / install pages ---------- */
.auth-page { min-height: 100vh; margin: 0; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.auth-photo {
    position: relative; overflow: hidden; color: #fff;
    background: var(--charcoal) center / cover no-repeat;
    display: flex; flex-direction: column; justify-content: space-between; padding: 44px;
}
.auth-photo::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30, 29, 35, 0.92) 0%, rgba(30, 29, 35, 0.35) 35%, rgba(30, 29, 35, 0.45) 60%, rgba(30, 29, 35, 0.94) 100%); }
.auth-photo > * { position: relative; }
.auth-photo img.auth-logo-img { width: 240px; }
.auth-photo blockquote { margin: 0; font-family: var(--serif); font-size: 30px; line-height: 1.25; max-width: 460px; }
.auth-photo blockquote span { color: var(--gold); font-style: italic; }
.auth-photo p { color: #ddd6cb; margin: 12px 0 0; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .mobile-logo { display: none; width: 210px; margin-bottom: 26px; }
.auth-card h1 { font-family: var(--serif); font-weight: 600; font-size: 32px; margin-bottom: 6px; }
.auth-card .intro { color: var(--muted); margin-bottom: 26px; }
.auth-card form { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: 0 20px 40px rgba(40, 30, 20, 0.06); }
.input-icon { position: relative; display: block; margin-top: 6px; }
.input-icon input { margin-top: 0; }
.input-icon .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 42px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; font-size: 14px; text-decoration: none; color: var(--muted); }
.back-link:hover { color: var(--maroon); }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 700; color: #4a4450; margin-bottom: 14px; }
input, select, textarea {
    display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
    border: 1px solid #ddd5c9; border-radius: 10px; background: #fff;
    font: inherit; font-size: 14px; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(201, 160, 78, 0.28); border-color: var(--gold); }
input:disabled { background: #f4f1ec; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
label.check input { width: auto; margin: 0; accent-color: var(--maroon); }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: #fcfbf8; }
.checks label { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.filters label { margin: 0; min-width: 160px; }
.filters .btn { height: 41px; }

/* ---------- Layout: sidebar + main ---------- */
.sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 256px; z-index: 40;
    background: var(--charcoal); color: #cfc9bf;
    display: flex; flex-direction: column;
    transition: transform .3s;
}
.side-brand { display: block; padding: 22px 22px 18px; border-bottom: 1px solid #36353d; }
.side-brand img { width: 100%; max-width: 190px; display: block; }
.side-nav { flex: 1; overflow-y: auto; padding: 8px 12px 18px; }
.side-section { display: block; margin: 18px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: #807a86; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-bottom: 2px;
    border-radius: 9px; color: #d9d3c9; text-decoration: none; font-weight: 600; font-size: 14px;
    position: relative;
}
.side-nav a .icon { color: #a39d93; }
.side-nav a:hover { background: #302f37; color: #fff; }
.side-nav a:hover .icon { color: var(--gold); }
.side-nav a.active { background: #34333b; color: #fff; }
.side-nav a.active .icon { color: var(--gold); }
.side-nav a.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.side-nav .logout:hover .icon { color: #e88b95; }
.side-website { display: flex; align-items: center; gap: 8px; margin: 0 16px 16px; padding: 10px 12px; border: 1px solid #3c3b44; border-radius: 9px; color: #bdb6ab; font-size: 13px; text-decoration: none; }
.side-website:hover { color: var(--gold); border-color: var(--gold); }
.sidebar-backdrop { display: none; }

/* Sidebar scrollbar: thin, dark, gold on hover (instead of the white browser bar) */
.side-nav { scrollbar-width: thin; scrollbar-color: #45444d transparent; }
.side-nav:hover { scrollbar-color: #6b6573 transparent; }
.side-nav::-webkit-scrollbar { width: 6px; }
.side-nav::-webkit-scrollbar-track { background: transparent; }
.side-nav::-webkit-scrollbar-thumb { background: #45444d; border-radius: 10px; }
.side-nav:hover::-webkit-scrollbar-thumb { background: #6b6573; }
.side-nav::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Table scrollbars: thin and light */
.table-wrap { scrollbar-width: thin; scrollbar-color: #d8d0c3 transparent; }
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: #d8d0c3; border-radius: 10px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* "Developed by Danish Labs" */
.dev-credit { font-size: 12px; color: var(--muted); }
.dev-credit a { color: var(--maroon); font-weight: 700; text-decoration: none; }
.dev-credit a:hover { text-decoration: underline; }
.side-credit { margin: -6px 16px 16px; text-align: center; }
.side-credit .dev-credit { color: #807a86; }
.side-credit .dev-credit a { color: var(--gold); }
.auth-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.auth-footer .back-link { margin-top: 0; }

.main { margin-left: 256px; min-height: 100vh; }
.topbar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
    padding: 14px 30px; background: rgba(246, 243, 238, 0.92); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.page-title small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.page-title h1 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.menu-btn { display: none; background: #fff; border: 1px solid var(--border); border-radius: 10px; width: 42px; height: 42px; cursor: pointer; color: var(--text); align-items: center; justify-content: center; }
.campus-switch { display: flex; align-items: center; gap: 8px; padding: 0 4px 0 12px; background: #fff; border: 1px solid var(--border); border-radius: 10px; color: var(--maroon); }
.campus-switch select { margin: 0; width: auto; min-width: 170px; border: 0; padding: 9px 8px; font-weight: 700; background: transparent; }
.campus-switch select:focus { outline: none; }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 4px 10px 4px 4px; border-radius: 12px; }
.user-chip:hover { background: #fff; }
.user-chip b { display: block; font-size: 14px; }
.user-chip small { color: var(--muted); font-size: 12px; }
.avatar {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0;
    background: var(--maroon); color: #f6e7c8; font-weight: 800; font-size: 14px;
}
.content { padding: 28px 30px 50px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 22px; border: 1px solid var(--border); box-shadow: 0 1px 2px rgba(40, 30, 20, 0.04); margin-bottom: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2 { display: flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; }
.card-head h2 .icon { color: var(--gold); }

/* Stat cards: white card, coloured icon chip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 22px; }
.stat-card {
    display: flex; align-items: center; gap: 16px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(40, 30, 20, 0.08); }
.stat-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--maroon-soft); color: var(--maroon); }
.stat-card:nth-child(4n+2) .stat-icon { background: var(--gold-soft); color: #8a6a22; }
.stat-card:nth-child(4n+3) .stat-icon { background: var(--green-soft); color: var(--green); }
.stat-card:nth-child(4n+4) .stat-icon { background: var(--blue-soft); color: var(--blue); }
.stat-card small { display: block; color: var(--muted); font-weight: 700; font-size: 13px; }
.stat-card b { display: block; font-family: var(--serif); font-weight: 600; font-size: clamp(18px, 1.6vw, 24px); line-height: 1.2; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card { min-width: 0; }
.stat-card > div { min-width: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-2 > .card { margin-bottom: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #f0ebe3; font-size: 14px; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); background: #fbf9f5; font-weight: 800; }
tr:hover td { background: #fdfbf8; }
td, th { white-space: nowrap; }             /* keep short values (ADM-001, Grade 5 - A) on one line */
td.small, td.wrap { white-space: normal; }  /* long text like messages can wrap */
td .actions, .actions { display: flex; gap: 6px; flex-wrap: wrap; }
td .actions { flex-wrap: nowrap; }

/* Buttons column stays visible on the right while a wide table scrolls sideways
   (applies to every table whose last column has buttons) */
.table-wrap table:has(td:last-child .btn) tr > :last-child {
    position: sticky; right: 0; z-index: 1;
    background: #fff;
    box-shadow: -8px 0 12px -10px rgba(40, 30, 20, 0.25);
}
.table-wrap table:has(td:last-child .btn) tr > th:last-child { background: #fbf9f5; }
.table-wrap table:has(td:last-child .btn) tr:hover > td:last-child { background: #fdfbf8; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 34px; height: 34px; font-size: 12px; border-radius: 10px; }
.person small { display: block; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.marks-input { width: 90px; margin: 0; }
td input, td select { margin: 0; }

/* Attendance choices */
.att-options { display: flex; gap: 6px; flex-wrap: wrap; }
.att-options label { margin: 0; }
.att-options input { display: none; }
.att-options span { display: inline-block; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; cursor: pointer; background: #fff; }
.att-options input:checked + .present { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.att-options input:checked + .absent { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.att-options input:checked + .late { background: var(--orange-soft); border-color: var(--orange); color: var(--orange); }
.att-options input:checked + .leave { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }

/* Simple bar chart */
.bars { display: flex; align-items: flex-end; gap: 12px; height: 180px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 12px; color: var(--muted); gap: 4px; }
.bar div { width: 100%; max-width: 38px; border-radius: 7px 7px 2px 2px; background: linear-gradient(180deg, var(--gold), #b48836); min-height: 3px; }
.bar b { font-size: 11px; color: var(--text); }

.progress { height: 7px; border-radius: 9px; background: #efe9df; overflow: hidden; }
.progress div { height: 100%; background: var(--maroon); }

/* Notices */
.notice { padding: 14px 0; border-bottom: 1px solid var(--border); }
.notice:last-child { border-bottom: 0; }
.notice h3 { font-size: 15px; margin-bottom: 4px; }
.notice p { margin: 6px 0 0; color: #4f4954; white-space: pre-line; }

/* Timetable */
.tt-cell { background: #fbf8f2; border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.tt-cell b { display: block; color: var(--maroon); }
.tt-cell small { color: var(--muted); }

/* Pagination under tables */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.pagination nav { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination nav a, .pagination nav span {
    min-width: 36px; height: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--text); text-decoration: none; font-weight: 700; font-size: 14px;
}
.pagination nav a:hover { border-color: var(--gold); color: var(--maroon); }
.pagination nav .current { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.pagination nav .disabled { color: #c9c2b8; }
.pagination nav .dots { border: 0; background: none; min-width: 20px; padding: 0; }
.pagination .per-page select { margin: 0; width: auto; padding: 7px 10px; font-size: 13px; }

/* Two-factor setup */
.setup-steps { padding-left: 20px; margin: 0 0 12px; }
.setup-steps li { margin-bottom: 6px; }
.qr-box { display: flex; gap: 26px; align-items: flex-start; flex-wrap: wrap; }
#qr-code { padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.setup-key { display: inline-block; padding: 8px 12px; background: #faf7f1; border: 1px dashed var(--gold); border-radius: 8px; font-size: 15px; letter-spacing: 1px; }
.backup-codes { padding: 16px; margin-bottom: 18px; background: #fff8e8; border: 1px solid #efd9a4; border-radius: 12px; }
.backup-codes div { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
.backup-codes code { padding: 8px; text-align: center; background: #fff; border: 1px solid #efe2c2; border-radius: 8px; font-size: 15px; letter-spacing: 1px; }
@media (max-width: 700px) { .backup-codes div { grid-template-columns: repeat(2, 1fr); } }

/* "Print vouchers of a class" bar above the fee list */
.print-bar { padding: 12px 14px; background: #faf7f1; border: 1px dashed #e3d6bd; border-radius: 12px; }

/* Admission fee summary on the New Admission form */
.admission-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.admission-summary div { flex: 1; min-width: 150px; padding: 12px 16px; border-radius: 12px; background: #faf7f1; border: 1px solid #efe7d9; }
.admission-summary span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.admission-summary b { font-family: var(--serif); font-size: 22px; font-weight: 600; }
.admission-summary .total { background: var(--maroon); border-color: var(--maroon); color: #fff; }
.admission-summary .total span { color: #f1dcc0; }

/* Tabs (e.g. Salary sheet / Non-teaching staff) */
.tabs { display: flex; gap: 6px; margin-bottom: 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; color: var(--muted); font-weight: 700; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--maroon); border-bottom-color: var(--maroon); }


/* ---------- Printed documents (fee voucher / receipt, salary slip, report card) ---------- */
.doc {
    position: relative; overflow: hidden; max-width: 820px; margin: 0 auto 22px;
    background: #fff; border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 24px 50px rgba(40, 30, 20, 0.10);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-band { height: 8px; background: linear-gradient(90deg, var(--maroon) 0 70%, var(--gold) 70% 100%); }
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding: 26px 34px 20px; border-bottom: 1px dashed #e3dacb; }
.doc-brand img { width: 250px; display: block; }
.doc-brand small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.doc-title { text-align: right; }
.doc-title span { display: block; font-size: 11px; font-weight: 800; letter-spacing: 2.5px; text-transform: uppercase; color: var(--gold); }
.doc-title b { display: block; font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--maroon); margin: 2px 0; }
.doc-title small { color: var(--muted); font-size: 12px; }

.doc-body { padding: 24px 34px 30px; position: relative; }
.doc-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 22px; }
.doc-info div { background: #faf7f1; border: 1px solid #efe7d9; border-radius: 10px; padding: 10px 14px; }
.doc-info span { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.doc-info b { display: block; font-size: 15px; margin-top: 2px; color: var(--text); }

.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.doc-table th { background: var(--charcoal); color: #f1e6cc; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; padding: 10px 14px; }
.doc-table th:first-child { border-radius: 8px 0 0 8px; }
.doc-table th:last-child { border-radius: 0 8px 8px 0; }
.doc-table td { padding: 11px 14px; border-bottom: 1px solid #f0e9de; font-size: 14px; }
.doc-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-table .minus { color: var(--green); }
.doc-table tr.subtotal td { font-weight: 800; background: #fbf8f2; }
/* "Previous dues" heading row inside the voucher table */
.doc-table tr.doc-section td { padding-top: 16px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--maroon); border-bottom: 2px solid #ecdcc0; }

.doc-total { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding: 18px 22px; border-radius: 12px; background: linear-gradient(135deg, var(--maroon), #6b1421); color: #fff; }
.doc-total span { font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold-light, #e9d6a8); opacity: .9; }
.doc-total b { display: block; font-family: var(--serif); font-size: 30px; font-weight: 600; }
.doc-total small { display: block; font-size: 12.5px; color: #f3dfe2; margin-top: 2px; font-style: italic; }
.doc-total .doc-total-side { text-align: right; font-size: 13px; color: #f3dfe2; }

.doc-note { margin: 16px 0 0; padding: 12px 14px; border-left: 3px solid var(--gold); background: #fbf7ee; border-radius: 0 8px 8px 0; font-size: 13.5px; color: #5a5146; }

/* Stamp sits in the empty space of the header, between the logo and the document number */
.doc-stamp {
    position: absolute; right: 240px; top: 30px; transform: rotate(-12deg);
    padding: 6px 18px; border: 3px double currentColor; border-radius: 10px;
    font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase;
    opacity: .85; pointer-events: none;
}
.doc-stamp-paid { color: #1f7a45; }
.doc-stamp-waived { color: #5f3b8c; }
.doc-stamp-due { color: var(--maroon); }
.doc-stamp-partial { color: #a85a12; }

.doc-footer { display: flex; justify-content: space-between; gap: 30px; padding: 0 34px 26px; }
.doc-footer .sign { flex: 1; max-width: 220px; margin-top: 50px; border-top: 1px solid #8a8178; padding-top: 6px; text-align: center; font-size: 12px; color: var(--muted); }
.doc-actions { max-width: 820px; margin: 0 auto 22px; display: flex; gap: 10px; }

.grade-chip { display: inline-block; min-width: 34px; text-align: center; padding: 2px 8px; border-radius: 6px; font-weight: 800; background: var(--gold-soft); color: #7a5d1d; }

@media (max-width: 700px) {
    .doc-header { flex-direction: column; padding: 20px; }
    .doc-title { text-align: left; }
    .doc-body { padding: 18px 20px 24px; }
    .doc-footer { padding: 0 20px 20px; }
    .doc-stamp { top: 30px; right: 18px; font-size: 18px; }
}


.print-credit { display: none; }

@media print {
    .sidebar, .topbar, .no-print, .alert, .sidebar-backdrop { display: none !important; }
    .print-credit { display: block; margin-top: 28px; padding-top: 8px; border-top: 1px solid #ccc; text-align: center; font-size: 11px; color: #555; }
    @page { margin: 12mm; }
    .doc { box-shadow: none; border-color: #ddd; margin: 0 auto; }
    .doc-page + .doc-page { break-before: page; page-break-before: always; }   /* bulk printing: one voucher per sheet */
    .main { margin: 0; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 0; }
    body { background: #fff; }
}

/* ---------- Tablet & phone ---------- */
@media (max-width: 980px) {
    .auth-page { grid-template-columns: 1fr; }
    .auth-photo { display: none; }
    .auth-card .mobile-logo { display: block; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, 0.4); }
    .sidebar-backdrop.show { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(20, 18, 24, 0.45); }
    .main { margin-left: 0; }
    .menu-btn { display: inline-flex; }
    .topbar { padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
    .page-title h1 { font-size: 20px; }
    .topbar-right { width: 100%; justify-content: space-between; }
    .user-text { display: none; }
    .campus-switch select { min-width: 0; max-width: 200px; }
    .content { padding: 18px 16px 40px; }
    .form-grid, .grid-2 { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
    .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
    .stat-card b { font-size: 20px; }
    .card { padding: 16px; }
    .filters label { min-width: 0; flex: 1 1 140px; }
}

/* Several buttons in a card header (Students page) */
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Expenses + Reports (panel/expenses.php, panel/reports.php) ---------- */
.big-number { font-family: var(--serif); font-size: 32px; font-weight: 600; margin: 4px 0 14px; }
.meter-row { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr auto; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #efe6d8; font-size: 14px; }
.meter-row:last-child { border-bottom: 0; }
.meter-row b { text-align: right; white-space: nowrap; }
.card .meter-row:has(> :nth-child(2):last-child) { grid-template-columns: 1fr auto; }
.meter { height: 9px; background: #f3ece1; border-radius: 99px; overflow: hidden; }
.meter div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--maroon), #b13a4b); }
.meter.green div { background: linear-gradient(90deg, #1f8a5b, #3fb37f); }
.quick-ranges { display: flex; flex-wrap: wrap; gap: 8px; }
.report-title { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 6px 0 14px; }
.result-card.is-profit { border-color: #bfe3cf; background: linear-gradient(135deg, #f1fbf5, #fff); }
.result-card.is-profit b { color: var(--green); }
.result-card.is-loss { border-color: #f1c4c4; background: linear-gradient(135deg, #fff3f3, #fff); }
.result-card.is-loss b { color: var(--red); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.dot.in, .money-bar .in { background: linear-gradient(180deg, #3fb37f, #1f8a5b); }
.dot.out, .money-bar .out { background: linear-gradient(180deg, #b13a4b, var(--maroon)); }
.money-bars { display: flex; align-items: flex-end; gap: 10px; height: 200px; overflow-x: auto; padding-top: 8px; }
.money-bar { flex: 1; min-width: 44px; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.money-bar .pair { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.money-bar .pair div { width: 40%; max-width: 22px; border-radius: 6px 6px 2px 2px; min-height: 2px; }
.money-bar span { font-size: 11px; color: var(--muted); white-space: nowrap; }
tr.total-row td { font-weight: 800; background: #fbf8f2; border-top: 2px solid #ecdcc0; }
@media (max-width: 640px) {
    .meter-row { grid-template-columns: 1fr auto; }
    .meter-row .meter { grid-column: 1 / -1; grid-row: 2; }
}
@media print {
    .money-bar .pair div, .meter div, .legend .dot { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Grid columns may shrink below their content (wide tables scroll inside .table-wrap instead) */
.grid-2 > * { min-width: 0; }

/* ---------- Certificates (panel/certificates.php) ---------- */
.pick-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.pick-row:hover { background: #fbf7ee; border-color: #efe3cb; }
.certificate .doc-body { padding-top: 34px; }
.cert-title { text-align: center; font-family: var(--serif); font-weight: 600; font-size: 30px; color: var(--maroon); margin: 0 0 22px; letter-spacing: .5px; }
.cert-title::after { content: ""; display: block; width: 90px; height: 3px; margin: 12px auto 0; border-radius: 3px; background: var(--gold); }
.cert-text { font-size: 16.5px; line-height: 2; text-align: justify; margin: 0 0 14px; color: #3b352f; }
.certificate .doc-info { margin-top: 22px; }

/* ---------- Student ID cards: real ATM-card size 85.6 x 54 mm ---------- */
.id-cards { display: flex; flex-wrap: wrap; gap: 6mm; justify-content: center; }
.id-card { width: 85.6mm; height: 54mm; border-radius: 3mm; overflow: hidden; background: #fff; border: 1px solid #e6dccb; display: flex; flex-direction: column; box-shadow: 0 6px 18px rgba(40, 30, 20, .08); break-inside: avoid; font-family: var(--sans, inherit); }
.id-top { display: flex; align-items: center; justify-content: space-between; padding: 2mm 3mm; background: linear-gradient(135deg, var(--maroon), #6b1421); color: #f1e6cc; }
.id-top img { height: 8mm; }
.id-top span { font-size: 7pt; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.id-body { flex: 1; display: flex; gap: 3mm; padding: 2.5mm 3mm 1mm; min-height: 0; }
.id-photo { width: 21mm; height: 26mm; flex: none; border: 1px dashed #c9b48a; border-radius: 2mm; display: grid; place-items: center; font-size: 7pt; color: #a8977a; background: #fbf7ee; }
.id-info { min-width: 0; flex: 1; }
.id-name { display: block; font-size: 10pt; line-height: 1.2; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-info small { display: block; font-size: 7pt; color: var(--muted); margin-bottom: 1.2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-info dl { display: grid; grid-template-columns: auto 1fr; gap: .4mm 2mm; margin: 0; font-size: 7pt; }
.id-info dt { color: var(--muted); }
.id-info dd { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.id-bottom { background: var(--gold); color: #3a2c10; font-size: 6.5pt; font-weight: 700; text-align: center; padding: 1.2mm 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media print {
    .id-cards { gap: 4mm; justify-content: flex-start; }
    .id-card { box-shadow: none; border-color: #bbb; }
    .id-top, .id-bottom, .id-photo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Fees list: "N vouchers match" + Print all button under the filters */
.list-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: -4px 0 14px; padding: 10px 14px; border-radius: 10px; background: #fbf7ee; border: 1px solid #efe3cb; }

/* Previous-dues lines on a voucher: a little smaller than the main rows */
.doc-table tr.due-row td { padding-top: 7px; padding-bottom: 7px; font-size: 13px; }

/* Printing: a voucher / receipt / slip / certificate always stays on ONE page */
@media print {
    .doc-page { break-inside: avoid; page-break-inside: avoid; }
    .doc-header { padding: 14px 22px 12px; }
    .doc-brand img { width: auto; height: 52px; }
    .doc-title b { font-size: 22px; }
    .doc-body { padding: 14px 22px 16px; }
    .doc-info { gap: 6px; margin-bottom: 12px; }
    .doc-info div { padding: 6px 10px; }
    .doc-info b { font-size: 13.5px; }
    .doc-table { margin-bottom: 10px; }
    .doc-table th { padding: 7px 10px; }
    .doc-table td { padding: 6px 10px; font-size: 13px; }
    .doc-table tr.doc-section td { padding-top: 9px; }
    .doc-total { padding: 12px 16px; }
    .doc-note { margin-top: 10px; padding: 8px 12px; font-size: 12.5px; }
    .doc-footer { padding: 0 22px 16px; }
    .doc-footer .sign { margin-top: 30px; }
    .print-credit { margin-top: 10px; }
}
@media print {
    .doc-header { align-items: center; padding: 10px 22px; }
    .doc-brand img { height: 44px; }
    .doc-brand small { font-size: 10px; line-height: 1.35; margin-top: 4px; }
    .doc-title span { font-size: 9.5px; }
    .doc-title b { font-size: 19px; }
    .doc-title small { font-size: 10px; }
    .doc-stamp { transform: rotate(-12deg) scale(.82); }
    .doc-table td { padding: 5px 10px; }
    .doc-total { padding: 10px 16px; }
    .doc-total b { font-size: 24px; }
    .doc-total small { font-size: 11px; }
}
@media print {
    /* A4 is only ~700px wide, so phone rules would stack the header - keep it side by side */
    .doc-header { flex-direction: row !important; flex-wrap: nowrap !important; justify-content: space-between; }
    .doc-title { text-align: right !important; }
}
