/* tufactu.cl · diseño "oscuro profesional" */
:root {
  --acento: #059669; --acento-hover: #047857; --acento-suave: #e7f7f1; --acento-texto: #065f46;
  --fondo: #eef1f4; --caja: #fff; --texto: #0f172a; --gris: #64748b; --gris-claro: #94a3b8;
  --borde: #e2e8f0; --borde-fuerte: #cbd5e1; --hover: #f1f5f9;
  --verde: #059669; --verde-suave: #e7f7f1; --naranjo: #f59e0b; --naranjo-suave: #fef6e4;
  --rojo: #e11d48; --rojo-suave: #fdecef; --costos: #e11d48;
  --menu: #0f172a; --menu-texto: #cbd5e1; --menu-tenue: #64748b; --menu-hover: #1e293b; --menu-borde: #1e293b;
  --radio: 12px; --radio-chico: 8px;
  --sombra: 0 1px 2px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
body { margin: 0; font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fondo); -webkit-font-smoothing: antialiased; }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .8rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 1rem 0 .5rem; }
.ti { font-size: 1.15em; line-height: 1; }

/* Menú lateral (azul noche) */
body.con-menu { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.menu { background: var(--menu); color: var(--menu-texto); padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.marca { display: flex; align-items: center; gap: .55rem; font-size: 1.25rem; color: #fff !important; font-weight: 500; letter-spacing: -.02em; padding: 0 .4rem; text-decoration: none !important; }
.marca b { font-weight: 700; color: #34d399; }
.logo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--acento); color: #fff; font-size: .85rem; font-weight: 700; }
.empresa-activa { display: flex; align-items: center; gap: .6rem; padding: .6rem; background: var(--menu-hover); border: 1px solid #334155; border-radius: var(--radio); color: #fff; text-decoration: none !important; }
.empresa-activa:hover { border-color: #475569; }
.empresa-activa .ti { color: var(--menu-tenue); margin-left: auto; }
.empresa-activa .datos small, .salir .datos small { color: var(--menu-tenue); }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--acento-suave); color: var(--acento-texto); font-weight: 700; text-transform: uppercase; }
.menu .avatar { background: rgba(52, 211, 153, .15); color: #34d399; }
.avatar.chico { width: 30px; height: 30px; border-radius: 50%; font-size: .85rem; }
.datos { display: grid; min-width: 0; line-height: 1.3; }
.datos strong { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.datos small { font-size: .75rem; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.salir .datos strong { color: #fff; }
.menu nav { display: flex; flex-direction: column; gap: 2px; }
.menu nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: var(--radio-chico); color: var(--menu-texto); font-weight: 500; font-size: .88rem; text-decoration: none; }
.menu nav a .ti { color: var(--menu-tenue); font-size: 1.2rem; }
.menu nav a:hover { background: var(--menu-hover); color: #fff; }
.menu nav a.activo { background: rgba(5, 150, 105, .18); color: #fff; box-shadow: inset 3px 0 0 #34d399; }
.menu nav a.activo .ti { color: #34d399; }
.menu nav a.deshabilitado { color: #475569; cursor: default; }
.menu nav a.deshabilitado .ti { color: #475569; }
.menu nav a.deshabilitado:hover { background: none; color: #475569; }
.menu nav a em { margin-left: auto; font-style: normal; font-size: .68rem; font-weight: 600; background: var(--menu-hover); color: var(--menu-tenue); padding: .1rem .45rem; border-radius: 99px; }
.menu nav a.admin { margin-top: .4rem; border: 1px dashed #334155; }
.menu .grupo { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--menu-tenue); padding: .9rem .65rem .3rem; }
.salir { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .7rem .4rem 0; border-top: 1px solid var(--menu-borde); }
.salir button { margin-left: auto; border: 0; background: none; color: var(--menu-tenue); padding: .4rem; box-shadow: none; }
.salir button:hover { background: var(--menu-hover); color: #fb7185; }
main { padding: 1.8rem 2.2rem; min-width: 0; max-width: 1400px; }

/* Cajas y rejillas */
.panel-caja { background: var(--caja); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; box-shadow: var(--sombra); overflow-x: auto; }
.encabezado { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.tarjeta { background: var(--caja); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; box-shadow: var(--sombra); display: grid; gap: .4rem; align-content: start; }
.tarjeta h3 { margin: 0; font-size: 1rem; }
.tarjeta p { margin: 0; color: var(--gris); font-size: .88rem; }
.tarjeta form { margin-top: .6rem; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem 1.2rem; }
.dos-columnas { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 1.25rem; align-items: start; }
.panel-grilla { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.kpi h3 { font-weight: 500; margin: 0 0 .6rem; font-size: .85rem; color: var(--gris); }
.kpi .valor { font-size: 1.65rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .5rem; }
.kpi small { font-size: .78rem; color: var(--gris); }
.kpi small.sube, .kpi small.baja { font-weight: 600; padding: .1rem .45rem; border-radius: 99px; margin-right: .3rem; }
.sube { color: var(--verde); background: var(--verde-suave); } .baja { color: var(--rojo); background: var(--rojo-suave); } .gris { color: var(--gris); }
.grafico .lienzo { position: relative; height: 320px; }

/* Formularios */
.formulario { display: grid; gap: 1rem; }
.formulario > button { justify-self: start; }
.caja-acceso .formulario > button { justify-self: stretch; justify-content: center; }
label { display: grid; gap: .35rem; font-size: .82rem; font-weight: 500; color: #344054; }
input, select { font: inherit; font-weight: 400; padding: .6rem .75rem; border: 1px solid var(--borde-fuerte); border-radius: var(--radio-chico); background: #fff; color: var(--texto); min-width: 0; box-shadow: var(--sombra); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-suave); }
input:disabled { background: var(--hover); color: var(--gris); }
button, .boton { font: inherit; font-weight: 600; font-size: .88rem; padding: .6rem 1rem; border-radius: var(--radio-chico); border: 1px solid var(--borde-fuerte); background: #fff; color: #344054; cursor: pointer; text-decoration: none !important; display: inline-flex; align-items: center; gap: .4rem; box-shadow: var(--sombra); transition: background .15s; }
button:hover, .boton:hover { background: var(--hover); }
.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.primario:hover { background: var(--acento-hover); }
.boton.peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.chico { font-size: .74rem; padding: .3rem .65rem; margin-top: .35rem; }
button.enlace { background: none; border: 0; padding: 0; color: var(--acento); font-weight: 600; box-shadow: none; }
button.enlace:hover { text-decoration: underline; background: none; }
button.enlace.peligro { color: var(--rojo); }
.en-linea { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; }
.filtros input[type=search] { flex: 1; min-width: 200px; }
.rango-fechas { display: flex; justify-content: flex-end; gap: .8rem; margin-bottom: 1.25rem; }
.rango-fechas label { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio-chico); padding: .45rem .75rem; font-size: .75rem; color: var(--gris); box-shadow: var(--sombra); }
.rango-fechas input { border: 0; padding: 0; box-shadow: none; font-weight: 600; }
.ayuda { font-size: .8rem; color: var(--gris); margin: 0; }
.pasos { display: flex; gap: .5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.pasos span { padding: .3rem .85rem; border-radius: 99px; background: var(--hover); color: var(--gris); font-size: .8rem; font-weight: 500; }
.pasos .hecho { background: var(--verde-suave); color: var(--verde); } .pasos .actual { background: var(--acento); color: #fff; }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; font-size: .87rem; }
.tabla th, .tabla td { padding: .7rem .8rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
.tabla thead th { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--gris); background: #f9fafb; }
.tabla tbody tr:hover { background: #fafbfc; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla.oscura thead th { background: #f9fafb; color: var(--gris); }
.tabla.ficha th { width: 180px; color: var(--gris); font-weight: 500; background: none; text-transform: none; font-size: .85rem; letter-spacing: 0; }
.tabla .acciones { display: flex; gap: .9rem; justify-content: flex-end; }
.centro { text-align: center !important; }
.nowrap { white-space: nowrap; }
.fila-critico { background: #fff8f9; }
.fila-bajo { background: #fffbf3; }
.vacio { color: var(--gris); text-align: center; padding: 2rem; }

/* Etiquetas y semáforo */
.etiqueta { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; }
.etiqueta.normal { background: var(--verde-suave); color: var(--verde); }
.etiqueta.bajo { background: var(--naranjo-suave); color: #b54708; }
.etiqueta.critico { background: var(--rojo-suave); color: var(--rojo); }
.folios h2 { margin-bottom: .2rem; }
.folios > p { color: var(--gris); font-size: .82rem; margin: 0 0 .9rem; }
.leyenda { display: flex; justify-content: space-around; text-align: center; font-size: .78rem; color: var(--gris); margin-top: 1rem; }
.leyenda b { color: var(--texto); }
.punto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; }
.punto.normal { background: var(--verde); } .punto.bajo { background: var(--naranjo); } .punto.critico { background: var(--rojo); }

/* Alertas */
.alerta { display: flex; gap: .6rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radio); margin-bottom: 1.1rem; border: 1px solid; font-size: .88rem; font-weight: 500; }
.alerta .ti { font-size: 1.2rem; margin-top: .05rem; }
.alerta ul { margin: 0; padding-left: 1.1rem; }
.alerta.ok { background: var(--verde-suave); color: #05603a; border-color: #a6e9cf; }
.alerta.aviso { background: var(--naranjo-suave); color: #93370d; border-color: #fedf89; }
.alerta.error { background: var(--rojo-suave); color: #9f1239; border-color: #fecdd6; }

/* Acceso */
body.publico { display: grid; place-items: center; min-height: 100vh; background: var(--fondo); background-image: radial-gradient(circle at 15% 0%, #1e293b 0, transparent 55%), linear-gradient(160deg, #0f172a 0%, #0f172a 45%, #064e3b 100%); }
body.publico main { width: 100%; max-width: 430px; padding: 16px; }
.caja-acceso { background: #fff; border: 1px solid var(--borde); border-radius: 16px; padding: 2.2rem; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); }
.caja-acceso h1 { font-weight: 500; font-size: 1.9rem; letter-spacing: -.03em; }
.caja-acceso h1 b { color: var(--acento); font-weight: 700; }
.caja-acceso > p { color: var(--gris); margin: .4rem 0 1.6rem; }
.caja-acceso { border-color: transparent; box-shadow: 0 24px 48px rgba(2, 6, 23, .45); }
.caja-acceso .pie { text-align: center; font-size: .88rem; color: var(--gris); margin-top: 1.4rem; }

/* Campos RUT */
input.rut-ok { border-color: var(--verde); }
input.rut-error { border-color: var(--rojo); box-shadow: 0 0 0 4px var(--rojo-suave); }
.aviso-rut { color: var(--rojo); font-size: .78rem; font-weight: 500; }
.aviso-rut:empty { display: none; }

/* Clave SII y pie del gráfico */
label.casilla { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; color: var(--texto); }
label.casilla input { margin-top: .2rem; box-shadow: none; accent-color: var(--acento); }
.pie-grafico { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--borde); }

@media (max-width: 1100px) {
  .panel-grilla, .dos-columnas { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  body.con-menu { grid-template-columns: 1fr; }
  .menu { position: static; height: auto; }
  main { padding: 16px; }
  .kpis { grid-template-columns: 1fr; }
  .rango-fechas { justify-content: stretch; flex-direction: column; }
}

/* Tarjeta de resultado operativo */
.columna { display: grid; gap: 1.25rem; align-content: start; }
.columna > .panel-caja { margin-bottom: 0; }
.resultado { text-align: right; padding: 1.4rem 1.6rem; }
.resultado .cifra { font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.resultado .cifra.grande { font-size: 2.6rem; color: var(--texto); }
.resultado .cifra.negativo { color: var(--rojo); }
.resultado .cifra.ingreso { color: #14b8a6; }
.resultado .cifra.gasto { color: var(--rojo); }
.resultado .rotulo { font-size: .85rem; color: var(--gris); margin: .3rem 0 1.1rem; }
.resultado .rotulo:last-child { margin-bottom: 0; }
.resultado .rotulo::first-letter { text-transform: uppercase; }

/* Proyección de impuesto (F29) */
.impuesto h2 { display: flex; align-items: center; gap: .45rem; }
.impuesto h2 .ti { color: var(--acento); }
.desglose { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.desglose td { padding: .35rem 0; color: var(--gris); }
.desglose td:last-child { text-align: right; color: var(--texto); font-weight: 500; white-space: nowrap; }
.desglose .subtotal td { border-top: 1px solid var(--borde); padding-top: .55rem; color: var(--texto); font-weight: 600; }
.total-impuesto { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: .9rem 0 .7rem; padding: .8rem 1rem; border-radius: var(--radio-chico); background: var(--menu); color: #cbd5e1; }
.total-impuesto strong { font-size: 1.5rem; font-weight: 700; color: #fff; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* Resultados de tu empresa (comparativo 1M / 3M / 12M) */
.resultados-empresa { margin-top: 1.25rem; }
.encabezado-seccion { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.encabezado-seccion h2 { margin: 0; }
.selector { display: inline-flex; gap: 4px; padding: 4px; background: var(--hover); border-radius: 10px; }
.selector button { border: 0; box-shadow: none; background: none; color: var(--gris); padding: .4rem .9rem; font-size: .85rem; }
.selector button:hover { background: #fff; }
.selector button[aria-selected="true"] { background: var(--menu); color: #fff; }
.tabla.comparativa { font-variant-numeric: tabular-nums; }
.tabla.comparativa thead th { background: var(--menu); color: #fff; font-size: .8rem; text-transform: none; letter-spacing: 0; }
.tabla.comparativa thead th:first-child { border-top-left-radius: var(--radio-chico); }
.tabla.comparativa thead th:last-child { border-top-right-radius: var(--radio-chico); }
.tabla.comparativa tbody th { background: var(--menu); color: #fff; font-weight: 600; width: 26%; white-space: nowrap; }
.tabla.comparativa tbody th .ti { color: var(--menu-tenue); cursor: help; margin-left: .2rem; }
.tabla.comparativa tbody tr:hover { background: none; }
.tabla.comparativa tr.total td { font-weight: 700; }
.tabla.comparativa td.negativo { color: var(--rojo); }
.tabla.comparativa td .sube, .tabla.comparativa td .baja { font-weight: 600; padding: .1rem .45rem; border-radius: 99px; }
.resultados-empresa .ayuda { margin-top: .8rem; }

/* Panel: barra de sincronización y bloques mes / año / impuesto */
.barra-sincronizacion { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.barra-sincronizacion .ayuda { display: flex; align-items: center; gap: .4rem; }
.horizontes { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 1.25rem; margin-bottom: 1.25rem; align-items: stretch; }
.horizontes .panel-caja { margin-bottom: 0; }
.horizonte h2 { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--gris); font-weight: 600; }
.horizonte h2 .ti { color: var(--acento); }
.cifra-principal { font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.bajada { font-size: .8rem; color: var(--gris); margin: .25rem 0 .8rem; }
.bajada .sube, .bajada .baja { font-weight: 600; padding: .05rem .4rem; border-radius: 99px; }
.desglose td.negativo { color: var(--rojo); }
.desglose .ti { color: var(--gris-claro); cursor: help; }
.avance { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; margin: .9rem 0 .35rem; }
.avance i { display: block; height: 100%; border-radius: 99px; background: var(--acento); }
.impuesto .ayuda span[title] { cursor: help; white-space: nowrap; }
.grafico .encabezado-seccion { margin-bottom: .6rem; }
.grafico .rango-fechas { justify-content: flex-start; margin: .9rem 0 0; padding-top: .9rem; border-top: 1px solid var(--borde); }
.grafico .selector button { padding: .35rem .7rem; font-size: .8rem; }

/* Bloques horizontales: cifra principal + fila de mini indicadores */
.horizonte { display: flex; flex-direction: column; }
.horizonte h2 { margin-bottom: .7rem; }
.horizonte .bajada { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.mini-datos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; padding: .75rem 0 0; border-top: 1px solid var(--borde); margin-top: auto; }
.mini-datos div { display: grid; gap: .15rem; min-width: 0; }
.mini-datos span { font-size: .72rem; color: var(--gris); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-datos b { font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-datos b.negativo { color: var(--rojo); }
.nota-pie { font-size: .78rem; color: var(--gris); margin: .7rem 0 0; display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.nota-pie b { color: var(--texto); }
.nota-pie .ti { color: var(--acento); }
.nota-pie span[title] .ti { color: var(--gris-claro); cursor: help; }
.pastilla { font-size: .72rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px; background: var(--naranjo-suave); color: #b54708; }
.impuesto .cifra-principal { color: var(--texto); }
.horizonte .avance { margin: .8rem 0 0; }

/* Folios compactos: misma altura que el gráfico */
.panel-grilla { align-items: stretch; }
.panel-grilla > .panel-caja { margin-bottom: 0; }
.panel-grilla + .horizontes { margin-top: 1.25rem; }
.folios { display: flex; flex-direction: column; }
.lista-folios { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; grid-auto-rows: minmax(44px, 1fr); }
.lista-folios li { display: flex; align-items: center; gap: .55rem; padding: .6rem .7rem; border-radius: var(--radio-chico); border: 1px solid var(--borde); background: #fff; font-size: .85rem; }
.lista-folios li.fila-critico { background: #fff8f9; border-color: #fbd5dd; }
.lista-folios li.fila-bajo { background: #fffbf3; border-color: #fde7c2; }
.lista-folios .nombre { flex: 1; min-width: 0; font-weight: 600; line-height: 1.3; }
.lista-folios .punto { margin: 0; flex: none; }
.lista-folios .etiqueta { min-width: 2.2rem; text-align: center; }
.lista-folios .boton.chico { margin: 0; padding: .28rem .55rem; font-size: .72rem; box-shadow: none; }
.folios .leyenda { margin-top: auto; padding-top: .9rem; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.folios .leyenda > span { display: inline-flex; align-items: center; gap: .1rem; }

/* Emisión de documentos */
.emision .panel-caja { overflow: visible; }
.emision label.ancho { grid-column: span 2; }
.emision details summary { cursor: pointer; font-weight: 600; margin-bottom: .6rem; }
.tabla.items td { padding: .4rem .4rem; }
.tabla.items input, .tabla.items select { width: 100%; box-shadow: none; }
.tabla.items td:first-child { width: 45%; }
.num, .tabla th.num, .tabla td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla.items .monto { font-weight: 600; white-space: nowrap; }
.totales-doc { display: grid; grid-template-columns: repeat(4, auto); justify-content: end; gap: .3rem 1.6rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--borde); }
.totales-doc div { display: grid; text-align: right; }
.totales-doc span { font-size: .75rem; color: var(--gris); }
.totales-doc b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.totales-doc .total b { font-size: 1.35rem; color: var(--acento); }
label.compacto { gap: .4rem; font-size: .8rem; }
.fila-enlace { cursor: pointer; }

/* Estado del documento en el SII */
.estado-sii { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .6rem; border-radius: 99px; background: var(--hover); color: var(--gris); white-space: nowrap; }
.estado-sii.aceptado { background: var(--verde-suave); color: var(--verde); }
.estado-sii.reparos, .estado-sii.enviado, .estado-sii.en_proceso { background: var(--naranjo-suave); color: #b54708; }
.estado-sii.rechazado { background: var(--rojo-suave); color: var(--rojo); }
.estado-documento { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.estado-linea { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; font-size: .85rem; }

/* Representación impresa del DTE */
.representacion { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 2rem; max-width: 900px; font-size: .85rem; color: #111; }
.rep-encabezado { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.4rem; }
.rep-emisor h2 { font-size: 1.15rem; margin: 0 0 .3rem; }
.rep-emisor p { margin: 0; color: #444; }
.rep-recuadro { border: 3px solid #d0021b; color: #d0021b; text-align: center; padding: .8rem 1.4rem; min-width: 250px; font-weight: 700; }
.rep-recuadro p { margin: .2rem 0; font-size: 1rem; }
.rep-recuadro .rep-tipo { font-size: .95rem; }
.rep-recuadro small { font-size: .75rem; }
.rep-receptor { width: 100%; border: 1px solid #ccc; border-collapse: collapse; margin-bottom: 1.2rem; }
.rep-receptor th, .rep-receptor td { padding: .35rem .6rem; text-align: left; border-bottom: 1px solid #eee; }
.rep-receptor th { width: 110px; color: #555; font-weight: 600; }
.rep-items { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.rep-items th { background: #f1f3f5; padding: .45rem .6rem; text-align: left; font-size: .78rem; }
.rep-items td { padding: .45rem .6rem; border-bottom: 1px solid #eee; }
.rep-referencias { font-size: .8rem; margin-bottom: 1rem; }
.rep-referencias p { margin: .15rem 0; }
.rep-pie { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; }
.rep-timbre { width: 320px; flex: none; text-align: center; }
.rep-timbre svg { width: 100%; height: auto; }
.rep-timbre p { font-size: .72rem; margin: .3rem 0 0; }
.rep-totales { border-collapse: collapse; min-width: 240px; }
.rep-totales th, .rep-totales td { padding: .3rem .6rem; text-align: right; }
.rep-totales th { color: #555; font-weight: 600; }
.rep-totales .total th, .rep-totales .total td { font-size: 1.05rem; font-weight: 700; border-top: 2px solid #111; }

@media print {
  body.con-menu { display: block; background: #fff; }
  .menu, .no-imprimir, .alerta { display: none !important; }
  main { padding: 0; }
  .representacion { border: 0; padding: 0; max-width: none; }
}

/* Importación de clientes desde el SII */
.importar-sii select { padding: .5rem .6rem; font-size: .85rem; }
a.etiqueta { text-decoration: none !important; margin-left: .3rem; }

/* Datos para transferencia en la factura */
.rep-pago { display: flex; flex-wrap: wrap; gap: .15rem 1.2rem; align-items: baseline; border: 1px solid #ccc; border-radius: 6px; padding: .55rem .8rem; margin-bottom: 1rem; font-size: .8rem; }
.rep-pago b { width: 100%; font-size: .82rem; margin-bottom: .1rem; }

/* Logo de la empresa */
.logo-empresa { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.logo-empresa > div:last-child { display: grid; gap: .6rem; }
.vista-logo { width: 260px; height: 90px; display: grid; place-items: center; border: 1px dashed var(--borde-fuerte); border-radius: var(--radio-chico); background: #fff; padding: .6rem; }
.vista-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rep-logo { display: block; max-width: 240px; max-height: 64px; object-fit: contain; margin-bottom: .6rem; }

/* Usuarios e invitaciones */
.invitar input[type=email] { flex: 1; min-width: 240px; }
.roles-ayuda { margin: .9rem 0 0; padding-left: 1.1rem; color: var(--gris); font-size: .82rem; display: grid; gap: .2rem; }
.roles-ayuda b { color: var(--texto); }
.enlace-invitacion { border-color: #a6e9cf; background: var(--verde-suave); }
.enlace-invitacion input { flex: 1; min-width: 280px; font-family: ui-monospace, monospace; font-size: .8rem; }

/* Copia cedible: acuse de recibo (Ley 19.983) */
.rep-acuse { border: 1px solid #333; padding: .6rem .8rem; margin-bottom: 1rem; font-size: .75rem; }
.rep-acuse table { width: 100%; border-collapse: collapse; margin-bottom: .4rem; }
.rep-acuse th { text-align: left; width: 70px; padding: .55rem .3rem .2rem; font-weight: 600; }
.rep-acuse td { border-bottom: 1px solid #555; padding: .55rem .3rem .2rem; }
.rep-acuse p { margin: 0; font-size: .7rem; color: #333; }
.rep-cedible { font-size: 1.05rem !important; font-weight: 700; letter-spacing: .15em; margin-top: .4rem !important; }

/* Descuentos en la emisión */
.descuento-global { display: flex; align-items: center; gap: .6rem; justify-content: flex-end; margin-top: .8rem; font-size: .82rem; }
.descuento-global input { width: 90px; }
.tabla.items td:first-child { width: 38%; }

/* Envío del documento al cliente */
.enviar-cliente { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--borde); }
.enviar-cliente input[type=text] { min-width: 320px; }

/* Menú por tareas: botón "Emitir documento" desplegable y avisos */
.menu details.emitir { border-radius: var(--radio-chico); margin-bottom: .5rem; }
.menu details.emitir[open] { background: var(--menu-hover); padding-bottom: .3rem; }
.menu details.emitir summary { list-style: none; display: flex; align-items: center; justify-content: center; gap: .5rem; background: var(--acento); color: #fff; border-radius: var(--radio-chico); padding: .6rem; font-weight: 600; font-size: .88rem; cursor: pointer; }
.menu details.emitir summary::-webkit-details-marker { display: none; }
.menu details.emitir summary:hover { background: var(--acento-hover); }
.menu details.emitir summary .ti-chevron-down { font-size: .95rem; transition: transform .15s; }
.menu details.emitir[open] summary .ti-chevron-down { transform: rotate(180deg); }
.menu details.emitir a { margin: .15rem .3rem 0; font-size: .85rem; }
.menu nav a em.aviso { background: var(--naranjo); color: #422006; }

/* Pestañas dentro de una sección (Configuración, Clientes y proveedores) */
.pestanas { display: flex; gap: .2rem; border-bottom: 1px solid var(--borde); margin: 0 0 1.25rem; overflow-x: auto; }
.pestanas a { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; color: var(--gris); font-weight: 500; font-size: .88rem; text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.pestanas a:hover { color: var(--texto); }
.pestanas a.activa { color: var(--acento-texto); border-bottom-color: var(--acento); }

/* Guardar como plantilla (en el detalle del documento) */
.guardar-plantilla { position: relative; }
.guardar-plantilla summary { list-style: none; cursor: pointer; }
.guardar-plantilla summary::-webkit-details-marker { display: none; }
.guardar-plantilla form { position: absolute; z-index: 5; top: calc(100% + .4rem); left: 0; background: var(--caja); border: 1px solid var(--borde); border-radius: var(--radio-chico); padding: .6rem; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); }
.guardar-plantilla input { min-width: 260px; }

/* Cobranza: estado de pago de los documentos */
.estado-pago { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.estado-pago.pendiente { background: var(--naranjo-suave); color: #92400e; }
.estado-pago.abonada { background: #e0f2fe; color: #075985; }
.estado-pago.pagada { background: var(--verde-suave); color: var(--acento-texto); }
.estado-pago.anulada { background: var(--hover); color: var(--gris); }
.cobranza .mini-datos { margin-bottom: 1rem; }
.pagos-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; }
.pagos-form label { display: grid; gap: .25rem; font-size: .8rem; color: var(--gris); }
.pagos-form input[name=monto] { width: 9rem; }
.cobro-antiguos { list-style: none; margin: 0; padding: 0; font-size: .85rem; }
.cobro-antiguos li { display: flex; gap: .4rem; align-items: baseline; padding: .4rem 0; border-top: 1px solid var(--borde); }
.cobro-antiguos li b { margin-left: auto; white-space: nowrap; }

/* Gráfico: vista de productos sin datos */
.lienzo .sin-datos { margin: 0; height: 100%; display: grid; place-items: center; text-align: center; color: var(--gris); font-size: .9rem; padding: 0 2rem; }
.lienzo .sin-datos[hidden] { display: none; }
/* Seis vistas en el gráfico: las pestañas van bajo el título, en una línea (con desplazamiento si no caben) */
.grafico .encabezado-seccion { flex-wrap: wrap; }
.grafico .selector { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
.grafico .selector button { white-space: nowrap; flex: 0 0 auto; }

/* Cotizaciones: estado */
.estado-cotizacion { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 99px; white-space: nowrap; }
.estado-cotizacion.borrador { background: var(--hover); color: var(--gris); }
.estado-cotizacion.enviada { background: #e0f2fe; color: #075985; }
.estado-cotizacion.aceptada { background: var(--verde-suave); color: var(--acento-texto); }
.estado-cotizacion.facturada { background: var(--menu); color: #fff; }
.estado-cotizacion.rechazada { background: var(--rojo-suave); color: #9f1239; }
.estado-cotizacion.vencida { background: var(--naranjo-suave); color: #92400e; }

/* Correo corporativo */
.estado-correo { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .75rem; }
.estado-correo > i { font-size: 1.6rem; color: var(--acento); }
.estado-correo strong { display: block; overflow-wrap: anywhere; }
#ayuda-proveedor p[hidden] { display: none; }

/* Suscripción */
.estado-suscripcion { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.estado-suscripcion > div { display: flex; flex-direction: column; gap: .2rem; }
.estado-suscripcion strong { font-size: 1.15rem; }
.opciones-pago { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.opcion-pago { border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.opcion-pago.destacada { border-color: var(--acento); background: var(--acento-suave); }
.opcion-pago h3 { margin: 0; font-size: 1rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.precio-uf { font-size: 1.6rem; font-weight: 700; }
.precio-uf small { font-size: .85rem; font-weight: 500; color: var(--gris); }
.aviso-suscripcion a { font-weight: 600; margin-left: .3rem; }
.comprobantes-pendientes { border-left: 4px solid var(--naranjo); }

/* Indicadores económicos (barra del panel) */
.indicadores { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; flex: 1; justify-content: center; }
.indicadores li { display: flex; align-items: baseline; gap: .35rem; background: var(--caja); border: 1px solid var(--borde);
  border-radius: 999px; padding: .3rem .75rem; font-size: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.indicadores li .gris { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.indicadores li small { font-size: .7rem; display: inline-flex; align-items: center; }
@media (max-width: 760px) { .indicadores { justify-content: flex-start; order: 3; flex-basis: 100%; } }
.indicadores li small.sube, .indicadores li small.baja { padding: 0 .35rem; border-radius: 99px; font-weight: 600; }
.barra-sincronizacion > .ayuda { flex: 0 1 300px; flex-wrap: wrap; row-gap: 0; margin: 0; }
.indicadores { gap: .35rem; }
.indicadores li { padding: .25rem .6rem; gap: .3rem; font-size: .78rem; }
@media (max-width: 1450px) and (min-width: 761px) { .indicadores .ind-euro { display: none; } }

/* Actividad de cuentas (Administración) */
.punto-actividad { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.punto-actividad.activo { background: var(--verde); } .punto-actividad.tibio { background: var(--naranjo); } .punto-actividad.inactivo { background: var(--rojo); }

/* Código interno de ítems en cotizaciones (no sale en el PDF) */
input.codigo-interno { width: 7.5rem; background: var(--hover); border-style: dashed; font-family: ui-monospace, monospace; font-size: .8rem; }
td.codigo-interno { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--gris); }

/* Formato de documentos (Configuración) */
.formatos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin: .8rem 0; }
.formato { border: 1px solid var(--borde); border-radius: var(--radio); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.formato.elegido { border: 2px solid var(--acento); background: var(--acento-suave); }
.formato h3 { margin: 0; font-size: 1rem; display: flex; gap: .4rem; align-items: center; }
.formato .ayuda { margin: 0; flex: 1; }
.miniatura { position: relative; height: 150px; background: #fff; border: 1px solid var(--borde-fuerte); border-radius: 4px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .08); overflow: hidden; }
.miniatura span { position: absolute; display: block; border-radius: 2px; }
.m-logo { left: 8%; top: 8%; width: 28%; height: 12%; background: #cbd5e1; }
.m-recuadro { right: 7%; top: 7%; width: 32%; height: 20%; border: 2px solid #dc2626; }
.m-linea { left: 8%; top: 34%; width: 60%; height: 4px; background: #e2e8f0; }
.m-linea.corta { top: 40%; width: 40%; }
.m-tabla { left: 8%; right: 8%; top: 50%; height: 26%; background: repeating-linear-gradient(#fff 0 7px, #f1f5f9 7px 9px); border-top: 6px solid #e2e8f0; }
.m-total { right: 8%; bottom: 7%; width: 30%; height: 9%; background: #e2e8f0; }
.miniatura-corporativo .m-logo { background: #93c5fd; }
.miniatura-corporativo .m-tabla { border-top-color: #1d4ed8; }
.miniatura-corporativo .m-total { background: #1d4ed8; }
.miniatura-corporativo .m-linea { background: #bfdbfe; }
.miniatura-minimalista .m-recuadro { border: 1.5px solid #111; }
.miniatura-minimalista .m-tabla { border-top: 1px solid #111; background: repeating-linear-gradient(#fff 0 8px, #e5e7eb 8px 9px); }
.miniatura-minimalista .m-total { background: none; border-top: 2px solid #111; border-radius: 0; }
.miniatura-minimalista .m-logo { background: #e5e7eb; }
.check-cobro { display: flex; align-items: center; gap: .4rem; margin-bottom: .25rem; } .check-cobro .casilla { margin: 0; font-weight: 600; }

/* Referidos */
.enlace-referido { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.enlace-referido input { flex: 1 1 260px; font-family: ui-monospace, monospace; font-size: .85rem; background: var(--hover); }
.tabla-desplazable { overflow-x: auto; }

/* ===== Portada pública ===== */
body.portada { background: var(--fondo); color: var(--texto); margin: 0; }
.portada .marca { color: var(--texto) !important; padding: 0; }
.portada .marca b { color: var(--acento); }
.p-cabecera { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .8rem max(16px, calc((100% - 1120px) / 2)); background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borde); }
.p-cabecera nav { display: flex; align-items: center; gap: 1.1rem; }
.p-cabecera nav a:not(.boton) { color: var(--texto); font-weight: 500; font-size: .92rem; text-decoration: none; }
.p-hero { text-align: center; padding: 4.5rem 16px 3.5rem; color: #fff;
  background: radial-gradient(circle at 15% 0%, #1e293b 0, transparent 55%), linear-gradient(160deg, #0f172a 0%, #0f172a 45%, #064e3b 100%); }
.p-hero h1 { font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.1; letter-spacing: -.03em; max-width: 820px; margin: 1rem auto; font-weight: 800; }
.p-hero h1 span { color: #34d399; }
.p-hero > p { max-width: 640px; margin: 0 auto 1.6rem; font-size: 1.1rem; color: #cbd5e1; line-height: 1.55; }
.p-acciones { justify-content: center; flex-wrap: wrap; }
.boton.grande { font-size: 1rem; padding: .85rem 1.4rem; }
.p-nota { margin-top: 1.2rem; font-size: .88rem; color: #94a3b8; }
.p-sello { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .3rem .8rem;
  border-radius: 999px; background: rgba(52, 211, 153, .15); color: #34d399; border: 1px solid rgba(52, 211, 153, .35); }
.p-cercania { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; max-width: 1120px;
  margin: -2rem auto 0; padding: 0 16px; position: relative; }
.p-cercania > div, .p-funciones > div { background: var(--caja); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.3rem; box-shadow: var(--sombra); }
.p-cercania i, .p-funciones i { font-size: 1.7rem; color: var(--acento); }
.p-cercania h3, .p-funciones h3 { margin: .5rem 0 .3rem; font-size: 1.02rem; }
.p-cercania p, .p-funciones p { margin: 0; color: var(--gris); font-size: .92rem; line-height: 1.5; }
.p-seccion { max-width: 1120px; margin: 0 auto; padding: 4rem 16px 0; }
.p-seccion > h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -.02em; text-align: center; margin: 0 0 .5rem; }
.p-sub { text-align: center; color: var(--gris); margin: 0 0 1.6rem; }
.p-funciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1.6rem; }
.p-precios { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.p-plan { background: var(--caja); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.5rem; display: flex; flex-direction: column; gap: .4rem; }
.p-plan.destacado { border: 2px solid var(--acento); box-shadow: 0 8px 24px rgba(5, 150, 105, .12); }
.p-plan h3 { margin: 0; }
.p-valor { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; }
.p-valor small { font-size: .85rem; font-weight: 500; color: var(--gris); }
.p-plan ul, .p-contadores ul { list-style: none; padding: 0; margin: .6rem 0 1rem; display: grid; gap: .45rem; flex: 1; }
.p-plan li i, .p-contadores li i { color: var(--acento); margin-right: .3rem; }
.p-plan .boton { justify-content: center; }
.p-contadores > div { background: var(--menu); color: #e2e8f0; border-radius: var(--radio); padding: 2.2rem; }
.p-contadores h2 { color: #fff; text-align: left; margin: .8rem 0 .5rem; font-size: clamp(1.4rem, 3vw, 1.9rem); }
.p-contadores p { color: #cbd5e1; max-width: 680px; line-height: 1.55; }
.p-pie { max-width: 1120px; margin: 4rem auto 0; padding: 2rem 16px 2.5rem; border-top: 1px solid var(--borde);
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.p-pie > div:first-child { max-width: 560px; }
.p-pie p { color: var(--gris); font-size: .85rem; line-height: 1.5; }
.p-contacto { display: flex; flex-direction: column; gap: .5rem; font-size: .92rem; }
.p-contacto a, .p-contacto span { color: var(--texto); display: inline-flex; gap: .4rem; align-items: center; text-decoration: none; }
@media (max-width: 760px) {
  .p-cabecera nav a:not(.boton):not(.p-ingresar) { display: none; }
  .p-hero { padding-top: 3rem; }
  .p-contadores > div { padding: 1.4rem; }
}
.empresa-cobrada { border-top: 1px solid var(--borde); padding: .9rem 0; display: flex; flex-direction: column; gap: .4rem; }
.empresa-cobrada h3 { margin: 0; font-size: 1rem; }
.empresa-cobrada .alerta { margin: 0; }
.tabla-simulacion input[type=text], .tabla-simulacion input:not([type]) { min-width: 8rem; }
.texto-correo { white-space: pre-wrap; background: var(--hover); padding: .8rem; border-radius: var(--radio-chico); font-family: inherit; font-size: .85rem; }
