:root {
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 88px;
    --topbar-height: 76px;
    --app-bg: #eef1f6;
    --app-surface: #fbfcfe;
    --app-surface-strong: #ffffff;
    --app-surface-muted: #f4f6fa;
    --app-border: #dce2eb;
    --app-border-strong: #cbd4e1;
    --app-text: #172033;
    --app-text-muted: #68738a;
    --app-primary: #3659c9;
    --app-primary-hover: #2948ae;
    --app-primary-soft: #e8edff;
    --app-accent: #d38b28;
    --app-accent-soft: #fff1d9;
    --app-danger: #c84c5a;
    --app-success: #268768;
    --app-info: #267aa0;
    --app-sidebar: #17233a;
    --app-sidebar-raised: #202e49;
    --app-sidebar-text: #d6deeb;
    --app-sidebar-muted: #8f9db3;
    --app-shadow-sm: 0 1px 2px rgba(19, 30, 52, .05), 0 4px 12px rgba(19, 30, 52, .04);
    --app-shadow-md: 0 14px 36px rgba(19, 30, 52, .12);
    --app-radius-sm: 10px;
    --app-radius: 16px;
    --app-radius-lg: 22px;
    --bs-primary: #3659c9;
    --bs-primary-rgb: 54, 89, 201;
    --bs-link-color: #3659c9;
    --bs-link-hover-color: #2948ae;
}

[data-theme="dark"] {
    --app-bg: #0e1420;
    --app-surface: #151e2d;
    --app-surface-strong: #192435;
    --app-surface-muted: #111a28;
    --app-border: #2a374b;
    --app-border-strong: #3a4960;
    --app-text: #edf1f7;
    --app-text-muted: #9eabc0;
    --app-primary: #7895ff;
    --app-primary-hover: #94aaff;
    --app-primary-soft: #23325a;
    --app-accent: #e5a94e;
    --app-accent-soft: #49371f;
    --app-danger: #f07b87;
    --app-success: #58b998;
    --app-info: #6fb6d6;
    --app-sidebar: #0a101b;
    --app-sidebar-raised: #151f31;
    --app-sidebar-text: #e1e7f1;
    --app-sidebar-muted: #8290a7;
    --app-shadow-sm: 0 1px 2px rgba(0, 0, 0, .18), 0 5px 16px rgba(0, 0, 0, .15);
    --app-shadow-md: 0 18px 44px rgba(0, 0, 0, .3);
    --bs-primary: #7895ff;
    --bs-primary-rgb: 120, 149, 255;
    --bs-link-color: #94aaff;
    --bs-link-hover-color: #b0c0ff;
}

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

body {
    color: var(--app-text);
    background: var(--app-bg);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: .94rem;
}

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

a {
    text-decoration: none;
}

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

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1045;
    display: flex;
    width: var(--sidebar-width);
    min-height: 100vh;
    flex-direction: column;
    overflow: hidden;
    color: var(--app-sidebar-text);
    background: var(--app-sidebar);
    border-right: 1px solid rgba(255, 255, 255, .06);
    transition: width .22s ease, transform .22s ease;
}

.sidebar-header {
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.sidebar-brand:hover {
    color: #fff;
}

.brand-mark {
    display: grid;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    place-items: center;
    overflow: hidden;
    background: #10192a;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 14px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

.brand-mark img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .24));
}

.brand-copy,
.user-copy,
.academic-copy,
.nav-link-text {
    min-width: 0;
    overflow: hidden;
    transition: opacity .15s ease, width .2s ease;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-copy strong {
    font-size: 1.12rem;
    letter-spacing: .06em;
}

.brand-copy small {
    margin-top: 5px;
    color: var(--app-sidebar-muted);
    font-size: .73rem;
    letter-spacing: .03em;
}

.sidebar-close {
    display: none;
    width: 38px;
    height: 38px;
    color: var(--app-sidebar-text);
    background: transparent;
    border: 0;
    border-radius: 10px;
}

.sidebar-user {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
    margin: 18px 14px 8px;
    padding: 11px;
    color: var(--app-sidebar-text);
    text-align: left;
    background: var(--app-sidebar-raised);
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
}

.sidebar-user:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, .14);
}

.user-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.user-avatar img,
.topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.user-status {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    background: #46ba8d;
    border: 2px solid var(--app-sidebar-raised);
    border-radius: 50%;
}

.user-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
    white-space: nowrap;
}

.user-copy strong {
    overflow: hidden;
    font-size: .88rem;
    text-overflow: ellipsis;
}

.user-copy small {
    margin-top: 3px;
    overflow: hidden;
    color: var(--app-sidebar-muted);
    font-size: .72rem;
    text-overflow: ellipsis;
}

.user-chevron {
    color: var(--app-sidebar-muted);
    font-size: .72rem;
}

.sidebar-nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px 14px 18px;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
    scrollbar-width: thin;
}

.nav-section-label {
    margin: 16px 10px 4px;
    color: var(--app-sidebar-muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-nav-link {
    position: relative;
    display: flex;
    min-height: 46px;
    align-items: center;
    gap: 12px;
    padding: 7px 11px;
    color: var(--app-sidebar-text);
    border-radius: 11px;
    white-space: nowrap;
}

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

.app-nav-link.active {
    color: #fff;
    background: #3659c9;
    box-shadow: inset 3px 0 0 var(--app-accent);
}

.nav-link-icon {
    display: grid;
    width: 26px;
    height: 30px;
    flex: 0 0 26px;
    place-items: center;
    font-size: .98rem;
}

.nav-link-text {
    font-size: .86rem;
    font-weight: 600;
    text-overflow: ellipsis;
}

.sidebar-footer {
    display: grid;
    gap: 8px;
    padding: 12px 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.academic-summary {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 12px;
    padding: 8px 11px;
    color: var(--app-sidebar-text);
    background: rgba(255, 255, 255, .04);
    border-radius: 11px;
}

.academic-summary > span:first-child {
    display: grid;
    width: 26px;
    flex: 0 0 26px;
    place-items: center;
    color: var(--app-accent);
}

.academic-copy {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
}

.academic-copy small {
    color: var(--app-sidebar-muted);
    font-size: .68rem;
}

.academic-copy strong {
    margin-top: 2px;
    overflow: hidden;
    font-size: .8rem;
    text-overflow: ellipsis;
}

.nav-link-logout {
    color: #ffc4c9;
}

.app-workspace {
    grid-column: 2;
    display: grid;
    min-width: 0;
    min-height: 100vh;
    grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
    transition: margin .22s ease;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    min-width: 0;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--app-surface-strong) 94%, transparent);
    border-bottom: 1px solid var(--app-border);
    backdrop-filter: blur(14px);
}

.topbar-leading,
.topbar-actions,
.app-page-context {
    display: flex;
    min-width: 0;
    align-items: center;
}

.topbar-leading {
    gap: 14px;
}

.topbar-actions {
    gap: 9px;
}

.topbar-icon-button,
.topbar-avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    place-items: center;
    color: var(--app-text-muted);
    background: var(--app-surface-muted);
    border: 1px solid var(--app-border);
    border-radius: 12px;
}

.topbar-icon-button:hover,
.topbar-avatar:hover {
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-color: color-mix(in srgb, var(--app-primary) 30%, var(--app-border));
}

.topbar-avatar {
    padding: 3px;
}

.topbar-avatar img {
    border-radius: 9px;
}

.app-page-context {
    gap: 11px;
}

.app-page-icon {
    display: grid;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    place-items: center;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: 12px;
}

.page-context-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.page-context-copy small {
    color: var(--app-text-muted);
    font-size: .7rem;
    line-height: 1.1;
}

.page-context-copy strong {
    margin-top: 4px;
    overflow: hidden;
    font-size: 1.05rem;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-academic {
    min-height: 40px;
    align-items: center;
    gap: 9px;
    padding: 0 13px;
    color: var(--app-text-muted);
    background: var(--app-surface-muted);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    font-size: .78rem;
    font-weight: 600;
}

.topbar-academic i {
    color: var(--app-accent);
}

.notification-button {
    position: relative;
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -5px;
    display: grid;
    min-width: 19px;
    height: 19px;
    place-items: center;
    padding: 0 5px;
    color: #fff;
    background: var(--app-danger);
    border: 2px solid var(--app-surface-strong);
    border-radius: 10px;
    font-size: .62rem;
    font-weight: 700;
}

.app-notification-menu {
    width: min(390px, calc(100vw - 24px));
    margin-top: 10px !important;
    overflow: hidden;
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-md);
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--app-border);
}

.notification-header > span:first-child {
    display: flex;
    flex-direction: column;
}

.notification-header small {
    color: var(--app-text-muted);
    font-size: .67rem;
}

.notification-header strong {
    margin-top: 2px;
    color: var(--app-text);
}

.notification-total {
    padding: 4px 8px;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: 8px;
    font-size: .7rem;
    font-weight: 700;
}

.app-notification-list {
    max-height: 340px;
    overflow-y: auto;
}

.notification-footer {
    width: 100%;
    padding: 12px 18px;
    color: var(--app-primary);
    text-align: center;
    background: var(--app-surface-muted);
    border: 0;
    border-top: 1px solid var(--app-border);
    font-size: .8rem;
    font-weight: 700;
}

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

.app-container {
    width: min(100%, 1740px);
    min-width: 0;
    margin: 0 auto;
}

.app-module-host,
.app-module-view,
.module-body {
    min-width: 0;
}

.app-module-view {
    animation: module-in .18s ease both;
}

@keyframes module-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-module-view > .module-body > .card-body,
.app-module-view > .module-body > .card,
.app-module-view > .module-body > .row {
    margin-top: 0;
}

.app-module-view > .module-body > .card-body {
    padding: 0;
    background: transparent;
}

.app-footer {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    color: var(--app-text-muted);
    background: var(--app-surface-muted);
    border-top: 1px solid var(--app-border);
    font-size: .76rem;
}

.app-footer > span:first-child {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.app-footer strong {
    color: var(--app-text);
}

.app-loading-state,
.app-error-state {
    display: grid;
    min-height: 360px;
    place-items: center;
    align-content: center;
    gap: 10px;
    padding: 38px;
    color: var(--app-text-muted);
    text-align: center;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-sm);
}

.app-loading-state strong,
.app-error-state h2 {
    margin: 0;
    color: var(--app-text);
}

.app-loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid var(--app-primary-soft);
    border-top-color: var(--app-primary);
    border-radius: 50%;
    animation: app-spin .8s linear infinite;
}

@keyframes app-spin { to { transform: rotate(360deg); } }

.app-error-icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    color: var(--app-danger);
    background: color-mix(in srgb, var(--app-danger) 12%, var(--app-surface));
    border-radius: 16px;
    font-size: 1.35rem;
}

/* Componentes del sistema */
.card {
    color: var(--app-text);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.card-header,
.card-footer {
    background: var(--app-surface-muted);
    border-color: var(--app-border);
}

.card-header {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 17px;
    border-radius: var(--app-radius) var(--app-radius) 0 0 !important;
}

.card-title {
    float: none;
    margin: 0;
    color: var(--app-text);
    font-size: .92rem;
    font-weight: 700;
}

.card-body {
    padding: 18px;
}

.card-footer {
    padding: 12px 17px;
    border-radius: 0 0 var(--app-radius) var(--app-radius) !important;
}

.card-outline {
    border-top: 3px solid var(--app-primary);
}

.card-primary { border-top-color: var(--app-primary); }
.card-warning { border-top-color: var(--app-accent); }
.card-danger { border-top-color: var(--app-danger); }
.card-success { border-top-color: var(--app-success); }
.card-info { border-top-color: var(--app-info); }
.card-indigo { border-top-color: #6958c9; }
.card-purple { border-top-color: #8a55b7; }

.card-tools {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-tool {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    color: var(--app-text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
}

.btn-tool:hover {
    color: var(--app-primary);
    background: var(--app-primary-soft);
}

.info-box {
    display: flex;
    min-height: 112px;
    overflow: hidden;
    color: var(--app-text);
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.info-box-icon {
    display: grid;
    width: 82px;
    flex: 0 0 82px;
    place-items: center;
    color: #fff;
    background: var(--app-primary) !important;
    font-size: 1.4rem;
}

.info-box:nth-child(2n) .info-box-icon {
    background: var(--app-accent) !important;
}

.info-box-content {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    padding: 14px 16px;
}

.info-box-text {
    overflow: hidden;
    color: var(--app-text-muted) !important;
    font-size: .75rem;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.info-box-number {
    margin-top: 4px;
    color: var(--app-text);
    font-size: 1.28rem;
    font-weight: 800;
}

.progress-description {
    margin-top: 5px;
    color: var(--app-text-muted) !important;
    font-size: .72rem;
}

.small-box {
    position: relative;
    min-height: 126px;
    overflow: hidden;
    color: #fff;
    background: var(--app-primary);
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow-sm);
}

.small-box > .inner { padding: 18px; }
.small-box h3 { margin: 0 0 5px; font-size: 1.65rem; font-weight: 800; }
.small-box p { margin: 0; opacity: .84; }
.small-box .icon { position: absolute; right: 16px; bottom: 7px; font-size: 3.5rem; opacity: .16; }
.small-box-footer { display: block; padding: 8px 15px; color: #fff; background: rgba(0, 0, 0, .12); }

.btn {
    --bs-btn-border-radius: 10px;
    --bs-btn-padding-x: .9rem;
    --bs-btn-padding-y: .52rem;
    font-size: .82rem;
    font-weight: 650;
    box-shadow: none !important;
}

.btn-primary {
    --bs-btn-bg: var(--app-primary);
    --bs-btn-border-color: var(--app-primary);
    --bs-btn-hover-bg: var(--app-primary-hover);
    --bs-btn-hover-border-color: var(--app-primary-hover);
    --bs-btn-active-bg: var(--app-primary-hover);
    --bs-btn-active-border-color: var(--app-primary-hover);
}

.btn-light,
.btn-outline-secondary {
    --bs-btn-color: var(--app-text);
    --bs-btn-bg: var(--app-surface-muted);
    --bs-btn-border-color: var(--app-border-strong);
    --bs-btn-hover-color: var(--app-text);
    --bs-btn-hover-bg: var(--app-primary-soft);
    --bs-btn-hover-border-color: var(--app-primary);
}

.btn-app {
    display: inline-flex;
    min-width: 110px;
    min-height: 72px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 4px;
    padding: 10px 14px;
    color: #fff;
    border: 0;
    border-radius: 13px;
}

.btn-app i { font-size: 1.1rem; }

.badge,
.text-bg-primary,
.badge-primary,
.badge-danger,
.badge-success,
.badge-warning,
.badge-info {
    padding: .38em .62em;
    border-radius: 7px;
    font-weight: 700;
}

.badge-danger { color: #fff; background: var(--app-danger); }
.badge-success { color: #fff; background: var(--app-success); }
.badge-warning { color: #37230b; background: #efb453; }
.badge-info { color: #fff; background: var(--app-info); }

.form-control,
.form-select {
    min-height: 43px;
    color: var(--app-text);
    background-color: var(--app-surface-strong);
    border-color: var(--app-border-strong);
    border-radius: 10px;
}

.form-control:focus,
.form-select:focus {
    color: var(--app-text);
    background-color: var(--app-surface-strong);
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--app-primary) 16%, transparent);
}

.form-control:disabled,
.form-control[readonly],
.solo-lectura {
    color: var(--app-text) !important;
    background: var(--app-surface-muted) !important;
}

.form-group {
    margin-bottom: 1rem;
}

.label-over-border {
    position: relative;
    margin-top: 1.55rem;
}

.label-over-border label {
    position: absolute;
    z-index: 4;
    top: -10px;
    left: 12px;
    max-width: calc(100% - 24px);
    padding: 1px 7px;
    overflow: hidden;
    color: var(--app-text-muted);
    background: var(--app-surface-strong);
    border-radius: 6px;
    font-size: .74rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card .label-over-border label,
.modal .label-over-border label,
.login-card .label-over-border label {
    background: var(--app-surface-strong);
}

.label-over-border:focus-within label {
    color: var(--app-primary);
}

.input-group > .form-control,
.input-group > .form-select {
    min-width: 0;
}

.input-group-append {
    display: flex;
    margin-left: -1px;
}

.input-group-append .btn {
    border-radius: 0 10px 10px 0;
}

.parsley-errors-list {
    margin: 5px 0 0;
    padding: 0;
    color: var(--app-danger);
    font-size: .72rem;
    list-style: none;
}

.ts-wrapper { width: 100% !important; }
.ts-control {
    min-height: 43px;
    color: var(--app-text);
    background-color: var(--app-surface-strong);
    border-color: var(--app-border-strong);
    border-radius: 10px;
}
.ts-wrapper.focus .ts-control,
.ts-wrapper.dropdown-active .ts-control {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--app-primary) 16%, transparent);
}
.ts-dropdown {
    color: var(--app-text);
    background: var(--app-surface-strong);
    border-color: var(--app-border-strong);
    border-radius: 10px;
    box-shadow: var(--app-shadow-md);
}
.ts-dropdown .selected:not(.active) {
    background: var(--app-primary-soft);
}
.ts-dropdown .active {
    color: #fff;
    background: var(--app-primary);
}

.tabs-modern {
    position: sticky;
    top: calc(var(--topbar-height) + 10px);
    z-index: 1015;
    display: flex;
    width: 100%;
    gap: 6px;
    margin: 0 0 20px !important;
    padding: 7px;
    overflow-x: auto;
    background: var(--app-surface);
    border: 1px solid var(--app-border) !important;
    border-radius: 14px;
    box-shadow: var(--app-shadow-sm);
    scrollbar-width: thin;
}

.tabs-modern .nav-item {
    flex: 0 0 auto;
}

.tabs-modern .nav-link {
    min-height: 40px;
    padding: 9px 14px;
    color: var(--app-text-muted) !important;
    background: transparent;
    border: 0 !important;
    border-radius: 9px !important;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap;
}

.tabs-modern .nav-link:hover {
    color: var(--app-text) !important;
    background: var(--app-surface-muted);
}

.tabs-modern .nav-link.active {
    color: #fff !important;
    background: var(--app-primary) !important;
}

.tabs-modern .nav-link.active::after {
    display: none !important;
}

.tab-content {
    min-width: 0;
}

.table-responsive {
    overflow: auto;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 14px;
}

.table {
    --bs-table-color: var(--app-text);
    --bs-table-bg: var(--app-surface);
    --bs-table-border-color: var(--app-border);
    --bs-table-striped-bg: var(--app-surface-muted);
    --bs-table-striped-color: var(--app-text);
    --bs-table-hover-bg: var(--app-primary-soft);
    --bs-table-hover-color: var(--app-text);
    margin-bottom: 0;
    font-size: .8rem;
}

.table > :not(caption) > * > * {
    padding: .78rem .8rem;
    vertical-align: middle;
    border-bottom-width: 1px;
}

.table thead th,
.thead-light th {
    color: var(--app-text-muted) !important;
    background: var(--app-surface-muted) !important;
    border-bottom: 1px solid var(--app-border-strong) !important;
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-bordered {
    border: 0;
}

div.dt-container {
    color: var(--app-text-muted);
}

div.dt-container .dt-layout-row {
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
}

div.dt-container .dt-layout-row:last-child {
    margin: 12px 0 0;
}

div.dt-container .dt-search,
div.dt-container .dt-length {
    display: flex;
    align-items: center;
    gap: 7px;
}

div.dt-container .dt-search input,
div.dt-container .dt-length select,
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    min-height: 38px;
    color: var(--app-text);
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border-strong);
    border-radius: 9px;
}

div.dt-container .dt-paging .dt-paging-button,
.dataTables_wrapper .page-link {
    min-width: 36px;
    min-height: 36px;
    margin: 0 2px;
    color: var(--app-text-muted) !important;
    background: var(--app-surface) !important;
    border: 1px solid var(--app-border) !important;
    border-radius: 9px !important;
}

div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover,
.page-item.active .page-link {
    color: #fff !important;
    background: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
}

.dt-buttons,
.dataTables_wrapper .dt-buttons {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dt-buttons .btn {
    margin: 0 !important;
}

.modal {
    z-index: 1060;
}

.modal-backdrop {
    z-index: 1055;
    background: #0a1020;
}

.modal-backdrop.show {
    opacity: .58;
}

.modal-dialog {
    margin-top: max(1.75rem, env(safe-area-inset-top));
    margin-bottom: 1.75rem;
}

.modal-content {
    color: var(--app-text);
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border);
    border-radius: 18px;
    box-shadow: var(--app-shadow-md);
}

.modal-header,
.modal-footer {
    padding: 15px 18px;
    background: var(--app-surface-muted);
    border-color: var(--app-border);
}

.modal-header {
    align-items: center;
    border-radius: 18px 18px 0 0;
}

.modal-footer {
    border-radius: 0 0 18px 18px;
}

.modal-body {
    padding: 20px;
}

.modal-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 11px;
}

.modal-heading > span:last-child {
    min-width: 0;
}

.modal-heading small {
    display: block;
    color: var(--app-text-muted);
    font-size: .65rem;
}

.modal-title {
    margin: 2px 0 0;
    color: var(--app-text);
    font-size: .98rem;
    font-weight: 750;
}

.modal-heading-icon {
    display: grid;
    width: 39px;
    height: 39px;
    flex: 0 0 39px;
    place-items: center;
    color: var(--app-primary);
    background: var(--app-primary-soft);
    border-radius: 11px;
}

.modal-heading-icon-warning {
    color: var(--app-accent);
    background: var(--app-accent-soft);
}

.btn-close {
    filter: none;
}

[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

.close {
    display: grid;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    place-items: center;
    padding: 0;
    color: var(--app-text-muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 1.35rem;
    line-height: 1;
}

.close:hover {
    color: var(--app-danger);
    background: color-mix(in srgb, var(--app-danger) 10%, transparent);
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 24px;
    padding: 13px;
    background: var(--app-primary-soft);
    border: 1px solid color-mix(in srgb, var(--app-primary) 16%, var(--app-border));
    border-radius: 13px;
}

.profile-summary img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 13px;
}

.profile-summary > span {
    display: flex;
    flex-direction: column;
}

.profile-summary small {
    margin-top: 4px;
    color: var(--app-text-muted);
}

.fab-container,
.btn-flotante {
    right: 24px !important;
    bottom: 24px !important;
}

.fab-main,
.fab-btn,
.btn-flotante {
    display: inline-grid !important;
    aspect-ratio: 1;
    place-items: center;
    padding: 0 !important;
    border-radius: 50% !important;
}

.fab-main,
.btn-flotante {
    width: 56px !important;
    height: 56px !important;
    background: var(--app-primary) !important;
    border: 4px solid var(--app-surface-strong) !important;
    box-shadow: 0 10px 26px rgba(30, 52, 110, .26) !important;
}

.fab-btn {
    width: 46px !important;
    height: 46px !important;
}

.fab-label {
    color: #fff;
    background: #202b3d;
    border-color: #303d52;
    border-radius: 9px;
}

.alertify .ajs-dialog,
.alertify-notifier .ajs-message {
    color: var(--app-text);
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border);
    border-radius: 12px;
    box-shadow: var(--app-shadow-md);
}

.alertify-notifier {
    z-index: 1100;
}

.text-dark { color: var(--app-text) !important; }
.text-muted { color: var(--app-text-muted) !important; }
.bg-light { background-color: var(--app-surface-muted) !important; }
.border { border-color: var(--app-border) !important; }
.shadow-sm,
.elevation-1,
.elevation-2 { box-shadow: var(--app-shadow-sm) !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-normal { font-weight: 400 !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.float-right { float: right !important; }
.float-left { float: left !important; }
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }
.mr-1 { margin-right: .25rem !important; }
.mr-2 { margin-right: .5rem !important; }
.mr-3 { margin-right: 1rem !important; }
.ml-1 { margin-left: .25rem !important; }
.ml-2 { margin-left: .5rem !important; }
.ml-3 { margin-left: 1rem !important; }
.pl-3 { padding-left: 1rem !important; }
.pr-3 { padding-right: 1rem !important; }
.btn-block { display: block; width: 100%; }
.dropdown-menu-right { right: 0; left: auto; }
.modal-md { max-width: 560px; }

.app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: none;
    background: rgba(8, 13, 24, .62);
    border: 0;
}

body.sidebar-collapsed .app-shell {
    grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .user-copy,
body.sidebar-collapsed .academic-copy,
body.sidebar-collapsed .nav-link-text,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .user-chevron {
    width: 0;
    opacity: 0;
    pointer-events: none;
}

body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding-inline: 14px;
}

body.sidebar-collapsed .sidebar-brand {
    gap: 0;
}

body.sidebar-collapsed .sidebar-user {
    justify-content: center;
    margin-inline: 12px;
    padding-inline: 8px;
}

body.sidebar-collapsed .sidebar-nav,
body.sidebar-collapsed .sidebar-footer {
    padding-inline: 12px;
}

body.sidebar-collapsed .app-nav-link,
body.sidebar-collapsed .academic-summary {
    justify-content: center;
    gap: 0;
    padding-inline: 8px;
}

body.sidebar-collapsed .app-nav-link.active {
    box-shadow: inset 0 -3px 0 var(--app-accent);
}

body.sidebar-collapsed .app-workspace {
    grid-column: 2;
}

@media (max-width: 991.98px) {
    :root { --topbar-height: 68px; }

    .app-shell {
        display: block;
    }

    .app-sidebar,
    body.sidebar-collapsed .app-sidebar {
        width: min(286px, calc(100vw - 38px));
        transform: translateX(-105%);
        box-shadow: var(--app-shadow-md);
    }

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

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

    .sidebar-close {
        display: grid;
        place-items: center;
    }

    body.sidebar-collapsed .brand-copy,
    body.sidebar-collapsed .user-copy,
    body.sidebar-collapsed .academic-copy,
    body.sidebar-collapsed .nav-link-text,
    body.sidebar-collapsed .nav-section-label,
    body.sidebar-collapsed .user-chevron {
        width: auto;
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-collapsed .sidebar-header,
    body.sidebar-collapsed .sidebar-user,
    body.sidebar-collapsed .app-nav-link,
    body.sidebar-collapsed .academic-summary {
        justify-content: initial;
        gap: 12px;
    }

    .app-workspace,
    body.sidebar-collapsed .app-workspace {
        display: grid;
        min-height: 100vh;
        grid-template-rows: var(--topbar-height) minmax(0, 1fr) auto;
    }

    .app-topbar {
        padding: 0 15px;
    }

    .app-main {
        padding: 18px 15px;
    }

    .tabs-modern {
        top: calc(var(--topbar-height) + 7px);
    }
}

@media (max-width: 575.98px) {
    .app-page-icon,
    .topbar-academic {
        display: none !important;
    }

    .topbar-leading {
        gap: 9px;
    }

    .page-context-copy small {
        display: none;
    }

    .page-context-copy strong {
        margin-top: 0;
        max-width: 120px;
        font-size: .9rem;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar-icon-button,
    .topbar-avatar {
        width: 39px;
        height: 39px;
        flex-basis: 39px;
    }

    .app-main {
        padding: 14px 10px 20px;
    }

    .tabs-modern {
        top: calc(var(--topbar-height) + 5px);
        gap: 4px;
        padding: 5px;
        border-radius: 12px;
    }

    .tabs-modern .nav-link {
        min-height: 38px;
        padding: 8px 11px;
    }

    .app-footer {
        min-height: 54px;
        justify-content: center;
        padding-inline: 12px;
        text-align: center;
    }

    .app-footer small {
        display: none;
    }

    .card-body,
    .modal-body {
        padding: 15px;
    }

    .modal-dialog {
        margin: 10px;
    }

    .fab-container,
    .btn-flotante {
        right: 15px !important;
        bottom: 15px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Acceso */
.app-login-page {
    min-height: 100vh;
    color: var(--app-text);
    background: var(--app-bg);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(350px, .9fr) minmax(470px, 1.1fr);
}

.login-brand-panel {
    position: relative;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    padding: clamp(42px, 7vw, 92px);
    color: #fff;
    background: #17233a;
}

.login-brand-panel::before {
    position: absolute;
    content: "";
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 28px;
}

.login-brand-panel::before {
    top: 11%;
    right: -80px;
    width: 260px;
    height: 260px;
}

.login-brand-content {
    position: relative;
    z-index: 2;
    max-width: 620px;
}

.login-brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    color: #d6dfff;
    background: rgba(120, 149, 255, .1);
    border: 1px solid rgba(158, 180, 255, .24);
    border-radius: 10px;
    font-size: .73rem;
    font-weight: 700;
}

.login-brand-content h1 {
    margin: 25px 0 18px;
    font-size: clamp(2.25rem, 4.5vw, 4.6rem);
    font-weight: 760;
    letter-spacing: -.045em;
    line-height: 1.02;
}

.login-brand-content h1 span {
    color: #a9baff;
}

.login-brand-content > p {
    max-width: 560px;
    margin: 0;
    color: #aebbd0;
    font-size: 1rem;
    line-height: 1.7;
}

.login-brand-metrics {
    display: grid;
    margin-top: 38px;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.login-brand-metrics > span {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 9px;
    padding: 20px 14px 0 0;
}

.login-brand-metrics i {
    grid-row: span 2;
    margin-top: 3px;
    color: #a9baff;
}

.login-brand-metrics strong { font-size: .78rem; }
.login-brand-metrics small { color: #8f9db3; font-size: .67rem; }
.login-pattern { display: none; }

.login-trust-card {
    position: absolute;
    z-index: 2;
    top: clamp(28px, 5vw, 58px);
    right: clamp(24px, 5vw, 58px);
    display: flex;
    max-width: 260px;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: #eef3fb;
    background: #202e49;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 15px;
    box-shadow: 0 14px 32px rgba(5, 11, 22, .24);
}

.login-trust-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    color: #cbd6ff;
    background: rgba(120, 149, 255, .12);
    border: 1px solid rgba(158, 180, 255, .24);
    border-radius: 11px;
}

.login-trust-card > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.login-trust-card strong {
    font-size: .76rem;
    font-weight: 760;
}

.login-trust-card small {
    margin-top: 2px;
    color: #aebbd0;
    font-size: .67rem;
}

.login-form-panel {
    position: relative;
    display: grid;
    place-items: center;
    align-content: center;
    padding: clamp(30px, 6vw, 88px);
    background: var(--app-bg);
}

.login-theme-toggle {
    position: fixed;
    z-index: 10;
    top: 22px;
    right: 22px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    color: var(--app-text-muted);
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border);
    border-radius: 12px;
}

.login-card {
    width: min(100%, 500px);
    padding: clamp(24px, 4.5vw, 42px);
    background: var(--app-surface-strong);
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg);
    box-shadow: var(--app-shadow-md);
}

.login-card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.login-logo {
    display: grid;
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    place-items: center;
    background: #17233a;
    border: 1px solid #2c3b58;
    border-radius: 17px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .035), var(--app-shadow-sm);
}

.login-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .24));
}

.login-eyebrow {
    color: var(--app-primary);
    font-size: .67rem;
    font-weight: 800;
    letter-spacing: .1em;
}

.login-card-header h2 {
    margin: 4px 0 3px;
    color: var(--app-text);
    font-size: 1.35rem;
    font-weight: 760;
}

.login-card-header p {
    margin: 0;
    color: var(--app-text-muted);
    font-size: .76rem;
}

.login-submit {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    margin-top: 21px;
    padding-inline: 18px;
}

.login-alert { min-height: 20px; }

.login-card-footer {
    margin-top: 22px;
    padding-top: 18px;
    color: var(--app-text-muted);
    text-align: center;
    border-top: 1px solid var(--app-border);
    font-size: .7rem;
}

.login-copyright {
    margin: 18px 0 0;
    color: var(--app-text-muted);
    font-size: .7rem;
}

@media (max-width: 920px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { display: none; }
    .login-form-panel { min-height: 100vh; }
}

@media (min-width: 921px) and (max-width: 1180px) {
    .login-trust-card {
        right: 24px;
        padding: 10px 12px;
    }
}

@media (max-width: 520px) {
    .login-form-panel { padding: 70px 14px 26px; }
    .login-card { padding: 24px 18px; border-radius: 17px; }
    .login-card-header { align-items: flex-start; }
    .login-logo { width: 54px; height: 54px; flex-basis: 54px; }
    .login-logo img { width: 42px; height: 42px; }
}
