/* Shell UX — Identidad ITL / TecNM */
:root {
    /* Azul TecNM (Pantone 294 C aprox.) + oro del engrane ITL */
    --brand-950: #061428;
    --brand-900: #0c1f3d;
    --brand-800: #132a52;
    --brand-700: #1b396a;
    --brand-600: #234a86;
    --accent: #c4a35a;
    --accent-strong: #a8863f;
    --accent-soft: #e8d7a8;
    --surface: #f2f4f8;
    --ink: #1a1f2a;
    --muted: #5c6675;
    --line: #d5dbe6;
    --ok: #0f766e;
    --danger: #b91c1c;
    --shadow-soft: 0 1px 2px rgb(15 30 50 / 5%), 0 8px 24px rgb(15 30 50 / 7%);
    --radius: 0.875rem;
}

[x-cloak] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1100px 480px at 8% -8%, rgb(27 57 106 / 10%), transparent 55%),
        radial-gradient(900px 420px at 100% 0%, rgb(196 163 90 / 12%), transparent 50%),
        var(--surface);
}

.font-display {
    font-family: "Montserrat", "Source Sans 3", sans-serif;
}

/* Controles unificados en el área principal */
.app-main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]):not([type="button"]),
.app-main select,
.app-main textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: #fff;
    padding: 0.55rem 0.75rem;
    font-size: 0.925rem;
    line-height: 1.4;
    color: var(--ink);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.app-main input:hover:not(:disabled),
.app-main select:hover:not(:disabled),
.app-main textarea:hover:not(:disabled) {
    border-color: #b8c2d1;
}

.app-main input:focus,
.app-main select:focus,
.app-main textarea:focus {
    outline: none;
    border-color: var(--brand-700);
    box-shadow: 0 0 0 3px rgb(27 57 106 / 18%);
}

.app-main label {
    letter-spacing: 0.01em;
}

.app-main table {
    border-collapse: separate;
    border-spacing: 0;
}

.app-main thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.app-main tbody tr {
    transition: background-color .12s ease;
}

.panel {
    background: #fff;
    border: 1px solid rgb(213 219 230 / 90%);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 0.65rem;
    background: linear-gradient(180deg, #234a86, #1b396a);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    border: 0;
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
    box-shadow: 0 1px 0 rgb(255 255 255 / 12%) inset, 0 6px 14px rgb(27 57 106 / 28%);
}

.btn-primary:hover {
    filter: brightness(1.06);
}

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

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 0.65rem;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 500;
    transition: background .12s ease, border-color .12s ease;
}

.btn-ghost:hover {
    background: #f7f8fb;
    border-color: #c5cedb;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 0.65rem;
    background: #dc2626;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border: 0;
    transition: filter .12s ease;
}

.btn-danger:hover { filter: brightness(1.05); }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-ok { background: #ccfbf1; color: #0f766e; }
.badge-muted { background: #e8eef3; color: #475569; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0e7ff; color: #1b396a; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.75rem;
    border-radius: 0.7rem;
    color: rgb(226 232 240 / 82%);
    font-size: 0.9rem;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.nav-link:hover {
    background: rgb(255 255 255 / 6%);
    color: #fff;
}

.nav-link.is-active {
    background: linear-gradient(90deg, rgb(196 163 90 / 28%), rgb(196 163 90 / 6%));
    color: #fff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-section {
    margin-top: 1.1rem;
    padding: 0 0.75rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(148 163 184 / 85%);
    font-family: "Montserrat", sans-serif;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgb(213 219 230 / 90%);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.15rem 1.25rem;
    transition: transform .18s ease, box-shadow .18s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgb(15 30 50 / 10%);
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -20% -40% auto;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: radial-gradient(circle, rgb(196 163 90 / 22%), transparent 70%);
    pointer-events: none;
}

.toast-enter {
    animation: toast-in .28s ease-out;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.login-brand {
    position: relative;
    overflow: hidden;
    color: #fff;
    background:
        linear-gradient(155deg, #061428 0%, #1b396a 52%, #2a4f88 100%);
    padding: 2.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: -15% 35% auto -15%;
    height: 55%;
    background: radial-gradient(circle, rgb(196 163 90 / 28%), transparent 65%);
    pointer-events: none;
}

.login-brand::after {
    content: "";
    position: absolute;
    inset: auto -10% -25% 35%;
    height: 55%;
    background: radial-gradient(circle, rgb(255 255 255 / 10%), transparent 60%);
    pointer-events: none;
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark img {
    display: block;
    object-fit: contain;
}

/* Columna izquierda fija en escritorio; el menú hace scroll si no cabe */
.app-sidebar {
    max-height: 100vh;
}

@media (min-width: 1024px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
    }
}

/* Logos del login: siempre en una sola fila */
.login-logos {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 1rem;
    width: 100%;
}

.login-logos img {
    display: block !important;
    max-width: none; /* anula preflight de Tailwind que pone max-width:100% y apila */
    background: transparent !important;
    vertical-align: middle;
}

.login-logo-itl {
    width: 3.5rem !important;
    height: 3.5rem !important;
    max-width: 3.5rem !important;
    border-radius: 0;
    padding: 0;
    object-fit: contain;
    flex: 0 0 auto !important;
    box-shadow: none;
}

.login-logo-tecnm {
    height: 2.5rem !important;
    width: auto !important;
    max-width: 12.5rem !important;
    border-radius: 0;
    padding: 0;
    object-fit: contain;
    flex: 0 0 auto !important;
}

.login-logo-sep {
    height: 1.75rem;
    width: auto;
    max-width: 14rem;
    object-fit: contain;
    opacity: 0.95;
}

.login-logo-form {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0;
    border: 0;
    background: transparent;
    object-fit: contain;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }
    .login-brand {
        min-height: 260px;
        padding: 1.75rem;
    }
    .login-logo-itl {
        width: 3rem;
        height: 3rem;
    }
    .login-logo-tecnm {
        height: 2rem;
        max-width: 10rem;
    }
}

/* Créditos / Acerca del sistema */
.credits-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
    background: rgb(6 20 40 / 55%);
    backdrop-filter: blur(2px);
}

@media (min-width: 640px) {
    .credits-backdrop {
        align-items: center;
    }
}

.credits-dialog {
    width: 100%;
    max-width: 28rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid rgb(213 219 230 / 90%);
    box-shadow: 0 24px 48px rgb(15 30 50 / 18%);
    overflow: hidden;
}

.credits-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.15rem;
    background: linear-gradient(180deg, #f7f9fc, #eef2f8);
    border-bottom: 1px solid var(--line);
}

.credits-logos {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.credits-logo-tecnm {
    display: block;
    height: 2rem;
    width: auto;
    max-width: min(11rem, 52%);
    object-fit: contain;
    flex: 0 0 auto;
}

.credits-logo-sep {
    display: block;
    height: 1.25rem;
    width: auto;
    max-width: min(9rem, 42%);
    object-fit: contain;
    flex: 0 0 auto;
    opacity: 0.85;
}

.credits-close {
    padding: 0.35rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
}

.credits-close:hover {
    color: #334155;
    background: #fff;
}

.credits-dialog-body {
    padding: 1.15rem 1.25rem 1rem;
}

.credits-kicker {
    margin: 0;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brand-700);
}

.credits-app-name {
    margin: 0.35rem 0 0;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
}

.credits-institution {
    margin: 0.45rem 0 0;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.35;
    color: #334155;
}

.credits-campus {
    margin: 0.25rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.credits-version {
    margin: 0.2rem 0 0;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #64748b;
}

.credits-scope {
    margin-top: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 0.65rem;
    background: rgb(27 57 106 / 6%);
    border: 1px solid rgb(27 57 106 / 12%);
}

.credits-scope p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #334155;
}

.credits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
    margin: 1rem 0 0;
}

.credits-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.85rem 0 0;
}

.credits-detail {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
}

.credits-line {
    margin: 0;
    padding: 0;
    font-size: 0.84rem;
    line-height: 1.35;
    color: #1e293b;
}

.credits-email {
    color: var(--brand-700);
    text-decoration: none;
}

.credits-email:hover {
    text-decoration: underline;
}

.credits-item {
    min-width: 0;
}

.credits-item-full {
    grid-column: 1 / -1;
}

.credits-item dt {
    margin: 0;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
}

.credits-item dd {
    margin: 0.15rem 0 0;
    font-size: 0.84rem;
    line-height: 1.35;
    color: #1e293b;
}

.credits-item dd.credits-sub {
    margin-top: 0.05rem;
    font-size: 0.76rem;
    color: var(--muted);
}

.credits-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    border-top: 1px solid var(--line);
    background: #f8fafc;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #64748b;
}

.credits-sidebar-btn {
    width: 100%;
    padding: 0.45rem 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.credits-sidebar-btn:hover {
    background: rgb(255 255 255 / 6%);
}

.credits-sidebar-label {
    display: block;
    font-family: "Montserrat", "Source Sans 3", sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-soft);
}

.credits-sidebar-hint {
    display: block;
    margin-top: 0.12rem;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    color: rgb(232 215 168 / 72%);
}
