:root {
    --ink: #0f2744;
    --ink-soft: #1e3a5f;
    --ocean: #0d6e6e;
    --ocean-deep: #0a5555;
    --mint: #2a9d8f;
    --sand: #e8f1f2;
    --mist: #f3f7f8;
    --line: #d5e3e6;
    --warn: #c45c26;
    --danger: #b42318;
    --white: #ffffff;
    --shadow: 0 18px 50px rgba(15, 39, 68, 0.14);
    --radius: 18px;
    --font-display: "Outfit", sans-serif;
    --font-body: "Outfit", sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--mist);
}

a {
    color: var(--ocean);
    text-decoration: none;
}

a:hover {
    color: var(--ocean-deep);
}

/* Auth shell */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background:
        radial-gradient(circle at 12% 18%, rgba(42, 157, 143, 0.22), transparent 34%),
        radial-gradient(circle at 88% 82%, rgba(15, 39, 68, 0.18), transparent 36%),
        linear-gradient(135deg, #0f2744 0%, #134e5e 48%, #0d6e6e 100%);
}

.auth-brand {
    position: relative;
    color: var(--white);
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 45%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.brand-kicker {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.9;
    animation: riseIn 0.7s ease both;
}

.brand-mark {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-family: var(--font-display);
    font-size: 0.9rem;
    line-height: 1;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #fff;
    box-sizing: border-box;
    flex-shrink: 0;
}

.brand-title {
    position: relative;
    margin: 28px 0 14px;
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 5vw, 4.2rem);
    line-height: 1.05;
    font-weight: 700;
    animation: riseIn 0.8s ease 0.08s both;
}

.brand-copy {
    position: relative;
    max-width: 460px;
    font-size: 1.08rem;
    line-height: 1.65;
    opacity: 0.92;
    animation: riseIn 0.85s ease 0.16s both;
}

.brand-footer {
    position: relative;
    font-size: 0.92rem;
    opacity: 0.8;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        linear-gradient(180deg, rgba(243, 247, 248, 0.96), rgba(232, 241, 242, 0.98));
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(213, 227, 230, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 34px 32px;
    backdrop-filter: blur(8px);
    animation: panelIn 0.65s ease both;
}

.auth-card h1 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1.85rem;
    color: var(--ink);
}

.auth-card .subtitle {
    margin: 0 0 24px;
    color: #5a7184;
    font-size: 0.98rem;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.form-control,
.form-select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    font: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--mint);
    box-shadow: 0 0 0 4px rgba(42, 157, 143, 0.15);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    font-size: 0.92rem;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #516579;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.btn:disabled,
.btn.is-loading {
    cursor: not-allowed;
    opacity: 0.85;
    transform: none !important;
    pointer-events: none;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
    flex-shrink: 0;
}

.btn-secondary .btn-spinner,
.btn-ghost .btn-spinner {
    border-color: rgba(15, 39, 68, 0.2);
    border-top-color: var(--ink);
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

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

.btn-primary,
a.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--ocean), var(--mint));
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(13, 110, 110, 0.28);
    text-decoration: none;
}

.btn-sm,
.action-row .btn,
.action-row .btn-primary,
a.btn-sm.btn-primary {
    width: auto;
    min-width: 0;
}

.btn-icon {
    display: block;
    flex-shrink: 0;
}

.btn-primary:hover,
a.btn-primary:hover,
.btn-primary:focus,
a.btn-primary:focus {
    background: linear-gradient(135deg, var(--ocean-deep), var(--ocean));
    color: #fff !important;
}

.btn-secondary,
a.btn-secondary {
    background: #e8f1f2;
    color: var(--ink) !important;
    text-decoration: none;
}

.btn-secondary:hover,
a.btn-secondary:hover {
    background: #d9e8ea;
    color: var(--ink) !important;
}

.btn-danger,
a.btn-danger {
    background: var(--danger);
    color: #fff !important;
    text-decoration: none;
}

.btn-danger:hover,
a.btn-danger:hover {
    background: #931c14;
    color: #fff !important;
}

.btn-ghost,
a.btn-ghost {
    background: transparent;
    color: var(--ink-soft) !important;
    text-decoration: none;
}

.btn-ghost:hover,
a.btn-ghost:hover {
    background: rgba(15, 39, 68, 0.06);
    color: var(--ink) !important;
}

.auth-links {
    margin-top: 18px;
    text-align: center;
    font-size: 0.94rem;
    color: #5a7184;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.92rem;
}

.alert-success {
    background: #e8f7f2;
    color: #0f5c4c;
    border: 1px solid #b9e5d7;
}

.alert-danger {
    background: #fdeceb;
    color: #8a1c16;
    border: 1px solid #f3c1bd;
}

.invalid-feedback {
    display: block;
    margin-top: 6px;
    color: var(--danger);
    font-size: 0.84rem;
}

.is-invalid {
    border-color: #e3a19c !important;
}

/* App layout */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--mint) 18%, transparent), transparent 28%),
        linear-gradient(180deg, #f5f9fa 0%, #eef4f6 100%);
}

.sidebar {
    background: linear-gradient(180deg, var(--ink) 0%, var(--ocean-deep) 55%, var(--ocean) 100%);
    color: #fff;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.sidebar-close {
    display: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
}

.mobile-topbar {
    display: none;
    align-items: center;
    gap: 12px;
    margin: -8px 0 18px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 39, 68, 0.06);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.mobile-brand .brand-mark {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 0.78rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ocean), var(--mint));
    border: 0;
}

.mobile-brand strong {
    font-family: var(--font-display);
    font-size: 1.05rem;
    color: var(--ink);
}

.nav-toggle {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--sand);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-text {
    min-width: 0;
}

.sidebar-brand .brand-text strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.2rem;
    line-height: 1.15;
    color: #fff;
    white-space: nowrap;
}

.sidebar-brand .brand-text span {
    display: block;
    font-size: 0.75rem;
    opacity: 0.75;
    letter-spacing: 0.04em;
    color: #fff;
    white-space: nowrap;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.86);
    transition: background 0.2s ease;
}

.nav-list a:hover,
.nav-list a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.sidebar-user {
    margin-top: auto;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-user .name {
    font-weight: 700;
}

.sidebar-user .meta {
    margin-top: 4px;
    font-size: 0.82rem;
    opacity: 0.75;
}

.main {
    padding: 28px;
}

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

.topbar h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.8rem;
}

.topbar p {
    margin: 6px 0 0;
    color: #5a7184;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #dff3ef;
    color: #0f5c4c;
    font-size: 0.82rem;
    font-weight: 700;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(15, 39, 68, 0.05);
    animation: riseIn 0.6s ease both;
}

.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.2s; }
.stat-card:nth-child(6) { animation-delay: 0.25s; }

.stat-card .label {
    color: #5a7184;
    font-size: 0.9rem;
}

.stat-card .value {
    margin-top: 8px;
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--ink);
}

.panel-card {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 39, 68, 0.05);
}

.panel-card h2 {
    margin: 0 0 8px;
    font-family: var(--font-display);
    font-size: 1.35rem;
}

.panel-card p {
    margin: 0 0 16px;
    color: #5a7184;
}

.welcome-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 16px;
}

.info-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.info-list li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.95rem;
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list span {
    color: #5a7184;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 39, 68, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.modal-backdrop.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: var(--shadow);
    animation: panelIn 0.25s ease;
}

.modal h3 {
    margin: 0 0 8px;
    font-family: var(--font-display);
}

.modal p {
    margin: 0 0 20px;
    color: #5a7184;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Institution management */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.toolbar-filters .form-control,
.toolbar-filters .form-select {
    min-width: 140px;
    width: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 0.93rem;
    vertical-align: top;
}

.data-table th {
    color: #5a7184;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #e8f1f2;
    color: var(--ink-soft);
}

.badge-success { background: #dff3ef; color: #0f5c4c; }
.badge-warn { background: #fff1e6; color: #9a4b12; }
.badge-danger { background: #fdeceb; color: #8a1c16; }
.badge-info { background: #e7f1fb; color: #1a4f7a; }

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

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 10px;
    width: auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.section-title {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-size: 1.2rem;
}

.section-note {
    margin: -6px 0 16px;
    color: #5a7184;
    font-size: 0.92rem;
}

.tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.tabs a {
    padding: 9px 12px;
    border-radius: 999px;
    background: #e8f1f2;
    color: var(--ink-soft);
    font-size: 0.86rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.tabs a.active {
    background: linear-gradient(135deg, var(--ocean), var(--mint));
    color: #fff;
}

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

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    font-size: 0.92rem;
}

.multi-inst-box {
    max-height: 260px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: 6px;
}

.multi-inst-row {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
}

.multi-inst-row:hover {
    background: rgba(13, 110, 110, 0.06);
}

.inst-swatch {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.inst-name {
    font-size: 0.92rem;
    color: var(--ink);
}

.inst-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #5a7184;
    white-space: nowrap;
}

.nested-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    background: #fff;
}

.nested-card h3,
.nested-card h4 {
    margin: 0 0 10px;
    font-family: var(--font-display);
}

.year-block {
    margin-bottom: 18px;
    padding: 14px;
    border-left: 4px solid var(--mint);
    background: rgba(42, 157, 143, 0.06);
    border-radius: 0 12px 12px 0;
}

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

.inline-form .full { grid-column: 1 / -1; }

.empty-state {
    padding: 28px;
    text-align: center;
    color: #5a7184;
    border: 1px dashed var(--line);
    border-radius: 14px;
    background: #fff;
}

/* ========== Responsive ========== */
@media (max-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .welcome-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    body.nav-lock {
        overflow: hidden;
    }

    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        min-height: auto;
        padding: 28px 22px 20px;
    }

    .brand-title {
        margin: 16px 0 10px;
        font-size: clamp(2rem, 8vw, 2.8rem);
    }

    .brand-copy {
        font-size: 0.98rem;
        max-width: none;
    }

    .brand-footer {
        margin-top: 18px;
    }

    .auth-panel {
        padding: 18px 16px 28px;
        align-items: flex-start;
    }

    .auth-card {
        padding: 26px 20px;
        max-width: none;
    }

    .app-shell {
        grid-template-columns: 1fr;
        min-height: 100vh;
    }

    .mobile-topbar {
        display: flex;
        position: sticky;
        top: 10px;
        z-index: 25;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 39, 68, 0.48);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.22s ease;
    }

    .app-shell.nav-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-backdrop[hidden] {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        z-index: 100;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 12px 0 40px rgba(15, 39, 68, 0.25);
        overflow-y: auto;
    }

    .app-shell.nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main {
        padding: 16px;
        min-width: 0;
    }

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

    .topbar h1 {
        font-size: 1.45rem;
    }

    .topbar > .btn,
    .topbar > .action-row {
        width: 100%;
    }

    .topbar > .action-row .btn {
        flex: 1 1 auto;
    }

    .stats-grid,
    .form-grid,
    .check-grid,
    .inline-form,
    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .panel-card {
        padding: 16px;
        border-radius: 14px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-filters {
        width: 100%;
    }

    .toolbar-filters .form-control,
    .toolbar-filters .form-select {
        min-width: 0;
        flex: 1 1 140px;
        width: 100%;
    }

    .info-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .action-row {
        width: 100%;
    }

    .action-row .btn,
    .action-row form {
        flex: 1 1 auto;
    }

    .modal {
        max-width: 100%;
        margin: 0;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .modal-actions .btn,
    .modal-actions form {
        flex: 1 1 auto;
    }

    .multi-inst-row {
        grid-template-columns: auto auto 1fr;
        grid-template-rows: auto auto;
    }

    .inst-primary {
        grid-column: 2 / -1;
        justify-self: start;
        margin-top: 2px;
    }

    .data-table {
        min-width: 640px;
    }

    .table-scroll,
    .panel-card > div[style*="overflow"] {
        margin: 0 -4px;
        padding: 0 4px;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card .value {
        font-size: 1.65rem;
    }

    .main {
        padding: 12px;
    }

    .mobile-topbar {
        margin-bottom: 14px;
        top: 8px;
    }

    .btn {
        padding: 11px 14px;
        font-size: 0.92rem;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 0.86rem;
    }

    .nested-card,
    .year-block {
        padding: 12px;
    }

    .auth-card h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 420px) {
    .brand-kicker {
        font-size: 0.75rem;
        letter-spacing: 0.08em;
    }

    .role-pill {
        font-size: 0.75rem;
    }
}

@media (min-width: 981px) {
    .mobile-topbar,
    .sidebar-close,
    .sidebar-backdrop {
        display: none !important;
    }

    .sidebar {
        transform: none !important;
    }
}
