:root {
    --bg: #f3f6f8;
    --surface: #ffffff;
    --surface-soft: #f7f9fa;
    --ink: #172b3a;
    --muted: #647482;
    --line: #dce5e9;
    --line-strong: #bdcdd4;
    --primary: #126b70;
    --primary-dark: #0d5156;
    --accent: #b58a42;
    --warning: #b45309;
    --danger: #b91c1c;
    --success: #15803d;
    --sidebar: #142b38;
    --radius: 12px;
    --shadow-sm: 0 3px 14px rgba(19, 49, 62, .045);
    --shadow-md: 0 18px 42px rgba(19, 49, 62, .12);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #10191d;
    --surface: #172329;
    --surface-soft: #1d2b31;
    --ink: #e6eef0;
    --muted: #9aadb3;
    --line: #2a3b42;
    --line-strong: #3c5159;
    --sidebar: #0c171c;
    --shadow-sm: 0 4px 18px rgba(0, 0, 0, .16);
    --shadow-md: 0 18px 46px rgba(0, 0, 0, .3);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at 85% 0%, rgba(18, 107, 112, .07), transparent 34%), var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

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

img,
svg,
canvas {
    max-width: 100%;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(420px, .85fr);
    background: #f7f9f8;
    overflow: hidden;
}

.auth-visual {
    position: relative;
    min-width: 0;
    overflow: hidden;
    isolation: isolate;
    color: #fff;
}

.auth-visual-image,
.auth-visual-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.auth-visual-image {
    z-index: -2;
    object-fit: cover;
    object-position: 54% center;
    transform: scale(1.015);
}

.auth-visual-overlay {
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(7, 31, 35, .48) 0%, rgba(7, 35, 38, .08) 40%, rgba(6, 29, 34, .88) 100%),
        linear-gradient(90deg, rgba(8, 45, 48, .48), transparent 68%);
}

.auth-visual-top,
.auth-copy,
.auth-photo-caption {
    position: absolute;
    left: clamp(28px, 5vw, 76px);
    right: clamp(28px, 5vw, 76px);
}

.auth-visual-top {
    top: clamp(26px, 5vh, 54px);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
}

.auth-brand > span:last-child {
    display: grid;
    gap: 1px;
}

.auth-brand strong {
    font-size: 15px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.01em;
}

.auth-brand small {
    font-size: 10px;
    opacity: .72;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-brand-mark,
.auth-logo {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 13px;
}

.auth-brand-mark {
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--primary);
    box-shadow: 0 10px 26px rgba(4, 34, 37, .2);
}

.auth-brand-mark svg {
    width: 22px;
    height: 22px;
}

.auth-logo {
    padding: 5px;
    object-fit: contain;
    background: rgba(255, 255, 255, .94);
}

.auth-brand-light .auth-brand-mark {
    color: #153f41;
    background: #fff;
}

.auth-copy {
    bottom: clamp(70px, 12vh, 132px);
    max-width: 700px;
}

.auth-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.auth-kicker svg {
    width: 16px;
    color: #e2b864;
}

.auth-copy h1 {
    max-width: 650px;
    margin: 0 0 18px;
    font-size: clamp(2.7rem, 4.5vw, 5rem);
    line-height: .98;
    font-weight: 800;
    letter-spacing: -.055em;
    text-wrap: balance;
}

.auth-copy p {
    max-width: 580px;
    margin: 0;
    color: rgba(255, 255, 255, .8);
    font-size: clamp(14px, 1.2vw, 17px);
    line-height: 1.7;
}

.auth-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    margin-top: 28px;
}

.auth-highlights span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
}

.auth-highlights svg {
    width: 17px;
    color: #e2b864;
}

.auth-photo-caption {
    bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: rgba(255, 255, 255, .62);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.auth-photo-caption span {
    width: 30px;
    height: 1px;
    background: #e2b864;
}

.login-panel {
    min-height: 100vh;
    background: #fbfcfb;
    padding: clamp(28px, 4vw, 64px);
    display: flex;
    align-items: center;
    box-shadow: -24px 0 70px rgba(15, 42, 43, .09);
    z-index: 1;
}

.login-wrap {
    width: 100%;
    max-width: 420px;
    margin-inline: auto;
}

.auth-brand-mobile {
    display: none;
    margin-bottom: 44px;
    color: #173b3e;
}

.login-heading {
    margin-bottom: 30px;
}

.login-eyebrow {
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.login-heading h2 {
    margin: 9px 0 8px;
    color: #152d30;
    font-size: clamp(2rem, 3vw, 2.65rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -.045em;
}

.login-heading p {
    margin: 0;
    color: #708083;
    font-size: 14px;
}

.auth-alert {
    display: flex;
    gap: 11px;
    margin-bottom: 20px;
    padding: 13px 14px;
    border: 1px solid #fecaca;
    border-radius: 12px;
    color: #991b1b;
    background: #fff7f7;
    font-size: 12px;
}

.auth-alert > svg {
    flex: 0 0 18px;
    margin-top: 1px;
}

.auth-alert div,
.auth-alert span {
    display: block;
}

.auth-alert strong {
    display: block;
    margin-bottom: 2px;
}

.auth-field {
    margin-bottom: 19px;
}

.auth-field label {
    display: block;
    margin-bottom: 8px;
    color: #263f42;
    font-size: 12px;
    font-weight: 800;
}

.auth-input-wrap {
    height: 54px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 15px;
    border: 1px solid #dce5e4;
    border-radius: 12px;
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.auth-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.auth-input-wrap.is-invalid {
    border-color: #dc3545;
}

.auth-input-wrap > svg {
    width: 18px;
    flex: 0 0 18px;
    color: #8ca09f;
}

.auth-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: 0;
    color: #183436;
    background: transparent;
    font-size: 13px;
}

.auth-input-wrap input::placeholder {
    color: #a4b0b0;
}

.password-toggle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #778c8c;
    background: transparent;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, #fff);
}

.auth-check {
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 24px;
    color: #526567;
    font-size: 12px;
    cursor: pointer;
}

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

.auth-submit {
    width: 100%;
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 0;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 14px 28px color-mix(in srgb, var(--primary) 28%, transparent);
    font-size: 13px;
    font-weight: 800;
    transition: transform .2s ease, box-shadow .2s ease;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 34px color-mix(in srgb, var(--primary) 34%, transparent);
}

.auth-submit svg {
    width: 18px;
}

.auth-help {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 38px;
    padding-top: 25px;
    border-top: 1px solid #e7eceb;
}

.auth-help-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, #fff);
}

.auth-help-icon svg {
    width: 18px;
}

.auth-help p {
    display: grid;
    gap: 2px;
    margin: 0;
    color: #879493;
    font-size: 11px;
}

.auth-help strong {
    color: #3b5052;
    font-size: 12px;
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 44px;
    color: #9aa6a5;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.auth-footer span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.auth-footer svg {
    width: 12px;
}

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

.sidebar {
    background: linear-gradient(170deg, color-mix(in srgb, var(--sidebar) 90%, #235262), var(--sidebar) 42%, color-mix(in srgb, var(--sidebar) 88%, #081c29));
    color: #e6edf5;
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    transition: padding .24s ease, transform .2s ease;
}

.sidebar > .brand {
    position: sticky;
    top: -24px;
    z-index: 8;
    margin: -24px -16px 17px;
    padding: 24px 16px 16px;
    border-bottom: 1px solid rgba(203, 213, 225, .13);
    background: color-mix(in srgb, var(--sidebar) 94%, #173f49);
    box-shadow: 0 10px 20px rgba(5, 18, 24, .08);
}

.sidebar > .brand::after,
.mobile-header::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: -10px;
    left: 0;
    height: 10px;
    background: linear-gradient(180deg, rgba(5, 18, 24, .1), transparent);
    pointer-events: none;
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(203, 213, 225, .28);
    border-radius: 999px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    font-weight: 800;
    font-size: 15px;
    margin-bottom: 24px;
}

.brand span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand-mark,
.avatar-mark {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.brand-logo {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    object-fit: contain;
    border-radius: var(--radius);
    background: #fff;
    padding: 4px;
}

.nav-stack {
    display: grid;
    gap: 12px;
}

.menu-search {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    margin-bottom: 16px;
    padding: 5px 7px 5px 11px;
    border: 1px solid rgba(203, 213, 225, .18);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .08);
    color: #cbd5e1;
}

.menu-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #fff;
    font-size: 13px;
    font-weight: 650;
}

.menu-search input::placeholder {
    color: #98a2b3;
}

.menu-search button {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .1);
    color: #e6edf5;
}

.menu-search button[hidden],
.menu-search-empty[hidden] {
    display: none;
}

.menu-search-empty {
    margin: -4px 0 12px;
    padding: 10px 11px;
    border: 1px dashed rgba(203, 213, 225, .22);
    border-radius: var(--radius);
    color: #cbd5e1;
    font-size: 12px;
}

.nav-group {
    display: grid;
    gap: 5px;
}

.nav-group + .nav-group {
    padding-top: 12px;
    border-top: 1px solid rgba(203, 213, 225, .16);
}

.nav-group-title {
    padding: 0 11px 3px;
    color: #a4b9c2;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 9px 11px;
    border-radius: var(--radius);
    color: #d1e0e5;
    font-size: 13px;
    font-weight: 650;
    transition: background .16s ease, color .16s ease;
}

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

.nav-link.active {
    background: color-mix(in srgb, var(--primary) 24%, transparent);
    box-shadow: inset 3px 0 0 #d8b276;
}

.main {
    min-width: 0;
}

.topbar {
    min-height: 68px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px clamp(16px, 3vw, 28px);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.topbar-leading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

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

.topbar-actions form {
    margin: 0;
}

.theme-toggle {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: #52666c;
    background: var(--surface);
    font-size: 10px;
    font-weight: 800;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
    background: color-mix(in srgb, var(--primary) 7%, var(--surface));
}

.theme-toggle svg {
    width: 15px;
}

.sidebar-collapse-toggle {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #53686f;
    background: #fff;
    transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.sidebar-collapse-toggle:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 30%, var(--line));
    background: color-mix(in srgb, var(--primary) 6%, #fff);
}

@media (min-width: 821px) {
    body.sidebar-collapsed .app-shell {
        grid-template-columns: 82px minmax(0, 1fr);
    }

    body.sidebar-collapsed .sidebar {
        padding-inline: 13px;
        overflow-x: hidden;
    }

    body.sidebar-collapsed .sidebar > .brand {
        margin-inline: -13px;
        padding-inline: 13px;
    }

    body.sidebar-collapsed .sidebar > .brand {
        justify-content: center;
    }

    body.sidebar-collapsed .sidebar > .brand > span:last-child,
    body.sidebar-collapsed .sidebar > .brand > img + span,
    body.sidebar-collapsed .nav-group-title,
    body.sidebar-collapsed .menu-search,
    body.sidebar-collapsed .menu-search-empty {
        display: none;
    }

    body.sidebar-collapsed .nav-stack {
        gap: 9px;
    }

    body.sidebar-collapsed .nav-group {
        gap: 6px;
    }

    body.sidebar-collapsed .nav-group + .nav-group {
        padding-top: 9px;
    }

    body.sidebar-collapsed .nav-link {
        width: 48px;
        min-height: 44px;
        justify-content: center;
        gap: 0;
        margin-inline: auto;
        padding: 10px;
        font-size: 0;
    }

    body.sidebar-collapsed .nav-link svg {
        width: 20px;
        height: 20px;
        flex: 0 0 20px;
    }

    body.sidebar-collapsed .nav-link.active {
        box-shadow: inset 0 -3px 0 #d8b276;
    }
}

.topbar-user {
    min-width: 190px;
}

.user-chip,
.profile-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-chip {
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
}

.user-chip:hover {
    background: var(--surface-soft);
    border-color: var(--line);
}

.user-chip span:last-child {
    min-width: 0;
}

.user-chip strong,
.user-chip .small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.context-switcher {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 10px;
    min-width: 0;
}

.context-field {
    min-width: 180px;
}

.context-field:first-child {
    min-width: min(340px, 42vw);
}

.context-field .form-label {
    margin-bottom: 2px;
    font-size: 10px;
    text-transform: uppercase;
}

.context-field .form-select {
    min-height: 32px;
    padding-top: 4px;
    padding-bottom: 4px;
}

.content {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(18px, 2.5vw, 32px);
}

.app-breadcrumb {
    margin: 0 0 14px;
}

.app-breadcrumb ol {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-breadcrumb li,
.app-breadcrumb a,
.app-breadcrumb li > span {
    min-width: 0;
    display: inline-flex;
    align-items: center;
}

.app-breadcrumb a,
.app-breadcrumb li > span {
    gap: 6px;
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 8px;
    color: #718086;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    transition: color .16s ease, background .16s ease;
}

.app-breadcrumb a:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, transparent);
}

.app-breadcrumb li.current > span {
    max-width: min(38vw, 320px);
    overflow: hidden;
    color: var(--ink);
    background: #eaf1f0;
    text-overflow: ellipsis;
}

.app-breadcrumb svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.app-breadcrumb .breadcrumb-separator {
    color: #abb7ba;
}

.app-breadcrumb .breadcrumb-separator svg {
    width: 12px;
    height: 12px;
}

.notification-stack {
    position: fixed;
    top: 82px;
    right: clamp(16px, 2.5vw, 34px);
    z-index: 90;
    width: min(410px, calc(100vw - 32px));
    display: grid;
    gap: 10px;
    pointer-events: none;
}

.system-alert {
    --alert-color: #246c52;
    --alert-soft: #edf8f2;
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) 30px;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 12px 14px 14px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--alert-color) 22%, #fff);
    border-radius: 14px;
    color: #314a46;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 18px 46px rgba(20, 48, 55, .18);
    backdrop-filter: blur(16px);
    pointer-events: auto;
    animation: notification-enter .28s ease-out both;
}

.system-alert-warning { --alert-color: #a5631c; --alert-soft: #fff5e8; }
.system-alert-info { --alert-color: #316a91; --alert-soft: #eaf5fb; }
.system-alert-danger { --alert-color: #b23b49; --alert-soft: #fff0f2; }

.system-alert-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--alert-color);
    background: var(--alert-soft);
}

.system-alert-icon svg {
    width: 19px;
}

.system-alert-copy {
    min-width: 0;
    display: block;
    padding-top: 1px;
}

.system-alert-copy strong,
.system-alert-copy > span {
    display: block;
}

.system-alert-copy strong {
    margin-bottom: 3px;
    color: var(--ink);
    font-size: 12px;
}

.system-alert-copy > span,
.system-alert-copy li {
    color: #607176;
    font-size: 10px;
    line-height: 1.5;
}

.system-alert-copy ul {
    max-height: 130px;
    margin: 7px 0 0;
    padding-left: 17px;
    overflow-y: auto;
}

.system-alert > button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #849195;
    background: transparent;
}

.system-alert > button:hover {
    color: var(--ink);
    background: #f1f4f4;
}

.system-alert > button svg {
    width: 15px;
}

.system-alert-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--alert-color);
    transform-origin: left;
    animation: notification-progress var(--notification-duration, 5500ms) linear forwards;
}

.system-alert.is-leaving {
    animation: notification-leave .24s ease-in forwards;
}

@keyframes notification-enter {
    from { opacity: 0; transform: translateY(-10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes notification-leave {
    to { opacity: 0; transform: translateX(22px) scale(.98); }
}

@keyframes notification-progress {
    to { transform: scaleX(0); }
}

.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: clamp(18px, 2.2vw, 25px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background:
        linear-gradient(110deg, rgba(255, 255, 255, .98), rgba(247, 251, 250, .96)),
        var(--surface);
    box-shadow: var(--shadow-sm);
}

.page-title h1 {
    margin: 0;
    font-size: clamp(1.4rem, 2vw, 1.85rem);
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: -.035em;
}

.page-title p {
    margin: 6px 0 0;
    color: var(--muted);
    max-width: 720px;
    font-size: 12px;
    line-height: 1.6;
}

.page-title > div:first-child {
    min-width: 0;
}

.page-title > div:first-child::before {
    content: 'Gestión académica';
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.section-title {
    margin: 0;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 800;
}

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

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.panel + .panel {
    margin-top: 14px;
}

.panel-body {
    padding: clamp(17px, 2.2vw, 23px);
}

.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
}

.pagination {
    margin: 0;
    flex-wrap: wrap;
}

.page-link {
    color: var(--primary);
    border-color: var(--line);
}

.active > .page-link,
.page-link.active {
    background: var(--primary);
    border-color: var(--primary);
}

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

.metric {
    min-height: 124px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid color-mix(in srgb, var(--primary) 72%, white);
}

.metric:nth-child(2) { border-top-color: #428c77; }
.metric:nth-child(3) { border-top-color: #bd8c60; }
.metric:nth-child(4) { border-top-color: #a2a6bd; }

.metric span,
.permission-summary span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 7px;
    font-size: 2.2rem;
    color: var(--ink);
    line-height: 1;
}

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

/* Dashboard */
.dashboard-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    min-height: 205px;
    margin-bottom: 18px;
    padding: clamp(26px, 4vw, 46px);
    overflow: hidden;
    border-radius: 20px;
    color: #fff;
    background:
        radial-gradient(circle at 78% 20%, rgba(255, 255, 255, .15), transparent 24%),
        linear-gradient(125deg, color-mix(in srgb, var(--sidebar) 90%, #214f55), var(--primary));
    box-shadow: 0 18px 38px rgba(19, 60, 64, .16);
}

.dashboard-hero::before,
.dashboard-hero::after {
    content: '';
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    pointer-events: none;
}

.dashboard-hero::before {
    width: 320px;
    height: 320px;
    right: -90px;
    top: -190px;
}

.dashboard-hero::after {
    width: 210px;
    height: 210px;
    right: 140px;
    bottom: -165px;
}

.dashboard-hero-copy,
.dashboard-hero-actions {
    position: relative;
    z-index: 1;
}

.dashboard-kicker,
.dashboard-context,
.dashboard-context span {
    display: flex;
    align-items: center;
}

.dashboard-kicker {
    gap: 7px;
    margin-bottom: 11px;
    color: #f0cf8d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.dashboard-kicker svg,
.dashboard-context svg {
    width: 15px;
}

.dashboard-hero h1 {
    margin: 0 0 9px;
    font-size: clamp(2rem, 3.4vw, 3rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -.045em;
}

.dashboard-hero p {
    max-width: 620px;
    margin: 0;
    color: rgba(255, 255, 255, .76);
    font-size: 14px;
}

.dashboard-context {
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 22px;
}

.dashboard-context span {
    gap: 6px;
    color: rgba(255, 255, 255, .68);
    font-size: 11px;
    font-weight: 650;
}

.dashboard-hero-actions {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 175px;
}

.dashboard-hero-actions .btn {
    justify-content: center;
}

.dashboard-ghost-btn {
    color: #fff;
    border-color: rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .08);
}

.dashboard-ghost-btn:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, .48);
    background: rgba(255, 255, 255, .14);
}

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

.dashboard-metric {
    min-width: 0;
    padding: 19px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
}

.dashboard-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(19, 49, 62, .09);
}

.metric-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.metric-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, #fff);
}

.metric-icon svg {
    width: 19px;
}

.metric-success .metric-icon { color: #18794e; background: #eaf7f0; }
.metric-warning .metric-icon { color: #ae6420; background: #fff4e8; }
.metric-neutral .metric-icon { color: #6b6f8a; background: #f0f1f7; }

.metric-tag {
    overflow: hidden;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .04em;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.dashboard-metric > strong {
    display: block;
    color: var(--ink);
    font-size: clamp(1.8rem, 2.5vw, 2.4rem);
    line-height: 1;
    letter-spacing: -.04em;
}

.dashboard-metric h2 {
    margin: 7px 0 3px;
    font-size: 13px;
    font-weight: 800;
}

.dashboard-metric p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.metric-progress {
    height: 5px;
    margin-top: 13px;
    overflow: hidden;
    border-radius: 99px;
    background: #eaf0ee;
}

.metric-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #2c9367;
}

.dashboard-main-grid,
.dashboard-lower-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

.dashboard-main-grid {
    grid-template-columns: minmax(0, 1.7fr) minmax(290px, .72fr);
}

.dashboard-lower-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
}

.dashboard-side-stack {
    display: grid;
    gap: 18px;
}

.dashboard-main-grid .panel,
.dashboard-lower-grid .panel,
.dashboard-statistics-panel {
    border-radius: 16px;
    overflow: hidden;
}

.dashboard-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 14px;
}

.dashboard-panel-head.compact {
    padding-bottom: 6px;
}

.dashboard-panel-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.dashboard-panel-head h2 {
    margin: 0;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 800;
}

.dashboard-panel-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 11px;
}

.dashboard-panel-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, #fff);
}

.dashboard-panel-icon svg {
    width: 17px;
}

.dashboard-chart-wrap {
    position: relative;
    padding: 5px 20px 20px;
}

.dashboard-chart-large { height: 335px; }
.dashboard-chart-shift { height: 265px; }

.dashboard-doughnut-wrap {
    position: relative;
    height: 180px;
    padding: 8px 20px;
}

.doughnut-center {
    position: absolute;
    inset: 50% auto auto 50%;
    display: grid;
    text-align: center;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.doughnut-center strong {
    color: var(--ink);
    font-size: 1.45rem;
    line-height: 1;
}

.doughnut-center span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
}

.chart-legend {
    display: grid;
    gap: 8px;
    padding: 4px 20px 18px;
}

.chart-legend span {
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
}

.chart-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.chart-legend strong {
    color: var(--ink);
}

.quick-actions-card {
    display: grid;
    grid-template-columns: minmax(120px, .8fr) minmax(0, 1.2fr);
    gap: 15px;
    padding: 18px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #173a40, color-mix(in srgb, var(--primary) 84%, #1a3440));
    box-shadow: var(--shadow-sm);
}

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

.quick-actions-copy span {
    margin-bottom: 5px;
    color: #dfbc76;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.quick-actions-copy strong {
    font-size: 13px;
    line-height: 1.35;
}

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

.quick-actions-grid a {
    min-height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 10px;
    color: rgba(255, 255, 255, .82);
    background: rgba(255, 255, 255, .07);
    font-size: 9px;
    font-weight: 700;
    transition: background .16s ease, transform .16s ease;
}

.quick-actions-grid a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    transform: translateY(-1px);
}

.quick-actions-grid svg {
    width: 17px;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
}

.panel-link svg { width: 14px; }

.recent-student-list {
    padding: 0 10px 10px;
}

.recent-student {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 11px;
    transition: background .16s ease;
}

.recent-student + .recent-student {
    border-top: 1px solid #edf1f2;
}

.recent-student:hover {
    background: var(--surface-soft);
}

.student-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, #fff);
    font-size: 12px;
    font-weight: 800;
}

.student-data {
    min-width: 0;
}

.student-data strong,
.student-data small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.student-data strong {
    font-size: 11px;
}

.student-data small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.recent-arrow {
    width: 14px;
    color: #a7b2b5;
}

.dashboard-empty {
    min-height: 190px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-align: center;
}

.dashboard-empty svg {
    width: 30px;
    margin-bottom: 10px;
    color: #9badb1;
}

.dashboard-empty strong { color: var(--ink); }
.dashboard-empty span { margin-top: 4px; font-size: 10px; }

.dashboard-statistics-panel {
    margin-bottom: 4px;
}

.dashboard-statistics-panel .table-responsive {
    padding: 0 10px 10px;
}

.dashboard-table {
    margin-bottom: 0;
}

.table-tag {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 99px;
    color: #496066;
    background: #f0f4f4;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.settings-list {
    display: grid;
    gap: 10px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.settings-row:last-child {
    border-bottom: 0;
}

.settings-logo-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-logo-preview img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 4px;
}

.filter-panel {
    overflow: hidden;
}

.filter-panel-head {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px clamp(17px, 2.2vw, 23px);
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, #fbfcfc, #f5f9f8);
}

.filter-panel-title {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.filter-panel-title > span:last-child {
    min-width: 0;
}

.filter-panel-title strong,
.filter-panel-title small {
    display: block;
}

.filter-panel-title strong {
    color: var(--ink);
    font-size: 12px;
    font-weight: 800;
}

.filter-panel-title small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.filter-panel-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, #fff);
}

.filter-panel-icon svg {
    width: 16px;
}

.filter-toggle {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 0;
    border-radius: 8px;
    color: #5e7278;
    background: transparent;
    font-size: 10px;
    font-weight: 800;
}

.filter-toggle:hover {
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, #fff);
}

.filter-toggle svg {
    width: 14px;
}

.filter-panel > .panel-body {
    transition: opacity .16s ease;
}

.filter-panel.filters-collapsed > .panel-body {
    display: none;
}

.filter-panel.filters-collapsed .filter-panel-head {
    border-bottom: 0;
}

.filter-panel .form-grid > .d-flex.align-items-end {
    align-self: end;
}

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

.form-grid-single {
    grid-template-columns: 1fr;
}

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

.form-label {
    color: #354b51;
    font-weight: 800;
    font-size: 11px;
    margin-bottom: 7px;
}

.required-mark {
    margin-left: 4px;
    color: #c44d59;
}

.form-control,
.form-select {
    width: 100%;
    border-color: #d7e1e3;
    border-radius: 11px;
    min-height: 45px;
    padding-inline: 13px;
    color: #263f45;
    background-color: #fff;
    font-size: 13px;
    box-shadow: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: #b8c9cc;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent);
}

.form-control::placeholder {
    color: #98a6aa;
}

textarea.form-control {
    min-height: 110px;
    padding-block: 11px;
    resize: vertical;
}

.form-panel {
    overflow: hidden;
}

.form-panel .editor-form > .toolbar:last-child {
    margin: 24px calc(clamp(17px, 2.2vw, 23px) * -1) calc(clamp(17px, 2.2vw, 23px) * -1);
    padding: 16px clamp(17px, 2.2vw, 23px);
    border-top: 1px solid var(--line);
    background: #f8faf9;
}

.student-select-search {
    margin-bottom: 7px;
}

.student-select-search-result {
    min-height: 18px;
}

textarea.form-control {
    min-height: 112px;
}

.form-check-input {
    border-color: var(--line-strong);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn {
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 41px;
    padding-inline: 15px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible,
.icon-btn:focus-visible,
.sidebar-collapse-toggle:focus-visible,
.mobile-nav-toggle:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary) 38%, white);
    outline-offset: 2px;
}

.btn-sm {
    min-height: 34px;
    padding-inline: 10px;
    border-radius: 9px;
    font-size: 11px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 18%, transparent);
}

.btn-primary:hover,
.btn-primary:focus {
    background: color-mix(in srgb, var(--primary) 78%, #102d35);
    border-color: color-mix(in srgb, var(--primary) 78%, #102d35);
    color: #fff;
    box-shadow: 0 7px 18px color-mix(in srgb, var(--primary) 25%, transparent);
}

.btn-return {
    background: #fff;
    border-color: var(--line-strong);
    color: #415760;
}

.btn-return:hover,
.btn-return:focus {
    background: #f1f5f4;
    border-color: #aebfc3;
    color: var(--primary-dark);
}

.btn-outline-secondary {
    color: #345264;
    border-color: var(--line-strong);
    background: #fff;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    color: var(--primary-dark);
    border-color: color-mix(in srgb, var(--primary) 45%, white);
    background: color-mix(in srgb, var(--primary) 8%, white);
}

.icon-btn,
.mobile-nav-toggle {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
}

.mobile-nav-toggle {
    display: none;
    position: fixed;
    left: 12px;
    top: 12px;
    z-index: 50;
    box-shadow: var(--shadow-md);
}

.table-responsive {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #c2d0d3 transparent;
}

.table {
    margin: 0;
    min-width: 720px;
}

.table th {
    color: #4c6572;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
    padding: 13px 14px;
    background: #f5f8f8;
    border-bottom-color: var(--line);
}

.table td {
    vertical-align: middle;
    padding: 12px 14px;
    border-bottom-color: #edf1f2;
    font-size: 12px;
}

.table-hover > tbody > tr:hover > * {
    background: #f1f7f6;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #075985;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.neutral,
.status-pill.certification-borrador,
.status-pill.enrollment-pre_matricula {
    background: #f1f5f9;
    color: #475569;
}

.status-pill.success,
.status-pill.matriculado,
.status-pill.certification-registrado,
.status-pill.enrollment-matriculado {
    background: #dcfce7;
    color: #166534;
}

.status-pill.warning,
.status-pill.observado,
.status-pill.certification-observado,
.status-pill.enrollment-observado {
    background: #fef3c7;
    color: #92400e;
}

.status-pill.danger,
.status-pill.retirado,
.status-pill.certification-anulado,
.status-pill.enrollment-retirado,
.status-pill.enrollment-anulado {
    background: #fee2e2;
    color: #991b1b;
}

.status-pill.licencia_estudio {
    background: #ede9fe;
    color: #5b21b6;
}

.status-pill.certification-emitido,
.status-pill.enrollment-reservado {
    background: #dbeafe;
    color: #1d4ed8;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.action-bar .btn {
    width: 34px;
    padding: 0;
}

.action-bar form {
    display: inline-flex;
}

.empty-state {
    padding: 54px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state-content {
    width: min(100%, 390px);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-inline: auto;
}

.empty-state-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    margin-bottom: 13px;
    border: 1px solid color-mix(in srgb, var(--primary) 13%, var(--line));
    border-radius: 16px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 7%, #fff);
    box-shadow: 0 8px 20px rgba(19, 75, 77, .07);
}

.empty-state-icon svg {
    width: 24px;
    height: 24px;
}

.empty-state-content strong {
    margin-bottom: 5px;
    color: var(--ink);
    font-size: 13px;
}

.empty-state-content > span:not(.empty-state-icon) {
    font-size: 11px;
}

.empty-state-content small {
    margin-top: 6px;
    color: #93a0a4;
    font-size: 9px;
}

.empty-state.compact {
    padding: 18px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.empty-state.compact .empty-state-content {
    min-height: 110px;
}

/* Document emission tray */
.emission-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.emission-status-card {
    --status-color: #49727b;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 11px;
    min-height: 88px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.emission-status-card:hover,
.emission-status-card.active {
    border-color: color-mix(in srgb, var(--status-color) 42%, var(--line));
    box-shadow: 0 10px 24px color-mix(in srgb, var(--status-color) 12%, transparent);
    transform: translateY(-2px);
}

.emission-status-card > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--status-color);
    background: color-mix(in srgb, var(--status-color) 10%, var(--surface));
}

.emission-status-card svg { width: 18px; }
.emission-status-card > svg { width: 14px; color: #9babad; }
.emission-status-card strong, .emission-status-card small { display: block; }
.emission-status-card strong { color: var(--ink); font-size: 20px; line-height: 1; }
.emission-status-card small { margin-top: 5px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.emission-status-card.status-pendiente { --status-color: #b4772c; }
.emission-status-card.status-para_firma { --status-color: #6c65a4; }
.emission-status-card.status-entregado { --status-color: #297b55; }

.status-pill.emission-registrado { color: #315f72; background: #e6f2f6; }
.status-pill.emission-pendiente { color: #93601f; background: #fff2dc; }
.status-pill.emission-para_firma { color: #5d568e; background: #eeecff; }
.status-pill.emission-entregado { color: #216944; background: #e5f6ec; }
.emission-subject { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.document-student-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.selected-student-card {
    margin-top: 18px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--line));
    border-radius: 14px;
    background: color-mix(in srgb, var(--primary) 3%, var(--surface));
}

.selected-student-card[hidden] { display: none; }
.selected-student-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.selected-student-head > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.selected-student-head svg { width: 18px; }
.selected-student-head small, .selected-student-head strong { display: block; }
.selected-student-head small { color: var(--primary); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.selected-student-head strong { margin-top: 2px; color: var(--ink); font-size: 12px; }
.selected-student-head button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 8px; border: 0; border-radius: 8px; color: #8a5960; background: transparent; font-size: 9px; font-weight: 800; }
.selected-student-head button:hover { color: #b23b49; background: #fff0f2; }
.selected-student-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.selected-student-grid > div { padding: 11px 15px; background: var(--surface); }
.selected-student-grid small, .selected-student-grid strong { display: block; }
.selected-student-grid small { margin-bottom: 3px; color: var(--muted); font-size: 8px; font-weight: 800; text-transform: uppercase; }
.selected-student-grid strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.student-picker-dialog {
    width: min(940px, calc(100vw - 32px));
    max-width: none;
    max-height: min(720px, calc(100vh - 32px));
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--ink);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(11, 30, 36, .3);
}

.student-picker-dialog::backdrop { background: rgba(8, 24, 30, .62); backdrop-filter: blur(3px); }
.student-picker-shell { display: grid; grid-template-rows: auto auto minmax(220px, 1fr) auto; max-height: min(720px, calc(100vh - 32px)); }
.student-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.student-picker-head > div { display: flex; align-items: center; gap: 11px; }
.student-picker-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); }
.student-picker-icon svg { width: 19px; }
.student-picker-head strong, .student-picker-head small { display: block; }
.student-picker-head strong { font-size: 14px; }
.student-picker-head small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.student-picker-head > button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; color: var(--muted); background: var(--surface-soft); }
.student-picker-search { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; align-items: center; gap: 8px; margin: 14px 18px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); }
.student-picker-search > svg { width: 17px; color: var(--muted); }
.student-picker-search input { min-height: 46px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.student-picker-search > span { color: var(--muted); font-size: 9px; }
.student-picker-results { min-height: 260px; overflow: auto; border-block: 1px solid var(--line); }
.student-picker-results.is-loading { opacity: .58; }
.student-picker-results table { width: 100%; border-collapse: collapse; }
.student-picker-results th { position: sticky; top: 0; z-index: 1; padding: 10px 13px; color: var(--muted); background: var(--surface-soft); font-size: 9px; text-align: left; text-transform: uppercase; }
.student-picker-results td { padding: 11px 13px; border-top: 1px solid var(--line); color: var(--ink); font-size: 10px; }
.student-picker-results tr { cursor: pointer; }
.student-picker-results tbody tr:hover, .student-picker-results tbody tr:focus { outline: 0; background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.student-picker-results td strong, .student-picker-results td small { display: block; }
.student-picker-results td small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.student-picker-empty { min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); text-align: center; }
.student-picker-empty svg { width: 28px; margin-bottom: 9px; color: var(--primary); }
.student-picker-empty strong { color: var(--ink); font-size: 12px; }
.student-picker-empty span { margin-top: 4px; font-size: 9px; }
.student-picker-shell > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--surface-soft); }
.student-picker-shell > footer > span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 9px; }
.student-picker-shell > footer svg { width: 14px; }

/* Student spreadsheet import */
.import-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, .7fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}

.import-main-panel,
.import-guide .panel,
.import-result-panel,
.import-errors-panel {
    overflow: hidden;
    border-radius: 16px;
}

.import-panel-head {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(90deg, #fbfcfc, #f4f9f8);
}

.import-head-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 9%, #fff);
}

.import-head-icon svg { width: 20px; }
.import-panel-head > div > span,
.import-guide-kicker {
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.import-panel-head h2,
.import-guide h2,
.import-errors-head h2 {
    margin: 3px 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
}

.import-panel-head p,
.import-errors-head p {
    margin: 0;
    color: var(--muted);
    font-size: 10px;
}

.import-dropzone {
    min-height: 265px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px;
    border: 1.5px dashed #a9c4c5;
    border-radius: 15px;
    text-align: center;
    background: color-mix(in srgb, var(--primary) 3%, #fff);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.import-dropzone:hover,
.import-dropzone.is-dragging {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 8%, #fff);
}

.import-dropzone.is-dragging { transform: scale(1.005); }
.import-dropzone.has-file { border-style: solid; }
.import-dropzone.is-invalid { border-color: #c44958; }
.import-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.import-drop-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin-bottom: 15px;
    border-radius: 18px;
    color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, #fff);
    box-shadow: 0 10px 24px rgba(18, 107, 112, .1);
}

.import-drop-icon svg { width: 28px; height: 28px; }
.import-dropzone strong { color: var(--ink); font-size: 14px; }
.import-dropzone > span:not(.import-drop-icon) { margin-top: 5px; color: var(--muted); font-size: 11px; }
.import-dropzone small { margin-top: 13px; color: #8d9b9e; font-size: 9px; }

.import-file-preview {
    grid-template-columns: 40px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 11px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}

.import-file-preview:not([hidden]) { display: grid; }
.import-file-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; color: #277653; background: #e9f7ef; }
.import-file-icon svg { width: 19px; }
.import-file-data { min-width: 0; }
.import-file-data strong, .import-file-data small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-file-data strong { color: var(--ink); font-size: 11px; }
.import-file-data small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.import-file-preview button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; color: #7d8a8e; background: transparent; }
.import-file-preview button:hover { color: #b23b49; background: #fff0f2; }
.import-file-preview button svg { width: 15px; }

.import-field-error { display: flex; align-items: center; gap: 6px; margin-top: 9px; color: #b23b49; font-size: 10px; font-weight: 700; }
.import-field-error svg { width: 14px; }
.import-submit-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; }
.import-submit-row p { max-width: 420px; display: flex; align-items: flex-start; gap: 7px; margin: 0; color: var(--muted); font-size: 9px; }
.import-submit-row p svg { width: 15px; flex: 0 0 15px; color: var(--primary); }
.import-submit-row .btn { min-width: 165px; }

.button-spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: import-spin .7s linear infinite; }
@keyframes import-spin { to { transform: rotate(360deg); } }

.import-guide { display: grid; gap: 14px; }
.import-guide h2 { margin: 5px 0 18px; }
.import-steps { display: grid; gap: 17px; margin: 0; padding: 0; list-style: none; }
.import-steps li { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 11px; }
.import-steps li:not(:last-child)::after { content: ''; position: absolute; top: 31px; bottom: -17px; left: 14px; width: 1px; background: var(--line); }
.import-steps li > span { width: 30px; height: 30px; display: grid; place-items: center; z-index: 1; border-radius: 9px; color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); font-size: 10px; font-weight: 800; }
.import-steps strong, .import-steps small { display: block; }
.import-steps strong { color: var(--ink); font-size: 11px; }
.import-steps small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.45; }

.import-required-card { display: flex; align-items: flex-start; gap: 11px; padding: 15px; border: 1px solid #ead9b5; border-radius: 14px; color: #76551c; background: #fff9ed; }
.import-required-card > svg { width: 18px; flex: 0 0 18px; }
.import-required-card strong, .import-required-card span { display: block; }
.import-required-card strong { margin-bottom: 3px; font-size: 11px; }
.import-required-card span { font-size: 9px; line-height: 1.5; }

.import-result-panel { margin-bottom: 18px; }
.import-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.import-summary-grid > div { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; padding: 16px 18px; background: var(--surface); }
.import-summary-grid > div > span { grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, var(--surface)); }
.import-summary-grid svg { width: 16px; }
.import-summary-grid strong { color: var(--ink); font-size: 18px; line-height: 1; }
.import-summary-grid small { color: var(--muted); font-size: 9px; }
.import-summary-grid .success > span { color: #24764f; background: #e9f7ef; }
.import-summary-grid .info > span { color: #316a91; background: #eaf5fb; }
.import-summary-grid .danger > span { color: #b23b49; background: #fff0f2; }

.import-errors-panel { margin-top: 18px; }
.import-errors-head { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 16px 20px; border-bottom: 1px solid #f0d4d8; background: #fff7f8; }
.import-errors-head > span:first-child { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #b23b49; background: #ffe8eb; }
.import-errors-head svg { width: 18px; }
.import-error-list { max-height: 360px; display: grid; gap: 0; padding: 8px 20px 16px; overflow-y: auto; }
.import-error-list > div { display: flex; align-items: flex-start; gap: 8px; padding: 9px 0; border-bottom: 1px solid #edf1f2; color: #5c6c71; font-size: 10px; }
.import-error-list > div svg { width: 14px; flex: 0 0 14px; color: #bd5561; }
.import-error-list > p { margin: 12px 0 0; color: var(--muted); font-size: 9px; }

.permission-editor {
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.permission-editor-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.permission-editor-head p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

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

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

.permission-group {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    background: #fbfdff;
}

.permission-group-title {
    margin-bottom: 10px;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.permission-list {
    display: grid;
    gap: 9px;
}

.permission-item,
.permission-override {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    color: #344054;
}

.permission-item input {
    margin-top: 3px;
}

.permission-item strong,
.permission-item small,
.permission-copy strong,
.permission-copy small {
    display: block;
}

.permission-item small,
.permission-copy small {
    color: var(--muted);
    font-size: 11px;
}

.permission-override {
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid var(--line);
}

.permission-override:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.permission-copy {
    min-width: 0;
}

.permission-choice {
    flex: 0 0 auto;
    display: inline-grid;
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.permission-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.permission-choice label {
    display: grid;
    place-items: center;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 6px;
    color: #475467;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.permission-choice input:checked + label {
    background: #fff;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.permission-choice input[value="allow"]:checked + label {
    color: var(--success);
}

.permission-choice input[value="deny"]:checked + label {
    color: var(--danger);
}

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

.permission-summary > div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
}

.permission-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 22px;
}

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

.variable-list code {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-soft);
    color: #344054;
}

.indicator-list {
    margin: 0;
    padding-left: 20px;
    color: #344054;
    line-height: 1.65;
}

.indicator-list li + li {
    margin-top: 6px;
}

.document-preview-shell {
    overflow-x: auto;
    padding: 18px 0 32px;
}

.pdf-viewer-frame {
    width: 100%;
    height: min(82vh, 1100px);
    min-height: 560px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #eef2f4;
    box-shadow: var(--shadow-md);
}

.pdf-viewer-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.document-preview-landscape {
    min-width: 0;
}

.document-paper {
    position: relative;
    width: min(100%, 820px);
    min-height: 1060px;
    margin: 0 auto;
    padding: 58px 64px;
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    color: #111827;
}

.document-paper-with-background {
    width: min(100%, 210mm);
    min-height: 0;
    aspect-ratio: 210 / 297;
    border: 0;
    overflow: hidden;
}

.document-page-background {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: fill;
    pointer-events: none;
    z-index: 0;
}

.document-paper-with-background > :not(.document-page-background) {
    position: relative;
    z-index: 1;
}

.document-paper + .document-paper {
    margin-top: 22px;
}

.document-paper-header {
    text-align: center;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 26px;
}

.document-paper-logo {
    max-width: 96px;
    max-height: 72px;
    object-fit: contain;
    margin-bottom: 10px;
}

.document-inline-logo {
    display: block;
    text-align: center;
    margin: 10px 0;
}

.document-inline-logo img {
    max-width: 140px;
    max-height: 92px;
    object-fit: contain;
}

.document-paper-header h1 {
    margin: 0 0 8px;
    font-size: 22px;
    line-height: 1.25;
    text-transform: uppercase;
}

.document-paper-header p,
.document-paper-header span {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.document-template-head {
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
    margin-bottom: 26px;
    text-align: center;
}

.egresado-head {
    display: block;
    text-align: center;
}

.egresado-logos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 12px;
    min-height: 82px;
    margin-bottom: 18px;
}

.egresado-logos.ratio-1 {
    grid-template-columns: 1fr;
}

.egresado-logos.ratio-1_1 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.egresado-logos img {
    max-height: 78px;
    width: auto;
    object-fit: contain;
}

.egresado-year {
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 600;
}

.egresado-head h1 {
    margin-bottom: 20px;
    font-size: clamp(17px, 2vw, 22px);
}

.egresado-institution {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.65;
}

.document-template-head-grid {
    display: grid;
    align-items: stretch;
    gap: 14px;
    min-height: 104px;
}

.document-template-head-grid.ratio-1_2_1 {
    grid-template-columns: 1fr 2fr 1fr;
}

.document-template-head-grid.ratio-1_3_1 {
    grid-template-columns: 1fr 3fr 1fr;
}

.document-template-head-grid.ratio-1_4_1 {
    grid-template-columns: 1fr 4fr 1fr;
}

.document-template-head h1 {
    margin: 10px 0 6px;
    font-size: 22px;
    line-height: 1.25;
    text-transform: uppercase;
}

.document-template-head p,
.document-template-head span {
    display: block;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

.document-header-center-text {
    font-weight: 800;
    text-transform: uppercase;
    color: var(--ink);
    font-size: 12px;
    line-height: 1.25;
}

.document-header-center-text .institution-name-line {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(9px, 1.05vw, 13px);
}

.document-header-right-text {
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.document-block {
    border: 1px solid var(--line);
    padding: 16px;
    margin-bottom: 18px;
    line-height: 1.65;
    white-space: normal;
}

.main-document-body {
    min-height: 220px;
    border-color: transparent;
    padding: 10px 0;
    font-size: 14px;
    text-align: justify;
}

.document-footer {
    margin-top: 42px;
    padding-top: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.55;
}

.document-signature {
    display: block;
    text-align: center;
    margin: 34px auto 8px;
    color: var(--ink);
    line-height: 1 !important;
}

.document-signature * {
    line-height: 1 !important;
}

.document-signature img {
    display: block;
    max-width: 180px;
    max-height: 84px;
    object-fit: contain;
    margin: 0 auto 4px;
}

.document-signature span {
    display: block;
    width: min(220px, 100%);
    margin: 0 auto;
    border-top: 1px solid var(--ink);
    padding-top: 4px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1 !important;
}

.document-signature small {
    display: block;
    margin-top: 0;
    font-size: 11px;
    font-weight: 800;
    line-height: 1 !important;
}

.template-asset-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.template-asset-preview img {
    width: 82px;
    height: 58px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
}

.variable-token {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 6px 9px;
    cursor: pointer;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.variable-token:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
    transform: translateY(-1px);
}

.rich-editor-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.rich-editor-source {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.rich-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 9px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.rich-editor-toolbar select,
.rich-editor-toolbar button,
.rich-editor-toolbar input[type="color"] {
    min-height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
}

.rich-editor-toolbar select {
    max-width: 170px;
    padding: 0 8px;
    font-size: 13px;
}

.rich-editor-toolbar button {
    width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.rich-editor-toolbar input[type="color"] {
    width: 38px;
    padding: 3px;
}

.rich-editor-toolbar button:hover,
.rich-editor-toolbar select:hover,
.rich-editor-toolbar input[type="color"]:hover {
    border-color: var(--primary);
}

.rich-editor-surface {
    width: 100%;
    padding: 14px;
    color: var(--ink);
    line-height: 1.65;
    outline: 0;
    overflow: auto;
}

.rich-editor-surface:focus {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 24%, transparent);
}

.rich-editor-surface img {
    max-width: 100%;
    height: auto;
}

.rich-editor-surface table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.rich-editor-surface th,
.rich-editor-surface td {
    border: 1px solid #cbd5e1;
    padding: 8px;
}

.modular-certificate-paper {
    width: min(100%, 1060px);
    min-height: 760px;
}

.modular-certificate-head {
    text-align: center;
    margin-bottom: 28px;
}

.modular-certificate-head-grid {
    display: grid;
    align-items: stretch;
    gap: 14px;
    min-height: 112px;
}

.modular-certificate-head-grid.ratio-1_2_1 {
    grid-template-columns: 1fr 2fr 1fr;
}

.modular-certificate-head-grid.ratio-1_3_1 {
    grid-template-columns: 1fr 3fr 1fr;
}

.modular-certificate-head-grid.ratio-1_4_1 {
    grid-template-columns: 1fr 4fr 1fr;
}

.certificate-header-slot {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.certificate-header-slot.align-left {
    align-items: flex-start;
    text-align: left;
}

.certificate-header-slot.align-center {
    align-items: center;
    text-align: center;
}

.certificate-header-slot.align-right {
    align-items: flex-end;
    text-align: right;
}

.certificate-header-slot.valign-top {
    justify-content: flex-start;
}

.certificate-header-slot.valign-middle {
    justify-content: center;
}

.certificate-header-slot.valign-bottom {
    justify-content: flex-end;
}

.certificate-header-slot img {
    max-height: 96px;
    width: auto;
    object-fit: contain;
}

.modular-certificate-head p {
    margin: 0 0 4px;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 16px;
}

.modular-certificate-head span {
    display: block;
    width: fit-content;
    margin-left: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.4;
}

.modular-certificate-head h1 {
    margin: 18px 0 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: .04em;
}

.modular-header-center-text {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
    line-height: 1.22;
}

.modular-header-center-text .institution-name-line {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(9px, 1.15vw, 13px);
}

.modular-header-right-text {
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.modular-certificate-awarded {
    margin: 0 0 16px;
    line-height: 1.55;
    text-align: justify;
}

.modular-certificate-awarded strong {
    display: block;
    text-align: center;
    margin: 8px 0 12px;
    font-size: 19px;
    text-transform: uppercase;
}

.modular-certificate-body strong {
    display: inline;
    margin: 0;
    font-size: inherit;
    text-transform: none;
}

.modular-certificate-body div[style*="text-align: center"] strong {
    display: block;
    text-align: center;
    margin: 8px 0 12px;
    font-size: 16px;
    text-transform: uppercase;
}

.modular-certificate-body {
    text-align: justify;
    line-height: 1.65;
    font-size: 15px;
}

.modular-certificate-body .document-signature {
    margin-top: 58px;
}

.modular-certificate-signature {
    margin-top: 32px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.modular-certificate-signature .document-signature {
    margin-top: 0;
}

.modular-second-page-header {
    margin: 0 0 22px;
    text-align: center;
    color: var(--ink);
    font-weight: 800;
}

.modular-certificate-annex table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.55;
}

.document-paper-page-2.modular-certificate-annex {
    width: min(100%, 1060px);
    min-height: 760px;
}

@page modular-certificate-landscape {
    size: A4 landscape;
    margin: 0;
}

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

    .mobile-nav-toggle,
    .sidebar-backdrop,
    .sidebar,
    .topbar,
    .app-breadcrumb,
    .page-title,
    .panel {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .main,
    .content,
    .document-preview-shell {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    .modular-certificate-paper,
    .document-paper-page-2.modular-certificate-annex {
        page: modular-certificate-landscape;
        width: 297mm;
        min-height: 210mm;
        margin: 0;
        padding: 18mm 20mm;
        border: 0;
        box-shadow: none;
        page-break-after: always;
        break-after: page;
    }

    .document-paper-page-2.modular-certificate-annex {
        page-break-after: auto;
        break-after: auto;
    }
}

.modular-certificate-annex th {
    background: #dbe3ec;
    border: 1px solid #64748b;
    text-align: left;
    padding: 10px 12px;
    font-size: 14px;
}

.modular-certificate-annex th:first-child {
    width: 38%;
}

.modular-certificate-annex td {
    background: #fff;
    border: 1px solid #64748b;
    vertical-align: middle;
    padding: 22px 12px;
    text-align: justify;
}

.modular-certificate-annex td:first-child {
    background: #fff;
    font-weight: 500;
}

.modular-certificate-annex p {
    margin: 0 0 12px;
}

.modular-annex-register-box {
    width: min(100%, 320px);
    margin: 34px auto 0;
    padding: 12px 16px;
    border: 1px solid var(--ink);
    text-align: center;
}

.modular-annex-register-box span {
    display: block;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.modular-annex-register-box strong {
    display: block;
    margin-top: 6px;
    font-size: 15px;
}

.modular-annex-signature {
    width: min(100%, 260px);
    margin: 82px auto 0;
    line-height: 1 !important;
}

.modular-annex-signature small {
    display: block;
    margin-top: 0;
    font-size: 11px;
    font-weight: 800;
    line-height: 1 !important;
}

.modular-annex-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 48px;
    margin-top: 54px;
}

.modular-annex-footer > div:first-child {
    text-align: center;
}

.modular-annex-footer p {
    margin: 0 0 6px;
    color: #334155;
    font-weight: 700;
}

.template-header-slot {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.template-header-slot-title {
    margin-bottom: 12px;
    color: var(--ink);
    font-weight: 800;
}

.mobile-header,
.sidebar-backdrop {
    display: none;
}

.alert {
    border-radius: var(--radius);
    border-color: transparent;
}

/* Dark color theme */
html[data-theme="dark"] body.is-authenticated {
    background: radial-gradient(circle at 85% 0%, rgba(27, 132, 137, .1), transparent 32%), var(--bg);
    color: var(--ink);
}

html[data-theme="dark"] body.is-authenticated .topbar {
    background: rgba(20, 31, 36, .94);
    border-bottom-color: var(--line);
}

html[data-theme="dark"] body.is-authenticated .sidebar-collapse-toggle,
html[data-theme="dark"] body.is-authenticated .mobile-nav-toggle,
html[data-theme="dark"] body.is-authenticated .icon-btn,
html[data-theme="dark"] body.is-authenticated .theme-toggle,
html[data-theme="dark"] body.is-authenticated .btn-outline-secondary,
html[data-theme="dark"] body.is-authenticated .btn-return {
    color: #b2c1c5;
    border-color: var(--line-strong);
    background: var(--surface);
}

html[data-theme="dark"] body.is-authenticated .sidebar-collapse-toggle:hover,
html[data-theme="dark"] body.is-authenticated .theme-toggle:hover,
html[data-theme="dark"] body.is-authenticated .btn-outline-secondary:hover,
html[data-theme="dark"] body.is-authenticated .btn-return:hover {
    color: #73c7c6;
    border-color: #45666b;
    background: #203238;
}

html[data-theme="dark"] body.is-authenticated .user-chip:hover,
html[data-theme="dark"] body.is-authenticated .page-title,
html[data-theme="dark"] body.is-authenticated .filter-panel-head {
    background: linear-gradient(110deg, #172329, #1a292e);
}

html[data-theme="dark"] body.is-authenticated .page-title,
html[data-theme="dark"] body.is-authenticated .panel,
html[data-theme="dark"] body.is-authenticated .dashboard-metric,
html[data-theme="dark"] body.is-authenticated .filter-panel,
html[data-theme="dark"] body.is-authenticated .permission-group,
html[data-theme="dark"] body.is-authenticated .settings-row,
html[data-theme="dark"] body.is-authenticated .template-header-slot,
html[data-theme="dark"] body.is-authenticated .rich-editor-wrap {
    color: var(--ink);
    border-color: var(--line);
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
}

html[data-theme="dark"] body.is-authenticated .form-control,
html[data-theme="dark"] body.is-authenticated .form-select,
html[data-theme="dark"] body.is-authenticated .student-select-search,
html[data-theme="dark"] body.is-authenticated .rich-editor-toolbar select,
html[data-theme="dark"] body.is-authenticated .rich-editor-toolbar button,
html[data-theme="dark"] body.is-authenticated .rich-editor-toolbar input[type="color"] {
    color: var(--ink);
    border-color: var(--line-strong);
    background-color: #121f24;
}

html[data-theme="dark"] body.is-authenticated .form-control:focus,
html[data-theme="dark"] body.is-authenticated .form-select:focus {
    border-color: color-mix(in srgb, var(--primary) 72%, #8bd7d3);
    background-color: #142329;
}

html[data-theme="dark"] body.is-authenticated .form-control::placeholder {
    color: #6f858b;
}

html[data-theme="dark"] body.is-authenticated .form-label,
html[data-theme="dark"] body.is-authenticated .section-title,
html[data-theme="dark"] body.is-authenticated .dashboard-panel-head h2,
html[data-theme="dark"] body.is-authenticated .dashboard-metric h2,
html[data-theme="dark"] body.is-authenticated .filter-panel-title strong,
html[data-theme="dark"] body.is-authenticated .student-data strong {
    color: var(--ink);
}

html[data-theme="dark"] body.is-authenticated .form-panel .editor-form > .toolbar:last-child,
html[data-theme="dark"] body.is-authenticated .rich-editor-toolbar,
html[data-theme="dark"] body.is-authenticated .table th,
html[data-theme="dark"] body.is-authenticated .pagination-wrap {
    border-color: var(--line);
    background: #1a282e;
}

html[data-theme="dark"] body.is-authenticated .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: #203239;
    --bs-table-hover-color: var(--ink);
    color: var(--ink);
}

html[data-theme="dark"] body.is-authenticated .table th {
    color: #a9bbc0;
}

html[data-theme="dark"] body.is-authenticated .table-hover > tbody > tr:hover > * {
    color: var(--ink);
    background: #203239;
}

html[data-theme="dark"] body.is-authenticated .recent-student + .recent-student,
html[data-theme="dark"] body.is-authenticated .recent-student:hover {
    border-color: var(--line);
    background-color: var(--surface-soft);
}

html[data-theme="dark"] body.is-authenticated .student-avatar,
html[data-theme="dark"] body.is-authenticated .metric-icon,
html[data-theme="dark"] body.is-authenticated .dashboard-panel-icon,
html[data-theme="dark"] body.is-authenticated .filter-panel-icon,
html[data-theme="dark"] body.is-authenticated .empty-state-icon,
html[data-theme="dark"] body.is-authenticated .auth-help-icon {
    background: color-mix(in srgb, var(--primary) 20%, var(--surface));
}

html[data-theme="dark"] body.is-authenticated .metric-success .metric-icon { color: #71d7a3; background: #19372c; }
html[data-theme="dark"] body.is-authenticated .metric-warning .metric-icon { color: #efb16f; background: #3a2b1d; }
html[data-theme="dark"] body.is-authenticated .metric-neutral .metric-icon { color: #b6b9d8; background: #292b3e; }

html[data-theme="dark"] body.is-authenticated .metric-progress {
    background: #283a3d;
}

html[data-theme="dark"] body.is-authenticated .table-tag,
html[data-theme="dark"] body.is-authenticated .app-breadcrumb li.current > span {
    color: #bed0d4;
    background: #213238;
}

html[data-theme="dark"] body.is-authenticated .page-link {
    color: #8bd0cf;
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] body.is-authenticated .active > .page-link,
html[data-theme="dark"] body.is-authenticated .page-link.active {
    color: #fff;
    background: var(--primary);
}

html[data-theme="dark"] body.is-authenticated .system-alert {
    color: #d7e2e4;
    border-color: color-mix(in srgb, var(--alert-color) 38%, var(--line));
    background: rgba(23, 35, 41, .97);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .36);
}

html[data-theme="dark"] body.is-authenticated .system-alert-copy strong {
    color: #f0f5f6;
}

html[data-theme="dark"] body.is-authenticated .system-alert-copy > span,
html[data-theme="dark"] body.is-authenticated .system-alert-copy li {
    color: #afc0c4;
}

html[data-theme="dark"] body.is-authenticated .system-alert > button:hover {
    color: #fff;
    background: #27373d;
}

html[data-theme="dark"] body.is-authenticated .text-muted {
    color: var(--muted) !important;
}

html[data-theme="dark"] body.is-authenticated .border,
html[data-theme="dark"] body.is-authenticated .border-top,
html[data-theme="dark"] body.is-authenticated .border-bottom {
    border-color: var(--line) !important;
}

html[data-theme="dark"] body.is-authenticated .responsive-card-table tbody tr,
html[data-theme="dark"] body.is-authenticated .responsive-card-table tbody td.card-primary {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] body.is-authenticated .responsive-card-table tbody td {
    border-color: var(--line);
}

html[data-theme="dark"] body.is-authenticated .responsive-card-table tbody td.card-primary {
    background: linear-gradient(90deg, #1b2b30, #172329);
}

html[data-theme="dark"] body.is-authenticated .modal-content,
html[data-theme="dark"] body.is-authenticated .dropdown-menu {
    color: var(--ink);
    border-color: var(--line);
    background: var(--surface);
}

html[data-theme="dark"] body.is-authenticated .import-panel-head,
html[data-theme="dark"] body.is-authenticated .import-errors-head {
    border-color: var(--line);
    background: linear-gradient(90deg, #1a292e, #172329);
}

html[data-theme="dark"] body.is-authenticated .import-dropzone {
    border-color: #45666b;
    background: #142328;
}

html[data-theme="dark"] body.is-authenticated .import-dropzone:hover,
html[data-theme="dark"] body.is-authenticated .import-dropzone.is-dragging {
    border-color: #69b9b8;
    background: #193036;
}

html[data-theme="dark"] body.is-authenticated .import-drop-icon,
html[data-theme="dark"] body.is-authenticated .import-head-icon {
    background: #20373b;
}

html[data-theme="dark"] body.is-authenticated .import-file-preview,
html[data-theme="dark"] body.is-authenticated .import-summary-grid > div {
    border-color: var(--line);
    background: var(--surface-soft);
}

html[data-theme="dark"] body.is-authenticated .import-required-card {
    color: #e8c782;
    border-color: #5d4d2e;
    background: #30291c;
}

html[data-theme="dark"] body.is-authenticated .import-error-list > div {
    color: #b7c5c8;
    border-color: var(--line);
}

html[data-theme="dark"] body.is-authenticated .status-pill.emission-registrado { color: #9ad1df; background: #203940; }
html[data-theme="dark"] body.is-authenticated .status-pill.emission-pendiente { color: #efc27c; background: #3b301e; }
html[data-theme="dark"] body.is-authenticated .status-pill.emission-para_firma { color: #c5bff1; background: #302e49; }
html[data-theme="dark"] body.is-authenticated .status-pill.emission-entregado { color: #87d4ab; background: #203b2e; }

@media (max-width: 1180px) {
    .metric-grid,
    .permission-grid-compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .dashboard-main-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr);
    }

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

@media (max-width: 980px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(390px, .95fr);
    }

    .auth-copy h1 {
        font-size: clamp(2.55rem, 5vw, 3.8rem);
    }

    .app-shell {
        grid-template-columns: 248px minmax(0, 1fr);
    }

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

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

    .dashboard-main-grid,
    .dashboard-lower-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-side-stack {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }
}

@media (max-width: 820px) {
    .auth-shell {
        min-height: 100svh;
        display: block;
        background: #f5f8f7;
        overflow: visible;
    }

    .auth-visual {
        display: none;
    }

    .login-panel {
        min-height: 100svh;
        padding: clamp(28px, 7vw, 58px) clamp(20px, 7vw, 56px);
        box-shadow: none;
        background:
            radial-gradient(circle at 90% 5%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 30%),
            #f9fbfa;
    }

    .login-wrap {
        max-width: 470px;
    }

    .auth-brand-mobile {
        display: inline-flex;
    }

    .app-shell {
        display: block;
    }

    .mobile-nav-toggle {
        display: inline-grid;
    }

    .sidebar-collapse-toggle {
        display: none;
    }

    .topbar-leading {
        min-width: 0;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: min(86vw, 330px);
        height: 100vh;
        padding: 14px;
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 24px 0 60px rgba(15, 23, 42, .28);
    }

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

    body.nav-open {
        overflow: hidden;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(15, 23, 42, .48);
        backdrop-filter: blur(2px);
    }

    body.nav-open .sidebar-backdrop {
        display: block;
    }

    .mobile-header {
        position: sticky;
        top: -14px;
        z-index: 8;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin: -14px -14px 12px;
        padding: 14px;
        border-bottom: 1px solid rgba(203, 213, 225, .13);
        background: color-mix(in srgb, var(--sidebar) 94%, #173f49);
        box-shadow: 0 10px 20px rgba(5, 18, 24, .08);
    }

    .sidebar > .brand.d-none.d-md-flex {
        display: none !important;
    }

    .mobile-header .brand {
        margin-bottom: 0;
    }

    .mobile-header .icon-btn {
        background: rgba(255, 255, 255, .08);
        color: #fff;
        border-color: rgba(255, 255, 255, .18);
    }

    .topbar {
        position: sticky;
        top: 0;
        min-height: 58px;
        padding: 8px 12px 8px 62px;
        align-items: center;
        flex-wrap: wrap;
    }

    .topbar-user {
        min-width: 0;
        max-width: 48vw;
    }

    .context-switcher {
        order: 3;
        width: 100%;
        flex: 1 0 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .context-field,
    .context-field:first-child {
        flex: 1 1 180px;
        min-width: 0;
    }

    .content {
        padding: 16px;
    }

    .notification-stack {
        position: static;
        width: 100%;
        margin-bottom: 14px;
    }

    .system-alert {
        box-shadow: 0 10px 25px rgba(20, 48, 55, .1);
    }

    .page-title h1 {
        font-size: 1.35rem;
    }

    .toolbar {
        width: 100%;
    }

    .toolbar .btn {
        flex: 1 1 auto;
    }

    .dashboard-hero {
        min-height: 0;
        padding: 28px;
    }

    .dashboard-hero-actions {
        min-width: 155px;
    }

    .import-layout {
        grid-template-columns: 1fr;
    }

    .import-guide {
        grid-template-columns: minmax(0, 1.3fr) minmax(220px, .7fr);
        align-items: stretch;
    }
}

@media (max-width: 640px) {
    .metric-grid,
    .grid-2,
    .permission-grid,
    .permission-grid-compact,
    .form-grid,
    .permission-summary {
        grid-template-columns: 1fr;
    }

    .page-title {
        gap: 12px;
        padding: 17px;
        border-radius: 14px;
    }

    .app-breadcrumb {
        margin: -3px -2px 11px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .app-breadcrumb::-webkit-scrollbar {
        display: none;
    }

    .app-breadcrumb ol {
        width: max-content;
        min-width: 100%;
    }

    .app-breadcrumb a,
    .app-breadcrumb li > span {
        min-height: 28px;
        padding: 4px 6px;
        font-size: 9px;
    }

    .app-breadcrumb li.current > span {
        max-width: 180px;
    }

    .page-title .toolbar,
    .action-bar {
        justify-content: flex-start;
    }

    .toolbar .btn,
    .action-bar .btn {
        white-space: normal;
        text-align: center;
    }

    .page-title .toolbar .btn {
        flex: 1 1 calc(50% - 6px);
    }

    .filter-panel-head {
        min-height: 58px;
        padding: 11px 14px;
    }

    .filter-toggle span {
        display: none;
    }

    .filter-panel .panel-body {
        padding: 15px 14px;
    }

    .import-guide {
        grid-template-columns: 1fr;
    }

    .import-dropzone {
        min-height: 225px;
        padding: 22px 15px;
    }

    .import-submit-row {
        align-items: stretch;
        flex-direction: column;
    }

    .import-submit-row .btn {
        width: 100%;
    }

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

    .import-errors-head {
        grid-template-columns: 36px minmax(0, 1fr);
    }

    .import-errors-head > .status-pill {
        grid-column: 2;
        justify-self: start;
    }

    .emission-status-grid {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .emission-status-card {
        min-height: 72px;
        padding: 12px;
    }

    .document-student-field {
        grid-template-columns: 1fr;
    }

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

    .student-picker-dialog {
        width: calc(100vw - 18px);
        max-height: calc(100dvh - 18px);
        border-radius: 14px;
    }

    .student-picker-shell {
        max-height: calc(100dvh - 18px);
    }

    .student-picker-head {
        padding: 13px;
    }

    .student-picker-head small,
    .student-picker-shell > footer > span,
    .student-picker-search > span {
        display: none;
    }

    .student-picker-search {
        grid-template-columns: 18px minmax(0, 1fr);
        margin: 10px 12px;
    }

    .student-picker-results table,
    .student-picker-results tbody,
    .student-picker-results tr,
    .student-picker-results td {
        display: block;
        width: 100%;
    }

    .student-picker-results thead { display: none; }
    .student-picker-results tbody { padding: 8px 12px; }
    .student-picker-results tr { margin-bottom: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; }
    .student-picker-results td { padding: 3px 0; border: 0; }
    .student-picker-results td:nth-child(n+3) { display: inline; margin-right: 8px; color: var(--muted); font-size: 8px; }

    .action-bar .btn {
        flex: 1 1 auto;
    }

    .table {
        min-width: 640px;
    }

    .panel-body {
        padding: 14px;
    }

    .dashboard-hero {
        display: block;
        padding: 25px 22px;
        border-radius: 16px;
    }

    .dashboard-hero h1 {
        font-size: 1.8rem;
    }

    .dashboard-hero-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 22px;
    }

    .dashboard-hero-actions .btn {
        padding-inline: 9px;
        font-size: 11px;
    }

    .dashboard-metrics,
    .dashboard-side-stack {
        grid-template-columns: 1fr;
    }

    .dashboard-metric {
        padding: 16px;
    }

    .dashboard-main-grid,
    .dashboard-lower-grid,
    .dashboard-side-stack {
        gap: 14px;
        margin-bottom: 14px;
    }

    .dashboard-chart-large {
        height: 290px;
    }

    .quick-actions-card {
        grid-template-columns: 1fr;
    }

    .quick-actions-copy {
        text-align: center;
    }

    .recent-student {
        grid-template-columns: 36px minmax(0, 1fr) auto;
    }

    .recent-student .status-pill,
    .recent-arrow {
        display: none;
    }

    .dashboard-statistics-panel .table-responsive {
        padding: 0 12px 12px;
        overflow: visible;
    }

    .dashboard-statistics-panel .dashboard-table {
        min-width: 0;
    }

    .dashboard-statistics-panel .dashboard-table thead {
        display: none;
    }

    .dashboard-statistics-panel .dashboard-table tbody,
    .dashboard-statistics-panel .dashboard-table tr,
    .dashboard-statistics-panel .dashboard-table td {
        display: block;
        width: 100%;
    }

    .dashboard-statistics-panel .dashboard-table tr {
        margin-bottom: 11px;
        padding: 10px 12px;
        border: 1px solid var(--line);
        border-radius: 11px;
        background: #fff;
    }

    .dashboard-statistics-panel .dashboard-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        padding: 6px 0;
        border: 0;
        text-align: right !important;
    }

    .dashboard-statistics-panel .dashboard-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 9px;
        font-weight: 800;
        letter-spacing: .05em;
        text-transform: uppercase;
    }

    .table-responsive:has(> .responsive-card-table) {
        overflow: visible;
        padding: 0;
    }

    .responsive-card-table {
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    .responsive-card-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .responsive-card-table tbody {
        display: grid;
        gap: 12px;
        padding: 12px;
    }

    .responsive-card-table tbody tr {
        display: flex;
        flex-direction: column;
        padding: 5px 14px 13px;
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 5px 16px rgba(19, 49, 62, .055);
    }

    .responsive-card-table tbody tr:hover > * {
        background: transparent;
    }

    .responsive-card-table tbody td {
        width: 100%;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 18px;
        order: 4;
        padding: 8px 0;
        border: 0;
        border-bottom: 1px dashed #e8edef;
        text-align: right !important;
        overflow-wrap: anywhere;
    }

    .responsive-card-table tbody td::before {
        content: attr(data-label);
        flex: 0 0 34%;
        color: #718187;
        font-size: 9px;
        font-weight: 800;
        letter-spacing: .055em;
        text-align: left;
        text-transform: uppercase;
    }

    .responsive-card-table tbody td.card-primary {
        order: 1;
        display: block;
        margin: 0 -14px 4px;
        padding: 14px;
        border-bottom: 1px solid var(--line);
        color: var(--ink);
        background: linear-gradient(90deg, #f6faf9, #fbfcfc);
        text-align: left !important;
    }

    .responsive-card-table tbody td.card-primary::before {
        display: block;
        margin-bottom: 4px;
        color: var(--primary);
    }

    .responsive-card-table tbody td.card-primary > strong,
    .responsive-card-table tbody td.card-primary strong {
        font-size: 13px;
    }

    .responsive-card-table tbody td.card-status {
        order: 2;
        align-items: center;
    }

    .responsive-card-table tbody td.card-actions {
        order: 3;
        display: block;
        padding: 10px 0 7px;
        border-bottom: 1px solid var(--line);
        text-align: left !important;
    }

    .responsive-card-table tbody td.card-actions::before {
        display: block;
        margin-bottom: 8px;
    }

    .responsive-card-table .card-actions .action-bar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
        gap: 7px;
        justify-content: stretch;
    }

    .responsive-card-table .card-actions .action-bar .btn,
    .responsive-card-table .card-actions .action-bar form,
    .responsive-card-table .card-actions .action-bar form .btn {
        width: 100%;
    }

    .responsive-card-table tbody td:last-child {
        border-bottom: 0;
    }

    .responsive-card-table .responsive-empty-row {
        min-height: 180px;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-shadow: none;
    }

    .responsive-card-table .responsive-empty-row .empty-state {
        display: block;
        padding: 25px 12px;
        border: 0;
        text-align: center !important;
    }

    .responsive-card-table .responsive-empty-row .empty-state::before {
        display: none;
    }

    .panel > .pagination-wrap {
        margin: 0 12px 12px;
        padding: 13px 0 0;
        text-align: center;
    }

    .pagination-wrap > * {
        width: 100%;
    }

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

    .settings-row,
    .permission-editor-head,
    .permission-override {
        align-items: stretch;
        flex-direction: column;
    }

    .permission-choice {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .permission-choice label {
        padding-inline: 4px;
    }

    .document-paper {
        min-height: 0;
        padding: 30px 22px;
    }

    .rich-editor-toolbar {
        align-items: stretch;
    }

    .rich-editor-toolbar select {
        flex: 1 1 130px;
        max-width: none;
    }

    .modular-certificate-head-grid {
        gap: 8px;
        min-height: 84px;
    }

    .document-template-head-grid {
        gap: 8px;
        min-height: 84px;
    }

    .certificate-header-slot img {
        max-height: 64px;
        max-width: 100%;
    }

    .modular-certificate-head p {
        font-size: 12px;
        overflow-wrap: anywhere;
    }

    .modular-certificate-head h1 {
        margin-top: 12px;
        font-size: 18px;
    }

    .modular-certificate-head span {
        font-size: 10px;
    }

    .document-template-head h1 {
        font-size: 18px;
    }

    .document-template-head p,
    .document-template-head span,
    .document-header-center-text,
    .document-header-right-text {
        font-size: 10px;
    }

    .modular-annex-footer {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 430px) {
    .auth-shell {
        min-height: 100svh;
    }

    .login-panel {
        min-height: 100svh;
        padding: 24px 20px;
        align-items: flex-start;
    }

    .auth-brand-mobile {
        margin-bottom: 38px;
    }

    .login-heading {
        margin-bottom: 25px;
    }

    .login-heading h2 {
        font-size: 2rem;
    }

    .auth-input-wrap {
        height: 52px;
    }

    .auth-help {
        margin-top: 30px;
    }

    .auth-footer {
        margin-top: 34px;
    }

    .metric strong {
        font-size: 1.65rem;
    }

    .topbar {
        gap: 8px;
    }

    .topbar-user {
        max-width: calc(100vw - 134px);
    }

    .btn-label {
        display: none;
    }

    .theme-toggle {
        width: 34px;
        padding-inline: 0;
    }

    .theme-toggle-label {
        display: none;
    }

    .context-switcher {
        gap: 8px;
    }

    .context-field {
        flex-basis: 130px;
    }

    .context-field .form-select {
        font-size: 12px;
    }

    .context-field .form-label {
        display: none;
    }

    .modular-certificate-head-grid {
        gap: 5px;
    }

    .document-template-head-grid {
        gap: 5px;
    }

    .modular-certificate-head h1 {
        font-size: 15px;
    }

    .modular-certificate-head p,
    .modular-certificate-head span {
        font-size: 9px;
    }

    .document-template-head h1 {
        font-size: 15px;
    }

    .document-template-head p,
    .document-template-head span,
    .document-header-center-text,
    .document-header-right-text {
        font-size: 9px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }

    .system-alert,
    .system-alert-progress,
    .system-alert.is-leaving {
        animation-duration: .01ms !important;
    }
}
