:root{
  --hub-primary:#1e3a8a;
  --hub-primary-2:#2563eb;
  --hub-sidebar:#0f172a;
  --hub-sidebar-2:#111827;
  --hub-success:#15803d;
  --hub-warning:#b45309;
  --hub-danger:#b91c1c;
  --hub-bg:#f4f6f8;
  --hub-card:#ffffff;
  --hub-border:#e5e7eb;
  --hub-text:#111827;
  --hub-muted:#64748b;
  --hub-radius:10px;
  --hub-shadow:0 1px 4px rgba(15,23,42,.14);
  --hub-sidebar-width:260px;
}
*{box-sizing:border-box}
html{min-height:100%}
body{font-family:Arial,sans-serif;background:var(--hub-bg);margin:0;color:var(--hub-text);min-height:100vh}
a{color:var(--hub-primary-2)}
.hub-shell{min-height:0}
.hub-sidebar{position:fixed;inset:0 auto 0 0;width:var(--hub-sidebar-width);background:linear-gradient(180deg,var(--hub-sidebar),var(--hub-sidebar-2));color:#fff;padding:20px 16px;overflow-y:auto;z-index:1000;display:flex;flex-direction:column}
.hub-brand{padding:4px 8px 20px;border-bottom:1px solid rgba(255,255,255,.12);margin-bottom:16px}
.hub-brand-title{font-size:21px;font-weight:700;line-height:1.15}
.hub-brand-subtitle{font-size:13px;color:#bfdbfe;margin-top:5px}
.hub-nav{display:flex;flex-direction:column;gap:4px;flex:1}
.hub-nav-group{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:#94a3b8;margin:18px 10px 6px}
.hub-nav a,.hub-logout{display:flex;align-items:center;gap:10px;color:#e5e7eb;text-decoration:none;padding:10px 12px;border-radius:8px;border:0;background:transparent;font:inherit;text-align:left;width:100%;cursor:pointer;margin:0}
.hub-nav a:hover,.hub-logout:hover{background:rgba(37,99,235,.22);color:#fff}
.hub-nav-icon{width:20px;text-align:center}
.hub-user{border-top:1px solid rgba(255,255,255,.12);padding:15px 8px 0;margin-top:18px}
.hub-user-name{font-weight:700;font-size:14px;overflow-wrap:anywhere}
.hub-user-meta{color:#94a3b8;font-size:12px;margin-top:4px}
.hub-version{color:#64748b;font-size:11px;padding:12px 8px 0}
.hub-topbar{position:fixed;left:var(--hub-sidebar-width);right:0;top:0;height:64px;background:#fff;border-bottom:1px solid var(--hub-border);display:flex;align-items:center;justify-content:space-between;padding:0 28px;z-index:900;box-shadow:0 1px 3px rgba(15,23,42,.05)}
.hub-topbar-title{font-weight:700;color:#0f172a}.hub-topbar-meta{font-size:13px;color:var(--hub-muted)}
main{margin-left:var(--hub-sidebar-width);padding:88px 28px 28px;min-height:100vh}
main>h1:first-child,main>h2:first-child{margin-top:0}
.card,section,.filtros{background:var(--hub-card);padding:20px;border-radius:var(--hub-radius);box-shadow:var(--hub-shadow);margin-bottom:20px;border:1px solid rgba(229,231,235,.7)}
.card h2,.card h3,section h2,section h3{margin-top:0}
.cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:15px;margin-bottom:20px}
.cards .card{margin-bottom:0}.card h2{font-size:30px;margin:0 0 6px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin:15px 0}
.kpi{background:#f8fafc;border:1px solid var(--hub-border);border-radius:8px;padding:12px}.kpi strong{display:block;font-size:22px}
.toolbar{display:flex;justify-content:flex-end;gap:8px;margin-bottom:15px;flex-wrap:wrap}
table{width:100%;border-collapse:collapse;background:#fff;font-size:14px}th,td{padding:10px;border-bottom:1px solid var(--hub-border);text-align:left;vertical-align:top}th{background:#f1f5f9;color:#334155;font-weight:700}tbody tr:hover{background:#f8fafc}
label{display:block;margin-top:14px;font-weight:700;color:#334155}input,select,textarea{width:100%;padding:10px;margin-top:6px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;font:inherit}input:focus,select:focus,textarea:focus{outline:none;border-color:var(--hub-primary-2);box-shadow:0 0 0 3px rgba(37,99,235,.12)}input[type=checkbox],input[type=radio]{width:auto;margin-right:7px}
button,.btn,.btn-exportar{display:inline-block;padding:9px 13px;border-radius:6px;border:0;background:var(--hub-primary-2);color:#fff;text-decoration:none;cursor:pointer;font:inherit;margin:8px 6px 0 0}button:hover,.btn:hover,.btn-exportar:hover{filter:brightness(.94)}.primary,.btn-dark{background:#1f2937}.edit{background:#2563eb}.test{background:#7c3aed}.on,.btn-green,.btn-excel,.btn-exportar{background:var(--hub-success)}.off{background:var(--hub-danger)}.btn-warn{background:var(--hub-warning)}
.ok{color:var(--hub-success);font-weight:700}.bad{color:var(--hub-danger);font-weight:700}.warn{color:var(--hub-warning);font-weight:700}.muted,.note,.help,.small{color:var(--hub-muted)}.small,.help{font-size:12px}.note{font-size:13px}
.alert,.alert-error,.msg-error{background:#fee2e2;color:#991b1b;padding:12px;border-radius:7px;margin-bottom:15px;font-weight:700}.alert-ok,.msg-ok{background:#dcfce7;color:#166534;padding:12px;border-radius:7px;margin-bottom:15px}.note{background:#eff6ff;padding:10px;border-radius:6px}
.section-title{margin-top:28px;border-top:1px solid var(--hub-border);padding-top:17px;color:#1f2937}
.tag{padding:4px 8px;border-radius:999px;font-size:12px;font-weight:700}.insert{background:#dcfce7;color:#166534}.update{background:#fef9c3;color:#854d0e}.same{background:#e5e7eb;color:#374151}.error{background:#fee2e2;color:#991b1b}
pre{background:#111827;color:#e5e7eb;padding:15px;border-radius:8px;white-space:pre-wrap;overflow:auto}
.plantillas{display:flex;flex-wrap:wrap;gap:8px}
@media(max-width:1100px){.cards{grid-template-columns:repeat(2,1fr)}.kpis{grid-template-columns:repeat(3,1fr)}}
@media(max-width:800px){:root{--hub-sidebar-width:0px}.hub-sidebar{position:relative;width:100%;min-height:auto}.hub-topbar{position:relative;left:0;height:auto;padding:14px 18px}.hub-shell{display:block}main{margin-left:0;padding:22px}.hub-nav{display:grid;grid-template-columns:1fr 1fr}.hub-nav-group{grid-column:1/-1}.grid,.cards,.kpis{grid-template-columns:1fr}.hub-user{margin-top:10px}}

/* Hardening responsive global: evita desbordamientos en tablas, formularios y contenido largo. */
.card,section,.filtros{min-width:0;overflow-wrap:anywhere}
input,select,textarea,button,.btn,.btn-exportar{max-width:100%}
.table-responsive{width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
th,td{overflow-wrap:anywhere}
img,svg,video,canvas{max-width:100%;height:auto}
@media(max-width:520px){main{padding:14px}.card,section,.filtros{padding:14px}.hub-nav{grid-template-columns:1fr}.toolbar{justify-content:stretch}.toolbar .btn,.toolbar button,.toolbar .btn-exportar{width:100%;margin-right:0;text-align:center}}

.table-responsive table{width:100%}
@media(max-width:800px){
  .table-responsive table{min-width:680px}
}
.inline-form{display:inline-block;margin:0;padding:0;background:transparent;border:0;box-shadow:none}
.inline-form .btn{margin-top:8px}
@media(max-width:520px){.inline-form{display:block}.inline-form .btn{width:100%;margin-right:0}}


/* ===== CSP HARDENING 2026-08-12 ===== */

/* Migrado desde admin/importacion.html */
.import-progress{
    width:100%;
    height:18px;
    background:#e2e8f0;
    border-radius:999px;
    overflow:hidden;
    margin:14px 0
}

.import-progress-bar{
    width:0;
    height:100%;
    background:#2563eb;
    transition:width .4s ease
}

.estado-badge{
    display:inline-block;
    padding:5px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:bold
}

.estado-cola{
    background:#fef3c7;
    color:#92400e
}

.estado-proceso{
    background:#dbeafe;
    color:#1e40af
}

.estado-finalizado{
    background:#dcfce7;
    color:#166534
}

.estado-error{
    background:#fee2e2;
    color:#991b1b
}

.import-message{
    margin-top:12px;
    padding:10px 12px;
    background:#f8fafc;
    border-radius:7px;
    color:#475569
}

.historial-table{
    overflow-x:auto
}

/* Migrado desde admin/login.html */
body{font-family:Arial,sans-serif;background:#f4f6f8;display:flex;align-items:center;justify-content:center;height:100vh;margin:0}
.box{background:white;padding:30px;width:380px;border-radius:10px;box-shadow:0 1px 6px #bbb}
h1{margin-top:0;color:#1f2937}
label{display:block;margin-bottom:6px;color:#374151;font-weight:bold}
input{width:100%;padding:10px;margin-bottom:4px;box-sizing:border-box}
button{width:100%;padding:10px;background:#1f2937;color:white;border:none;cursor:pointer;margin-top:12px}
button:hover{background:#111827}
.ayuda{display:block;color:#6b7280;font-size:12px;margin-bottom:12px}
.msg-error{background:#fee2e2;color:#991b1b;padding:10px;border-radius:6px;margin-bottom:12px;font-weight:bold}
.msg-ok{background:#dcfce7;color:#166534;padding:10px;border-radius:6px;margin-bottom:12px;font-weight:bold}

/* Migrado desde admin/monitoreo-pui.html */
.estado-fase3{display:inline-block;padding:4px 9px;border-radius:999px;font-weight:700;white-space:nowrap}
.estado-fase3-activo{background:#dcfae6;color:#067647}
.estado-fase3-inactivo{background:#fff3cd;color:#7a4d00}
.evento-fase3-ok{color:#16794b;font-weight:700}
.evento-fase3-error{color:#b42318;font-weight:700}
.evento-reintento{color:#9a6700;font-weight:700}
.evento-notificacion{color:#175cd3;font-weight:700}
.tabla-scroll{overflow-x:auto}
.small-wrap{max-width:520px;white-space:normal;overflow-wrap:anywhere}

/* Migrado desde admin/reporte-detalle.html */
.detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.estado-card {
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 16px;
    background: #ffffff;
}

.estado-card h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
}

.estado-card .valor {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.estado-card .detalle {
    font-size: 0.88rem;
    color: #5f6b76;
    overflow-wrap: anywhere;
}

.estado-ok {
    color: #16794b;
}

.estado-pendiente {
    color: #9a6700;
}

.estado-error {
    color: #b42318;
}

.resumen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.resumen-item {
    border: 1px solid #dfe3e8;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
    background: #ffffff;
}

.resumen-item strong {
    display: block;
    font-size: 1.45rem;
    margin-bottom: 4px;
}

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-ok {
    background: #dcfae6;
    color: #067647;
}

.badge-pendiente {
    background: #fff3cd;
    color: #7a4d00;
}

.badge-error {
    background: #fee4e2;
    color: #b42318;
}

.badge-neutral {
    background: #eef2f6;
    color: #344054;
}

.tabla-scroll {
    overflow-x: auto;
}

.celda-detalle {
    max-width: 680px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.acciones-detalle {
    margin-top: 18px;
}

/* Migrado desde error/400.html */
.error-page{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:#f4f6f8;
    box-sizing:border-box
}

.error-card{
    width:100%;
    max-width:620px;
    background:#fff;
    border-radius:12px;
    box-shadow:0 4px 18px rgba(15,23,42,.12);
    padding:36px
}

.error-code{
    margin:0;
    text-align:center;
    font-size:72px;
    line-height:1;
    color:#b45309
}

.error-title{
    text-align:center
}

.error-message{
    color:#64748b;
    text-align:center
}

.error-list{
    margin-top:18px;
    padding:16px 28px;
    border-radius:8px;
    background:#fff7ed;
    color:#9a3412
}

.error-actions{
    margin-top:24px;
    text-align:center
}

/* Migrado desde error/404.html */
.error-page{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:#f4f6f8;
    box-sizing:border-box
}

.error-card{
    width:100%;
    max-width:620px;
    background:#fff;
    border-radius:12px;
    box-shadow:0 4px 18px rgba(15,23,42,.12);
    padding:36px;
    text-align:center
}

.error-code{
    margin:0;
    font-size:72px;
    line-height:1;
    color:#1e3a8a
}

.error-title{
    margin:14px 0 8px
}

.error-message{
    color:#64748b;
    line-height:1.6
}

.error-route{
    margin:18px 0;
    padding:10px;
    border-radius:6px;
    background:#f1f5f9;
    color:#475569;
    word-break:break-all
}

.error-actions{
    display:flex;
    justify-content:center;
    gap:10px;
    flex-wrap:wrap;
    margin-top:24px
}

/* Migrado desde error/500.html */
.error-page{
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:24px;
    background:#f4f6f8;
    box-sizing:border-box
}

.error-card{
    width:100%;
    max-width:620px;
    background:#fff;
    border-radius:12px;
    box-shadow:0 4px 18px rgba(15,23,42,.12);
    padding:36px;
    text-align:center
}

.error-code{
    margin:0;
    font-size:72px;
    line-height:1;
    color:#b91c1c
}

.error-title{
    margin:14px 0 8px
}

.error-message{
    color:#64748b;
    line-height:1.6
}

.error-actions{
    display:flex;
    justify-content:center;
    gap:10px;
    flex-wrap:wrap;
    margin-top:24px
}

/* CSP: sustitución de atributos style inline */
.checkbox-auto {
    width: auto;
}

.import-details {
    margin-top: 20px;
}

.card-flat {
    box-shadow: none;
    border: 1px solid #e2e8f0;
}

.btn-reenviar {
    background: #b45309;
}

/* Barra de importación sin style.width dinámico */
.import-progress-bar {
    width: 100%;
    height: 18px;
    border: 0;
    accent-color: #2563eb;
}

/* Login CSP-safe */
.login-page {
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

.login-box {
    background: #fff;
    padding: 30px;
    width: min(380px, calc(100% - 30px));
    border-radius: 10px;
    box-shadow: 0 1px 6px #bbb;
}

.login-box h1 {
    margin-top: 0;
    color: #1f2937;
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-weight: bold;
}

.login-box input {
    width: 100%;
    padding: 10px;
    margin-bottom: 4px;
    box-sizing: border-box;
}

.login-box button {
    width: 100%;
    padding: 10px;
    background: #1f2937;
    color: #fff;
    border: none;
    cursor: pointer;
    margin-top: 12px;
}

.login-box button:hover {
    background: #111827;
}

.ayuda {
    display: block;
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 12px;
}
