:root {
    --primary: #0f4c81;
    --primary-2: #1769aa;
    --primary-soft: #e8f2fb;
    --ink: #142033;
    --muted: #66758a;
    --line: #dce5ef;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --danger: #b42318;
    --ok: #157347;
    --shadow: 0 18px 48px rgba(15, 76, 129, .12);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, #e8f2fb 0, transparent 34%), var(--bg);
    color: var(--ink);
    font: 14px/1.5 Inter, "Segoe UI", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
.hidden { display: none !important; }
.muted, small { color: var(--muted); }

.loading {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(3px);
}
.spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #dbeafe;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(232,242,251,.88), rgba(249,251,253,.94)), url('login-background.jpeg') center/cover no-repeat fixed;
}
.login-card {
    width: min(430px, 100%);
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(220,229,239,.9);
    border-radius: 24px;
    padding: 34px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}
.login-logos { display: flex; justify-content: center; gap: 16px; }
.login-logos img { width: 66px; height: 66px; object-fit: contain; border-radius: 14px; }
.login-card h1 { text-align: center; margin: 18px 0 5px; color: var(--primary); font-size: 32px; }
.login-card p { text-align: center; color: var(--muted); margin: 0 0 24px; }
.login-card p.login-subtitle { margin-bottom: 14px; }
.login-school-info {
    display: grid;
    gap: 3px;
    margin: 0 0 20px;
    padding: 11px 13px;
    border: 1px solid #dbe8f3;
    border-radius: 13px;
    background: rgba(240,247,253,.76);
    text-align: center;
}
.login-school-info strong { color: #173f63; font-size: 13px; }
.login-school-info span { color: var(--muted); font-size: 11px; }
.login-contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: -9px 0 18px;
}
.login-contact-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 7px 9px;
    border: 1px solid #d6e4ef;
    border-radius: 10px;
    background: #f8fbfe;
    color: #315a7d;
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    transition: color .15s, border-color .15s, background .15s, transform .15s;
}
.login-contact-links a:hover {
    color: var(--primary);
    border-color: #9fc4df;
    background: #edf7ff;
    transform: translateY(-1px);
}
.login-contact-links svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.login-contact-links .contact-icon-dot,
#loginYoutube svg path:last-child { fill: currentColor; stroke: none; }
.login-card label, .settings label {
    display: block;
    margin: 13px 0;
    font-weight: 700;
}
input, select, textarea {
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary-2);
    box-shadow: 0 0 0 4px rgba(23,105,170,.12);
}
.login-card input, .settings input, .toolbar input, .toolbar select { width: 100%; margin-top: 6px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 11px;
    padding: 10px 15px;
    font-weight: 800;
    text-decoration: none;
    transition: transform .12s, background .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 8px 18px rgba(15,76,129,.20); }
.btn.secondary { background: #edf3f9; color: #24415f; }
.btn.danger { background: #fee4e2; color: #991b1b; }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.login-card .btn { width: 100%; margin-top: 12px; }
.error { min-height: 20px; color: var(--danger); margin-top: 12px; font-size: 13px; }

.app { min-height: 100vh; display: flex; }
.sidebar {
    width: 270px;
    min-height: 100vh;
    position: sticky;
    top: 0;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    color: #dceaf6;
    background: linear-gradient(180deg, #0c2f50, #102a43);
    box-shadow: 10px 0 35px rgba(16,42,67,.08);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; }
.brand small, .user-box small { display: block; color: #9fb6c9; font-size: 11px; margin-top: 3px; }
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255,255,255,.12);
    font-size: 20px;
}
.brand-mark img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    border-radius: 10px;
}
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#nav {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 5px;
    overflow-y: auto;
    padding-right: 3px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.20) transparent;
}
#nav button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 44px;
    padding: 11px 12px;
    border-radius: 12px;
    background: transparent;
    color: #cbdbea;
    text-align: left;
}
#nav button:hover, #nav button.active, .nav-group.open > .nav-group-toggle {
    background: rgba(255,255,255,.12);
    color: #fff;
}
#nav button:focus-visible { outline: 2px solid rgba(147,197,253,.8); outline-offset: 2px; }
.nav-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .92;
}
.nav-label {
    min-width: 0;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-group { display: grid; gap: 3px; }
.nav-group-toggle { font-weight: 750; }
.nav-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s ease;
    opacity: .65;
}
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.nav-submenu {
    display: grid;
    gap: 3px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height .25s ease, opacity .18s ease, transform .18s ease;
}
.nav-group.open .nav-submenu {
    max-height: 420px;
    opacity: 1;
    transform: none;
}
.nav-submenu .nav-item {
    min-height: 40px;
    margin-left: 12px;
    padding: 9px 11px 9px 17px;
    border-left: 1px solid rgba(255,255,255,.14);
    border-radius: 0 11px 11px 0;
    font-size: 13px;
}
.nav-submenu .nav-icon {
    width: 17px;
    height: 17px;
    flex-basis: 17px;
}
.nav-submenu .nav-item.active {
    border-left-color: #7dd3fc;
    background: linear-gradient(90deg, rgba(56,189,248,.18), rgba(255,255,255,.09));
}
.nav-profile {
    margin-top: auto;
    padding-top: 9px;
    border-top: 1px solid rgba(255,255,255,.10);
}
.side-footer { margin-top: auto; padding: 18px 8px 0; color: #8ca5ba; font-size: 11px; }

.main { flex: 1; min-width: 0; }
.topbar {
    min-height: 72px;
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 28px;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.topbar-school {
    display: flex;
    flex: 1;
    align-items: center;
    min-width: 0;
    gap: 11px;
}
.topbar-school > img {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    padding: 3px;
}
.topbar-school > div { min-width: 0; }
.topbar-school small {
    display: flex;
    min-width: 0;
    gap: 7px;
    margin-top: 1px;
    color: var(--muted);
    font-size: 11px;
}
.topbar-school small strong,
.topbar-school small span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-school small span::before { content: "·"; margin-right: 7px; }
.menu-toggle {
    display: none;
    min-width: 42px;
    min-height: 42px;
    border-radius: 12px;
    background: #edf3f9;
}
.user-box { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar, .profile-avatar {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 800;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.content {
    width: min(1600px, 100%);
    padding: 28px;
}
.welcome {
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ffffff, #eef7ff);
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(15,76,129,.07);
}
.welcome h2 { margin: 0 0 4px; font-size: 26px; }
.welcome p { margin: 0; color: var(--muted); }
.stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0;
}
.stat, .panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 26px rgba(15,76,129,.06);
}
.stat { padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat strong { display: block; margin-top: 8px; color: var(--primary); font-size: 30px; letter-spacing: -.03em; }
.panel { padding: 20px; }
.dashboard-attendance-panel { margin-bottom: 22px; }
.attendance-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.attendance-summary-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-left: 4px solid #7b8da1;
    border-radius: 13px;
    background: #f9fbfd;
}
.attendance-summary-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; }
.attendance-summary-card strong { display: block; margin-top: 5px; color: var(--ink); font-size: 25px; }
.attendance-summary-card.status-present { border-left-color: #157347; }
.attendance-summary-card.status-permit { border-left-color: #2563eb; }
.attendance-summary-card.status-sick { border-left-color: #d97706; }
.attendance-summary-card.status-absent { border-left-color: #b42318; }
.attendance-summary-card.status-total { border-left-color: var(--primary); }
.dashboard-subheading { margin: 0 0 10px; font-size: 15px; }
.dashboard-absence-table { min-width: 760px; }
.panel-head {
    display: flex;
    align-items: center;
    gap: 15px;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 19px; }
.panel-subtitle { margin: 4px 0 0; }
.toolbar { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 160px; margin: 0; }
.table-wrap { overflow: auto; border-radius: 12px; }
.data-table {
    width: 100%;
    min-width: 860px;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th, .data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9eff6;
    text-align: left;
    vertical-align: top;
}
.data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7fafc;
    color: #526579;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.data-table tbody tr:hover { background: #f9fcff; }
.actions { white-space: nowrap; }
.select-search-input {
    margin-bottom: 6px !important;
    background: #f8fbfe;
}
.form-grid .select-search-input + select {
    margin-top: 0;
}
.attendance-tabs {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 14px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #eaf1f7;
}
.attendance-tab {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 9px;
    background: transparent;
    color: #536b80;
    font-weight: 800;
}
.attendance-tab.active { background: #fff; color: var(--primary); box-shadow: 0 4px 12px rgba(15,76,129,.1); }
.attendance-toolbar {
    display: grid;
    grid-template-columns: minmax(150px, .7fr) minmax(160px, .8fr) minmax(240px, 1.5fr) auto auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 16px;
}
.attendance-toolbar label { display: grid; gap: 5px; color: #526579; font-size: 12px; font-weight: 800; }
.attendance-toolbar input, .attendance-toolbar select { width: 100%; }
.attendance-summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.attendance-summary span {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    min-height: 31px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #f8fbfe;
    color: #536b80;
    font-size: 12px;
}
.attendance-summary strong { color: var(--ink); }
.attendance-status-hadir { --attendance-color: #187548; --attendance-bg: #e8f8ef; }
.attendance-status-izin { --attendance-color: #8a5a00; --attendance-bg: #fff6d8; }
.attendance-status-sakit { --attendance-color: #9a3412; --attendance-bg: #ffedd5; }
.attendance-status-alpha { --attendance-color: #a31d1d; --attendance-bg: #fee8e8; }
.attendance-summary .attendance-status-hadir,
.attendance-summary .attendance-status-izin,
.attendance-summary .attendance-status-sakit,
.attendance-summary .attendance-status-alpha { color: var(--attendance-color); background: var(--attendance-bg); border-color: transparent; }
.attendance-table { min-width: 930px; }
.attendance-table th:nth-child(1) { width: 90px; }
.attendance-table th:nth-child(2), .attendance-table th:nth-child(3) { width: 130px; }
.attendance-table th:nth-child(5) { width: 145px; }
.attendance-table th:nth-child(6) { width: 32%; }
.attendance-table select, .attendance-table input { width: 100%; min-width: 125px; }
.attendance-table td small { display: block; margin-top: 2px; }
.attendance-table tr[class*="attendance-status-"] td:first-child { box-shadow: inset 4px 0 0 var(--attendance-color); }
.attendance-report-wrap { max-height: 68vh; }
.attendance-report-table { min-width: 1700px; font-size: 12px; }
.attendance-report-table th, .attendance-report-table td { padding: 8px 7px; text-align: center; white-space: nowrap; }
.attendance-report-table th:nth-child(4), .attendance-report-table td:nth-child(4),
.attendance-report-table th:last-child, .attendance-report-table td:last-child { text-align: left; }
.attendance-report-table td[class*="attendance-status-"] { color: var(--attendance-color); background: var(--attendance-bg); font-weight: 900; }
.attendance-report-table th:nth-child(1), .attendance-report-table td:nth-child(1) { position: sticky; left: 0; z-index: 2; background: #fff; }
.attendance-report-table th:nth-child(2), .attendance-report-table td:nth-child(2) { position: sticky; left: 46px; z-index: 2; background: #fff; }
.attendance-report-table th:nth-child(3), .attendance-report-table td:nth-child(3) { position: sticky; left: 146px; z-index: 2; background: #fff; }
.attendance-report-table th:nth-child(4), .attendance-report-table td:nth-child(4) { position: sticky; left: 256px; z-index: 2; min-width: 220px; background: #fff; box-shadow: 6px 0 12px rgba(20,32,51,.05); }
.attendance-report-table thead th { z-index: 3; background: #f7fafc; }
.attendance-report-table thead th:nth-child(-n+4) { z-index: 4; background: #f7fafc; }
.activity-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid #eef2f6; }
.activity-dot { flex: 0 0 auto; width: 9px; height: 9px; margin-top: 7px; border-radius: 50%; background: #3b82b6; box-shadow: 0 0 0 4px #dbeafe; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.report-summary { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }
.report-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.report-card {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(135deg, #fff, #f7fbff);
}
.report-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}
.report-card strong {
    display: block;
    margin-top: 5px;
    color: var(--primary);
    font-size: 22px;
}
.settings { display: grid; grid-template-columns: 90px 1fr; gap: 24px; max-width: 580px; }
.settings small { display: block; margin: 6px 0 14px; }
.school-profile-form {
    display: grid;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr);
    gap: 24px;
}
.school-logo-grid { display: grid; align-content: start; gap: 14px; }
.school-logo-card {
    display: grid;
    gap: 9px;
    padding: 16px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #f8fbfe;
    font-weight: 800;
}
.school-logo-card img {
    width: 96px;
    height: 96px;
    justify-self: center;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid #d7e3ee;
    background: #fff;
    padding: 6px;
}
.school-logo-card input { width: 100%; padding: 9px; background: #fff; }
.school-logo-card small { font-weight: 500; }
.school-logo-card .school-logo-reset {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}
.school-logo-card .school-logo-reset input { width: 17px; height: 17px; padding: 0; accent-color: var(--primary); }
.school-profile-fields { align-content: start; }
.school-profile-actions {
    grid-column: 2;
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}
.access-note {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #b8d7ee;
    border-radius: 12px;
    background: #edf7ff;
    color: #254f72;
}
.role-badge, .status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 27px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #edf3f9;
    color: #24415f;
    font-size: 12px;
    font-weight: 800;
}
.status-badge.active { background: #dcfce7; color: #166534; }
.status-badge.inactive { background: #fee2e2; color: #991b1b; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.subscription-alert { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 14px 17px; border: 1px solid #f6d88c; border-left: 5px solid #d99816; border-radius: 13px; background: #fff9e8; color: #7a5307; }
.subscription-alert strong, .subscription-alert span { display: block; }
.subscription-alert strong { flex: 0 0 auto; }
.subscription-alert.urgent { border-color: #fdba74; border-left-color: #ea580c; background: #fff7ed; color: #9a3412; }
.subscription-alert.danger { border-color: #fca5a5; border-left-color: #dc2626; background: #fff1f2; color: #991b1b; }
.billing-grid { display: grid; grid-template-columns: minmax(380px, .85fr) minmax(440px, 1.15fr); gap: 20px; align-items: start; }
.subscription-card { background: linear-gradient(145deg, #fff, #edf7ff); }
.subscription-head, .subscription-period, .invoice-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.subscription-head h2 { margin: 3px 0 18px; color: var(--primary); }
.subscription-period { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 17px; border-top: 1px solid var(--line); }
.subscription-period div { display: grid; gap: 4px; }
.subscription-period strong { font-size: 17px; }
.subscription-deposit-card { padding: 0; overflow: hidden; }
.deposit-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 18px; }
.deposit-summary > div { display: grid; gap: 4px; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbfd; }
.deposit-summary small { color: var(--muted); }
.deposit-summary strong { color: #274862; font-size: 17px; }
.deposit-summary .balance { border-color: #a7e0c2; background: #effbf4; }
.deposit-summary .balance strong { color: #187548; }
.billing-subscription-form { padding: 0 0 18px; }
.billing-subscription-form .form-grid, .billing-subscription-form .school-profile-actions { padding-left: 18px; padding-right: 18px; }
.billing-price-preview { margin: 2px 18px 16px; padding: 12px 14px; border-left: 4px solid var(--primary); border-radius: 0 10px 10px 0; background: #eef7fc; color: var(--primary); font-weight: 800; }
.bank-list, .billing-invoices { display: grid; gap: 12px; margin-top: 14px; }
.billing-bank-panel { overflow: hidden; }
.billing-bank-heading { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.billing-bank-heading h2 { margin-top: 4px; }
.section-kicker {
    display: inline-block;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.bank-list { margin-top: 0; }
.bank-card, .invoice-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.bank-card {
    padding: 0;
    overflow: hidden;
    border-color: #cfddea;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 55, 86, .07);
}
.bank-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 18px;
    background: linear-gradient(135deg, #f8fbfe 0%, #eef6fc 100%);
    border-bottom: 1px solid #dce8f1;
}
.bank-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.bank-brand > div { display: grid; gap: 1px; min-width: 0; }
.bank-brand small, .bank-account-label {
    color: #688096;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.bank-brand h3 { margin: 0; color: #173a5b; font-size: 18px; }
.bank-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .04em;
    box-shadow: 0 6px 14px rgba(11, 78, 126, .2);
}
.bank-active {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: 999px;
    background: #e6f8ee;
    color: #187548;
    font-size: 11px;
    font-weight: 800;
}
.bank-active > span { width: 7px; height: 7px; border-radius: 50%; background: #20a565; }
.bank-account-box {
    display: grid;
    gap: 8px;
    margin: 18px;
    padding: 16px;
    border: 1px solid #d8e4ee;
    border-radius: 14px;
    background: #fff;
}
.bank-account-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bank-account-number {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--primary);
    font-size: clamp(24px, 2vw, 29px);
    line-height: 1.15;
    letter-spacing: .055em;
    font-variant-numeric: tabular-nums;
}
.bank-holder { color: #647d94; font-size: 13px; }
.bank-holder strong { color: #2b4a66; }
.bank-copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    min-height: 37px;
    padding: 7px 11px;
    border: 1px solid #bcd2e3;
    border-radius: 10px;
    background: #f1f7fb;
    color: var(--primary);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: .18s ease;
}
.bank-copy-button:hover { border-color: var(--primary); background: #e6f2fa; transform: translateY(-1px); }
.bank-copy-button.copied { border-color: #65bc8f; background: #e6f8ee; color: #187548; }
.bank-copy-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.bank-instructions { padding: 0 18px 18px; }
.bank-instructions-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 11px;
    color: #264a68;
}
.bank-instructions-title svg { width: 18px; height: 18px; fill: none; stroke: var(--ok); stroke-width: 1.9; }
.bank-instructions-title h4 { margin: 0; font-size: 14px; }
.bank-instruction-list { display: grid; gap: 9px; }
.bank-instruction-list p { margin: 0; color: #526c83; font-size: 13px; line-height: 1.55; }
.bank-instruction-intro {
    padding: 10px 12px;
    border-left: 3px solid #7bb9e2;
    border-radius: 0 9px 9px 0;
    background: #f3f8fc;
}
.bank-instruction-step {
    display: grid;
    grid-template-columns: 27px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
}
.bank-step-number {
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 9px;
    background: #e4f1fa;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
}
.bank-instruction-step p { padding-top: 3px; }
.bank-instruction-note {
    padding-top: 9px;
    border-top: 1px dashed #d7e3ec;
}
.invoice-card small { color: var(--muted); }
.invoice-main > div:first-child { display: grid; gap: 4px; }
.invoice-amount { display: grid; justify-items: end; gap: 7px; font-weight: 800; white-space: nowrap; }
.payment-history { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.payment-history small { flex-basis: 100%; color: var(--danger); }
.invoice-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.billing-payment-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.permission-table { min-width: 760px; }
.permission-table th:not(:first-child), .permission-table td:not(:first-child) { width: 92px; text-align: center; }
.permission-cell input {
    width: 19px;
    height: 19px;
    accent-color: var(--primary);
    cursor: pointer;
}
.permission-cell input:disabled { cursor: not-allowed; opacity: .45; }
.user-table { min-width: 1050px; }
#savePermissionsBtn:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.srs-cell-mark { display: block; margin-top: 4px; color: #b45309; font-size: 10px; font-weight: 800; letter-spacing: .04em; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(15,32,51,.52);
    backdrop-filter: blur(4px);
}
.modal {
    width: min(820px, 100%);
    max-height: min(90vh, 920px);
    overflow: auto;
    background: #fff;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 24px 80px rgba(15,32,51,.28);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.modal-head h2 { margin: 0; }
.close { min-width: 40px; min-height: 40px; border-radius: 12px; background: #f2f5f8; color: var(--muted); font-size: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 15px; }
.form-grid label { display: block; margin: 10px 0; font-weight: 700; }
.form-grid label.full { grid-column: 1 / -1; }
.form-section-title {
    grid-column: 1 / -1;
    margin: 18px 0 2px;
    padding: 11px 13px;
    border-left: 4px solid var(--primary);
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 14px;
}
.form-section-title:first-child { margin-top: 2px; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; margin-top: 6px; }
.form-grid textarea { min-height: 92px; resize: vertical; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast {
    position: fixed;
    right: 22px;
    bottom: calc(22px + env(safe-area-inset-bottom));
    z-index: 90;
    max-width: min(420px, calc(100vw - 32px));
    padding: 13px 16px;
    border-radius: 13px;
    background: #102a43;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }

.help-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 26px 28px;
    overflow: hidden;
    border: 1px solid #cfe2ef;
    border-radius: 20px;
    background:
        radial-gradient(circle at 92% 15%, rgba(74,164,220,.24), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #eff8fd 100%);
    box-shadow: var(--shadow);
}
.help-hero h2 { margin: 4px 0 7px; color: #123d5c; font-size: clamp(24px, 3vw, 34px); }
.help-hero p { max-width: 720px; margin: 0; color: var(--muted); }
.help-role-card {
    display: grid;
    flex: 0 0 min(290px, 34%);
    gap: 4px;
    padding: 17px 19px;
    border: 1px solid #c8dfed;
    border-radius: 16px;
    background: rgba(255,255,255,.9);
}
.help-role-card small, .help-role-card span { color: var(--muted); }
.help-role-card strong { color: var(--primary); font-size: 20px; }
.help-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.help-toc { position: sticky; top: 100px; display: grid; gap: 6px; padding: 15px; }
.help-toc > strong { padding: 5px 9px 10px; color: #2b4a66; }
.help-toc-button {
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #526c83;
    font: inherit;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}
.help-toc-button:hover, .help-toc-button.active { background: var(--primary-soft); color: var(--primary); }
.help-content { min-width: 0; }
.help-panel { padding: 0; overflow: hidden; }
.help-panel > :not(.panel-head) { margin-left: 20px; margin-right: 20px; }
.help-step-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 20px 0; }
.help-step {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}
.help-step > span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 16px;
    font-weight: 900;
}
.help-step h3, .help-guide-card h3, .help-role-detail h3 { margin: 0; color: #213f59; font-size: 15px; }
.help-step p, .help-guide-card p, .help-role-detail p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; }
.help-note {
    margin-bottom: 18px;
    padding: 16px 18px;
    border: 1px solid #bfe2d0;
    border-left: 5px solid var(--ok);
    border-radius: 14px;
    background: #f0fbf5;
    color: #315d48;
}
.help-note p { margin: 4px 0 0; }
.help-search-head input { width: min(300px, 100%); }
.help-guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px 0; }
.help-guide-card {
    display: flex;
    flex-direction: column;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fff;
}
.help-guide-title { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 11px; }
.help-guide-title .nav-icon {
    width: 38px;
    height: 38px;
    padding: 9px;
    border-radius: 11px;
    background: var(--primary-soft);
    color: var(--primary);
}
.help-permission-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.help-permission-badges span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f7ef;
    color: #187548;
    font-size: 11px;
    font-weight: 800;
}
.help-guide-card ol { flex: 1; margin: 15px 0 17px; padding-left: 20px; color: #526c83; }
.help-guide-card li { margin: 6px 0; padding-left: 3px; line-height: 1.5; }
.help-guide-card .btn { align-self: flex-start; }
.help-role-grid { display: grid; gap: 11px; padding: 20px 0; }
.help-role-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
}
.help-role-detail.current { border-color: #85bee1; background: #f2f9fd; }
.help-role-detail > div { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 12px; align-items: center; }
.help-role-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.help-role-detail h3 small { margin-left: 6px; color: var(--primary); font-size: 10px; text-transform: uppercase; }
.help-legend { display: flex; flex-wrap: wrap; gap: 15px; padding: 15px 0; color: var(--muted); font-size: 12px; }
.help-legend span { display: inline-flex; align-items: center; gap: 6px; }
.help-legend span:last-child { margin-left: auto; }
.help-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.help-dot.allowed { background: var(--ok); }
.help-dot.denied { background: #c9d4de; }
.help-matrix { min-width: 720px; }
.help-matrix td:first-child small { display: block; margin-top: 3px; color: var(--muted); }
.help-matrix th:not(:first-child), .help-matrix-cell { width: 82px; text-align: center; }
.matrix-mark { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; font-size: 12px; font-weight: 900; }
.matrix-mark.allowed { background: #e2f7eb; color: #187548; }
.matrix-mark.denied { background: #edf1f4; color: #8292a0; }
.matrix-na { color: #b8c3cc; }
.help-faq-list { display: grid; gap: 10px; padding: 20px 0; }
.help-faq-list details { border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.help-faq-list summary { padding: 14px 16px; color: #294a65; font-weight: 800; cursor: pointer; }
.help-faq-list p { margin: 0; padding: 0 16px 16px; color: var(--muted); line-height: 1.6; }
.help-support-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 20px 0 0; }
.help-support-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 13px;
    align-items: center;
    padding: 16px;
    border: 1px solid #bfe5d0;
    border-radius: 15px;
    background: linear-gradient(135deg, #fff, #f0fbf5);
}
.help-support-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #dcfce7; color: #15803d; font-size: 21px; font-weight: 900; }
.help-support-card small, .help-support-card strong, .help-support-card span { display: block; }
.help-support-card small { color: var(--muted); font-weight: 700; }
.help-support-card strong { margin-top: 2px; color: #214b39; font-size: 16px; }
.help-support-card span { margin-top: 2px; color: #49705f; }
.help-whatsapp-button { white-space: nowrap; background: #16a34a !important; color: #fff !important; border-color: #16a34a !important; }

.subscription-document-panel { margin-top: 20px; }
.subscription-document-layout { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(420px, 1.1fr); gap: 22px; align-items: start; }
.subscription-document-form { padding: 18px; border: 1px solid #dbe7f2; border-radius: 16px; background: linear-gradient(145deg, #f8fbff, #fff); }
.subscription-document-form textarea { min-height: 84px; }
.document-policy-note { margin-top: 14px; padding: 12px 14px; border: 1px solid #bfdbfe; border-radius: 12px; color: #1e3a5f; background: #eff6ff; font-size: 12px; line-height: 1.55; }
.document-workflow { display: flex; align-items: center; gap: 8px; overflow-x: auto; margin-bottom: 14px; padding: 12px; border-radius: 14px; background: #f1f5f9; }
.document-workflow span { display: flex; align-items: center; gap: 7px; min-width: max-content; color: #334155; font-size: 12px; font-weight: 700; }
.document-workflow strong { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: #0f4c81; }
.document-workflow i { color: #94a3b8; font-style: normal; }
.billing-documents { display: grid; gap: 12px; }
.billing-document-card { padding: 16px; border: 1px solid #dbe4ee; border-radius: 15px; background: #fff; box-shadow: 0 6px 18px rgba(15, 76, 129, .06); }
.billing-document-main { display: flex; justify-content: space-between; gap: 18px; }
.billing-document-main > div:first-child, .billing-document-status { display: grid; gap: 5px; }
.billing-document-main strong { color: #0f2740; }
.billing-document-main small, .signed-file-name { color: #64748b; }
.document-type { width: max-content; padding: 4px 8px; border-radius: 999px; color: #075985; background: #e0f2fe; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.billing-document-status { justify-items: end; min-width: 130px; }
.document-rejection { margin-top: 12px; padding: 10px 12px; border-radius: 10px; color: #991b1b; background: #fef2f2; font-size: 12px; }
.document-lock { display: block; margin-top: 12px; color: #166534; font-size: 12px; font-weight: 700; }
.billing-document-upload { margin-top: 14px; padding: 16px; border: 1px dashed #60a5fa; border-radius: 14px; background: #eff6ff; }
.billing-document-upload label { display: grid; gap: 8px; font-weight: 700; }
.billing-document-upload small { color: #64748b; font-weight: 400; }

@media (max-width: 1200px) {
    .subscription-document-layout { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .attendance-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        z-index: 50;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        transform: translateX(-100%);
        transition: transform .2s ease;
    }
    .sidebar.open { transform: none; }
    .menu-toggle { display: inline-grid; place-items: center; }
    .topbar { padding: 0 15px; }
    .content { padding: 16px; }
    .panel-head { align-items: flex-start; flex-direction: column; }
    .toolbar { width: 100%; margin-left: 0; }
    .toolbar input, .toolbar select, .toolbar .btn { flex: 1 1 150px; }
    .attendance-toolbar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .attendance-search { grid-column: 1 / -1; }
    .settings { grid-template-columns: 1fr; }
    .school-profile-form { grid-template-columns: 1fr; }
    .school-logo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .school-profile-actions { grid-column: 1; }
    .profile-avatar { margin: auto; }
    .report-cards { grid-template-columns: 1fr; }
    .billing-grid { grid-template-columns: 1fr; }
    .deposit-summary { grid-template-columns: 1fr; }
    .subscription-alert { align-items: flex-start; flex-direction: column; }
    .help-layout { grid-template-columns: 1fr; }
    .help-toc { position: static; display: flex; overflow-x: auto; }
    .help-toc > strong { display: none; }
    .help-toc-button { flex: 0 0 auto; width: auto; white-space: nowrap; }
}
@media (max-width: 640px) {
    body { font-size: 13px; }
    .login-screen { padding: 14px; }
    .login-card { padding: 24px; border-radius: 20px; }
    .app { display: block; }
    .topbar { min-height: 64px; }
    .topbar h1 { font-size: 18px; }
    .topbar-school { gap: 7px; }
    .topbar-school > img { width: 34px; height: 34px; flex-basis: 34px; }
    .topbar-school small span { display: none; }
    .user-box > div:nth-child(2) { display: none; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .attendance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat { padding: 14px; }
    .stat strong { font-size: 24px; }
    .panel { padding: 14px; border-radius: 14px; }
    .form-grid { grid-template-columns: 1fr; }
    .attendance-tabs { width: 100%; }
    .attendance-tab { flex: 1; }
    .attendance-toolbar { grid-template-columns: 1fr; }
    .attendance-search { grid-column: auto; }
    .attendance-toolbar .btn, .attendance-toolbar a.btn { width: 100%; }
    .attendance-table-wrap { overflow: visible; }
    .attendance-table { min-width: 0; border-collapse: separate; display: block; }
    .attendance-table thead { display: none; }
    .attendance-table tbody { display: grid; gap: 12px; }
    .attendance-table tr { display: grid; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
    .attendance-table td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 8px; align-items: center; padding: 7px 4px; border: 0; }
    .attendance-table td::before { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
    .attendance-table td:nth-child(1)::before { content: "Kelas"; }
    .attendance-table td:nth-child(2)::before { content: "NIS"; }
    .attendance-table td:nth-child(3)::before { content: "NISN"; }
    .attendance-table td:nth-child(4)::before { content: "Nama Siswa"; }
    .attendance-table td:nth-child(5)::before { content: "Kehadiran"; }
    .attendance-table td:nth-child(6)::before { content: "Keterangan"; }
    .invoice-main { flex-direction: column; }
    .invoice-amount { justify-items: start; }
    .billing-document-main { flex-direction: column; }
    .billing-document-status { justify-items: start; }
    .document-workflow { align-items: flex-start; flex-direction: column; }
    .document-workflow i { display: none; }
    .bank-card-header { align-items: flex-start; }
    .bank-active { padding: 5px 7px; }
    .bank-active > span { display: none; }
    .bank-account-row { align-items: stretch; flex-direction: column; }
    .bank-copy-button { width: 100%; }
    .school-logo-grid { grid-template-columns: 1fr; }
    .help-hero { align-items: stretch; flex-direction: column; padding: 20px; }
    .help-role-card { flex-basis: auto; }
    .help-step-grid, .help-guide-grid { grid-template-columns: 1fr; }
    .help-support-grid { grid-template-columns: 1fr; }
    .help-panel > :not(.panel-head) { margin-left: 14px; margin-right: 14px; }
    .help-role-detail { align-items: stretch; flex-direction: column; }
    .help-role-detail .btn { width: 100%; }
    .help-legend span:last-child { flex-basis: 100%; margin-left: 0; }
    .modal-backdrop { padding: 10px; align-items: end; }
    .modal {
        width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        padding: 18px;
    }
    .modal-actions { position: sticky; bottom: 0; padding-top: 12px; background: #fff; }
}
@media (max-width: 560px) {
    .help-support-card { grid-template-columns: 42px minmax(0, 1fr); }
    .help-whatsapp-button { grid-column: 1 / -1; width: 100%; }
}
@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr; }
    .attendance-summary-grid { grid-template-columns: 1fr; }
    .toolbar input, .toolbar select, .toolbar .btn { flex-basis: 100%; }
    .btn { width: 100%; }
    .user-box .btn { width: auto; }
    .actions .btn { width: auto; margin-bottom: 4px; }
}
