:root { --sidebar-w: 250px; --brand: #0d6efd; --brand-dark: #212529; }
body { background: #f4f6f9; font-size: .93rem; }
.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand); }
a { color: var(--brand); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--brand-dark); color: #cfd6df; flex-shrink: 0; transition: margin .2s; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 1030; }
.sidebar-brand { display: flex; align-items: center; gap: .6rem; padding: 1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); font-weight: 600; }
.brand-logo { height: 36px; max-width: 48px; object-fit: contain; background: #fff; border-radius: 6px; padding: 2px; }
.nav-group { text-transform: uppercase; font-size: .68rem; letter-spacing: .08em; padding: 1rem 1rem .3rem; color: #8b96a5; }
.nav-link-item { display: flex; align-items: center; gap: .7rem; padding: .55rem 1rem; color: #cfd6df; text-decoration: none; border-left: 3px solid transparent; }
.nav-link-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-link-item.active { background: rgba(255,255,255,.1); color: #fff; border-left-color: var(--brand); }
.nav-link-item i { font-size: 1.05rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid #e3e7ed; padding: .5rem 1rem; display: flex; align-items: center; position: sticky; top: 0; z-index: 1020; }
.project-switch { display: flex; align-items: center; gap: .4rem; max-width: 340px; }
.content { padding: 1.25rem; flex: 1; }
.app-footer { padding: .75rem 1.25rem; color: #8b96a5; font-size: .8rem; border-top: 1px solid #e3e7ed; background: #fff; }
.sidebar-collapsed .sidebar { margin-left: calc(var(--sidebar-w) * -1); }
@media (max-width: 991.98px) {
    .sidebar { position: fixed; margin-left: calc(var(--sidebar-w) * -1); }
    .sidebar-open .sidebar { margin-left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .content { padding: .9rem; }
}
.card { border: 0; box-shadow: 0 1px 3px rgba(20,30,50,.08); border-radius: .6rem; }
.card-header { background: transparent; font-weight: 600; border-bottom: 1px solid #eef1f5; }
.kpi { border-left: 4px solid var(--brand); }
.kpi .kpi-label { font-size: .74rem; text-transform: uppercase; color: #6b7686; letter-spacing: .04em; }
.kpi .kpi-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.kpi.kpi-danger { border-left-color: #dc3545; }
.kpi.kpi-success { border-left-color: #198754; }
.kpi.kpi-warning { border-left-color: #ffc107; }
.kpi.kpi-info { border-left-color: #0dcaf0; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7686; white-space: nowrap; }
.chart-box { position: relative; height: 280px; }
.guest-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand-dark), #3b4656); padding: 1rem; }
.guest-card { background: #fff; border-radius: .8rem; padding: 2rem; width: 100%; max-width: 420px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.guest-logo { max-height: 64px; max-width: 160px; }
.perm-matrix th, .perm-matrix td { text-align: center; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
@media print { .sidebar, .topbar, .app-footer, .no-print { display: none !important; } .content { padding: 0; } body { background: #fff; } }

/* ---- Pantalla de acceso (login, recuperación y restablecimiento) ---- */
.auth-body { margin: 0; min-height: 100vh; background: #0f1724; }
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-hero { position: fixed; inset: 0; z-index: 0; display: block; background-color: var(--brand-dark); background-size: cover; background-position: center; color: #fff; overflow: hidden;
    background-image: radial-gradient(circle at 15% 20%, color-mix(in srgb, var(--brand) 70%, transparent) 0, transparent 45%), radial-gradient(circle at 85% 85%, color-mix(in srgb, var(--brand) 45%, transparent) 0, transparent 50%), linear-gradient(135deg, var(--brand-dark), color-mix(in srgb, var(--brand-dark) 70%, var(--brand))); }
.auth-hero.has-image { background-image: none; }
.auth-hero:not(.has-image)::before { content: ""; position: absolute; inset: 0; opacity: .12;
    background-image: linear-gradient(rgba(255,255,255,.7) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.7) 1px, transparent 1px); background-size: 44px 44px; }
.auth-hero-overlay { position: absolute; inset: 0; background: linear-gradient(160deg, rgba(8,14,24,.62), rgba(8,14,24,.78)); }
.auth-hero:not(.has-image) .auth-hero-overlay { background: linear-gradient(160deg, rgba(8,14,24,.10), rgba(8,14,24,.35)); }
.auth-hero-inner { position: relative; z-index: 1; height: 100%; flex-direction: column; justify-content: space-between; padding: 2.5rem 3rem; }
.auth-brand { display: flex; align-items: center; gap: .8rem; }
.auth-brand-name { font-size: 1.15rem; font-weight: 600; letter-spacing: .02em; }
.auth-logo { max-height: 52px; max-width: 150px; background: rgba(255,255,255,.92); border-radius: .5rem; padding: .3rem .5rem; }
.auth-logo-icon { width: 48px; height: 48px; border-radius: .7rem; background: var(--brand); display: grid; place-items: center; font-size: 1.6rem; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.auth-hero-text h2 { font-size: clamp(1.8rem, 2.6vw, 2.7rem); font-weight: 700; line-height: 1.2; max-width: 30ch; text-shadow: 0 2px 14px rgba(0,0,0,.35); }
.auth-points { list-style: none; padding: 0; margin: 1.6rem 0 0; display: grid; gap: .75rem; font-size: 1rem; }
.auth-points li { display: flex; align-items: center; gap: .75rem; }
.auth-points i { width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.16); backdrop-filter: blur(4px); }
.auth-hero-foot { font-size: .8rem; opacity: .75; }
.auth-hero-inner { display: none; }
.auth-panel { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; padding: 1.5rem; min-height: 100vh; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border-radius: 1.1rem; padding: 2.2rem 2rem; box-shadow: 0 25px 60px rgba(0,0,0,.35); animation: authIn .5s ease both; }
.auth-title { font-size: 1.75rem; font-weight: 700; margin: 0 0 .25rem; color: #1b2430; }
.auth-sub { color: #6b7686; margin-bottom: 1.5rem; }
.auth-input .input-group-text { background: #f3f6fa; color: var(--brand); border-right: 0; }
.auth-input .form-control { border-left: 0; }
.auth-input .form-control:focus { box-shadow: none; border-color: var(--brand); }
.auth-input:focus-within .input-group-text { border-color: var(--brand); }
.auth-submit { font-weight: 600; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); border: 0; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 40%, transparent); transition: transform .15s ease, box-shadow .15s ease; }
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 12px 26px color-mix(in srgb, var(--brand) 50%, transparent); }
@keyframes authIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (min-width: 992px) {
    .auth-shell { grid-template-columns: 1.15fr .85fr; }
    .auth-hero { position: relative; }
    .auth-hero-inner { display: flex; }
    .auth-panel { background: #f4f6fa; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { .auth-card { animation: none; } .auth-submit { transition: none; } }
