:root {
    --primary: #103f8a;
    --secondary: #fecb0a;
    --bg: #eef4ff;
    --surface: #ffffff;
    --text: #111827;
    --muted: #64748b;
    --border: #d7e1ef;
    --shadow: 0 18px 45px rgba(16, 63, 138, 0.08);
    --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.06);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(254,203,10,.18), transparent 24%),
        radial-gradient(circle at top right, rgba(16,63,138,.12), transparent 20%),
        linear-gradient(180deg, #f9fbff 0%, var(--bg) 100%);
}

a { color: var(--primary); text-decoration: none; transition: .2s ease; }
a:hover { opacity: .95; }
button { cursor: pointer; font: inherit; }

.app-shell { min-height: 100vh; }
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 80;
    width: 282px;
    height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    background: linear-gradient(180deg, #0d3471 0%, #103f8a 100%);
    color: #fff;
}

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.brand-guest { margin: 0; }
.brand-mark {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(135deg, #fecb0a 0%, #fff2b8 100%);
    color: #111827;
}

.brand-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 16px;
    background: rgba(255,255,255,.12);
    padding: 6px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.brand strong { display: block; line-height: 1.2; }
.brand span { display: block; margin-top: 4px; color: rgba(255,255,255,.84); font-size: .9rem; }

.sidebar-note {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.08);
}

.sidebar-note strong { display: block; margin-bottom: 5px; font-size: .95rem; }
.sidebar-note span { color: rgba(255,255,255,.8); font-size: .88rem; line-height: 1.5; }

.nav-links { display: grid; gap: 8px; }
.nav-links-footer { margin-top: auto; position: sticky; bottom: 0; padding-top: 8px; background: linear-gradient(180deg, rgba(16,63,138,0) 0%, rgba(16,63,138,.95) 26%); }
.nav-links a {
    color: rgba(255,255,255,.96);
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.06);
    background: rgba(255,255,255,.1);
    font-weight: 700;
}

.nav-links a:hover { transform: translateX(2px); background: rgba(255,255,255,.16); }
.nav-links a.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(254,203,10,.28) 0%, rgba(255,255,255,.2) 100%);
    border-color: rgba(255,255,255,.18);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}

.main-content {
    min-width: 0;
    margin-left: 282px;
    padding: 28px 28px 108px;
}

.main-content.guest-content { margin-left: 0; }
.guest-content { max-width: 1100px; margin: 0 auto; }
.page-frame { width: min(1360px, 100%); margin: 0 auto; }

.topbar, .guest-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 24px;
}

.mobile-topbar,
.mobile-drawer,
.mobile-drawer-overlay { display: none; }

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: .8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.topbar h1 { margin: 0; font-size: clamp(1.8rem, 2.5vw, 2.5rem); }
.topbar-subtitle { margin: 8px 0 0; color: var(--muted); max-width: 720px; line-height: 1.6; }
.topbar-meta { display: flex; align-items: center; gap: 12px; }
.topbar-logo {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    object-fit: contain;
    background: #fff;
    padding: 4px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
}

.topbar-chip {
    padding: 12px 15px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-weight: 700;
}

.card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary) 0%, rgba(254,203,10,.65) 100%);
    opacity: .95;
}

.narrow { max-width: 920px; margin: 24px auto; }
.section-head { margin-bottom: 16px; }
.section-head h2, .section-head h3 { margin: 0 0 6px; }
.section-head p { margin: 0; color: var(--muted); }
.row-between { display: flex; justify-content: space-between; gap: 16px; align-items: start; }

.stats-grid,
.two-column,
.three-column,
.form-grid,
.check-grid,
.id-grid {
    display: grid;
    gap: 16px;
}

.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.stats-grid.compact { margin-top: 0; }
.two-column { grid-template-columns: 1fr 1fr; }
.three-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.id-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat-card { background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%); }
.stat-card p { margin: 0; color: var(--muted); font-size: .9rem; }
.stat-card h3 { margin: 8px 0 0; color: var(--primary); font-size: 1.8rem; line-height: 1.15; }
.stat-card-kpi { padding-top: 18px; }
.stat-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(16,63,138,.12) 0%, rgba(254,203,10,.22) 100%);
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field.action-fit { align-content: end; }
.field label { font-weight: 700; font-size: .92rem; }
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    font: inherit;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.search-row input:focus,
.search-row select:focus {
    outline: none;
    border-color: rgba(16,63,138,.45);
    box-shadow: 0 0 0 4px rgba(16,63,138,.09);
}

.field input[type="checkbox"] { width: auto; }
.field textarea { min-height: 88px; resize: vertical; }
.section-stack { display: grid; gap: 18px; }
.action-row, .search-row, .action-inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search-row { margin-bottom: 16px; }
.search-row input, .search-row select {
    flex: 1;
    min-width: 180px;
    padding: 12px 13px;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.button,
.action-inline button {
    border: 0;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
    box-shadow: var(--shadow-soft);
    transition: transform .2s ease, box-shadow .2s ease;
}

.button:hover,
.action-inline button:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(15,23,42,.08);
}

.button-primary { background: var(--primary); color: #fff; }
.button-secondary,
.action-inline button { background: #eff4fc; color: var(--text); }
.button-light {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.flash {
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: 14px;
    font-weight: 700;
}

.flash-success { background: #ecfdf3; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }

.empty-state {
    padding: 26px 18px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%);
    color: var(--muted);
    text-align: center;
    font-weight: 600;
}

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
thead th { position: sticky; top: 0; z-index: 1; background: #fbfdff; }
th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover td { background: rgba(16,63,138,.02); }
.desktop-only { display: block; }
.mobile-only { display: none; }

.simple-list { margin: 0; padding-left: 18px; }
.status-pill { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.status-active, .status-present { background: #ecfdf3; color: #166534; }
.status-inactive, .status-absent { background: #fff1f2; color: #be123c; }
.status-late { background: #fff7ed; color: #c2410c; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-item { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: #f8fbff; }
.detail-item span { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.detail-item strong { font-size: 1rem; line-height: 1.45; }
.detail-item-full { grid-column: 1 / -1; }

.check-item,
.check-box,
.id-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fbff;
}

.check-item.ok span { color: #166534; font-weight: 700; }
.check-item.warn span { color: #92400e; font-weight: 700; }
.check-box { display: block; }

.id-card {
    position: relative;
    overflow: hidden;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.id-card header { margin-bottom: 12px; color: var(--primary); font-size: 1.05rem; font-weight: 800; }
.id-card footer { margin-top: 10px; color: var(--muted); font-size: .85rem; }
.id-body { display: grid; gap: 6px; }
.id-card-top { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.id-logo { width: 56px; height: 56px; object-fit: contain; padding: 6px; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
.id-body-advanced { display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start; }
.id-photo-column { display: grid; gap: 10px; justify-items: start; }
.id-info-column { display: grid; gap: 6px; }
.id-photo { width: 88px; height: 88px; margin-bottom: 6px; border: 3px solid rgba(16,63,138,.14); border-radius: 16px; object-fit: cover; }
.id-photo-fallback { display: grid; place-items: center; background: #e7eefc; color: var(--primary); font-weight: 800; }
.id-qr-wrap { padding: 6px; border: 1px dashed var(--border); border-radius: 16px; background: #fff; }
.id-qr { width: 92px; height: 92px; margin-top: 8px; padding: 6px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.id-card-single { max-width: 440px; margin: 0 auto; }
.id-grid-a4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.id-card-a4 { min-height: 320px; }

.student-thumb { display: block; width: 88px; height: 88px; margin-top: 8px; border: 2px solid var(--border); border-radius: 18px; object-fit: cover; }
.logo-thumb { width: 84px; max-height: 84px; padding: 8px; border: 1px solid var(--border); border-radius: 16px; background: #fff; object-fit: contain; }
.profile-photo-wrap { margin-bottom: 16px; }
.profile-photo { width: 132px; height: 132px; border: 4px solid rgba(16,63,138,.08); border-radius: 24px; box-shadow: var(--shadow); object-fit: cover; }
.profile-photo-thumb { width: 96px; height: 96px; border-radius: 20px; }

.thumb-preview-card {
    display: inline-grid;
    gap: 8px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 18px;
    background: #f8fbff;
    align-items: start;
    justify-items: start;
}

.thumb-preview-card span { color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.thumb-preview-card-profile { margin-bottom: 12px; }

.receipt-card { max-width: 920px; margin: 0 auto; }
.receipt-header { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px dashed var(--border); }
.receipt-meta { display: grid; gap: 6px; color: var(--muted); }
.receipt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.receipt-box { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: #f8fbff; }
.receipt-total { color: var(--primary); font-size: 1.6rem; font-weight: 800; }

.notice-list { display: grid; gap: 10px; }
.notice-card {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
}

.notice-card strong { display: block; margin-bottom: 6px; }
.notice-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.notice-badge { padding: 6px 10px; border-radius: 999px; font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.notice-card-warning .notice-badge { background: #fff7ed; color: #c2410c; }
.notice-card-success .notice-badge { background: #ecfdf3; color: #166534; }
.notice-card-danger .notice-badge { background: #fff1f2; color: #be123c; }
.notice-card-info .notice-badge { background: #eff6ff; color: #1d4ed8; }
.notice-action { font-size: .88rem; font-weight: 800; }

.auth-hero,
.install-hero {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    max-width: 1180px;
    margin: 0 auto 18px;
    padding: 0 12px;
}

.auth-hero h2, .install-hero h2 { margin: 0 0 8px; font-size: clamp(1.8rem, 3vw, 2.8rem); }
.auth-copy, .install-copy { max-width: 760px; margin: 0; color: var(--muted); }
.auth-badges, .install-hero-meta { display: flex; gap: 10px; flex-wrap: wrap; }
.auth-badges span, .install-hero-meta span, .optional-tag {
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(16,63,138,.08);
    color: var(--primary);
    font-weight: 700;
}

.auth-card { margin-top: 0; }
.helper-line { color: var(--muted); font-size: .9rem; }
.install-layout {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 18px;
    align-items: start;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 12px 24px;
}

.install-main, .install-side { padding: 24px; }
.install-section { padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: linear-gradient(180deg, #fff 0%, #fbfdff 100%); }
.install-note { margin-top: 18px; padding: 16px; border: 1px solid #fde68a; border-radius: 16px; background: #fff9e6; }
.install-note strong { display: block; margin-bottom: 6px; }
.install-note p { margin: 0; color: #7c5a00; }
.check-grid.single { grid-template-columns: 1fr; }
.remember-row { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .95rem; }
.remember-row input { width: auto; }

.success-card { text-align: center; }
.success-icon {
    width: 82px;
    height: 82px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ecfdf3 0%, #dcfce7 100%);
    color: #166534;
    font-weight: 800;
}

.success-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0; text-align: left; }
.success-item { padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: #f8fbff; }
.success-item strong { display: block; margin-bottom: 6px; }
.success-checklist { display: grid; gap: 10px; margin-top: 18px; text-align: left; }
.success-check { padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: #f8fbff; color: var(--text); font-weight: 600; }
.redirect-note { margin-top: 12px; color: var(--muted); }

.quick-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.quick-tile {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 88px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
    font-weight: 700;
}

.quick-tile::after {
    content: "";
    position: absolute;
    inset: auto -12px -12px auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(254,203,10,.22);
}

.quick-tile:hover { transform: translateY(-2px); }
.quick-tile-icon {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(16,63,138,.12) 0%, rgba(254,203,10,.2) 100%);
    color: var(--primary);
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .06em;
}

.quick-tile-body { display: grid; gap: 4px; min-width: 0; }
.quick-tile-body strong { color: var(--text); }
.quick-tile-body small { color: var(--muted); font-size: .82rem; line-height: 1.4; }

.graph-stack { display: grid; gap: 14px; }
.graph-row { display: grid; grid-template-columns: 160px 1fr 70px; gap: 14px; align-items: center; }
.graph-bar { height: 12px; border-radius: 999px; background: #eef3fb; overflow: hidden; }
.graph-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%); }

.qr-scanner-card { display: grid; gap: 12px; padding: 14px; border: 1px dashed var(--border); border-radius: 18px; background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%); }
.qr-scanner-head { display: grid; gap: 4px; }
.qr-video-shell { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 240px; border-radius: 18px; background: #0f172a; }
.qr-video { display: block; width: 100%; min-height: 240px; max-height: 320px; object-fit: cover; }
.qr-scan-frame {
    position: absolute;
    inset: 50% auto auto 50%;
    width: min(60vw, 190px);
    height: min(60vw, 190px);
    transform: translate(-50%, -50%);
    border: 4px solid rgba(254,203,10,.95);
    border-radius: 18px;
    box-shadow: 0 0 0 999px rgba(0,0,0,.18);
}

.onboarding-card { margin-bottom: 20px; background: linear-gradient(135deg, rgba(16,63,138,.96) 0%, rgba(28,85,178,.96) 58%, rgba(18,53,113,.98) 100%); color: #fff; }
.onboarding-card::before { opacity: .55; }
.onboarding-card .eyebrow,
.onboarding-card .section-head p,
.onboarding-card h2 { color: #fff; }
.onboarding-badge { padding: 10px 14px; border-radius: 999px; background: rgba(254,203,10,.16); color: #fff2b8; font-weight: 800; }
.onboarding-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.onboarding-step { display: grid; gap: 8px; padding: 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: rgba(255,255,255,.08); }
.onboarding-step strong { font-size: 1rem; }
.onboarding-step span { color: rgba(255,255,255,.78); line-height: 1.5; }
.onboarding-step a { color: #fff; font-weight: 700; }

.mobile-card-stack { display: grid; gap: 12px; }
.mobile-data-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff 0%, #f8fbff 100%);
    box-shadow: var(--shadow-soft);
}

.mobile-data-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 8px; }
.mobile-data-head strong { color: var(--text); }
.mobile-data-head span { color: var(--primary); font-size: .88rem; font-weight: 800; }
.mobile-data-meta { display: grid; gap: 4px; color: var(--muted); font-size: .88rem; }

.mobile-nav { display: none; }
.mobile-profile-chip {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff;
    color: var(--primary);
    font-weight: 800;
    box-shadow: var(--shadow-soft);
}

.pagination-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

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

.pagination-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font-weight: 700;
    box-shadow: var(--shadow-soft);
}

.pagination-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination-link.disabled {
    opacity: .5;
    pointer-events: none;
}

.page-hero-card {
    padding: 20px 22px;
    background: linear-gradient(135deg, rgba(255,255,255,.98) 0%, rgba(247,250,255,.98) 100%);
}

.page-hero-card h2 { margin-bottom: 8px; }
.page-hero-card .section-head p:last-child {
    max-width: 720px;
    color: var(--muted);
    line-height: 1.65;
}

.students-filterbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(160px, 1fr)) auto;
    gap: 14px;
    align-items: end;
}

.students-filterbar .field { margin: 0; }
.students-filterbar .action-fit { align-self: end; }
.filter-reset-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.mobile-sticky-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.button-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.14);
    color: #fff5cf;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .08em;
}

.students-table-wrap {
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    box-shadow: var(--shadow-soft);
}

.students-table { min-width: 100%; }

.students-table thead th {
    top: 0;
    z-index: 2;
    padding: 15px 14px;
    background: #f8fbff;
    border-bottom: 1px solid #d9e5f6;
}

.students-table tbody td {
    padding: 16px 14px;
    background: transparent;
}

.students-table tbody tr:nth-child(even) td { background: rgba(248,251,255,.86); }
.students-table tbody tr:hover td { background: rgba(16,63,138,.045); }
.students-table tbody tr:last-child td { border-bottom: 0; }
.students-table img:not(.student-list-avatar) { display: none !important; }

.student-name-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.student-name-cell strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text);
}

.student-list-avatar {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 8px 18px rgba(16,63,138,.12);
    border: 2px solid rgba(16,63,138,.08);
    background: #fff;
}

.student-list-avatar-fallback {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(16,63,138,.9) 0%, rgba(38,92,181,.9) 100%);
    color: #fff;
    font-weight: 800;
}

.code-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(16,63,138,.08);
    color: var(--primary);
    font-size: .8rem;
    font-weight: 800;
    line-height: 1.25;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.code-chip-muted {
    background: rgba(100,116,139,.12);
    color: #475569;
}

.due-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.due-chip.pending {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fdba74;
}

.due-chip.clear {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.student-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.student-actions form { margin: 0; }

.mini-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: .84rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: var(--shadow-soft);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.mini-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 28px rgba(15,23,42,.1);
}

.mini-action.view {
    background: rgba(16,63,138,.08);
    border-color: rgba(16,63,138,.12);
    color: var(--primary);
}

.mini-action.edit {
    background: rgba(254,203,10,.18);
    border-color: rgba(254,203,10,.32);
    color: #7c5a00;
}

.mini-action.delete {
    border: 0;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    cursor: pointer;
}

.student-mobile-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: var(--shadow-soft);
}

.student-mobile-card,
.student-mobile-card * {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.student-mobile-card img:not(.student-list-avatar) {
    display: none !important;
}

.student-mobile-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.student-mobile-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.student-mobile-avatar {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 16px;
}

.student-mobile-profile strong {
    display: block;
    color: var(--text);
    margin-bottom: 3px;
}

.student-mobile-profile span {
    display: block;
    color: var(--muted);
    font-size: .84rem;
    word-break: break-word;
}

.student-mobile-title {
    min-width: 0;
    overflow: hidden;
}

.status-inline {
    font-weight: 800;
}

.status-inline.active { color: #166534; }
.status-inline.inactive { color: #be123c; }

.student-mobile-meta {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.student-mobile-meta span {
    padding: 10px 12px;
    border: 1px solid rgba(220,229,242,.9);
    border-radius: 14px;
    background: rgba(255,255,255,.92);
    overflow: hidden;
}

.student-mobile-meta strong { color: var(--text); }

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .students-filterbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 16px 16px 102px; }
    .page-frame { width: 100%; }
    .topbar { display: none; }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        position: sticky;
        top: 0;
        z-index: 70;
        margin-bottom: 18px;
        padding: 10px 0 14px;
        background: linear-gradient(180deg, rgba(238,244,255,.98) 0%, rgba(238,244,255,.88) 100%);
        backdrop-filter: blur(10px);
    }

    .mobile-topbar-title { display: grid; gap: 2px; min-width: 0; }
    .mobile-topbar-title strong { font-size: 1rem; color: var(--text); }
    .mobile-topbar-title span {
        max-width: 180px;
        color: var(--muted);
        font-size: .8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-menu-button {
        width: 42px;
        height: 42px;
        display: grid;
        align-content: center;
        justify-items: center;
        gap: 4px;
        border: 0;
        border-radius: 14px;
        background: #fff;
        box-shadow: var(--shadow-soft);
    }

    .mobile-menu-button span {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: var(--primary);
    }

    .mobile-drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 90;
        background: rgba(15, 23, 42, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .24s ease;
    }

    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        width: min(320px, 88vw);
        padding: 22px 18px 18px;
        overflow-y: auto;
        background: linear-gradient(180deg, #0d3471 0%, #103f8a 100%);
        color: #fff;
        transform: translateX(-104%);
        transition: transform .24s ease;
    }

    .mobile-drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 16px; }
    .mobile-drawer-links { margin-bottom: 16px; }

    .drawer-close {
        padding: 10px 12px;
        border: 0;
        border-radius: 12px;
        background: rgba(255,255,255,.14);
        color: #fff;
        font-weight: 700;
    }

    body.drawer-open .mobile-drawer { transform: translateX(0); }
    body.drawer-open .mobile-drawer-overlay { opacity: 1; pointer-events: auto; }

    .stats-grid,
    .two-column,
    .three-column,
    .form-grid,
    .check-grid,
    .id-grid,
    .detail-grid,
    .success-grid,
    .quick-grid,
    .graph-row,
    .onboarding-grid {
        grid-template-columns: 1fr;
    }

    .receipt-grid,
    .receipt-header,
    .auth-hero,
    .install-hero,
    .install-layout,
    .guest-header {
        display: grid;
        grid-template-columns: 1fr;
    }

    .desktop-only { display: none !important; }
    .mobile-only { display: block !important; }

    .mobile-nav {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 12px;
        z-index: 1200;
        padding: 10px;
        border-radius: 22px;
        background: rgba(255,255,255,.96);
        border: 1px solid rgba(215,225,239,.9);
        box-shadow: 0 18px 40px rgba(15,23,42,.14);
        backdrop-filter: blur(10px);
    }

    .mobile-nav a {
        text-align: center;
        padding: 10px 8px;
        border-radius: 16px;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 800;
        line-height: 1.2;
    }

    .mobile-nav a.active {
        background: linear-gradient(180deg, rgba(16,63,138,.92) 0%, rgba(16,63,138,.86) 100%);
        color: #fff;
    }

    .pagination-nav {
        justify-content: center;
    }

    .page-hero-card { padding: 18px; }

    .students-filterbar {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .students-filterbar .button,
    .students-filterbar .filter-reset-button {
        width: 100%;
    }

    .mobile-sticky-cta {
        position: sticky;
        top: 64px;
        z-index: 30;
        justify-self: start;
    }

    .student-mobile-head {
        flex-direction: column;
        align-items: stretch;
    }

    .student-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 10px;
    }

    .mini-action {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 12px 10px;
        border-radius: 14px;
        font-size: .86rem;
    }

    .student-mobile-card .student-actions form {
        width: 100%;
    }

    .student-mobile-card .due-chip {
        align-self: flex-start;
    }

    .student-mobile-card .code-chip {
        margin-top: 4px;
    }

    .qr-video { max-height: 260px; }
}

@media print {
    .sidebar,
    .topbar,
    .mobile-topbar,
    .mobile-nav,
    .mobile-drawer,
    .mobile-drawer-overlay,
    .action-row,
    .search-row,
    .build-stamp,
    .flash,
    .button,
    .quick-tile { display: none !important; }

    body { background: #fff !important; }
    .main-content { margin-left: 0; padding: 0; }
    .card { box-shadow: none; border: 0; padding: 0; }
    .id-grid-bulk, .id-grid-a4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .id-card { break-inside: avoid; page-break-inside: avoid; border: 1px solid #cbd5e1; }
}
