:root {
  --verde: #0e7a5f; --verde-osc: #0a5c48; --crema: #f7f6f2; --tinta: #1e2b28;
  --gris: #6b7a76; --borde: #dfe5e2; --rojo: #b3261e; --amarillo: #fff7e0;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tinta); background: var(--crema); line-height: 1.55; }
a { color: var(--verde); }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; margin-top: 1.8rem; }
h1, h2, h3 { line-height: 1.25; }

.nav { display: flex; justify-content: space-between; align-items: center; gap: .8rem;
  padding: .7rem 1rem; background: #fff; border-bottom: 1px solid var(--borde);
  flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.nav .logo { font-weight: 700; text-decoration: none; color: var(--tinta); font-size: 1.05rem; }
.nav nav { display: flex; gap: .9rem; align-items: center; flex-wrap: wrap; }
.nav nav a { text-decoration: none; color: var(--tinta); font-size: .95rem; }
.nav nav a:hover { color: var(--verde); }

.contenido { max-width: 1000px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.caja-angosta { max-width: 620px; margin: 0 auto; }
.pie { text-align: center; color: var(--gris); font-size: .8rem; padding: 1.2rem;
  border-top: 1px solid var(--borde); background: #fff; }

.heroe { text-align: center; padding: 2.2rem 0 1rem; }
.heroe h1 { font-size: 2rem; }
.grande { font-size: 1.1rem; color: var(--gris); max-width: 640px; margin: .6rem auto; }

.btn { display: inline-block; background: var(--verde); color: #fff; border: 0;
  padding: .6rem 1.2rem; border-radius: 8px; font-size: 1rem; cursor: pointer;
  text-decoration: none; }
.btn:hover { background: var(--verde-osc); }
.btn.secundario { background: #fff; color: var(--verde); border: 1.5px solid var(--verde); }
.btn-chico { display: inline-block; background: #fff; color: var(--verde);
  border: 1px solid var(--verde); padding: .18rem .6rem; border-radius: 6px;
  font-size: .82rem; cursor: pointer; text-decoration: none; }
.btn-chico.verde { background: var(--verde); color: #fff; }
.enlace-rojo { background: none; border: 0; color: var(--rojo); cursor: pointer;
  font-size: .85rem; padding: 0; text-decoration: underline; }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem; margin-top: 1rem; }
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: 1rem 1.1rem; margin: .8rem 0; }
.tarjeta.destacada { border-color: var(--verde); background: #f2faf7; }

.estadisticas { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.stat { background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: .7rem 1.2rem; min-width: 130px; }
.stat b { display: block; font-size: 1.3rem; color: var(--verde); }
.stat span { font-size: .8rem; color: var(--gris); }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--borde);
  border-radius: 8px; overflow: hidden; font-size: .92rem; margin: .6rem 0; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--borde);
  vertical-align: top; }
th { background: #f0f3f1; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
.fila-roja td { background: #fdf1f0; }

form label { display: block; margin: .7rem 0; font-size: .92rem; font-weight: 600; }
input, select, textarea { width: 100%; padding: .5rem .6rem; margin-top: .25rem;
  border: 1px solid var(--borde); border-radius: 7px; font-size: 1rem; font-family: inherit;
  background: #fff; }
input.corto { width: 90px; }
label.check { font-weight: 400; }
label.check input { width: auto; margin-right: .4rem; }
.fila { display: flex; gap: .8rem; flex-wrap: wrap; align-items: end; }
.fila label { flex: 1; min-width: 140px; }

.alerta { background: var(--amarillo); border: 1px solid #e8d9a0; border-radius: 8px;
  padding: .7rem 1rem; margin: .8rem 0; font-size: .95rem; }
.alerta.roja { background: #fdf1f0; border-color: #efb9b5; color: var(--rojo); }
.ok { color: var(--verde); }
.chico { font-size: .84rem; color: var(--gris); }
.etiqueta { display: inline-block; background: #eef1ef; border-radius: 20px;
  padding: .1rem .6rem; font-size: .78rem; }
.etiqueta.verde { background: #d9f2e8; color: var(--verde-osc); }

.galeria { display: flex; gap: .8rem; flex-wrap: wrap; }
.galeria figure { margin: 0; }
.miniatura { width: 140px; height: 100px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--borde); }
.dos-columnas { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; }
@media (max-width: 760px) { .dos-columnas { grid-template-columns: 1fr; } }
hr { border: 0; border-top: 1px solid var(--borde); margin: 1.6rem 0; }

/* Modo cobrador: filas grandes para usar caminando con el celular */
.fila-cobro { display: flex; justify-content: space-between; align-items: center;
  gap: .8rem; background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: .8rem 1rem; margin: .5rem 0; }
.fila-cobro.cobrado { opacity: .55; background: #f0f7f4; }
.fila-cobro form { display: flex; gap: .5rem; align-items: center; }
.fila-cobro .btn { padding: .8rem 1.1rem; white-space: nowrap; }
.fila-cobro select { width: auto; }
details.tarjeta summary { cursor: pointer; }
code { background: #eef1ef; padding: .15rem .4rem; border-radius: 5px;
  font-size: .85rem; word-break: break-all; }

/* Tarjetas de elección de tipo de contrato */
.tipo-card { text-decoration: none; color: inherit; display: block; transition: .15s; }
.tipo-card:hover { border-color: var(--verde); transform: translateY(-2px); }
.tipo-card h3 { margin-top: 0; color: var(--verde); }

/* Cláusulas */
.clausula { border-bottom: 1px solid var(--borde); padding: .6rem 0; }
.clausula.obligatoria { opacity: .8; }
.clausula label.check { margin: 0; }
.clausula .ayuda { margin: .2rem 0 .2rem 1.5rem; }
.texto-clausula { background: #f0f3f1; padding: .6rem .8rem; border-radius: 6px;
  margin: .4rem 0 .4rem 1.5rem; }
.clausula details summary { margin-left: 1.5rem; cursor: pointer; color: var(--gris); }
.clausula .fila, .clausula > label { margin-left: 1.5rem; }

/* Opciones de fin de contrato */
.opciones-fin { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; }
.opciones-fin > div { border: 1px solid var(--borde); border-radius: 8px; padding: .7rem; }

/* Reportes */
.barra { background: #eef1ef; border-radius: 3px; height: 9px; margin: 2px 0;
  overflow: hidden; }
.barra span { display: block; height: 100%; border-radius: 3px; }
.b-ing { background: var(--verde); }
.b-gas { background: #d4756b; }
.neto-pos { color: var(--verde); }
.neto-neg { color: var(--rojo); }
.fila-total td { background: #f0f3f1; border-top: 2px solid var(--borde); }
.stat-verde b { color: var(--verde); }
.stat-rojo b { color: var(--rojo); }

/* Mantenimiento: pestañas, filtros, chips y órdenes de trabajo */
.pestanas { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 2px solid var(--borde);
  margin: 1rem 0 .8rem; }
.pestana { text-decoration: none; color: var(--gris); padding: .45rem .9rem;
  border-radius: 8px 8px 0 0; font-size: .9rem; border: 1px solid transparent;
  border-bottom: none; margin-bottom: -2px; }
.pestana:hover { background: #fff; }
.pestana.activa { background: #fff; color: var(--tinta); font-weight: 600;
  border-color: var(--borde); border-bottom: 2px solid #fff; }
.pestana .conteo { background: #eef1ef; border-radius: 10px; padding: 0 .4rem;
  font-size: .78rem; margin-left: .2rem; }
.pestana.activa .conteo { background: var(--verde); color: #fff; }
.filtros { align-items: flex-end; background: #fff; border: 1px solid var(--borde);
  border-radius: 10px; padding: .6rem .8rem; margin-bottom: 1rem; }
.filtros label { margin: 0; }
.filtros select, .filtros input { min-width: 120px; }

.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 .6rem; }
.chip { background: #eef1ef; border: 1px solid var(--borde); border-radius: 20px;
  padding: .22rem .7rem; font-size: .82rem; cursor: pointer; }
.chip:hover { background: var(--verde); color: #fff; border-color: var(--verde); }

.orden { background: #fff; border: 1px solid var(--borde); border-left: 4px solid var(--gris);
  border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0; }
.orden.prio-urgente { border-left-color: var(--rojo); }
.orden.prio-normal { border-left-color: #e0a83c; }
.orden.prio-baja { border-left-color: var(--verde); }
.orden.cerrada { opacity: .6; border-left-color: var(--borde); }
.orden-cab { display: flex; justify-content: space-between; align-items: flex-start;
  gap: .8rem; flex-wrap: wrap; }
.orden-titulo { font-weight: 600; color: var(--tinta); text-decoration: none;
  font-size: 1.02rem; }
.orden-titulo:hover { color: var(--verde); }
.orden p { margin: .3rem 0; }
.orden-acciones { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.orden-acciones form { display: inline-flex; gap: .3rem; align-items: center; margin: 0; }
.fila-min { display: inline-flex; gap: .3rem; align-items: center; }
.etiqueta.roja { background: #fdf1f0; color: var(--rojo); }
.editor-gasto { display: flex; flex-direction: column; gap: .3rem; margin-top: .3rem; }
.editor-gasto input, .editor-gasto select { font-size: .85rem; padding: .3rem; }

/* Menú "Más" del nav */
.menu-mas { position: relative; }
.menu-mas summary { cursor: pointer; font-size: .95rem; list-style: none; }
.menu-mas summary::-webkit-details-marker { display: none; }
.menu-desplegable { position: absolute; right: 0; top: 1.6rem; background: #fff;
  border: 1px solid var(--borde); border-radius: 8px; padding: .4rem;
  box-shadow: 0 6px 18px rgba(0,0,0,.08); min-width: 190px; z-index: 10;
  display: flex; flex-direction: column; }
.menu-desplegable a { padding: .4rem .6rem; border-radius: 6px; font-size: .9rem;
  white-space: nowrap; }
.menu-desplegable a:hover { background: var(--crema); }

/* Portal: firma y respuestas */
.lienzo-firma { border: 2px dashed var(--borde); border-radius: 8px; background: #fff;
  width: 100%; touch-action: none; cursor: crosshair; display: block; }
.respuesta { background: #f2faf7; border-left: 3px solid var(--verde);
  padding: .5rem .7rem; border-radius: 0 6px 6px 0; margin: .5rem 0; }
tr.inactivo { opacity: .55; }

/* Mapa "de dónde viene el dinero": explica sin advertencias */
.mapa-dinero { display: flex; align-items: stretch; gap: .6rem; margin: .8rem 0 1.2rem;
  flex-wrap: wrap; }
.mapa-item { flex: 1; min-width: 210px; background: #fff; border: 1px solid var(--borde);
  border-radius: 10px; padding: .6rem .8rem; }
.mapa-item.activo { border-color: var(--verde); background: #f2faf7; }
.mapa-item b { display: block; margin-bottom: .2rem; }
.mapa-item span { font-size: .82rem; color: var(--gris); }
.mapa-flecha { align-self: center; color: var(--gris); font-size: 1.3rem; }

/* Desvío: te manda al lugar correcto en vez de advertirte */
.desvio { display: block; background: #fff8e8; border: 1px solid #e8d9a0;
  border-radius: 8px; padding: .6rem .8rem; margin-bottom: .8rem;
  text-decoration: none; color: var(--tinta); }
.desvio:hover { border-color: #d9a83c; }
.desvio span { display: block; font-size: .82rem; color: var(--gris); margin-top: .2rem; }

/* Suscripción y QR */
.precio { font-size: 1.4rem; font-weight: 700; color: var(--verde); margin: .3rem 0; }
.qr { max-width: 240px; width: 100%; border: 1px solid var(--borde); border-radius: 8px;
  margin: .5rem 0; display: block; }

/* Planes con marketing */
.oferta-banner { background: linear-gradient(90deg, #f2faf7, #fff8e8);
  border: 1px solid #cfe8dd; border-radius: 10px; padding: .7rem 1rem; margin: 1rem 0;
  text-align: center; font-size: .95rem; }
.planes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 1rem; margin: 1rem 0; align-items: start; }
.plan-card { position: relative; background: #fff; border: 1px solid var(--borde);
  border-radius: 12px; padding: 1.2rem 1rem; display: flex; flex-direction: column; }
.plan-card h3 { margin: 0 0 .1rem; }
.plan-destacado { border: 2px solid var(--verde); box-shadow: 0 8px 24px rgba(14,122,95,.12);
  transform: translateY(-4px); }
.plan-actual { background: #f2faf7; }
.plan-cinta { position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--verde); color: #fff; font-size: .75rem; font-weight: 600;
  padding: .2rem .8rem; border-radius: 20px; white-space: nowrap; }
.plan-gancho { color: var(--gris); font-size: .84rem; margin: 0 0 .6rem; min-height: 2.2em; }
.plan-card .precio { margin: .2rem 0; }
.por-mes { font-size: .9rem; color: var(--gris); font-weight: 400; }
.ahorro-anual { color: var(--verde-osc); min-height: 3em; }
.plan-ventajas { list-style: none; padding: 0; margin: .8rem 0; flex: 1; font-size: .88rem; }
.plan-ventajas li { padding: .2rem 0; color: var(--tinta); }
.opciones-tiempo { display: flex; gap: .5rem; flex-wrap: wrap; }
.opcion-tiempo { flex: 1; min-width: 90px; border: 1.5px solid var(--borde);
  border-radius: 8px; padding: .5rem; text-align: center; cursor: pointer; margin: 0;
  font-weight: 400; }
.opcion-tiempo.sel { border-color: var(--verde); background: #f2faf7; }
.opcion-tiempo input { display: none; }
.opcion-tiempo b { display: block; font-size: .9rem; }
.badge-ahorro { display: inline-block; background: #fff0d9; color: #b5730a;
  border-radius: 12px; padding: 0 .5rem; font-size: .74rem; font-weight: 700; }

/* Liquidación de garantía */
.resumen-liq { background: #f0f3f1; border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; }
#tabla-desc input { margin: 0; }

/* Impersonación admin + avisos masivos */
.banner-impersonar { background: #3a2a0f; color: #ffd48a; text-align: center;
  padding: .5rem 1rem; font-size: .9rem; }
.banner-impersonar a { color: #fff; text-decoration: underline; margin-left: .6rem; }
.aviso-banner { background: #eef6ff; border-color: #bcdcff; }
.aviso-banner p { margin: .3rem 0; }

/* Panel de administración */
.admin-tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .8rem; margin: 1rem 0; }
.admin-stat { background: #fff; border: 1px solid var(--borde); border-radius: 10px;
  padding: .8rem 1rem; text-align: center; }
.admin-stat b { display: block; font-size: 1.4rem; color: var(--verde-osc); }
.admin-stat span { font-size: .78rem; color: var(--gris); }
.grafico-barras { display: flex; align-items: flex-end; gap: .5rem; height: 90px;
  margin: .5rem 0 .3rem; }
.grafico-barras .col { flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%; }
.grafico-barras .barra-v { width: 100%; background: var(--verde); border-radius: 3px 3px 0 0;
  min-height: 2px; }
.grafico-barras .etiqueta-mes { font-size: .68rem; color: var(--gris); margin-top: .25rem;
  white-space: nowrap; }
.chip-oro { background: #fff0d9; color: #b5730a; border-radius: 12px; padding: .1rem .6rem;
  font-size: .78rem; font-weight: 600; }
