:root {
    --bg: #f4f7fb;
    --bg-strong: #eef3fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --soft-text: #94a3b8;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #dbeafe;
    --primary-tint: #eff6ff;
    --sidebar: #0f172a;
    --sidebar-soft: rgba(255,255,255,.08);
    --sidebar-border: rgba(255,255,255,.12);
    --success: #16a34a;
    --success-soft: #dcfce7;
    --warning: #d97706;
    --warning-soft: #fef3c7;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --info: #0891b2;
    --info-soft: #cffafe;
    --purple: #7c3aed;
    --neutral: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --shadow-sm: 0 4px 12px rgba(15, 23, 42, .06);
    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --shadow-lg: 0 28px 65px rgba(15, 23, 42, .14);
    --radius-sm: 12px;
    --radius: 18px;
    --radius-lg: 24px;
    --sidebar-width: 292px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, .10), transparent 30rem),
        linear-gradient(135deg, #f8fafc 0%, var(--bg) 52%, #edf4ff 100%);
    color: var(--text);
    line-height: 1.5;
    letter-spacing: -.01em;
}
body.has-bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
a { color: var(--primary); text-decoration: none; transition: color .16s ease, background .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
a:hover { color: var(--primary-dark); text-decoration: none; }
img { max-width: 100%; }

.auth-page .topbar { display: none; }
.auth-page .container {
    width: min(100% - 28px, 1120px);
    min-height: 100vh;
    display: grid;
    place-items: center;
    margin: 0 auto;
    padding: 28px 0;
}
.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(120deg, rgba(15, 23, 42, .04), transparent 48%),
        radial-gradient(circle at 12% 18%, rgba(37, 99, 235, .18), transparent 24rem),
        radial-gradient(circle at 88% 82%, rgba(14, 165, 233, .14), transparent 24rem);
}

.topbar {
    position: fixed;
    top: 18px;
    left: 18px;
    bottom: 18px;
    width: var(--sidebar-width);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(30, 41, 59, .98), rgba(15, 23, 42, .98)),
        radial-gradient(circle at top left, rgba(59, 130, 246, .35), transparent 14rem);
    border: 1px solid rgba(255,255,255,.10);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.topbar::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 0%, rgba(59, 130, 246, .22), transparent 13rem),
        radial-gradient(circle at 80% 95%, rgba(20, 184, 166, .12), transparent 15rem);
}
.topbar > * { position: relative; }
.topbar-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    min-width: 0;
}
.brand-wrap { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px;
    color: #fff;
    font-weight: 900;
    font-size: 16px;
    line-height: 1.2;
    border-radius: 16px;
}
.brand:hover { color: #fff; background: var(--sidebar-soft); }
.brand-mark,
.brand-logo {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 15px;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    color: #fff;
    font-size: 13px;
    font-weight: 950;
    box-shadow: 0 14px 28px rgba(37, 99, 235, .32);
}
.brand-logo {
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.28);
    background: #fff;
}
.brand-text { white-space: normal; overflow-wrap: anywhere; }
.role-pill {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border: 1px solid rgba(147, 197, 253, .35);
    border-radius: 999px;
    background: rgba(37, 99, 235, .16);
    color: #bfdbfe;
    font-size: 12px;
    font-weight: 850;
}
.role-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, .14);
}
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--sidebar-border);
    border-radius: 18px;
    background: rgba(255,255,255,.07);
    backdrop-filter: blur(10px);
}
.profile-avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: #fff;
    color: var(--primary-dark);
    font-weight: 950;
    box-shadow: var(--shadow-sm);
}
.sidebar-profile strong,
.sidebar-profile small { display: block; min-width: 0; max-width: 185px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile strong { font-size: 14px; color: #fff; }
.sidebar-profile small { font-size: 12px; color: #cbd5e1; }

.main-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.28) transparent;
}
.main-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 11px 12px;
    color: #cbd5e1;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 800;
    border: 1px solid transparent;
}
.main-nav a:hover {
    color: #fff;
    background: var(--sidebar-soft);
    border-color: var(--sidebar-border);
}
.main-nav a.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(37,99,235,.95), rgba(59,130,246,.88));
    box-shadow: 0 12px 26px rgba(37, 99, 235, .24);
}
.main-nav a.logout-link {
    margin-top: auto;
    color: #fecaca;
}
.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 9px;
    background: rgba(255,255,255,.08);
    font-size: 13px;
}
.menu-toggle { display: none; }
.bottom-nav { display: none; }

.container {
    width: auto;
    max-width: 1480px;
    margin: 0 28px 28px calc(var(--sidebar-width) + 46px);
    padding-top: 28px;
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 22px;
}
.page-head > div:first-child {
    min-width: 0;
}
h1, h2, h3 { margin: 0 0 8px; line-height: 1.16; letter-spacing: -.025em; }
h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 900; }
h2 { font-size: clamp(19px, 3vw, 23px); font-weight: 850; }
h3 { font-size: 17px; font-weight: 850; }
p { margin-top: 0; }
.muted { color: var(--muted); }
.required { color: var(--danger); }
.hidden { display: none !important; }

.card, .auth-card {
    position: relative;
    background: rgba(255,255,255,.94);
    border: 1px solid rgba(226, 232, 240, .92);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    backdrop-filter: blur(12px);
}
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,.55), transparent 42%);
}
.card > *, .auth-card > * { position: relative; }
.auth-card {
    width: min(100%, 470px);
    margin: 0;
    border-radius: 28px;
    padding: 34px;
    box-shadow: 0 35px 80px rgba(15, 23, 42, .14);
}
.auth-card h1::before {
    content: "ST";
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    border-radius: 18px;
    color: #fff;
    font-size: 15px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    box-shadow: 0 18px 40px rgba(37, 99, 235, .30);
}
.simple-card { max-width: 820px; }
.demo-box {
    background: #f8fafc;
    border: 1px dashed var(--border-strong);
    border-radius: 18px;
    padding: 15px;
    margin-top: 20px;
    font-size: 14px;
}
.demo-box p { margin: 6px 0; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    overflow: hidden;
}
.stat span { color: var(--muted); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .045em; }
.stat strong { display: block; font-size: clamp(30px, 6vw, 42px); line-height: 1; margin-top: 10px; letter-spacing: -.04em; }
.stat.card { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.stat.card:hover { transform: translateY(-2px); border-color: #bfdbfe; box-shadow: 0 24px 54px rgba(15, 23, 42, .10); }
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 22px;
}
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 10px; }
.head-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 11px;
}
.form label { font-weight: 850; margin-top: 6px; color: #1e293b; }
input, select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font: inherit;
    font-size: 15.5px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 100px; }
input[type="file"] { padding: 11px; background: #f8fafc; }
input[type="checkbox"] { accent-color: var(--primary); }
.search { margin: 8px 0 16px; }
.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    align-items: center;
}
.compact-filter-row { align-items: end; margin-bottom: 14px; }

button, .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 46px;
    padding: 12px 17px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #fff;
    font-weight: 850;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    gap: 7px;
    touch-action: manipulation;
    box-shadow: 0 12px 24px rgba(37, 99, 235, .18);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
button:hover, .button:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37, 99, 235, .24); }
button:active, .button:active { transform: translateY(0); }
button.small, .button.small { min-height: 36px; padding: 8px 12px; font-size: 12px; border-radius: 11px; }
.button.secondary, button.secondary {
    background: #f1f5f9;
    color: #1e293b;
    box-shadow: none;
    border: 1px solid var(--border);
}
.button.secondary:hover, button.secondary:hover { background: #e2e8f0; color: #0f172a; }
button.success, .button.success { background: linear-gradient(135deg, var(--success), #22c55e); box-shadow: 0 12px 24px rgba(22, 163, 74, .18); }
button.warning, .button.warning { background: linear-gradient(135deg, var(--warning), #f59e0b); box-shadow: 0 12px 24px rgba(217, 119, 6, .18); }
button.danger, .button.danger { background: linear-gradient(135deg, var(--danger), #ef4444); box-shadow: 0 12px 24px rgba(220, 38, 38, .18); }
button.info, .button.info { background: linear-gradient(135deg, var(--info), #06b6d4); box-shadow: 0 12px 24px rgba(8, 145, 178, .18); }
.inline-form { display: inline; }
.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 11px;
    margin-top: 10px;
}
.review-panel textarea { min-height: 150px; }

.alert {
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 17px;
    font-weight: 800;
    border: 1px solid transparent;
}
.alert.success { background: var(--success-soft); color: #166534; border-color: #bbf7d0; }
.alert.danger { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
}
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 780px;
}
th, td {
    padding: 14px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}
th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .055em;
    font-weight: 900;
}
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    color: #fff;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.08);
}
.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255,255,255,.88);
}
.badge.success { background: var(--success); }
.badge.warning { background: var(--warning); }
.badge.danger { background: var(--danger); }
.badge.info { background: var(--info); }
.badge.neutral { background: var(--neutral); }
.badge.purple { background: var(--purple); }

.details {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 12px 14px;
    margin: 14px 0 0;
}
.details dt { color: var(--muted); font-weight: 850; }
.details dd { margin: 0; overflow-wrap: anywhere; }

.school-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}
.school-card {
    display: block;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.school-card:hover { border-color: #93c5fd; transform: translateY(-2px); box-shadow: var(--shadow); }
.school-card strong { display: block; font-size: 17px; margin-bottom: 4px; }
.school-card small { display: block; color: var(--muted); margin-bottom: 10px; }
.school-card span { font-weight: 850; }
.mini-statuses { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.mini-statuses em { font-style: normal; font-size: 12px; background: #e2e8f0; color: #334155; padding: 6px 9px; border-radius: 999px; font-weight: 800; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
    gap: 10px;
    max-height: 345px;
    overflow-y: auto;
    padding: 4px;
}
.checkbox-grid.compact { max-height: 265px; }
.check-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 12px;
    background: #f8fafc;
    font-weight: 800;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.check-card:hover { background: #eff6ff; border-color: #bfdbfe; transform: translateY(-1px); }
.check-card input { width: auto; min-height: auto; margin-top: 3px; }
.check-card span { display: flex; flex-direction: column; gap: 2px; }
.check-card small { color: var(--muted); font-weight: 500; }
.tick-box {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 850;
    cursor: pointer;
}
.tick-box input,
.checklist-form table input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-height: auto;
    accent-color: var(--success);
}
.manual-action-panel {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    background: linear-gradient(180deg, #f8fafc, #eef6ff);
    display: grid;
    grid-template-columns: minmax(180px, 260px) 1fr auto;
    gap: 14px;
    align-items: end;
    box-shadow: var(--shadow-sm);
}
.checklist-stats .stat strong { font-size: 32px; }
.file-hint {
    margin-top: -2px;
    color: var(--muted);
    font-size: 13px;
}
.timeline { display: grid; gap: 13px; }
.timeline-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 15px;
    background: #f8fafc;
}
.timeline-item small { display: block; color: var(--muted); margin: 8px 0; }
.timeline-item p { margin: 0; }
.helper-card ul,
.simple-list {
    margin: 0;
    padding-left: 20px;
}
.simple-list li { margin: 8px 0; }
.row-editor summary {
    cursor: pointer;
    font-weight: 850;
    color: var(--primary-dark);
    padding: 7px 0;
}
.mini-form {
    min-width: 230px;
    padding-top: 8px;
}
.stat-link {
    color: var(--text);
    text-decoration: none;
}
.stat-link:hover {
    text-decoration: none;
    border-color: #93c5fd;
    background: #eff6ff;
}
.brand-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: #f8fafc;
    padding: 18px;
    margin-bottom: 14px;
}
.preview-logo,
.preview-mark {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: #fff;
}
.preview-mark { display: grid; place-items: center; color: #fff; font-weight: 950; font-size: 23px; background: linear-gradient(135deg, #60a5fa, #2563eb); }
.logo-remove { margin-top: 8px; }

@media (min-width: 981px) {
    .topbar .main-nav { flex: 1; }
}

@media (max-width: 980px) {
    body { background: var(--bg); }
    .topbar {
        position: sticky;
        top: 0;
        left: auto;
        bottom: auto;
        width: 100%;
        border-radius: 0;
        padding: 10px 16px;
        flex-direction: column;
        gap: 10px;
        background: rgba(255,255,255,.98);
        color: var(--text);
        border: 0;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
        backdrop-filter: blur(12px);
    }
    .topbar::before { display: none; }
    .topbar-row { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
    .brand-wrap { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
    .brand { color: var(--text); padding: 4px; min-height: 44px; }
    .brand:hover { color: var(--text); background: #f8fafc; }
    .brand-mark, .brand-logo { width: 38px; height: 38px; border-radius: 13px; }
    .role-pill { color: var(--primary-dark); background: var(--primary-soft); border-color: #bfdbfe; }
    .sidebar-profile { display: none; }
    .menu-toggle {
        display: inline-flex;
        min-height: 40px;
        padding: 8px 12px;
        width: auto;
        background: var(--primary-tint);
        color: var(--primary-dark);
        border: 1px solid #bfdbfe;
        box-shadow: none;
    }
    .menu-toggle:hover { background: #dbeafe; color: var(--primary-dark); box-shadow: none; }
    .main-nav {
        display: none;
        width: 100%;
        justify-content: flex-start;
        padding-top: 10px;
        border-top: 1px solid var(--border);
        overflow: visible;
    }
    .main-nav.open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .main-nav a {
        justify-content: center;
        background: #f8fafc;
        color: var(--text);
        border: 1px solid var(--border);
    }
    .main-nav a:hover, .main-nav a.active { background: #eef4ff; color: var(--primary-dark); }
    .main-nav a.logout-link { margin-top: 0; color: #b91c1c; }
    .nav-icon { background: #e2e8f0; }
    .container { width: min(100% - 32px, 1220px); margin: 24px auto; padding-top: 0; }
    .head-actions { justify-content: flex-start; }
    .manual-action-panel { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
    body.has-bottom-nav { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: 1fr;
        gap: 0;
        background: rgba(255,255,255,.98);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        box-shadow: 0 -12px 30px rgba(15, 23, 42, .10);
        backdrop-filter: blur(12px);
    }
    .bottom-nav a {
        color: var(--muted);
        display: flex;
        min-height: 54px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        border-radius: 15px;
        font-weight: 850;
        font-size: 11px;
        text-decoration: none;
    }
    .bottom-nav a span { font-size: 18px; line-height: 1; }
    .bottom-nav a em { font-style: normal; }
    .bottom-nav a.active { color: var(--primary-dark); background: #eef4ff; }
    .container { width: min(100% - 20px, 1220px); margin: 16px auto; }
    .page-head, .section-title { flex-direction: column; align-items: stretch; }
    .card, .auth-card { border-radius: 20px; padding: 17px; margin-bottom: 16px; }
    .auth-card { padding: 24px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat strong { font-size: 28px; }
    .details-grid, .details { grid-template-columns: 1fr; }
    .filter-row { grid-template-columns: 1fr; }
    .school-card-grid { grid-template-columns: 1fr; }
    .main-nav.open { grid-template-columns: 1fr; }
    .brand-text { max-width: 185px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    button, .button { width: 100%; }
    .inline-form, .inline-form button { width: 100%; }
    .action-buttons { grid-template-columns: 1fr; }

    .table-wrap { overflow: visible; border: 0; background: transparent; }
    table.responsive-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    table.responsive-table thead { display: none; }
    table.responsive-table tbody,
    table.responsive-table tr,
    table.responsive-table td { display: block; width: 100%; }
    table.responsive-table tr {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 10px 12px;
        box-shadow: var(--shadow-sm);
    }
    table.responsive-table td {
        border: 0;
        padding: 9px 0;
        display: grid;
        grid-template-columns: minmax(118px, 38%) 1fr;
        gap: 10px;
        align-items: start;
        overflow-wrap: anywhere;
    }
    table.responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-weight: 900;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: .035em;
    }
    table.responsive-table td[colspan] { display: block; }
    table.responsive-table td[colspan]::before { content: ''; display: none; }
    .manual-action-panel {
        position: sticky;
        bottom: calc(74px + env(safe-area-inset-bottom));
        z-index: 20;
        box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
    }
}

@media (max-width: 430px) {
    .stats-grid { grid-template-columns: 1fr; }
    .role-pill { display: none; }
    .brand-text { max-width: 170px; }
    table.responsive-table td { grid-template-columns: 1fr; gap: 4px; }
}

@media print {
    .topbar, .bottom-nav, .menu-toggle, .button, button, .search, .filters { display: none !important; }
    body { background: #fff; padding: 0 !important; }
    .container { width: 100%; max-width: none; margin: 0; padding: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    table { min-width: 0; }
}

/* V5 professional login and cluster setup enhancements */
.login-shell {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .72fr);
    gap: 26px;
    align-items: stretch;
}
.login-hero {
    position: relative;
    overflow: hidden;
    min-height: 620px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 5vw, 48px);
    border-radius: 34px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, .96), rgba(30, 64, 175, .90)),
        radial-gradient(circle at 12% 20%, rgba(96, 165, 250, .46), transparent 20rem),
        radial-gradient(circle at 88% 82%, rgba(45, 212, 191, .22), transparent 20rem);
    box-shadow: var(--shadow-lg);
}
.login-hero::before,
.login-hero::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
}
.login-hero::before {
    width: 300px;
    height: 300px;
    right: -90px;
    top: -80px;
    background: rgba(255,255,255,.10);
}
.login-hero::after {
    width: 200px;
    height: 200px;
    left: -70px;
    bottom: -60px;
    border: 38px solid rgba(255,255,255,.08);
}
.login-hero > * { position: relative; z-index: 1; }
.login-brand-display {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 760px;
}
.auth-logo-large,
.auth-logo-fallback {
    width: 82px;
    height: 82px;
    flex: 0 0 auto;
    border-radius: 26px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--primary);
    font-weight: 950;
    font-size: 24px;
    object-fit: contain;
    padding: 8px;
    box-shadow: 0 22px 52px rgba(0,0,0,.22);
}
.login-brand-display h1 {
    margin: 4px 0 0;
    font-size: clamp(32px, 5vw, 58px);
    line-height: .98;
    color: #fff;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #bfdbfe;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .12em;
}
.eyebrow::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .14);
}
.login-hero p {
    max-width: 690px;
    margin: 28px 0 auto;
    color: #dbeafe;
    font-size: clamp(17px, 2vw, 21px);
}
.login-feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 34px;
}
.login-feature-grid span {
    padding: 13px 15px;
    border-radius: 18px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(10px);
    font-weight: 800;
    color: #eff6ff;
}
.login-card {
    align-self: center;
    width: 100%;
    max-width: 440px;
    margin-left: auto;
    padding: clamp(24px, 4vw, 36px);
}
.login-card h1::before,
.login-card h2::before { display: none !important; }
.login-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}
.login-card-header h2 { margin-bottom: 2px; }
.auth-logo-small {
    width: 54px;
    height: 54px;
    flex: 0 0 auto;
    border-radius: 17px;
    object-fit: contain;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.auth-logo-small.fallback {
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 950;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
}
.login-demo summary {
    cursor: pointer;
    font-weight: 900;
    color: var(--text);
}
.login-demo[open] summary { margin-bottom: 10px; }
.helper-card li { margin-bottom: 8px; }

@media (max-width: 980px) {
    .login-shell {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .login-hero {
        min-height: auto;
        padding: 28px;
    }
    .login-card {
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 640px) {
    .login-brand-display {
        align-items: flex-start;
        flex-direction: column;
    }
    .auth-logo-large,
    .auth-logo-fallback {
        width: 68px;
        height: 68px;
        border-radius: 22px;
    }
    .login-feature-grid {
        grid-template-columns: 1fr;
    }
    .login-card-header {
        align-items: flex-start;
    }
}

/* V6 report coverage controls */
.scope-options {
    display: grid;
    gap: 12px;
    margin: 6px 0 12px;
}

.compact-scope-options {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.radio-card,
.school-check-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.radio-card:hover,
.school-check-item:hover {
    border-color: var(--primary, #2563eb);
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.radio-card input,
.school-check-item input {
    margin-top: 4px;
    min-width: 18px;
    min-height: 18px;
}

.radio-card strong,
.school-check-item span {
    display: block;
}

.radio-card small,
.school-check-item small {
    display: block;
    margin-top: 2px;
    color: var(--muted, #64748b);
    line-height: 1.35;
}

.school-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 10px 0 14px;
}

.scope-school-list[hidden] {
    display: none !important;
}

@media (max-width: 720px) {
    .school-check-grid {
        grid-template-columns: 1fr;
    }

    .radio-card,
    .school-check-item {
        padding: 14px;
    }
}

/* V8 login page only: professional Laravel-style authentication screen */
.auth-page {
    overflow-x: hidden;
    background:
        radial-gradient(circle at 18% 14%, rgba(59, 130, 246, .18), transparent 27rem),
        radial-gradient(circle at 88% 72%, rgba(14, 165, 233, .12), transparent 25rem),
        linear-gradient(135deg, #f8fafc 0%, #eef4ff 52%, #f8fafc 100%);
}
.auth-page .container {
    width: min(100% - 28px, 1180px);
    padding: 34px 0;
}
.laravel-login-shell {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, .78fr);
    gap: 30px;
    align-items: center;
}
.laravel-login-hero {
    min-height: 660px;
    padding: clamp(34px, 5vw, 56px);
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,.16);
    background:
        linear-gradient(145deg, rgba(15, 23, 42, .98), rgba(30, 64, 175, .93) 58%, rgba(37, 99, 235, .88)),
        radial-gradient(circle at 12% 12%, rgba(147, 197, 253, .42), transparent 18rem),
        radial-gradient(circle at 88% 86%, rgba(34, 211, 238, .20), transparent 17rem);
    box-shadow: 0 32px 90px rgba(15, 23, 42, .22);
}
.laravel-login-hero::before {
    width: 360px;
    height: 360px;
    right: -130px;
    top: -120px;
    background: linear-gradient(135deg, rgba(255,255,255,.16), rgba(255,255,255,.04));
}
.laravel-login-hero::after {
    width: 240px;
    height: 240px;
    left: -86px;
    bottom: -84px;
    border: 42px solid rgba(255,255,255,.08);
}
.login-hero-topline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 10px 14px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    background: rgba(255,255,255,.09);
    color: #dbeafe;
    font-size: 13px;
    font-weight: 850;
    backdrop-filter: blur(12px);
}
.login-status-dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, .13);
}
.laravel-brand-display {
    margin-top: auto;
    align-items: flex-start;
}
.laravel-auth-logo {
    width: 90px;
    height: 90px;
    border-radius: 28px;
    padding: 10px;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
.laravel-eyebrow {
    color: #c7d2fe;
}
.laravel-brand-display h1 {
    max-width: 760px;
    margin-top: 8px;
    font-size: clamp(36px, 5.2vw, 64px);
    letter-spacing: -.055em;
}
.laravel-login-description {
    max-width: 720px;
    margin: 26px 0 0;
    color: rgba(239, 246, 255, .92);
    font-size: clamp(17px, 1.9vw, 21px);
    line-height: 1.65;
}
.laravel-feature-grid {
    margin-top: 34px;
}
.laravel-feature-grid span {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    border-radius: 18px;
    background: rgba(255,255,255,.11);
    border-color: rgba(255,255,255,.18);
    color: #fff;
}
.laravel-feature-grid strong {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: rgba(34, 197, 94, .18);
    color: #86efac;
}
.login-metrics-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 22px;
}
.login-metrics-row div {
    padding: 16px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 18px;
    background: rgba(2, 6, 23, .18);
    backdrop-filter: blur(12px);
}
.login-metrics-row strong {
    display: block;
    color: #93c5fd;
    font-size: 22px;
    line-height: 1;
}
.login-metrics-row span {
    display: block;
    margin-top: 6px;
    color: #e0f2fe;
    font-weight: 850;
    font-size: 13px;
}
.laravel-login-card {
    width: 100%;
    max-width: 470px;
    margin-left: auto;
    padding: clamp(28px, 4vw, 40px);
    border-radius: 30px;
    border: 1px solid rgba(226, 232, 240, .86);
    background: rgba(255,255,255,.97);
    box-shadow: 0 28px 75px rgba(15, 23, 42, .15);
}
.laravel-login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,0) 48%);
}
.laravel-login-card-header {
    margin-bottom: 24px;
}
.login-card-kicker {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 950;
    text-transform: uppercase;
    letter-spacing: .10em;
}
.laravel-login-card h2 {
    margin: 0 0 7px;
    font-size: clamp(24px, 3vw, 31px);
    font-weight: 950;
    letter-spacing: -.04em;
    color: #0f172a;
}
.laravel-alert {
    border-radius: 16px;
    margin-bottom: 20px;
}
.laravel-login-form {
    gap: 10px;
}
.laravel-login-form label {
    margin-top: 8px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}
.input-group {
    position: relative;
    display: flex;
    align-items: center;
}
.input-group input {
    width: 100%;
    min-height: 54px;
    padding-left: 46px;
    padding-right: 18px;
    border-radius: 16px;
    border: 1px solid #dbe3ef;
    background: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.90);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.input-group input:focus {
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}
.input-icon {
    position: absolute;
    left: 16px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    color: #64748b;
    font-weight: 950;
}
.password-group input {
    padding-right: 72px;
}
.password-toggle {
    position: absolute;
    right: 8px;
    width: auto;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    color: #2563eb;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    font-size: 12px;
    font-weight: 950;
    box-shadow: none;
}
.password-toggle:hover {
    transform: none;
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: none;
}
.login-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 56px;
    margin-top: 14px;
    border-radius: 16px;
    font-weight: 950;
    letter-spacing: -.01em;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 18px 42px rgba(37, 99, 235, .30);
}
.login-submit-button:hover {
    box-shadow: 0 22px 50px rgba(37, 99, 235, .36);
}
.login-support-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 13px 14px;
    border: 1px solid #e0e7ff;
    border-radius: 16px;
    color: #475569;
    background: #f8fafc;
    font-size: 13px;
}
.login-support-note span {
    color: #2563eb;
    font-weight: 950;
}
.login-support-note p {
    margin: 0;
}
.laravel-demo-box {
    border-radius: 16px;
    background: #fff;
}
.laravel-demo-box summary {
    color: #1e293b;
}

@media (max-width: 980px) {
    .laravel-login-shell {
        grid-template-columns: 1fr;
        max-width: 720px;
        margin: 0 auto;
    }
    .laravel-login-hero {
        min-height: auto;
    }
    .laravel-brand-display {
        margin-top: 52px;
    }
    .laravel-login-card {
        max-width: none;
        margin: 0;
    }
}

@media (max-width: 640px) {
    .auth-page .container {
        width: min(100% - 22px, 1180px);
        padding: 18px 0;
    }
    .laravel-login-shell {
        gap: 14px;
    }
    .laravel-login-hero {
        padding: 24px;
        border-radius: 26px;
    }
    .laravel-brand-display {
        margin-top: 38px;
        gap: 14px;
    }
    .laravel-auth-logo {
        width: 68px;
        height: 68px;
        border-radius: 22px;
    }
    .laravel-brand-display h1 {
        font-size: 31px;
        line-height: 1.04;
    }
    .laravel-login-description {
        font-size: 15px;
        line-height: 1.55;
    }
    .laravel-feature-grid,
    .login-metrics-row {
        grid-template-columns: 1fr;
    }
    .login-metrics-row {
        display: none;
    }
    .laravel-login-card {
        padding: 24px;
        border-radius: 24px;
    }
    .laravel-login-card h2 {
        font-size: 25px;
    }
}
