/* Aplicación de puntos de pagos ViboralTV — único sistema de estilo para todas las páginas. */

:root {
  --fondo: #f5f7f2;
  --superficie: #ffffff;
  --tinta: #1e2a12;
  --tinta-suave: #5b6650;
  --borde: #dfe3d8;
  --verde: #71b100;
  --verde-oscuro: #3d6100;
  --verde-tinte: #eef7d6;
  --naranja: #e08709;
  --naranja-tinte: #fdf1dc;
  --rojo: #c0392b;
  --rojo-tinte: #fbe9e7;
  --radio: 6px;
  --fuente: "Lato", "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--fuente);
  color: var(--tinta);
  /* Fondo: velo gris claro→oscuro por encima de los tintes verde/oro y la trama de puntos; fijo al hacer scroll */
  background-color: var(--fondo);
  background-image:
    linear-gradient(180deg, rgba(235,237,232,.2) 0%, rgba(120,124,116,.35) 50%, rgba(35,38,33,.6) 100%),
    radial-gradient(ellipse 55% 45% at 0% 0%, rgba(113,177,0,.13), transparent 70%),
    radial-gradient(ellipse 50% 45% at 100% 100%, rgba(224,135,9,.14), transparent 70%),
    radial-gradient(rgba(30,42,18,.07) 1px, transparent 1.2px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 22px 22px;
  background-attachment: fixed;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--verde-oscuro); }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; font-weight: 900; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
.monto { font-variant-numeric: tabular-nums; font-weight: 900; white-space: nowrap; }
.suave { color: var(--tinta-suave); }
.oculto { display: none !important; }
:focus-visible { outline: 3px solid var(--naranja); outline-offset: 2px; }

/* Barra superior — blanca con franja oro corporativo; el logo naranja resalta sobre el blanco */
.topbar {
  background: #fff;
  border-bottom: 4px solid var(--naranja);
  color: var(--verde-oscuro);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  height: 76px;
}
.topbar__marca { display: flex; align-items: center; gap: .6rem; color: var(--verde-oscuro); text-decoration: none; font-weight: 900; }
.topbar__logo { height: 66px; width: 66px; border-radius: 50%; padding: 1px; object-fit: contain; }
.topbar__nav { display: flex; gap: .25rem; margin-left: .5rem; }
.topbar__nav a {
  color: var(--tinta-suave); text-decoration: none; padding: .45rem .7rem; border-radius: var(--radio); font-weight: 700;
}
.topbar__nav a:hover { background: var(--fondo); color: var(--verde-oscuro); }
.topbar__nav a.activo { background: var(--verde-oscuro); color: #fff; }
.topbar__usuario { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.topbar__usuario .nombre { color: var(--tinta-suave); }
.topbar__serie { white-space: nowrap; background: var(--naranja-tinte); color: #7a4a00; font-weight: 900; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; }
.topbar__serie--sin { background: var(--rojo); color: #fff; }
.topbar form { margin: 0; }

.contenido { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem 6rem; }
.contenido--ancho { max-width: 1140px; }
.encabezado { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Bloques */
.panel { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 1.25rem; }
.panel + .panel { margin-top: 1rem; }

/* Formularios */
label { display: block; font-weight: 700; margin-bottom: .3rem; }
.campo { margin-bottom: 1rem; }
input[type=text], input[type=password], input[type=search], select {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: var(--radio);
  background: #fff; color: var(--tinta);
}
input:focus, select:focus { border-color: var(--verde); outline: 3px solid var(--verde-tinte); outline-offset: 0; }
.ayuda { font-size: .85rem; color: var(--tinta-suave); margin-top: .25rem; }
.error-campo { color: var(--rojo); font-size: .85rem; }
.fila { display: flex; gap: 1rem; flex-wrap: wrap; }
.fila > * { flex: 1 1 200px; }
.acciones { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 700; padding: .55rem 1rem; border-radius: var(--radio);
  border: 1px solid var(--borde); background: #fff; color: var(--tinta); cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--fondo); }
.btn--primario { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn--primario:hover { background: #63a000; }
.btn--peligro { color: var(--rojo); border-color: #f0c7c2; }
.btn--peligro:hover { background: var(--rojo-tinte); }
.btn--grande { padding: .8rem 1.5rem; font-size: 1.1rem; }
.btn--chico { padding: .3rem .6rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Avisos */
.aviso { padding: .75rem 1rem; border-radius: var(--radio); margin-bottom: 1rem; border: 1px solid transparent; }
.aviso--error { background: var(--rojo-tinte); color: #7a1f14; border-color: #f0c7c2; }
.aviso--exito { background: var(--verde-tinte); color: var(--verde-oscuro); border-color: #cfe6a3; }
.aviso--alerta { background: var(--naranja-tinte); color: #7a4a00; border-color: #f3d39a; }

/* Etiquetas */
.etiqueta { display: inline-block; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; }
.etiqueta--verde { background: var(--verde-tinte); color: var(--verde-oscuro); }
.etiqueta--naranja { background: var(--naranja-tinte); color: #7a4a00; }
.etiqueta--gris { background: #eceee8; color: var(--tinta-suave); }
.etiqueta--rojo { background: var(--rojo-tinte); color: #7a1f14; }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; background: #fff; }
.tabla th, .tabla td { padding: .6rem .75rem; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: middle; }
.tabla th { font-size: .82rem; color: var(--tinta-suave); font-weight: 700; }
.tabla td.num, .tabla th.num { text-align: right; }
.tabla tr.seleccionada td { background: var(--verde-tinte); }
.tabla tr.bloqueada td { color: var(--tinta-suave); }
.tabla-envoltura { border: 1px solid var(--borde); border-radius: var(--radio); overflow: auto; background: #fff; }

/* Login */
body.auth {
  display: grid; place-items: center; min-height: 100vh;
  /* Login: verde corporativo con brillo oro y la misma trama */
  background-color: #34501c;
  background-image:
    radial-gradient(circle at 100% 100%, rgba(224,135,9,.5), transparent 45%),
    radial-gradient(circle at 0% 0%, rgba(113,177,0,.38), transparent 50%),
    radial-gradient(rgba(255,255,255,.08) 1px, transparent 1.2px);
  background-size: 100% 100%, 100% 100%, 22px 22px;
  background-attachment: fixed;
}
.auth__caja { width: min(400px, 92vw); background: #fff; border: 1px solid var(--borde); border-radius: 10px; padding: 2rem; box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.auth__logo { display: block; height: 72px; margin: 0 auto 1rem; }
.auth__titulo { text-align: center; margin-bottom: 1.5rem; }
.auth__titulo small { display: block; font-weight: 400; color: var(--tinta-suave); font-size: .9rem; }

/* Buscador (terminal de caja) */
.buscador { background: var(--superficie); border: 1px solid var(--borde); border-radius: 10px; padding: 1.5rem; }
.buscador__linea { display: flex; gap: .6rem; }
.buscador__linea input[type=search] {
  font-size: 1.25rem; padding: .7rem 1rem; letter-spacing: .04em; font-variant-numeric: tabular-nums;
}
.buscador__linea input::-webkit-search-cancel-button { appearance: none; }
.buscador__atajos { margin-top: .6rem; font-size: .82rem; color: var(--tinta-suave); }
kbd { font-family: inherit; font-size: .78rem; border: 1px solid var(--borde); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; background: #fff; }

/* Resultados de cliente */
.clientes { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .75rem; }
.cliente {
  display: grid; grid-template-columns: 1fr auto; gap: .25rem 1rem; align-items: center;
  background: #fff; border: 1px solid var(--borde); border-left: 5px solid var(--verde); border-radius: var(--radio); padding: .9rem 1.1rem;
  text-decoration: none; color: inherit;
}
.cliente:hover, .cliente:focus-visible { border-color: var(--verde); background: var(--verde-tinte); }
.cliente--sin-deuda { border-left-color: var(--borde); }
.cliente__nombre { grid-column: 1; grid-row: 1; font-weight: 900; font-size: 1.05rem; }
.cliente__datos { grid-column: 1; grid-row: 2; font-size: .9rem; color: var(--tinta-suave); }
.cliente__deuda { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.cliente__deuda .monto { font-size: 1.35rem; color: var(--naranja); }
.cliente--sin-deuda .cliente__deuda .monto { color: var(--tinta-suave); }
.cliente__deuda small { display: block; color: var(--tinta-suave); }

/* Ficha del cliente en facturas */
.ficha { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: start; margin-bottom: 1rem; }
.ficha__nombre { font-size: 1.3rem; font-weight: 900; }
.ficha__codigo { font-variant-numeric: tabular-nums; }

/* Barra fija de total a pagar */
.total-barra {
  position: fixed; left: 0; right: 0; bottom: 0; background: var(--verde-oscuro); color: #fff;
  box-shadow: 0 -4px 16px rgba(30,42,18,.18);
}
.total-barra__interno { max-width: 960px; margin: 0 auto; padding: .9rem 1rem; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.total-barra__texto { font-size: .9rem; color: #dbe9c4; }
.total-barra .monto { font-size: 1.9rem; }
.total-barra .btn--primario { margin-left: auto; }

/* Modal de confirmación */
dialog.modal { border: none; border-radius: 10px; padding: 0; width: min(440px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(30,42,18,.55); }
.modal__cuerpo { padding: 1.5rem; }
.modal__total { font-size: 2.2rem; color: var(--verde-oscuro); margin: .5rem 0 1rem; }
.modal__pie { display: flex; gap: .6rem; justify-content: flex-end; padding: 1rem 1.5rem; border-top: 1px solid var(--borde); background: var(--fondo); }

/* Comprobante (tirilla 80mm) */
.tirilla {
  width: 80mm; max-width: 100%; margin: 0 auto; background: #fff; border: 1px solid var(--borde); padding: 6mm 5mm;
  font-family: "Lato", "Courier New", monospace; font-size: 12px; line-height: 1.35; color: #000;
}
.tirilla__logo { display: block; height: 42px; margin: 0 auto 4px; }
.tirilla__centro { text-align: center; }
.tirilla__titulo { font-weight: 900; font-size: 14px; }
.tirilla__numero { font-size: 18px; font-weight: 900; text-align: center; margin: 6px 0; }
.tirilla__linea { border-top: 1px dashed #000; margin: 6px 0; }
.tirilla table { width: 100%; border-collapse: collapse; }
.tirilla td { padding: 2px 0; vertical-align: top; }
.tirilla td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tirilla__total { font-size: 16px; font-weight: 900; }
.comprobante-acciones { display: flex; gap: .6rem; justify-content: center; margin-bottom: 1rem; }

@media print {
  body { background: #fff; }
  .topbar, .comprobante-acciones, .no-imprimir { display: none !important; }
  .contenido { padding: 0; max-width: none; }
  .tirilla { border: none; margin: 0; padding: 2mm; }
  @page { size: 80mm auto; margin: 0; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 .75rem; gap: .6rem; }
  .topbar__nav a { padding: .4rem .5rem; }
  .topbar__usuario .nombre { display: none; }
  .topbar__marca span { display: none; }
  .buscador__linea { flex-direction: column; }
  .buscador__linea input[type=search] { font-size: 1.3rem; }
  .cliente__deuda { grid-row: auto; grid-column: 1; text-align: left; }
  .total-barra .btn--primario { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .cliente { transition: background-color .12s ease, border-color .12s ease; }
}

/* Iconos Font Awesome */
.fa-solid, .fa-regular, .fa-brands { font-size: .9em; }
.topbar__nav a .fa-solid, .btn .fa-solid { opacity: .9; }
.etiqueta .fa-solid { font-size: .8em; }
.cliente__datos .fa-solid { width: 1em; text-align: center; opacity: .65; }
.aviso > .fa-solid:first-child { margin-right: .35rem; }
.tirilla .fa-solid { display: none; }   /* la tirilla se imprime sin iconos */
