/* NotiWeb · sistema de diseño
   ⚠ SUNAT azul (#2563eb) y SUNAFIL fucsia (#be185d) son la seña de cada portal:
   NO cambian con el tema. Todo lo demás sale de los tokens de :root. */

:root {
    --sunat: #2563eb;
    --sunat-suave: #dbeafe;
    --sunafil: #be185d;
    --marca: #1e3a8a;
    --bg: #f3f5f9;
    --card: #ffffff;
    --linea: #e5e7eb;
    --txt: #111827;
    --tenue: #6b7280;
    --hover: #f3f4f6;
    --ok: #047857; --ok-bg: #d1fae5;
    --warn: #b45309; --warn-bg: #fef3c7;
    --err: #b91c1c; --err-bg: #fee2e2;
    --info: #1d4ed8; --info-bg: #dbeafe;
    --gris-bg: #f3f4f6;
    --sombra: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
    --radio: 14px;
    color-scheme: light;
}

/* ⚠ El oscuro no es negro puro: gris azulado. Blanco sobre negro absoluto cansa. */
html[data-theme="dark"] {
    --bg: #111827;
    --card: #1e293b;
    --linea: #334155;
    --txt: #e5e7eb;
    --tenue: #94a3b8;
    --hover: #273449;
    --sunat-suave: #1e3a8a;
    --ok-bg: #064e3b; --ok: #6ee7b7;
    --warn-bg: #78350f; --warn: #fcd34d;
    --err-bg: #7f1d1d; --err: #fca5a5;
    --info-bg: #1e3a8a; --info: #93c5fd;
    --gris-bg: #334155;
    --sombra: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: Inter, "Segoe UI", system-ui, sans-serif; background: var(--bg); color: var(--txt); font-size: 14px; line-height: 1.45; }
a { color: var(--sunat); }
h1 { font-size: 1.55rem; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
h3 { font-size: 1.02rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.nw-ico { flex-shrink: 0; vertical-align: middle; }
.nw-sub { color: var(--tenue); font-size: .92rem; }
.nw-tenue { color: var(--tenue); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Shell ─────────────────────────────────────────── */
.nw-shell { display: flex; min-height: 100vh; }
.nw-side { width: 240px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--linea); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.nw-marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.nw-logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #3b82f6, #1e40af); color: #fff; display: grid; place-items: center; font-weight: 800; }
.nw-logo.grande { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.nw-marca-nombre { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.nw-menu { display: flex; flex-direction: column; gap: 2px; }
.nw-op { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--txt); text-decoration: none; font-weight: 500; position: relative; }
.nw-op:hover { background: var(--hover); }
/* Activo: franja de acento a la izquierda + fondo suave, no un botón hundido. */
.nw-op.active { background: var(--sunat-suave); color: var(--sunat); font-weight: 600; }
html[data-theme="dark"] .nw-op.active { color: #fff; }
.nw-op.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sunat); }
.nw-side-pie { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.nw-proximo { font-size: .8rem; color: var(--tenue); padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--linea); }
.nw-proximo b { color: var(--sunafil); }
.nw-usuario { font-size: .82rem; color: var(--tenue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.nw-principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nw-top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--linea); background: var(--card); position: sticky; top: 0; z-index: 5; }
.nw-top-espacio { flex: 1; }
.nw-accesos { display: flex; gap: 6px; }
.nw-accesos a { font-size: .82rem; padding: 6px 10px; border-radius: 999px; background: var(--gris-bg); color: var(--txt); text-decoration: none; white-space: nowrap; }
.nw-accesos a:hover { background: var(--sunat-suave); }
.nw-hamb { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.nw-hamb span { display: block; width: 20px; height: 2px; background: var(--txt); margin: 4px 0; border-radius: 2px; }
.nw-contenido { padding: 24px; max-width: 1280px; width: 100%; }

/* ── Piezas ────────────────────────────────────────── */
.nw-cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.nw-acciones { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nw-acciones-pie { display: flex; justify-content: flex-end; margin-top: 8px; }
.nw-tarjeta { background: var(--card); border: 1px solid var(--linea); border-radius: var(--radio); box-shadow: var(--sombra); padding: 18px; margin-bottom: 16px; }

.nw-btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 10px; padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.nw-btn:disabled { opacity: .55; cursor: default; }
.nw-btn-primario { background: var(--sunat); color: #fff; }
.nw-btn-primario:hover:not(:disabled) { background: #1d4ed8; }
.nw-btn-suave { background: var(--card); color: var(--txt); border-color: var(--linea); }
.nw-btn-suave:hover:not(:disabled) { background: var(--hover); }
.nw-btn-peligro { background: #dc2626; color: #fff; }
.nw-btn-bloque { width: 100%; justify-content: center; }
.nw-btn-chico { padding: 6px 10px; font-size: .85rem; }
.nw-ico-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--tenue); display: inline-grid; place-items: center; cursor: pointer; }
.nw-ico-btn:hover { background: var(--hover); color: var(--txt); }
.nw-ico-btn.peligro:hover { color: #dc2626; }
.nw-enlace { background: none; border: 0; color: var(--sunat); cursor: pointer; padding: 10px 0; font: inherit; }

.nw-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--linea); background: var(--card); color: var(--txt); font: inherit; }
.nw-input:focus { outline: 2px solid var(--sunat-suave); border-color: var(--sunat); }
.nw-input:disabled { background: var(--gris-bg); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: .9rem; }
.nw-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.nw-form { display: flex; flex-direction: column; gap: 14px; }
.nw-ayuda { font-size: .8rem; color: var(--tenue); margin-top: -6px; }
.nw-pegar { min-height: 140px; font-family: Consolas, monospace; font-size: .85rem; }

.nw-alerta { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .92rem; }
.nw-alerta.ok { background: var(--ok-bg); color: var(--ok); }
.nw-alerta.err { background: var(--err-bg); color: var(--err); }
.nw-alerta.warn { background: var(--warn-bg); color: var(--warn); }
.nw-alerta.info { background: var(--info-bg); color: var(--info); }

.nw-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.nw-chip.ok { background: var(--ok-bg); color: var(--ok); }
.nw-chip.err { background: var(--err-bg); color: var(--err); }
.nw-chip.warn { background: var(--warn-bg); color: var(--warn); }
.nw-chip.info { background: var(--info-bg); color: var(--info); }
.nw-chip.gris { background: var(--gris-bg); color: var(--tenue); }

.nw-cargando, .nw-vacio { padding: 40px 20px; text-align: center; color: var(--tenue); }
.nw-vacio h3 { justify-content: center; color: var(--txt); margin-top: 10px; }
.nw-giro { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: nw-giro .7s linear infinite; }
@keyframes nw-giro { to { transform: rotate(360deg); } }
.nw-progreso { width: 160px; height: 8px; background: var(--gris-bg); border-radius: 999px; overflow: hidden; }
.nw-progreso div { height: 100%; background: var(--sunat); transition: width .3s; }

/* ── Tablero ───────────────────────────────────────── */
.nw-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.nw-kpi { background: var(--card); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); display: flex; flex-direction: column; }
.nw-kpi span { color: var(--tenue); font-size: .84rem; font-weight: 500; }
.nw-kpi b { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; }
.nw-kpi small { color: var(--tenue); }
.nw-kpi.sunat b { color: var(--sunat); }
.nw-kpi.critico b { color: #dc2626; }
.nw-kpi.aviso b { color: #d97706; }
.nw-prioridad h3 { color: #dc2626; }
.nw-prioridad-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.nw-prio { text-align: left; border: 1px solid var(--linea); border-left: 4px solid var(--tenue); border-radius: 10px; padding: 10px 12px; background: var(--card); color: var(--txt); font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.nw-prio.err { border-left-color: #dc2626; }
.nw-prio.warn { border-left-color: #d97706; }
.nw-prio:hover { background: var(--hover); }
.nw-prio small { color: var(--tenue); }
.nw-prio .nw-chip { align-self: flex-start; }

.nw-barra-filtros { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.nw-buscar { display: flex; align-items: center; gap: 8px; border: 1px solid var(--linea); border-radius: 10px; padding: 0 10px; background: var(--card); color: var(--tenue); min-width: 240px; flex: 1; max-width: 380px; }
.nw-buscar input { border: 0; outline: 0; background: none; color: var(--txt); font: inherit; padding: 9px 0; width: 100%; }
.nw-seg { display: inline-flex; background: var(--gris-bg); border-radius: 10px; padding: 3px; }
.nw-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font: inherit; font-weight: 500; color: var(--tenue); cursor: pointer; }
.nw-seg button.activo { background: var(--card); color: var(--txt); box-shadow: var(--sombra); }

/* Cabecera de grilla CLARA, no un bloque de color: es lo que separa una pantalla de 2010 de una de ahora. */
.nw-tabla-envoltura { background: var(--card); border: 1px solid var(--linea); border-radius: var(--radio); overflow-x: auto; box-shadow: var(--sombra); }
.nw-tabla-envoltura.nw-mini { box-shadow: none; margin: 10px 0; max-height: 220px; }
.nw-tabla { width: 100%; border-collapse: collapse; }
.nw-tabla th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--linea); background: var(--card); position: sticky; top: 0; }
.nw-tabla th.num { text-align: right; }
.nw-tabla td { padding: 11px 14px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.nw-tabla tbody tr:hover { background: var(--hover); }
.nw-tabla tbody tr:last-child td { border-bottom: 0; }
.nw-tabla tr.inactiva { opacity: .6; }
.nw-emp { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.nw-emp small { color: var(--tenue); font-variant-numeric: tabular-nums; }
.nw-cifra { font-size: 1.25rem; font-weight: 800; }
.nw-cifra.sunat { color: var(--sunat); }
.nw-guion { color: var(--tenue); font-size: 1.2rem; cursor: help; }
.nw-err-txt { color: var(--err); font-size: .85rem; }
.nw-fila-acciones { text-align: right; white-space: nowrap; }
.nw-fila-acciones > * { margin-left: 4px; }

/* ── Buzón ─────────────────────────────────────────── */
.nw-buzon { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.nw-buzon-empresas { padding: 12px; position: sticky; top: 72px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; gap: 10px; }
.nw-buzon-empresas .nw-buscar { max-width: none; min-width: 0; }
.nw-lista-emp { overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nw-item-emp { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; font: inherit; color: var(--txt); cursor: pointer; position: relative; }
.nw-item-emp:hover { background: var(--hover); }
.nw-item-emp.activo { background: var(--sunat-suave); }
.nw-item-emp-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.nw-item-emp-txt b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-item-emp-txt small { color: var(--tenue); }
.nw-globo { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--sunat); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.nw-globo.err { background: #dc2626; }
.nw-buzon-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.nw-buzon-cab h3 { margin: 0; }
.nw-mensajes { list-style: none; margin: 0; padding: 0; }
.nw-msj { display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; border-bottom: 1px solid var(--linea); cursor: pointer; border-radius: 8px; }
.nw-msj:hover { background: var(--hover); }
.nw-punto { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.nw-msj.no-leido .nw-punto { background: var(--sunat); }
.nw-msj.no-leido .nw-msj-asunto { font-weight: 700; }
.nw-msj-cuerpo { flex: 1; min-width: 0; }
.nw-msj-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: .8rem; }
.nw-msj-fecha { text-align: right; white-space: nowrap; font-size: .85rem; display: flex; flex-direction: column; }
.nw-msj-fecha small { color: var(--tenue); }
.nw-adjuntos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.nw-visor { width: 100%; height: 60vh; border: 1px solid var(--linea); border-radius: 10px; background: #fff; }

/* ── Ventana flotante ──────────────────────────────── */
.nw-velo { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; animation: nw-aparece .15s; }
.nw-ventana { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: calc(100% - 32px); max-height: calc(100vh - 48px); background: var(--card); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.3); z-index: 41; display: flex; flex-direction: column; }
.nw-ventana-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 10px; }
.nw-ventana-titulo { font-weight: 700; font-size: 1.08rem; }
.nw-ventana-cuerpo { padding: 6px 20px 16px; overflow-y: auto; }
.nw-ventana-pie { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--linea); }
@keyframes nw-aparece { from { opacity: 0; } }

/* ── Login (pantalla de marca: imagen, una frase, una línea de palabras clave) ── */
.nw-login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.nw-login-marca { background: radial-gradient(circle at 20% 20%, #3b82f6, #1e3a8a 70%); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 48px 56px; }
.nw-ilustracion { width: 100%; max-width: 420px; margin-bottom: 28px; }
.nw-login-marca h1 { font-size: 1.7rem; line-height: 1.25; max-width: 460px; }
.nw-keywords { color: #bfdbfe; margin-top: 10px; }
.nw-login-form { display: grid; place-items: center; padding: 32px; background: var(--card); }
.nw-login-caja { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.nw-login-caja form { display: flex; flex-direction: column; gap: 14px; }
.nw-marca-login { padding: 0 0 12px; }
.nw-legal { color: var(--tenue); font-size: .78rem; text-align: center; margin-top: 18px; }
.nw-splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 12px; font-weight: 700; color: var(--tenue); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 10px 20px; background: #fef3c7; color: #78350f; z-index: 100; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ── Teléfono ──────────────────────────────────────── */
@media (max-width: 900px) {
    .nw-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nw-buzon { grid-template-columns: 1fr; }
    .nw-buzon-empresas { position: static; max-height: 260px; }
    .nw-accesos { display: none; }
}
@media (max-width: 760px) {
    .nw-side { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--sombra); }
    .menu-abierto .nw-side { transform: none; }
    .nw-hamb { display: block; }
    .nw-contenido { padding: 16px; }
    .nw-top { padding: 8px 16px; }
    .nw-login { grid-template-columns: 1fr; }
    .nw-login-marca { padding: 32px 24px; }
    .nw-ilustracion { max-width: 260px; }
    .nw-login-marca h1 { font-size: 1.3rem; }
    /* Tabla → tarjetas: cada celda lleva su rótulo en data-l. */
    .nw-tabla-tarjetas thead { display: none; }
    .nw-tabla-tarjetas tr { display: block; border-bottom: 1px solid var(--linea); padding: 8px 4px; }
    .nw-tabla-tarjetas td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 10px; text-align: right; }
    .nw-tabla-tarjetas td::before { content: attr(data-l); color: var(--tenue); font-size: .8rem; text-align: left; }
    .nw-tabla-tarjetas td:not([data-l])::before { content: none; }
    .nw-tabla-tarjetas .nw-emp { align-items: flex-end; }
    .nw-buscar { max-width: none; min-width: 0; }
    /* Safari hace zoom al enfocar un campo con letra < 16 px. */
    .nw-input, .nw-buscar input { font-size: 16px; }
    .nw-ventana { top: 0; left: 0; transform: none; width: 100%; max-width: none !important; height: 100dvh; max-height: none; border-radius: 0; }
}
