/* Control DIOT. Idea visual: el papel de trabajo del contador, con marcatextos amarillo (pendiente) y verde (pagada). */
@font-face { font-family: "Plex"; src: url("fuentes/plex-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fuentes/plex-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fuentes/plex-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --papel: #f2f5f4;
  --hoja: #ffffff;
  --tinta: #15232d;
  --tenue: #566772;
  --raya: #d5dde0;
  --raya-suave: #e8edee;
  --pizarra: #1c3443;
  --pizarra-2: #274658;
  --verde: #1a7448;
  --verde-claro: #d6f0df;
  --amarillo: #ffe94d;
  --amarillo-claro: #fff6b0;
  --rojo: #b23a1c;
  --rojo-claro: #fbe1d8;
  --azul: #1a5a86;
  --radio: 6px;
  --fuente: "Plex", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papel); color: var(--tinta); font: 400 15px/1.5 var(--fuente); }
h1 { font-size: 1.7rem; line-height: 1.2; font-weight: 600; margin: 0 0 .3rem; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; line-height: 1.3; font-weight: 600; margin: 2rem 0 .7rem; }
h3 { font-size: .98rem; font-weight: 600; margin: 1.2rem 0 .4rem; }
p { margin: 0 0 .8rem; max-width: 74ch; }
a { color: var(--azul); text-underline-offset: 2px; }
a:hover { color: var(--pizarra); }
small, .chico { font-size: .86rem; }
.tenue { color: var(--tenue); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negativo { color: var(--rojo); }
:focus-visible { outline: 3px solid #1a5a86; outline-offset: 2px; border-radius: 3px; }
.saltar { position: absolute; left: -999px; top: 0; background: var(--amarillo); color: var(--tinta); padding: .5rem 1rem; z-index: 50; }
.saltar:focus { left: .5rem; top: .5rem; }

/* ---------- marco */
.marco { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.lateral { background: var(--pizarra); color: #dfe8ec; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.lateral-arriba { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.1rem .6rem; }
.marca { color: #fff; font-weight: 600; font-size: 1.12rem; text-decoration: none; letter-spacing: -.01em; }
.marca::before { content: ""; display: inline-block; width: .62em; height: .62em; margin-right: .45em; background: var(--amarillo); border-radius: 2px; transform: rotate(-8deg); }
.marca-oscura { color: var(--pizarra); margin: 0 0 1.2rem; }
.menu-boton { display: none; }
.menu { display: flex; flex-direction: column; flex: 1; padding: 0 .6rem 1rem; }
.menu ul { list-style: none; margin: .4rem 0 0; padding: 0; }
.menu li a, .menu .enlace { display: flex; align-items: center; justify-content: space-between; gap: .5rem; width: 100%; padding: .5rem .65rem; border-radius: var(--radio); color: #dfe8ec; text-decoration: none; font: inherit; font-size: .95rem; background: none; border: 0; cursor: pointer; text-align: left; }
.menu li a:hover, .menu .enlace:hover { background: var(--pizarra-2); color: #fff; }
.menu li a.activo { background: #fff; color: var(--pizarra); font-weight: 600; }
.menu form { margin: 0; }
.cuenta { background: var(--amarillo); color: var(--tinta); font-size: .78rem; font-weight: 600; border-radius: 99px; padding: .05rem .5rem; font-variant-numeric: tabular-nums; }
.empresa-actual { display: grid; grid-template-columns: 1fr auto; gap: 0 .5rem; margin: .3rem 0 .5rem; padding: .65rem .7rem; border: 1px solid #3c5b6d; border-radius: var(--radio); color: #fff; text-decoration: none; }
.empresa-actual:hover { background: var(--pizarra-2); color: #fff; }
.empresa-nombre { font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.empresa-rfc { grid-column: 1; font-size: .8rem; color: #a9bcc6; letter-spacing: .02em; }
.empresa-cambiar { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: .78rem; color: #a9bcc6; }
.menu-abajo { margin-top: auto !important; padding-top: 1rem !important; border-top: 1px solid #33505f; }
.quien { margin: .6rem .65rem 0; font-size: .8rem; color: #a9bcc6; }
.contenido { padding: 1.8rem 2.2rem 4rem; min-width: 0; max-width: 1500px; }

/* ---------- avisos */
.aviso { border-left: 5px solid var(--verde); background: var(--verde-claro); padding: .7rem 1rem; margin: 0 0 1rem; border-radius: 0 var(--radio) var(--radio) 0; max-width: 90ch; }
.aviso-error { border-color: var(--rojo); background: var(--rojo-claro); }
.aviso-info { border-color: var(--azul); background: #e1eef6; }
.aviso p:last-child { margin-bottom: 0; }

/* ---------- botones y formularios */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 500; font-size: .93rem; line-height: 1.2; padding: .55rem .95rem; border-radius: var(--radio); border: 1px solid var(--pizarra); background: var(--pizarra); color: #fff; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #0f2330; color: #fff; }
.btn-sec { background: var(--hoja); color: var(--pizarra); border-color: #9fb0b9; }
.btn-sec:hover { background: #e9eff1; color: var(--pizarra); }
.btn-verde { background: var(--verde); border-color: var(--verde); }
.btn-verde:hover { background: #125a37; }
.btn-peligro { background: var(--hoja); color: var(--rojo); border-color: #d9a898; }
.btn-peligro:hover { background: var(--rojo-claro); color: var(--rojo); }
.btn-chico { padding: .32rem .6rem; font-size: .84rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--azul); text-decoration: underline; cursor: pointer; }
.acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
label { font-weight: 500; font-size: .9rem; display: block; margin-bottom: .2rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  font: inherit; color: var(--tinta); background: var(--hoja); border: 1px solid #9fb0b9; border-radius: var(--radio); padding: .48rem .6rem; width: 100%; max-width: 100%; }
textarea { min-height: 6rem; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--verde); vertical-align: middle; }
.campo { margin-bottom: .9rem; max-width: 30rem; }
.campo .ayuda { font-size: .84rem; color: var(--tenue); margin: .2rem 0 0; }
.campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; max-width: 62rem; }
.hoja { background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--radio); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.hoja > :last-child { margin-bottom: 0; }
.hoja h2:first-child { margin-top: 0; }

/* ---------- cabecera de pantalla */
.cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .8rem 1.5rem; margin-bottom: 1.2rem; }
.cabecera p { margin: 0; color: var(--tenue); }
.selector-mes { display: inline-flex; align-items: center; gap: .3rem; }
.selector-mes select { width: auto; font-weight: 600; font-size: 1.02rem; padding: .42rem .5rem; }
.flecha { display: inline-flex; width: 2.2rem; height: 2.2rem; align-items: center; justify-content: center; border: 1px solid #9fb0b9; border-radius: var(--radio); background: var(--hoja); color: var(--pizarra); text-decoration: none; font-size: 1.4rem; line-height: 1; }
.flecha:hover { background: #e9eff1; }

/* ---------- renglón de totales (como el pie de una hoja de trabajo) */
.totales { display: flex; flex-wrap: wrap; background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--radio); margin-bottom: 1.2rem; }
.totales > div { flex: 1 1 150px; padding: .75rem 1rem; border-right: 1px solid var(--raya-suave); border-bottom: 1px solid var(--raya-suave); margin: 0 -1px -1px 0; }
.totales dt, .totales .rotulo { font-size: .82rem; color: var(--tenue); margin: 0; }
.totales dd, .totales .cifra { font-size: 1.28rem; font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; line-height: 1.3; }
.totales .cifra small { font-size: .8rem; font-weight: 400; color: var(--tenue); }
.totales .destaca { background: var(--amarillo-claro); }
.totales .bien { background: var(--verde-claro); }

/* ---------- tablas */
.tabla-caja { background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--radio); overflow-x: auto; margin-bottom: 1.2rem; }
table.tabla { width: 100%; border-collapse: collapse; font-size: .875rem; }
.tabla th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--tenue); padding: .55rem .6rem; border-bottom: 2px solid var(--raya); white-space: nowrap; background: var(--hoja); position: sticky; top: 0; z-index: 2; }
.tabla th.num { text-align: right; }
.tabla td { padding: .5rem .6rem; border-bottom: 1px solid var(--raya-suave); vertical-align: top; }
.tabla tbody tr:hover > td { background: #f6f9f9; }
.tabla tfoot td { font-weight: 600; border-top: 2px solid var(--raya); border-bottom: 0; background: #f6f9f9; }
table.tabla-compacta { font-size: .82rem; }
.tabla-compacta th, .tabla-compacta td { padding: .42rem .45rem; }
.tabla-compacta .prov { min-width: 9.5rem; }
.tabla .prov { font-weight: 500; overflow-wrap: anywhere; min-width: 11rem; }
.tabla .sub { display: block; font-size: .8rem; color: var(--tenue); font-weight: 400; }
.tabla td.marca-col { width: 2.6rem; padding-left: .8rem; }
.tabla td.col-quitar { width: 1%; white-space: nowrap; text-align: right; padding-right: .8rem; vertical-align: top; }
.tabla tr.es-pagada > td:first-child { box-shadow: inset 5px 0 0 var(--verde); }
.tabla tr.es-pendiente > td:first-child { box-shadow: inset 5px 0 0 var(--amarillo); }
.tabla tr.es-pagada > td { background: #f4fbf6; }
.tabla tr.es-otra > td { color: var(--tenue); }
.tabla tr.detalle > td { background: #f4fbf6; padding: .2rem .6rem .9rem 3.4rem; border-bottom: 1px solid var(--raya); }
.vacio { padding: 2.2rem 1rem; text-align: center; color: var(--tenue); }
.vacio p { margin-left: auto; margin-right: auto; }

/* marcatextos */
.marca-estado { display: inline-block; padding: .02em .5em; border-radius: .7em .25em .6em .3em; font-weight: 500; font-size: .84rem; white-space: nowrap; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.marca-estado.amarillo { background: linear-gradient(100deg, rgba(255,233,77,.55), #ffe94d 12%, rgba(255,233,77,.85) 92%, rgba(255,233,77,.5)); }
.marca-estado.verde { background: linear-gradient(100deg, rgba(150,222,176,.5), #a6e3bb 12%, rgba(166,227,187,.9) 92%, rgba(150,222,176,.5)); color: #0d4a2c; }
.marca-estado.rojo { background: var(--rojo-claro); color: var(--rojo); }
.marca-estado.gris { background: #e3e9eb; color: var(--tenue); }
.chip { display: inline-block; font-size: .76rem; padding: .02rem .45rem; border: 1px solid #b7c5cc; border-radius: 99px; color: var(--tenue); white-space: nowrap; }
.chip-nc { border-color: #d9a898; color: var(--rojo); }
.chip-papel { border-style: dashed; }
.chip-rep { border-color: #8ec3a3; color: var(--verde); }

/* ---------- filtros */
.filtros { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .9rem; }
.filtros .campo { margin: 0; min-width: 9rem; flex: 0 1 auto; }
.filtros .campo.ancho { flex: 1 1 16rem; max-width: 26rem; }
.filtros label { font-size: .8rem; color: var(--tenue); }

/* ---------- mes de trabajo */
.barra-mes { position: sticky; top: 0; z-index: 5; background: var(--papel); padding: .6rem 0 .1rem; margin: 0 0 .4rem; }
.barra-mes .totales { margin-bottom: .6rem; }
.uso-campos { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem .8rem; max-width: 60rem; align-items: end; }
.uso-campos label { font-size: .78rem; color: var(--tenue); }
.uso-campos input, .uso-campos select { padding: .34rem .5rem; font-size: .9rem; }
.guardado { font-size: .8rem; color: var(--verde); min-height: 1.2em; }
.lote { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--raya); background: #f6f9f9; font-size: .9rem; }
.lote select { width: auto; max-width: 15rem; padding: .3rem .5rem; }
.ver-pago { display: block; margin-top: .15rem; }

/* ---------- alertas de inicio */
.alertas { list-style: none; margin: 0 0 1.4rem; padding: 0; background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--radio); }
.alertas li { display: grid; grid-template-columns: 5.2rem 1fr auto; gap: .2rem 1rem; align-items: baseline; padding: .8rem 1rem; border-bottom: 1px solid var(--raya-suave); }
.alertas li:last-child { border-bottom: 0; }
.alertas .cuantas { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; line-height: 1.1; }
.alertas .que strong { font-weight: 600; }
.alertas .que span { display: block; color: var(--tenue); font-size: .88rem; }
.alertas .cuanto { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.alertas .cuanto small { display: block; color: var(--tenue); }
.alertas li.grave .cuantas { color: var(--rojo); }
.alertas li.cero { color: var(--tenue); }
.alertas li.cero .cuantas { font-weight: 400; }
.barras { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.barras li { display: grid; grid-template-columns: 7.5rem 1fr 9rem; gap: .7rem; align-items: center; font-size: .9rem; }
.barras .barra { height: 1.05rem; background: var(--raya-suave); border-radius: 3px; overflow: hidden; }
.barras .barra i { display: block; height: 100%; background: var(--amarillo); border-right: 2px solid #d8bf10; min-width: 2px; }
.dos-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1.2rem; align-items: start; }

/* ---------- carga de archivos */
.zona-carga { border: 2px dashed #8fa3ad; border-radius: 10px; background: var(--hoja); padding: 2.2rem 1.2rem; text-align: center; margin-bottom: 1rem; }
.zona-carga.zona-chica { padding: 1.2rem 1rem; }
.zona-carga.zona-chica .grande { font-size: 1.05rem; }
.tabla tr.panel > td { padding: .4rem .8rem 1rem .8rem; background: #f6f9f9; }
.tabla tr.panel label { display: block; }
.fila-pago > tr:first-child .acciones { justify-content: flex-end; }
.zona-carga.encima { border-color: var(--verde); background: var(--verde-claro); }
.zona-carga p { margin-left: auto; margin-right: auto; }
.zona-carga .grande { font-size: 1.15rem; font-weight: 600; margin-bottom: .3rem; }
.progreso { height: .7rem; background: var(--raya-suave); border-radius: 99px; overflow: hidden; margin: .6rem 0; }
.progreso i { display: block; height: 100%; width: 0; background: var(--verde); transition: width .2s; }
.resultado-carga { list-style: none; padding: 0; margin: .6rem 0 0; font-size: .9rem; max-height: 22rem; overflow-y: auto; }
.resultado-carga li { padding: .25rem 0; border-bottom: 1px solid var(--raya-suave); overflow-wrap: anywhere; }
.resultado-carga .mal { color: var(--rojo); }

/* ---------- varios */
.paginas { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1rem 0; font-size: .92rem; }
.tostada { position: fixed; right: 1rem; bottom: 1rem; max-width: min(28rem, calc(100vw - 2rem)); background: var(--pizarra); color: #fff; padding: .7rem 1rem; border-radius: var(--radio); opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .15s, transform .15s; z-index: 60; }
.tostada.visible { opacity: 1; transform: none; }
.tostada.error { background: var(--rojo); }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem 1.4rem; margin: 0 0 1rem; }
.datos dt { font-size: .8rem; color: var(--tenue); }
.datos dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.lista-empresas { list-style: none; padding: 0; margin: 0 0 1.4rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .8rem; }
.lista-empresas form { margin: 0; height: 100%; }
.lista-empresas button { width: 100%; height: 100%; text-align: left; font: inherit; color: inherit; background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--radio); padding: .9rem 1rem; cursor: pointer; display: grid; gap: .15rem; }
.lista-empresas button:hover { border-color: var(--pizarra); }
.lista-empresas .actual { border: 2px solid var(--pizarra); }
.lista-empresas strong { font-size: 1.05rem; overflow-wrap: anywhere; }
pre.txt { background: #10202a; color: #dce7ec; padding: .9rem 1rem; border-radius: var(--radio); overflow-x: auto; font-size: .8rem; line-height: 1.55; max-height: 20rem; }

/* ---------- pantallas sin menú */
body.simple { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem 1rem; }
.tarjeta-centro { width: 100%; max-width: 27rem; background: var(--hoja); border: 1px solid var(--raya); border-top: 6px solid var(--amarillo); border-radius: var(--radio); padding: 1.8rem 1.7rem; }
.tarjeta-centro.ancha { max-width: 40rem; }
.tarjeta-centro h1 { font-size: 1.45rem; }
.tarjeta-centro .campo { max-width: none; }
.tarjeta-centro .btn { width: 100%; padding: .7rem; }

/* ---------- pantallas chicas */
@media (max-width: 900px) {
  .marco { display: block; }
  .lateral { position: static; height: auto; }
  .lateral-arriba { padding: .7rem 1rem; }
  .menu-boton { display: inline-flex; font: inherit; font-weight: 500; color: #fff; background: var(--pizarra-2); border: 1px solid #47677a; border-radius: var(--radio); padding: .4rem .8rem; cursor: pointer; }
  .menu { display: none; padding: 0 .8rem 1rem; }
  .menu.abierto { display: flex; }
  .contenido { padding: 1.1rem 1rem 3rem; }
  h1 { font-size: 1.4rem; }
  .alertas li { grid-template-columns: 3.6rem 1fr; }
  .alertas .cuanto { grid-column: 2; text-align: left; }
  .barras li { grid-template-columns: 5.5rem 1fr 6.6rem; gap: .4rem; font-size: .84rem; }
  .barra-mes { position: static; }
  .tabla tr.detalle > td { padding-left: .8rem; }
  .totales > div { flex-basis: 45%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .lateral, .filtros, .acciones, .tostada, .lote, .col-quitar { display: none !important; }
  .marco { display: block; } .contenido { padding: 0; } body { background: #fff; }
}
