/* ==========================================================================
   NegPlanilla — Estilos globales
   Paleta: azul #2563eb (primario) + ámbar #f59e0b (acento), sobre gris claro.
   ========================================================================== */

:root {
    --azul: #2563eb;
    --azul-600: #1d4ed8;
    --azul-050: #eff4ff;
    --ambar: #f59e0b;
    --verde: #22c55e;
    --rojo: #ef4444;
    --purpura: #a855f7;

    --texto: #0f172a;
    --texto-2: #475569;
    --texto-3: #94a3b8;
    --linea: #e2e8f0;
    --fondo: #f4f6fb;
    --panel: #ffffff;

    --sidebar-w: 258px;
    --radio: 14px;
    --sombra: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .05);
    --sombra-sm: 0 1px 2px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
a { text-decoration: none; color: inherit; }

/* ---------------- Layout base ---------------- */
.app-shell { display: flex; min-height: 100vh; }

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-area { padding: 26px 32px 40px; }

/* ---------------- Sidebar ---------------- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 55%, #2563eb 100%);
    color: #dbe4ff;
    display: flex;
    flex-direction: column;
    z-index: 30;
    transition: transform .25s ease;
}

/* Drawer toggle (móvil/tablet) — oculto en escritorio */
.nav-toggle-cb { display: none; }
.nav-overlay { display: none; }
.hamburger {
    display: none;
    width: 40px; height: 40px;
    border: 1px solid var(--linea);
    background: #fff;
    border-radius: 11px;
    color: var(--texto-2);
    align-items: center; justify-content: center;
    cursor: pointer; flex-shrink: 0;
}
.hamburger:hover { background: var(--azul-050); color: var(--azul); }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 22px 18px;
}

.brand-mark {
    width: 42px; height: 42px;
    border-radius: 11px;
    background: #fff;
    color: var(--azul);
    display: grid; place-items: center;
    font-weight: 800; font-size: 16px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .18);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; font-size: 16px; color: #fff; }
.brand-tag { font-size: 11px; color: #a9bdf0; letter-spacing: .04em; text-transform: uppercase; }

.sidebar-scroll { flex: 1; overflow-y: auto; padding: 6px 14px 18px; }
.sidebar-scroll::-webkit-scrollbar { width: 6px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }

.nav-section { margin-top: 16px; }
.nav-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: #93a9e0;
    padding: 0 12px 8px;
    font-weight: 600;
}

/* Secciones colapsables (<details>/<summary>): sin JS, el navegador maneja el estado. */
summary.nav-caption { cursor: pointer; user-select: none; list-style: none; }
summary.nav-caption::-webkit-details-marker { display: none; }
summary.nav-caption::after {
    content: '';
    width: 7px; height: 7px;
    border-right: 1.5px solid #93a9e0;
    border-bottom: 1.5px solid #93a9e0;
    transform: rotate(45deg);
    transition: transform .15s;
    margin-right: 2px;
    flex-shrink: 0;
}
details.nav-section:not([open]) > summary.nav-caption::after { transform: rotate(-45deg); }
summary.nav-caption:hover { color: #c9d7f7; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #c9d7f7;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.nav-item.active {
    background: #fff;
    color: var(--azul-600);
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(0, 0, 0, .12);
}
.nav-ico { display: inline-flex; opacity: .95; }
.nav-item.active .nav-ico { color: var(--azul); }

.sidebar-footer {
    padding: 14px 22px;
    font-size: 11px;
    color: #9fb4e6;
    border-top: 1px solid rgba(255, 255, 255, .10);
}

/* ---------------- Topbar ---------------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    height: 66px;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--linea);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    gap: 20px;
}

.topbar-search {
    display: flex; align-items: center; gap: 10px;
    background: var(--fondo);
    border: 1px solid var(--linea);
    border-radius: 12px;
    padding: 9px 14px;
    width: min(420px, 42vw);
    color: var(--texto-3);
}
.topbar-search input {
    border: 0; background: transparent; outline: none;
    font-size: 14px; width: 100%; color: var(--texto);
    font-family: inherit;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    position: relative;
    width: 40px; height: 40px;
    border: 1px solid var(--linea);
    background: #fff;
    border-radius: 11px;
    color: var(--texto-2);
    display: grid; place-items: center;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--azul-050); color: var(--azul); border-color: #cdddff; }
.badge-dot {
    position: absolute; top: 8px; right: 9px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--ambar); border: 2px solid #fff;
}

.user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 6px 5px 8px;
    border: 1px solid var(--linea);
    border-radius: 12px;
    background: #fff;
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 9px;
    background: linear-gradient(135deg, var(--azul), #4f83f7);
    color: #fff; font-weight: 700; font-size: 13px;
    display: grid; place-items: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; color: var(--texto-3); }
.logout-form { margin: 0; }
.logout-form .icon-btn { width: 34px; height: 34px; }

/* ---------------- Encabezado de página ---------------- */
.page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 22px;
}
.page-head h1 { font-size: 24px; }
.page-sub { margin: 4px 0 0; color: var(--texto-2); font-size: 14px; }
.page-head-actions { display: flex; gap: 10px; align-items: center; }

.chip-soft {
    background: var(--azul-050); color: var(--azul-600);
    border: 1px solid #dbe6ff;
    padding: 7px 14px; border-radius: 999px;
    font-size: 13px; font-weight: 600; text-transform: capitalize;
}

/* ---------------- KPIs ---------------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px; margin-bottom: 20px;
}
.kpi-card {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    padding: 18px;
    display: flex; align-items: center; gap: 15px;
    box-shadow: var(--sombra-sm);
    transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--sombra); }
.kpi-ico { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.kpi-blue { background: var(--azul-050); color: var(--azul); }
.kpi-amber { background: #fef4e2; color: var(--ambar); }
.kpi-green { background: #e7f8ee; color: var(--verde); }
.kpi-purple { background: #f5ecfe; color: var(--purpura); }
.kpi-label { display: block; font-size: 12.5px; color: var(--texto-2); font-weight: 500; }
.kpi-value { display: block; font-size: 23px; font-weight: 700; margin: 2px 0; }
.kpi-trend { font-size: 11.5px; color: var(--texto-3); }
.kpi-trend.up { color: var(--verde); }

/* ---- Tarjetas KPI con degradado (estilo colorido) ---- */
.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 20px 22px;
    min-height: 116px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(15, 23, 42, .18); }
.stat-body { position: relative; z-index: 2; display: flex; flex-direction: column; }
.stat-label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; opacity: .92; }
.stat-value { font-size: 30px; font-weight: 800; line-height: 1.1; margin: 8px 0 5px; }
.stat-foot { font-size: 12.5px; font-weight: 500; opacity: .88; }
.stat-icon {
    position: absolute;
    right: 12px; bottom: -12px;
    z-index: 1;
    opacity: .22;
    color: #fff;
    pointer-events: none;
}
.stat-icon svg { width: 96px; height: 96px; stroke-width: 1.6; }

.grad-emerald { background: linear-gradient(135deg, #0d9488 0%, #10b981 100%); }
.grad-violet  { background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%); }
.grad-cyan    { background: linear-gradient(135deg, #0891b2 0%, #22d3ee 100%); }
.grad-amber   { background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%); }
.grad-blue    { background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%); }
.grad-rose    { background: linear-gradient(135deg, #e11d48 0%, #fb7185 100%); }
.grad-pink    { background: linear-gradient(135deg, #be185d 0%, #ec4899 100%); }
.grad-slate   { background: linear-gradient(135deg, #475569 0%, #64748b 100%); }

/* ---------------- Paneles / grids ---------------- */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; margin-bottom: 20px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    padding: 20px;
    box-shadow: var(--sombra-sm);
}
.panel-head { display: flex; flex-direction: column; margin-bottom: 14px; }
.panel-head h3 { font-size: 16px; }
.panel-sub { font-size: 12.5px; color: var(--texto-3); margin-top: 2px; }
.chart-box { position: relative; height: 260px; }

/* ---------------- Mini list ---------------- */
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--linea); }
.mini-row:last-child { border-bottom: 0; }
.mini-avatar {
    width: 38px; height: 38px; border-radius: 10px;
    background: var(--azul-050); color: var(--azul-600);
    display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.mini-info { flex: 1; display: flex; flex-direction: column; }
.mini-name { font-size: 13.5px; font-weight: 600; }
.mini-sub { font-size: 12px; color: var(--texto-3); }
.mini-date { font-size: 12px; color: var(--texto-2); }

/* ---------------- Tablas / data ---------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.search-inline {
    display: flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--linea);
    border-radius: 11px; padding: 9px 13px; min-width: 260px; color: var(--texto-3);
}
.search-inline input { border: 0; outline: none; font-size: 14px; width: 100%; font-family: inherit; color: var(--texto); }

.table-wrap { background: var(--panel); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th {
    text-align: left; padding: 13px 18px;
    background: #f8fafc; color: var(--texto-2);
    font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--linea);
}
table.data tbody td { padding: 13px 18px; border-bottom: 1px solid var(--linea); color: var(--texto); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #f9fbff; }
.cell-strong { font-weight: 600; }
.cell-muted { color: var(--texto-3); }

.avatar-cell { display: flex; align-items: center; gap: 10px; }
.avatar-cell .mini-avatar { width: 34px; height: 34px; }

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #e7f8ee; color: #15803d; }
.badge.off { background: #fdeaea; color: #b91c1c; }
.badge.warn { background: #fef4e2; color: #b45309; }
.badge.info { background: var(--azul-050); color: var(--azul-600); }
.badge.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------------- Botones ---------------- */
.btn-primary {
    background: var(--azul); color: #fff; border: 0;
    padding: 10px 18px; border-radius: 11px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px;
    transition: background .15s, transform .1s;
    font-family: inherit;
}
.btn-primary:hover { background: var(--azul-600); }
.btn-primary:active { transform: translateY(1px); }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; }
.btn-ghost {
    background: #fff; color: var(--texto-2); border: 1px solid var(--linea);
    padding: 9px 15px; border-radius: 11px; font-size: 14px; font-weight: 500; cursor: pointer;
    font-family: inherit;
}
.btn-ghost:hover { background: var(--fondo); }

/* ---------------- Estados vacíos / placeholder ---------------- */
.module-empty {
    background: var(--panel); border: 1px dashed #cdd7e6; border-radius: var(--radio);
    padding: 54px 30px; text-align: center; color: var(--texto-2);
}
.module-empty .emoji { font-size: 34px; }
.module-empty h3 { margin: 14px 0 6px; color: var(--texto); }
.module-empty p { margin: 0 auto; max-width: 460px; font-size: 14px; }

/* ---------------- Banner de alerta ---------------- */
.alert-banner {
    display: flex; align-items: center; gap: 12px;
    background: #fef4e2; border: 1px solid #f6d69a;
    color: #92400e; border-radius: 12px;
    padding: 13px 18px; margin-bottom: 20px; font-size: 14px;
    transition: background .15s;
}
.alert-banner:hover { background: #fdeccd; }
.alert-ico { font-size: 18px; }

/* ---------------- Notificaciones ---------------- */
.notif { position: relative; }
.badge-count {
    position: absolute; top: 2px; right: 2px;
    min-width: 17px; height: 17px; padding: 0 4px;
    background: var(--rojo); color: #fff;
    font-size: 10px; font-weight: 700;
    border-radius: 9px; border: 2px solid #fff;
    display: grid; place-items: center; line-height: 1;
}
.notif-backdrop { position: fixed; inset: 0; z-index: 40; }
.notif-panel {
    position: absolute; right: 0; top: 48px; z-index: 50;
    width: 320px; max-width: 90vw;
    background: #fff; border: 1px solid var(--linea);
    border-radius: 14px; box-shadow: 0 16px 40px rgba(15, 23, 42, .22);
    overflow: hidden; animation: modalIn .16s ease;
}
.notif-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 16px; border-bottom: 1px solid var(--linea); font-weight: 600; font-size: 14px;
}
.notif-tag { font-size: 11px; color: var(--azul-600); background: var(--azul-050); padding: 3px 8px; border-radius: 999px; }
.notif-empty { padding: 26px 16px; text-align: center; color: var(--texto-3); font-size: 13.5px; }
.notif-item { display: flex; gap: 11px; padding: 11px 16px; cursor: pointer; border-bottom: 1px solid var(--linea); transition: background .12s; }
.notif-item:hover { background: var(--azul-050); }
.notif-ico { font-size: 18px; }
.notif-body { display: flex; flex-direction: column; }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-sub { font-size: 12px; color: var(--texto-3); }
.notif-foot { padding: 11px 16px; text-align: center; font-size: 13px; color: var(--azul-600); font-weight: 600; cursor: pointer; }
.notif-foot:hover { background: var(--azul-050); }

/* ---------------- Modales ---------------- */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(2px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; overflow-y: auto;
}
.modal-card {
    background: #fff; border-radius: 16px;
    width: 100%; box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
    animation: modalIn .18s ease;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 860px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--linea);
}
.modal-head h3 { font-size: 17px; }
.modal-close {
    border: 0; background: transparent; font-size: 26px; line-height: 1;
    color: var(--texto-3); cursor: pointer; padding: 0 4px; border-radius: 8px;
}
.modal-close:hover { color: var(--rojo); }
.modal-body { padding: 22px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 22px; border-top: 1px solid var(--linea); background: #f8fafc;
    border-radius: 0 0 16px 16px;
}
.confirm-text { margin: 0; color: var(--texto-2); font-size: 14.5px; }

/* ---------------- Formularios (grid) ---------------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--texto-2); }
.form-control {
    width: 100%; padding: 10px 13px;
    border: 1px solid var(--linea); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--texto);
    background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-control:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------------- Botones adicionales ---------------- */
.btn-danger {
    background: var(--rojo); color: #fff; border: 0;
    padding: 10px 18px; border-radius: 11px; font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }

/* Acciones en filas de tabla */
.row-actions { display: flex; gap: 6px; }
.act-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1px solid var(--linea); background: #fff;
    display: grid; place-items: center; cursor: pointer;
    color: var(--texto-2); transition: all .15s;
}
.act-btn:hover { background: var(--azul-050); color: var(--azul); border-color: #cdddff; }
.act-btn.danger:hover { background: #fdeaea; color: var(--rojo); border-color: #f6c9c9; }

/* ---------------- Toast ---------------- */
.toast {
    position: fixed; right: 22px; bottom: 22px; z-index: 80;
    background: #0f172a; color: #fff;
    padding: 13px 18px; border-radius: 12px; font-size: 14px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    display: flex; align-items: center; gap: 10px;
    animation: modalIn .2s ease;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
.toast-close {
    background: none; border: none; color: inherit; opacity: .7;
    cursor: pointer; font-size: 13px; padding: 2px 4px; line-height: 1;
}
.toast-close:hover { opacity: 1; }

/* Overlay de reconexión de Blazor (reemplaza el default en inglés).
   blazor.web.js agrega components-reconnect-show/-failed/-rejected según el estado. */
#components-reconnect-modal { display: none; }
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected {
    display: grid; place-items: center;
    position: fixed; inset: 0; z-index: 200;
    background: rgba(15, 23, 42, .55); backdrop-filter: blur(2px);
}
.reconnect-box {
    background: #fff; border-radius: 14px; padding: 26px 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    max-width: 340px; text-align: center; font-size: 14px; color: var(--texto);
}
.reconnect-spinner {
    width: 30px; height: 30px; border-radius: 50%;
    border: 3px solid var(--azul-050); border-top-color: var(--azul);
    animation: reconnectSpin .8s linear infinite;
}
@keyframes reconnectSpin { to { transform: rotate(360deg); } }
.reconnect-msg { margin: 0; display: none; }
.reconnect-msg a { color: var(--azul-600); font-weight: 600; }
#components-reconnect-modal.components-reconnect-show .msg-show { display: block; }
#components-reconnect-modal.components-reconnect-failed .msg-failed { display: block; }
#components-reconnect-modal.components-reconnect-rejected .msg-rejected { display: block; }
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner { display: none; }

/* Filtros / selects en toolbar */
.filter-select {
    padding: 9px 34px 9px 13px; border: 1px solid var(--linea); border-radius: 11px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--texto); cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}

/* ---------------- Boleta de pago ---------------- */
.boleta-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.boleta-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 2px; border-bottom: 1px solid var(--linea); font-size: 14px;
}
.boleta-row.header { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-3); font-weight: 600; border-bottom: 2px solid var(--linea); }
.boleta-row.ingreso span:last-child { color: #15803d; font-weight: 600; }
.boleta-row.deduccion span:last-child { color: #b91c1c; font-weight: 600; }
.boleta-row.total {
    margin-top: 6px; border: 0; border-top: 2px solid var(--texto);
    font-size: 16px; font-weight: 700;
}
.boleta-row.total span:last-child { color: var(--azul); }
.boleta-note {
    margin-top: 14px; padding: 10px 12px; background: var(--azul-050);
    border-radius: 10px; font-size: 12.5px; color: var(--texto-2);
    display: flex; flex-wrap: wrap; gap: 4px 12px;
}
.boleta-note span { font-weight: 600; }

/* ---------------- Login ---------------- */
.auth-shell {
    min-height: 100vh;
    display: grid; place-items: center;
    background: radial-gradient(1200px 600px at 15% -10%, #dbe7ff 0, transparent 55%),
                radial-gradient(900px 500px at 100% 100%, #fde9c8 0, transparent 45%),
                #eef2fb;
    padding: 24px;
}

/* ---- Login split (tarjeta dividida) ---- */
.auth-split {
    display: flex;
    width: 100%; max-width: 960px;
    min-height: 580px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 30px 70px rgba(30, 58, 138, .22);
}

.auth-aside {
    position: relative;
    flex: 1 1 46%;
    padding: 40px 42px;
    color: #eaf0ff;
    background: linear-gradient(155deg, #1e3a8a 0%, #1e40af 45%, #2563eb 100%);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.auth-aside-brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 700; color: #fff; z-index: 2; }
.auth-aside-content { margin-top: auto; margin-bottom: auto; z-index: 2; }
.auth-aside-content h2 { font-size: 30px; line-height: 1.2; color: #fff; letter-spacing: -.02em; }
.auth-aside-content p { margin: 14px 0 26px; font-size: 14.5px; color: #bfd0f5; max-width: 340px; }
.auth-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 13px; }
.auth-features li { display: flex; align-items: center; gap: 11px; font-size: 14px; color: #dbe6ff; }
.af-ico {
    flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
    background: rgba(255, 255, 255, .18); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.auth-aside-foot { z-index: 2; font-size: 12px; color: #9fb4e6; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .5; }
.auth-blob-1 { width: 260px; height: 260px; right: -90px; top: -70px; background: radial-gradient(circle, rgba(96,165,250,.55), transparent 70%); }
.auth-blob-2 { width: 220px; height: 220px; left: -80px; bottom: -60px; background: radial-gradient(circle, rgba(245,158,11,.4), transparent 70%); }

.auth-form-side {
    flex: 1 1 54%;
    display: flex; align-items: center; justify-content: center;
    padding: 40px 44px;
}
.auth-form-box { width: 100%; max-width: 360px; }
.auth-brand-mobile { display: none; align-items: center; gap: 12px; margin-bottom: 24px; }

.input-wrap { position: relative; }
.input-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--texto-3); pointer-events: none; }
.form-input.has-ico { padding-left: 40px; }

.btn-lg { padding: 13px 18px; font-size: 15px; border-radius: 12px; }

.auth-demo {
    margin-top: 22px; text-align: center;
    display: flex; flex-direction: column; gap: 4px;
}
.auth-demo span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-3); font-weight: 600; }
.auth-demo code {
    font-size: 12.5px; color: var(--azul-600);
    background: var(--azul-050); border: 1px solid #dbe6ff;
    padding: 6px 12px; border-radius: 8px; font-family: 'Consolas', monospace;
}

@media (max-width: 760px) {
    .auth-split { flex-direction: column; max-width: 440px; min-height: 0; }
    .auth-aside { display: none; }
    .auth-form-side { padding: 34px 28px; }
    .auth-brand-mobile { display: flex; }
}
.auth-card {
    width: 100%; max-width: 410px;
    background: #fff; border: 1px solid var(--linea);
    border-radius: 20px; padding: 34px 32px;
    box-shadow: 0 24px 60px rgba(30, 58, 138, .16);
}
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-logo {
    width: 52px; height: 52px; border-radius: 14px;
    background: linear-gradient(135deg, var(--azul), #4f83f7);
    color: #fff; font-weight: 800; font-size: 18px;
    display: grid; place-items: center;
    box-shadow: 0 10px 22px rgba(37, 99, 235, .35);
}
.auth-title { font-size: 20px; }
.auth-subtitle { margin: 2px 0 0; font-size: 12.5px; color: var(--texto-3); }
.auth-heading { font-size: 20px; margin-bottom: 4px; }
.auth-hint { color: var(--texto-2); font-size: 14px; margin: 0 0 22px; }

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 7px; color: var(--texto-2); }
.form-input {
    width: 100%; padding: 11px 14px;
    border: 1px solid var(--linea); border-radius: 11px;
    font-size: 14px; font-family: inherit; color: var(--texto);
    transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-input:focus { border-color: var(--azul); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.field-error { display: block; color: var(--rojo); font-size: 12px; margin-top: 5px; }

.form-row-between { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 18px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--texto-2); cursor: pointer; }

.auth-alert {
    background: #fdeaea; color: #b91c1c; border: 1px solid #f6c9c9;
    padding: 11px 14px; border-radius: 11px; font-size: 13.5px; margin-bottom: 18px;
}
.auth-footer { text-align: center; font-size: 12.5px; color: var(--texto-3); margin: 20px 0 0; }

/* ---------------- Misc ---------------- */
.loading-screen, .access-denied { padding: 60px; text-align: center; color: var(--texto-2); }
.access-denied h3 { color: var(--texto); }

.validation-message { color: var(--rojo); font-size: 12px; }

/* ==========================================================================
   Responsive: escritorio (>1100) · tablet (900-1100) · móvil (<900 / <560)
   ========================================================================== */

/* Las tablas siempre pueden desplazarse horizontalmente si no caben */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { min-width: 620px; }

/* Tablet grande / laptops pequeñas */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .content-area { padding: 22px 24px 36px; }
}

/* Tablet / móvil: el sidebar se convierte en drawer deslizable */
@media (max-width: 900px) {
    .app-main { margin-left: 0; }
    .hamburger { display: inline-flex; }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 40px rgba(0, 0, 0, .3);
    }
    .nav-toggle-cb:checked ~ .sidebar { transform: translateX(0); }
    .nav-toggle-cb:checked ~ .nav-overlay {
        display: block;
        position: fixed; inset: 0;
        background: rgba(15, 23, 42, .5);
        z-index: 25;
        backdrop-filter: blur(1px);
    }

    .topbar { padding: 0 18px; gap: 12px; }
    .topbar-search { width: 100%; }
    .content-area { padding: 20px 18px 34px; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .chart-box { height: 240px; }
}

/* Móvil */
@media (max-width: 620px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-search { display: none; }
    .topbar { height: 60px; }
    .user-meta { display: none; }
    .user-chip { padding: 4px; gap: 6px; }
    .page-head h1 { font-size: 21px; }
    .panel { padding: 16px; }
    .chart-box { height: 220px; }
    .stat-value { font-size: 26px; }
    .content-area { padding: 16px 14px 30px; }
}

/* Móvil pequeño */
@media (max-width: 380px) {
    .stat-icon svg { width: 78px; height: 78px; }
    .kpi-card { padding: 15px; }
}
