:root {
    --primary: #047857;
    --primary-dark: #065f46;
    --accent: #2563eb;
    --bg: #f3f8f6;
    --surface: #ffffff;
    --border: #dbe7e2;
    --text: #10231d;
    --muted: #66756f;
    --danger: #dc2626;
    --warning: #d97706;
    --success: #059669;
    --shadow: 0 16px 50px rgba(16, 35, 29, .08);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, .12), transparent 28rem),
        linear-gradient(135deg, #f5fbf8, var(--bg) 46%, #eef5ff);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    color: #fff;
    background:
        linear-gradient(165deg, var(--primary), var(--primary-dark)),
        var(--primary);
    display: flex;
    flex-direction: column;
    box-shadow: 8px 0 30px rgba(15, 23, 42, .12);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand-logo,
.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .16);
    display: grid;
    place-items: center;
    font-weight: 900;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .24);
    overflow: hidden;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0;
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: rgba(255, 255, 255, .74);
    line-height: 1.35;
}

.nav-list {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    color: rgba(255, 255, 255, .82);
    margin-bottom: 6px;
    transition: .2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, .16);
    color: #fff;
    transform: translateX(2px);
}

.nav-group.is-open > .nav-parent {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.nav-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    font-size: 15px;
    font-weight: 900;
}

.nav-group {
    margin-bottom: 6px;
}

.nav-parent {
    margin-bottom: 4px;
}

.nav-caret {
    margin-left: auto;
    opacity: .74;
    font-size: 12px;
}

.nav-sublist {
    display: grid;
    gap: 4px;
    margin: 2px 0 10px 40px;
}

.nav-sub-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
    font-weight: 800;
}

.nav-sub-link:hover,
.nav-sub-link.is-active {
    background: rgba(255, 255, 255, .13);
    color: #fff;
}

.nav-sub-link .nav-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    font-size: 13px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .14);
}

.logout-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    border: 0;
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    background: rgba(220, 38, 38, .95);
    color: #fff;
    font-weight: 800;
}

.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 28px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(219, 231, 226, .72);
}

.page-kicker {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.page-title {
    margin: 2px 0 0;
    font-size: 26px;
    line-height: 1.1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-pill,
.role-pill,
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 999px;
    background: #eef8f4;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.content {
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: 28px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.alert {
    padding: 13px 15px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    font-weight: 700;
}

.alert-success {
    border-color: #bbf7d0;
    background: #ecfdf5;
    color: #065f46;
}

.alert-danger {
    border-color: #fecaca;
    background: #fff1f2;
    color: #991b1b;
}

.panel,
.card,
.table-card {
    background: var(--surface);
    border: 1px solid rgba(219, 231, 226, .88);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel {
    padding: 22px;
}

.panel-soft {
    padding: 16px;
    border-radius: 16px;
    background: #f2fbf7;
    border: 1px solid #d7f0e4;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    padding: 20px;
    border-radius: 18px;
    background: linear-gradient(145deg, #fff, #f3fbf7);
    border: 1px solid rgba(219, 231, 226, .86);
    box-shadow: var(--shadow);
}

.stat-card.accent {
    background: linear-gradient(145deg, #fff, #eef4ff);
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
}

.stat-value {
    margin-top: 7px;
    font-size: 28px;
    font-weight: 950;
    letter-spacing: 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-title {
    margin: 0;
    font-size: 18px;
    font-weight: 900;
}

.section-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar.compact {
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
}

label {
    display: grid;
    gap: 7px;
    font-size: 13px;
    font-weight: 800;
    color: #33443d;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(4, 120, 87, .14);
}

input[type="color"] {
    height: 45px;
    padding: 4px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.btn {
    border: 0;
    border-radius: 13px;
    padding: 11px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 900;
    transition: .18s ease;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 10px 24px rgba(4, 120, 87, .22);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-light {
    background: #eef4f1;
    color: var(--primary-dark);
}

.btn-wide {
    width: 100%;
}

.btn.disabled,
.btn:disabled {
    opacity: .52;
    pointer-events: none;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 13px 14px;
    border-bottom: 1px solid #edf2f0;
    vertical-align: top;
}

th {
    background: #eef8f4;
    color: #263b33;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:hover td {
    background: #fbfefd;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.muted {
    color: var(--muted);
}

.strong {
    font-weight: 900;
}

.danger {
    color: var(--danger);
}

.success {
    color: var(--success);
}

.form-block {
    display: grid;
    gap: 15px;
}

.split {
    display: grid;
    grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
    gap: 20px;
}

.profile-box {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 68px;
    height: 68px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: #eef8f4;
    color: var(--primary);
    font-weight: 950;
    overflow: hidden;
    flex: 0 0 auto;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.timeline span {
    display: inline-flex;
    padding: 7px 10px;
    border-radius: 999px;
    background: #eef8f4;
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 900;
}

.page-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.tab-link,
.tab-btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--primary-dark);
    padding: 10px 14px;
    font-weight: 900;
}

.tab-link.is-active,
.tab-btn.is-active {
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 10px 24px rgba(4, 120, 87, .18);
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .52);
    backdrop-filter: blur(7px);
}

.modal-card {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    max-height: min(88vh, 980px);
    overflow: auto;
    padding: 24px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid rgba(219, 231, 226, .88);
    box-shadow: 0 28px 80px rgba(15, 23, 42, .26);
}

.modal-wide {
    width: min(1120px, 100%);
}

.modal-header,
.student-detail-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.modal-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 12px;
    background: #eef4f1;
    color: var(--primary-dark);
    font-size: 24px;
    font-weight: 900;
}

.student-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0 18px;
}

.student-tab-panel {
    display: none;
    padding-top: 4px;
}

.student-tab-panel.is-active {
    display: block;
}

.student-tab-panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.detail-grid div {
    padding: 14px;
    border-radius: 14px;
    background: #f7fbf9;
    border: 1px solid #e2eee9;
}

.detail-grid span,
.detail-grid strong {
    display: block;
}

.detail-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.detail-grid strong {
    margin-top: 4px;
}

.receipt {
    width: min(420px, 100%);
    margin: 0 auto;
    padding: 24px;
    border: 1px dashed #94a3b8;
    border-radius: 16px;
    background: #fff;
}

.receipt h2 {
    margin: 0 0 4px;
    text-align: center;
}

.receipt-line {
    border-top: 1px dashed #9ca3af;
    margin: 14px 0;
}

.install-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.install-shell {
    width: min(860px, 100%);
}

.install-card {
    background: rgba(255, 255, 255, .94);
    border: 1px solid rgba(219, 231, 226, .82);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 30px;
}

.install-card h1 {
    margin-bottom: 6px;
}

.install-card p {
    color: var(--muted);
}

.install-form {
    display: grid;
    gap: 18px;
}

.install-form h2 {
    font-size: 15px;
    margin: 10px 0 0;
    padding-top: 14px;
    border-top: 1px solid #edf2f0;
}

.public-dashboard {
    min-height: 100vh;
    padding: 24px;
    display: grid;
    place-items: center;
}

.public-hero {
    width: min(1180px, 100%);
    min-height: min(780px, calc(100vh - 48px));
    padding: 28px;
    border-radius: 30px;
    background:
        linear-gradient(135deg, var(--primary), var(--accent)),
        var(--primary);
    color: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, .28);
    overflow: hidden;
    position: relative;
}

.public-hero::before {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    right: -130px;
    top: -160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .13);
}

.public-hero::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    left: -120px;
    bottom: -150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
}

.public-nav,
.public-grid {
    position: relative;
    z-index: 1;
}

.public-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.public-logo {
    background: rgba(255, 255, 255, .18);
}

.public-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 26px;
    align-items: stretch;
    margin-top: 54px;
}

.public-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.public-copy h1 {
    max-width: 760px;
    margin: 20px 0 12px;
    font-size: clamp(38px, 7vw, 76px);
    line-height: .96;
    letter-spacing: 0;
}

.public-copy p {
    max-width: 650px;
    color: rgba(255, 255, 255, .78);
    font-size: 17px;
    line-height: 1.7;
}

.public-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.public-stats .stat-card {
    background: rgba(255, 255, 255, .14);
    border-color: rgba(255, 255, 255, .18);
    color: #fff;
    backdrop-filter: blur(12px);
}

.public-stats .stat-label {
    color: rgba(255, 255, 255, .72);
}

.public-stats .stat-value {
    font-size: 25px;
}

.public-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.public-summary div {
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 16px;
    background: rgba(255, 255, 255, .09);
}

.public-summary span,
.public-summary strong {
    display: block;
}

.public-summary .muted {
    color: rgba(255, 255, 255, .66);
    font-size: 12px;
    font-weight: 800;
}

.public-summary strong {
    margin-top: 4px;
    font-size: 18px;
}

.login-panel {
    padding: 24px;
    border-radius: 22px;
    background: rgba(255, 255, 255, .94);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, .42);
    box-shadow: 0 18px 50px rgba(15, 23, 42, .22);
}

.login-panel h2 {
    margin: 0 0 4px;
    font-size: 24px;
}

.mobile-menu {
    display: none;
}

@media (max-width: 1080px) {
    .app-shell,
    .split,
    .public-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        height: auto;
    }

    .nav-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid,
    .grid.four,
    .public-stats,
    .public-summary,
    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .topbar,
    .content {
        padding: 18px;
    }

    .topbar,
    .section-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid.two,
    .grid.three,
    .grid.four,
    .stats-grid,
    .nav-list,
    .public-stats,
    .public-summary,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .public-dashboard {
        padding: 0;
    }

    .public-hero {
        min-height: 100vh;
        border-radius: 0;
        padding: 20px;
    }

    .public-nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-copy h1 {
        font-size: 40px;
    }

    .span-2 {
        grid-column: auto;
    }

    .toolbar {
        display: grid;
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 12px;
        align-items: flex-start;
    }

    .modal-card {
        max-height: calc(100vh - 24px);
    }

    .modal-header,
    .student-detail-head {
        flex-direction: column;
    }
}

@media print {
    body {
        background: #fff !important;
    }

    .sidebar,
    .topbar,
    .modal-backdrop,
    .modal-header,
    .student-tabs,
    .no-print,
    .flash-stack {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content {
        padding: 0;
        width: 100%;
    }

    .panel,
    .card,
    .table-card,
    .modal-card {
        box-shadow: none;
        border: none;
    }

    .modal {
        display: none !important;
    }

    .modal.is-open {
        position: static;
        display: block !important;
        padding: 0;
    }

    .student-tab-panel {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 14px;
    }

    th,
    td {
        border: 1px solid #111 !important;
        color: #000 !important;
        background: #fff !important;
        padding: 7px !important;
    }
}
