/* Maqueta del portal Aligant Facturación — estilo de hojas del ERP (tipo SAP) con los colores de la marca */

:root {
  --navy: #0F2A44;
  --navy-2: #2D4A66;
  --blue: #1E78D8;
  --blue-dk: #1765BA;
  --link: #0369A1;
  --ink: #0F172A;
  --muted: #64748B;
  --line: #CBD5E1;
  --line-2: #E2E8F0;
  --bg: #EEF2F6;
  --bar: #F1F5F9;
  --ok: #16A34A;
  --warn: #F59E0B;
  --err: #DC2626;
  --font: "Inter", "Segoe UI", Arial, sans-serif;
  --head: "Montserrat", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 13px/1.45 var(--font); }
a { color: var(--link); }
[hidden] { display: none !important; }

/* ---------- Ingreso ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(800px 500px at 80% 10%, rgba(30,120,216,.35), transparent 60%), linear-gradient(160deg, var(--navy), #0A1E31);
}
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 60px rgba(0,0,0,.35); text-align: center; }
.login-card img { margin: 0 auto -4px; width: 170px; height: auto; }
.login-card h1 { font: 800 18px var(--head); color: var(--navy); margin: 0 0 4px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); }
.login-card input { height: 38px; border: 1px solid #94A3B8; border-radius: 6px; padding: 0 10px; font: 14px var(--font); }
.login-card a { font-size: 12.5px; }
.login-pie { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

/* ---------- Barra superior ---------- */
.top { display: flex; align-items: center; gap: 18px; height: 50px; padding: 0 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.top-marca { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font: 600 15px var(--font); white-space: nowrap; }
.top-marca img { border-radius: 6px; background: #fff; }
.top-marca b { color: #8CC4FF; }
.top-menu-btn { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; border-radius: 4px; font-size: 18px; padding: 2px 10px; cursor: pointer; }
.top-nav { display: flex; align-items: stretch; height: 100%; }
.top-nav > a, .desp > button { display: flex; align-items: center; padding: 0 13px; color: #C9D8E8; text-decoration: none; font: 600 13px var(--font); background: none; border: 0; cursor: pointer; border-bottom: 3px solid transparent; height: 100%; white-space: nowrap; }
.top-nav > a:hover, .desp:hover > button { color: #fff; background: rgba(255,255,255,.06); }
.top-nav .on { color: #fff; border-bottom-color: #8CC4FF; }
.top-admin { color: #FCD34D !important; }
.desp { position: relative; }
.desp-menu { display: none; position: absolute; top: 100%; left: 0; min-width: 210px; background: #fff; border: 1px solid var(--line); border-radius: 0 0 6px 6px; box-shadow: 0 12px 24px rgba(15,42,68,.18); padding: 4px 0; }
.desp:hover .desp-menu, .desp:focus-within .desp-menu { display: block; }
.desp-menu a, .desp-off { display: block; padding: 7px 14px; color: var(--ink); text-decoration: none; font-weight: 500; }
.desp-menu a:hover { background: #EAF3FD; color: var(--blue-dk); }
.desp-off { color: #94A3B8; cursor: default; }
.top-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-user select { height: 30px; max-width: 230px; border: 1px solid rgba(255,255,255,.3); background: var(--navy-2); color: #fff; border-radius: 4px; padding: 0 8px; font: 500 12.5px var(--font); }
.top-salir { color: #C9D8E8; font-weight: 600; text-decoration: none; }
.top-salir:hover { color: #fff; }

/* Recuadro «Datos del emisor» */
.emisor { display: flex; flex-wrap: wrap; gap: 4px 26px; align-items: center; padding: 7px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.emisor div { display: flex; flex-direction: column; min-width: 0; }
.emisor span { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.emisor b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-amb { margin-left: auto; }
.amb { background: #FEF3C7; color: #92400E !important; border: 1px solid #FCD34D; border-radius: 999px; padding: 3px 10px; text-transform: none !important; letter-spacing: 0 !important; font-size: 12px !important; }

.main { padding: 14px 16px 40px; max-width: 1360px; margin: 0 auto; }
.main > section { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Hoja (como el ERP) ---------- */
.hoja { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--bar); border-bottom: 1px solid var(--line); }
.barra > b { font-size: 15px; font-weight: 800; color: var(--navy); }
.barra > span { color: var(--muted); font-size: 12.5px; }
.botones { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.volver { font-weight: 600; text-decoration: none; }

.b { display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #94A3B8; border-radius: 4px; padding: 4px 11px; font: 600 12.5px var(--font); color: var(--navy); cursor: pointer; text-decoration: none; white-space: nowrap; }
.b:hover { background: var(--line-2); }
.b:disabled { opacity: .5; cursor: not-allowed; background: #fff; }
.b-pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.b-pri:hover { background: var(--blue-dk); }
.b-err { color: var(--err); border-color: #FCA5A5; }
.b-err:hover { background: #FEF2F2; }
.b-full { width: 100%; height: 40px; font-size: 14px; border-radius: 6px; }
.seg { display: inline-flex; border: 1px solid #94A3B8; border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 4px 10px; font: 600 12px var(--font); color: var(--navy); cursor: pointer; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg .on { background: var(--navy); color: #fff; }

.filtros { display: grid; grid-template-columns: 130px 140px 130px 100px 100px 120px 120px minmax(160px, 1fr); gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.filtros-1 { grid-template-columns: minmax(200px, 420px); }
.filtros label, .campos label { display: flex; flex-direction: column; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); margin: 0; min-width: 0; }
.filtros input, .filtros select, .campos input, .campos select, .t-lineas input {
  height: 28px; border: 1px solid #94A3B8; border-radius: 4px; padding: 2px 7px; font: 400 13px var(--font); color: var(--ink); background: #fff; width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid #8CC4FF; outline-offset: 0; border-color: var(--blue); }

.scroll { overflow-x: auto; }
.t { width: 100%; border-collapse: collapse; }
.t th { font-size: 11.5px; font-weight: 700; color: #fff; text-align: left; background: var(--navy); padding: 5px 9px; border-right: 1px solid var(--navy-2); white-space: nowrap; }
.t td { padding: 3px 9px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); white-space: nowrap; height: 28px; }
.t tbody tr:hover td { background: #EFF6FF; }
.t .n { text-align: right; font-variant-numeric: tabular-nums; }
.t tfoot td { background: var(--bar); border-top: 2px solid var(--navy); font-weight: 700; height: 30px; white-space: normal; }
.t tr.gris td { color: #94A3B8; }
.t-docs { table-layout: fixed; min-width: 1040px; }
.c-tipo { width: 120px; } .c-folio { width: 70px; } .c-fecha { width: 82px; } .c-rut { width: 108px; } .c-vend { width: 92px; }
.c-total { width: 104px; } .c-sii { width: 120px; } .c-correo { width: 118px; } .c-pdf { width: 52px; }
.t-docs td { overflow: hidden; text-overflow: ellipsis; }
.folio { color: var(--link); font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
.folio:hover { text-decoration: underline; }
.gris { color: #94A3B8; }
.p { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #94A3B8; }
.p-ok { background: var(--ok); } .p-warn { background: var(--warn); } .p-err { background: var(--err); }
.pie { font-weight: 500; color: #475569; margin-right: 14px; white-space: nowrap; font-size: 12.5px; }
.pie b { color: var(--ink); }
.pie-nota { font-weight: 400 !important; font-size: 11.5px; }
.paginas { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 6px 12px; background: #F8FAFC; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.pag { display: flex; gap: 4px; align-items: center; }
.pag b { min-width: 28px; text-align: center; background: var(--navy); color: #fff; border-radius: 4px; padding: 4px 0; }
.pill { font-style: normal; display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: #EAF3FD; color: var(--blue-dk); }
.pill-ok { background: #DCFCE7; color: #166534; } .pill-warn { background: #FEF3C7; color: #92400E; }

/* Avisos en franjas */
.franja { padding: 9px 14px; border-radius: 6px; border: 1px solid; border-left-width: 4px; }
.franja-warn { background: #FFFBEB; border-color: #FCD34D; border-left-color: #D97706; color: #78350F; }
.franja-info { background: #EFF6FF; border-color: #BFDBFE; border-left-color: var(--blue); color: #1E3A5F; }
.franja a { font-weight: 700; margin-left: 6px; }

/* Indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; }
.kpi span { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.kpi b { font: 800 24px var(--head); color: var(--navy); margin: 2px 0; }
.kpi small { color: var(--muted); }
.kpi-ok { border-top-color: var(--ok); } .kpi-warn { border-top-color: var(--warn); background: #FFFBEB; }

.inicio-cols { display: grid; grid-template-columns: 1fr 300px; gap: 14px; align-items: start; }
.accesos { display: flex; flex-direction: column; }
.acceso { display: flex; flex-direction: column; padding: 10px 14px; border-bottom: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.acceso:last-child { border-bottom: 0; }
.acceso b { color: var(--blue-dk); }
.acceso span { color: var(--muted); font-size: 12px; }
.acceso:hover { background: #EFF6FF; }

/* ---------- Detalle ---------- */
.detalle { display: grid; grid-template-columns: 1fr 300px; min-height: 600px; }
.pdf-marco { background: #525659; padding: 22px; overflow: auto; }
.pdf { background: #fff; margin: 0 auto; max-width: 680px; padding: 30px 32px; font-size: 11.5px; color: #111; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.pdf.f80 { max-width: 300px; padding: 18px 16px; font-family: Consolas, "Courier New", monospace; font-size: 11px; }
.pdf-cab { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.pdf-logo { width: 56px; height: 56px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font: 800 18px var(--head); flex: none; }
.pdf-emisor { flex: 1; }
.pdf-emisor b { font-size: 14px; display: block; }
.pdf-rojo { border: 2.5px solid #C8102E; color: #C8102E; text-align: center; padding: 8px 14px; font-weight: 800; min-width: 210px; line-height: 1.6; }
.pdf-sii { text-align: right; color: #C8102E; font-weight: 700; margin-top: 4px; font-size: 10.5px; }
.pdf-rec { border: 1px solid #999; margin: 16px 0 12px; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 20px; }
.pdf-rec span { color: #555; }
.pdf table { width: 100%; border-collapse: collapse; }
.pdf th { background: #EEE; border: 1px solid #999; padding: 4px 6px; text-align: left; font-size: 10.5px; }
.pdf td { border: 1px solid #CCC; padding: 4px 6px; }
.pdf .n { text-align: right; }
.pdf-pie { display: flex; justify-content: space-between; gap: 20px; margin-top: 14px; align-items: flex-end; }
.pdf-ted { width: 230px; height: 70px; background: repeating-linear-gradient(90deg, #111 0 2px, #fff 2px 4px, #111 4px 5px, #fff 5px 8px); }
.pdf-ted-txt { font-size: 9.5px; color: #444; margin-top: 4px; }
.pdf-tot { min-width: 200px; }
.pdf-tot div { display: flex; justify-content: space-between; padding: 2px 0; }
.pdf-tot .tt { border-top: 2px solid #111; font-weight: 800; font-size: 13px; margin-top: 4px; padding-top: 4px; }
.pdf-cedible { margin-top: 14px; border: 1px dashed #777; padding: 8px 10px; font-size: 10.5px; }
.pdf-cedible b { display: block; text-align: right; }
.pdf-marca { margin-top: 10px; text-align: center; color: #888; font-size: 9.5px; }
.lado { border-left: 1px solid var(--line); padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.lado h3 { margin: 12px 0 2px; font: 800 12px var(--font); color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.lado-txt { margin: 0; color: var(--muted); }
.linea { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.linea li { display: flex; gap: 8px; align-items: baseline; }
.linea li small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.linea .pend { color: #94A3B8; }
.acciones { display: flex; flex-direction: column; gap: 6px; }
.acciones .b { justify-content: flex-start; padding: 6px 11px; }

/* ---------- Formularios ---------- */
.form-cuerpo { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.grupo { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 12px; margin: 0; }
.grupo legend { font-weight: 800; color: var(--navy); padding: 0 6px; font-size: 12.5px; }
.campos { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.c-2 { grid-column: span 2; } .c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; }
.rut-msg { font-weight: 600; min-height: 14px; }
.rut-ok { color: var(--ok); } .rut-err { color: var(--err); }
input.mal { border-color: var(--err); background: #FEF2F2; }
.t-lineas { min-width: 860px; }
.t-lineas td { padding: 3px 4px; }
.t-lineas input { height: 26px; border-color: var(--line); }
.t-lineas .n input { text-align: right; }
.c-cod { width: 90px; } .c-cant { width: 90px; } .c-un { width: 80px; } .c-precio { width: 120px; } .c-desc { width: 76px; } .c-valor { width: 120px; } .c-x { width: 36px; }
.quitar { border: 0; background: none; color: var(--err); font-size: 16px; cursor: pointer; }
.lineas-pie { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.totales { display: grid; grid-template-columns: auto 140px; gap: 4px 18px; margin: 0; min-width: 260px; }
.totales dt { color: var(--muted); font-weight: 600; text-align: right; }
.totales dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.totales .tt { font-size: 16px; color: var(--navy); font-weight: 800; border-top: 2px solid var(--navy); padding-top: 4px; }
.opciones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opcion { border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px 10px 36px; position: relative; cursor: pointer; display: flex; flex-direction: column; }
.opcion input { position: absolute; left: 12px; top: 13px; }
.opcion span { color: var(--muted); font-size: 12px; }
.opcion:has(input:checked) { border-color: var(--blue); background: #EFF6FF; box-shadow: inset 0 0 0 1px var(--blue); }
.nc-ref { align-self: end; padding: 6px 10px; background: var(--bar); border-radius: 4px; color: var(--muted); min-height: 28px; }
.nc-ref b { color: var(--ink); }
.firma { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 12px; }
.firma div { display: flex; flex-direction: column; }
.firma span { font-size: 11px; font-weight: 700; color: var(--muted); }
.barra-uso { display: inline-block; width: 110px; height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.barra-uso i { display: block; height: 100%; background: var(--blue); }
.barra-uso .uso-warn { background: var(--warn); } .barra-uso .uso-off { background: #94A3B8; }
.logo-carga { display: flex; align-items: center; gap: 14px; }
.logo-muestra { width: 64px; height: 64px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font: 800 20px var(--head); }
.drop { border: 2px dashed #94A3B8; border-radius: 8px; padding: 26px; text-align: center; color: var(--muted); margin: 6px 0 4px; }
.drop b { display: block; color: var(--navy); margin-bottom: 4px; }

/* ---------- Administración y alta de clientes ---------- */
.pill-grupo { background: #FEF3C7; color: #92400E; }
.t-admin td.chips { white-space: nowrap; }
.chip-paso { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; margin-right: 3px; border-radius: 999px; background: var(--line-2); color: var(--muted); }
.chip-paso.listo { background: #DCFCE7; color: #166534; }
.pasos { list-style: none; margin: 0; padding: 10px 12px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); counter-reset: paso; overflow-x: auto; }
.pasos li { counter-increment: paso; display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 6px; border-radius: 999px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.pasos li::before { content: counter(paso); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-size: 11.5px; }
.pasos li.actual { background: #EFF6FF; color: var(--blue-dk); }
.pasos li.actual::before { background: var(--blue); color: #fff; }
.pasos li.hecho { color: var(--ink); cursor: pointer; }
.pasos li.hecho::before { content: "✓"; background: var(--ok); color: #fff; }
.opcion-sola { max-width: 640px; }
.opcion-off { opacity: .55; cursor: not-allowed; }
.opciones-2 { grid-template-columns: repeat(2, 1fr); }
.opciones:has(> .opcion:nth-child(4)) { grid-template-columns: repeat(2, 1fr); }
.planes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.plan strong { font: 800 20px var(--head); color: var(--navy); margin: 2px 0; }
.plan strong small { font: 500 12px var(--font); color: var(--muted); }
.nota-plan { margin: 10px 0 0; }
.t-usuarios { min-width: 560px; }
.c-rol { width: 170px; }
.t-usuarios select { height: 26px; border: 1px solid var(--line); border-radius: 4px; width: 100%; font: 13px var(--font); }
.alta-botones { display: flex; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.alta-botones .b { padding: 7px 16px; font-size: 13px; white-space: normal; text-align: center; }
.resumen { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.resumen-col { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; }
.resumen-col h3 { margin: 0 0 6px; font: 800 12px var(--font); color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.resumen-col p { margin: 0 0 6px; }
.pendientes { margin: 0; padding-left: 18px; color: #92400E; }

/* ---------- Ventana propia y avisos ---------- */
.velo { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.ventana { background: #fff; border-radius: 8px; width: 100%; max-width: 460px; box-shadow: 0 30px 60px rgba(0,0,0,.35); overflow: hidden; }
.ventana h2 { margin: 0; padding: 12px 16px; background: var(--bar); border-bottom: 1px solid var(--line); font: 800 15px var(--font); color: var(--navy); }
#vCuerpo { padding: 14px 16px; }
#vCuerpo p { margin: 0 0 8px; }
.ventana .campos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ventana-botones { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.avisos { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.aviso { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 6px; border-left: 4px solid #8CC4FF; box-shadow: 0 10px 24px rgba(0,0,0,.25); max-width: 380px; animation: entra .2s ease-out; }
.aviso-ok { border-left-color: #4ADE80; }
@keyframes entra { from { transform: translateY(10px); opacity: 0; } }

/* ---------- Pantallas medianas y celular ---------- */
@media (max-width: 1100px) {
  .filtros { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .f-busca { grid-column: 1 / -1; }
  .inicio-cols, .detalle { grid-template-columns: 1fr; }
  .lado { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .top { flex-wrap: wrap; height: auto; min-height: 50px; padding: 8px 16px; gap: 10px; }
  .top-menu-btn { display: block; }
  .top-nav, .top-user { display: none; width: 100%; }
  .menu-abierto .top-nav { display: flex; flex-direction: column; height: auto; }
  .menu-abierto .top-user { display: flex; padding-bottom: 6px; }
  .top-nav > a, .desp > button { padding: 9px 4px; border-bottom: 0; height: auto; width: 100%; }
  .desp-menu { display: block; position: static; box-shadow: none; border: 0; background: transparent; padding: 0 0 4px 12px; }
  .desp-menu a, .desp-off { color: #C9D8E8; padding: 6px 4px; }
  .desp-menu a:hover { background: transparent; color: #fff; }
  .top-user select { flex: 1; max-width: none; }
  .campos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-4 { grid-column: 1 / -1; }
  .opciones, .firma { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .main { padding: 10px 10px 40px; }
  .em-giro, .em-dir { display: none !important; }
  .filtros { grid-template-columns: 1fr 1fr; }
  .campos { grid-template-columns: 1fr; }
  .c-2, .c-3, .c-4 { grid-column: auto; }
  .opciones, .firma, .opciones-2, .resumen { grid-template-columns: 1fr; }
  .opciones:has(> .opcion:nth-child(4)) { grid-template-columns: 1fr; }
  .botones { margin-left: 0; width: 100%; }
  .pdf-marco { padding: 10px; }
  .pdf { padding: 16px 12px; font-size: 10.5px; }
  .pdf th, .pdf td { padding: 3px 4px; }
  .pdf-cab { flex-wrap: wrap; }
  .pdf-rojo { min-width: 0; width: 100%; }
  .pdf-rec { grid-template-columns: 1fr; }
  .pdf-pie { flex-direction: column; align-items: stretch; }
  .pdf-ted { width: 100%; }
}
@media print {
  .top, .emisor, .botones, .filtros, .paginas, .avisos { display: none !important; }
  body { background: #fff; }
}

/* ---------- Plataforma AS (portal/): lo que la maqueta no tenía ---------- */
.franja-ok { background: #F0FDF4; border-color: #BBF7D0; border-left-color: var(--ok); color: #14532D; }
.franja-err { background: #FEF2F2; border-color: #FECACA; border-left-color: var(--err); color: #7F1D1D; }
.errores, .enlaces { margin: 6px 0 0; padding-left: 18px; }
.enlaces li { margin: 4px 0; }
.enlaces input { width: min(520px, 100%); height: 26px; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font: 12px var(--font); }
.top-nombre { color: #C9D8E8; font-size: 12.5px; white-space: nowrap; }
.top-user form { margin: 0; }
button.top-salir { background: none; border: 0; cursor: pointer; font: 600 13px var(--font); }
.recordar { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.vacio { color: var(--muted); padding: 14px 9px !important; white-space: normal !important; }
.avance { padding: 8px 12px; }
.dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.lista-mod { display: flex; flex-direction: column; gap: 4px; }
.fila-mod { display: flex; align-items: center; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.fila-mod > span { flex: 1; }
.fila-mod input[type=number] { width: 64px; height: 26px; border: 1px solid #94A3B8; border-radius: 4px; padding: 0 6px; }
.cobro-est h3 { margin: 4px 0 6px; font: 800 12px var(--font); color: var(--navy); text-transform: uppercase; letter-spacing: .5px; }
.t-mini td { height: 24px; white-space: normal; }
.t-mini td.n, .t-mini tfoot td.n { white-space: nowrap; }
.acciones-fila { display: flex; gap: 6px; }
.acciones-fila form { margin: 0; }
.fila-nuevo { grid-template-columns: 1fr 1.4fr 150px auto; border-bottom: 0; border-top: 1px solid var(--line); }
.boton-fila { justify-content: flex-end; }
.cargas { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.carga { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px dashed #94A3B8; border-radius: 6px; padding: 10px 12px; }
.carga label { display: flex; flex-direction: column; gap: 4px; }
.carga input[type=password] { height: 28px; border: 1px solid #94A3B8; border-radius: 4px; padding: 0 8px; width: 240px; max-width: 100%; }
.carga form { margin: 0; }
.carga select, .carga input[type=number] { height: 28px; border: 1px solid #94A3B8; border-radius: 4px; padding: 0 6px; }
.en-linea { display: flex; gap: 6px; }
.en-linea input { width: 80px; }
.txt-err { color: var(--err); font-weight: 700; }
.t td.envuelve { white-space: normal; min-width: 260px; }
.opciones-mod { grid-template-columns: repeat(3, 1fr) !important; }
.precio-mod { color: var(--navy) !important; font-weight: 700; margin-top: 4px; }
.cantidad { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cantidad input { width: 60px; height: 26px; border: 1px solid #94A3B8; border-radius: 4px; padding: 0 6px; }
@media (max-width: 1100px) { .dos-col, .cargas { grid-template-columns: 1fr; } .opciones-mod { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 900px) { .top-nombre { display: none; } }
@media (max-width: 640px) { .fila-nuevo { grid-template-columns: 1fr; } .opciones-mod { grid-template-columns: 1fr !important; } }
.salida { background: #0F172A; color: #CBD5E1; border-radius: 6px; padding: 10px 12px; font: 12px/1.5 Consolas, monospace; white-space: pre-wrap; max-height: 360px; overflow: auto; text-align: left; }
.pie-version { text-align: center; color: #94A3B8; font-size: 11.5px; padding: 0 16px 24px; }
.login-version { margin: 0; color: #94A3B8; font-size: 11px; }

/* ---------- Ambiente de la empresa (v1.3.0) ---------- */
.top-off { display: flex; align-items: center; padding: 0 13px; color: #6F86A0; font: 600 13px var(--font); cursor: default; white-space: nowrap; }
.top-user form select { height: 30px; max-width: 230px; border: 1px solid rgba(255,255,255,.3); background: var(--navy-2); color: #fff; border-radius: 4px; padding: 0 8px; font: 500 12.5px var(--font); }
.amb-prod { background: #DCFCE7 !important; color: #166534 !important; border-color: #86EFAC !important; }
.form-nuevo { border-bottom: 1px solid var(--line); background: #F8FAFC; }
.form-nuevo > summary { cursor: pointer; padding: 8px 12px; font-weight: 700; color: var(--blue-dk); list-style: none; }
.form-nuevo > summary::-webkit-details-marker { display: none; }
.form-nuevo[open] > summary { border-bottom: 1px solid var(--line-2); }
.form-nuevo .form-cuerpo { padding-top: 10px; }
.acciones-form { display: flex; gap: 8px; justify-content: flex-end; }
.t tr.inactivo td { color: #94A3B8; }
.t .c-acc { width: 1%; white-space: nowrap; }
.t td .acciones-fila { justify-content: flex-end; }
.solo-lectura input:disabled, .solo-lectura select:disabled { background: var(--bar); color: var(--ink); }
.nota-lectura { color: var(--muted); font-size: 12px; margin: 0; }
.paginacion { display: flex; gap: 4px; align-items: center; }
.paginacion a, .paginacion span { min-width: 28px; text-align: center; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; color: var(--navy); background: #fff; font-weight: 600; }
.paginacion .actual { background: var(--navy); color: #fff; border-color: var(--navy); }
.paginacion .off { color: #94A3B8; }
@media (max-width: 900px) { .top-off { padding: 9px 4px; } }
.filtros-2 { grid-template-columns: minmax(200px, 460px) 170px; }
.check-campo > span:last-child { display: flex; align-items: center; gap: 8px; height: 28px; font-weight: 600; color: var(--ink); font-size: 13px; }
.check-campo input { width: auto !important; height: auto !important; }
@media (max-width: 640px) { .filtros-2 { grid-template-columns: 1fr; } }
.sel-fila { height: 28px; border: 1px solid var(--line); border-radius: 4px; font: 13px var(--font); padding: 0 6px; }
.filtros-2 .f-busca { grid-column: auto; }
fieldset.form-cuerpo { border: 0; margin: 0; min-width: 0; }
@media print {
  .form-nuevo, .acciones-form, .c-acc, .t .b, .top-off, .pie-version { display: none !important; }
}
/* un botón principal bloqueado se ve azul apagado, no blanco sobre blanco */
.b-pri:disabled { background: var(--blue); color: #fff; opacity: .55; }
.b-err:disabled { background: #fff; }

/* Módulo base (BoletaPlus): marcado fijo en azul, no gris como un control apagado */
.chk-fijo{display:inline-grid;place-items:center;flex:none;width:15px;height:15px;border-radius:3px;background:var(--blue);color:#fff;font-size:11px;font-weight:700;line-height:1;cursor:help}
.fila-mod > span.chk-fijo { flex: none; }

/* ---------- Menos blanco, más «hoja SAP» (propuesta 14-11-2026) ---------- */
:root { --bg: #DCE3EB; --bar: #D5E3F2; }
.hoja { border-color: #B6C3D1; box-shadow: 0 1px 2px rgba(15,42,68,.08); }
.barra { border-left: 4px solid var(--blue); border-bottom-color: #B6C3D1; }
.barra > b { color: var(--navy); }
.form-cuerpo { background: #F4F7FA; }
.emisor { background: #EAF1F9; border-bottom-color: #B6C3D1; }
.kpi { border-color: #B6C3D1; }
.campos input, .campos select, .filtros input, .filtros select { background: #fff; }
.fila-mod { border-bottom-color: #D3DCE6; }
.t tbody tr:nth-child(even) td { background: #F4F7FA; }
.pie-version { color: #52627A; }

/* Datos tributarios: se ven en MAYÚSCULAS mientras se escriben (y se guardan así: trait EnMayusculas) */
input:is([name=razon_social], [name=giro], [name=direccion], [name=comuna], [name=ciudad]):not(:placeholder-shown) { text-transform: uppercase; }

/* ---------- BoletaPlus: emitir y documentos (v1.4.0) ---------- */
.filtros.filtros-doc { grid-template-columns: 140px 140px 170px 90px 90px minmax(160px, 1fr); }
@media (max-width: 900px) { .filtros.filtros-doc { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filtros-doc .f-busca { grid-column: 1 / -1; } .rec-datos { grid-column: 1 / -1; } }
.lado-estado { color: var(--ink); }
.lineas-pie p { margin: 6px 0 0; }
.kpi-err { border-top-color: var(--err); background: #FEF2F2; }
.t tfoot td { font-weight: 700; background: var(--bar); border-top: 2px solid var(--navy); }
@media print { .lado, .volver { display: none !important; } .detalle { display: block; } .pdf-visor { min-height: 100vh; } }
.rec-datos { grid-column: span 6; display: flex; flex-wrap: wrap; gap: 4px 22px; padding: 6px 10px; background: var(--bar); border-radius: 4px; font-size: 12.5px; min-height: 30px; align-items: center; }
.rec-datos b { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; margin-right: 4px; }
.t-lineas select { height: 26px; border: 1px solid var(--line); border-radius: 4px; width: 100%; }
.c-exe { width: 60px; text-align: center; }
.t-lineas .l-valor { font-weight: 600; white-space: nowrap; }
.pdf-marco { padding: 0; display: flex; }
.pdf-visor { flex: 1; width: 100%; min-height: 720px; border: 0; background: #525659; }
.acciones .desp-off { color: #94A3B8; cursor: default; }
@media (max-width: 900px) { .detalle { grid-template-columns: 1fr; } .pdf-visor { min-height: 520px; } }

/* Marca BoletaPlus arriba, en el ambiente del cliente */
.top-bp img { background: none; border-radius: 0; }
.top-bp span { font: 800 17px var(--head); letter-spacing: -.2px; display: flex; align-items: baseline; gap: 0; }
.top-bp b { color: #4FC3FF; font-weight: 800; }
.top-bp small { font: 500 10.5px var(--font); color: #9FB3C8; margin-left: 8px; letter-spacing: .2px; }
@media (max-width: 640px) { .top-bp small { display: none; } }
