:root {
  --v900: #0a3424; --v800: #0f4a33; --v700: #166042; --v600: #1f7a54; --v100: #e3efe6;
  --crema: #f5f4ea; --tarjeta: #ffffff; --texto: #13261d; --suave: #5d6c63; --borde: #e2e5da;
  --amarillo: #eaf09a; --amarillo-f: #d9e26a;
  --rojo: #b3261e; --rojo-f: #fdecea; --naranja: #b85f00; --naranja-f: #fff2e0; --azul: #1d5fa8; --azul-f: #e8f0fb;
  --radio: 18px; --sombra: 0 1px 2px rgba(10, 52, 36, .06), 0 6px 20px rgba(10, 52, 36, .06);
  --fuente: 'Outfit', system-ui, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--fuente); color: var(--texto); background: var(--crema); font-size: 16px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
a { color: var(--v700); }
[hidden] { display: none !important; }

.cargando { min-height: 100vh; display: grid; place-content: center; text-align: center; background: var(--v900); color: #fff; }
.logo-grande { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.cargando p { opacity: .75; }

/* ─── Estructura ─── */
.marco { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.lateral { background: var(--v900); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; }
.marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.marca-icono { width: 40px; height: 40px; border-radius: 12px; background: var(--amarillo); color: var(--v900); display: grid; place-items: center; font-weight: 800; font-size: 20px; }
.marca b { font-size: 26px; font-weight: 800; letter-spacing: -.03em; display: block; line-height: 1; }
.marca small { font-size: 10px; letter-spacing: .18em; opacity: .7; }
.nav-titulo { font-size: 10px; letter-spacing: .16em; opacity: .55; padding: 8px 10px; text-transform: uppercase; }
.nav-boton { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: #dfe9e2; padding: 11px 12px; border-radius: 12px; font-weight: 500; text-align: left; }
.nav-boton:hover { background: rgba(255, 255, 255, .07); }
.nav-boton.activo { background: var(--amarillo); color: var(--v900); font-weight: 700; }
.nav-boton svg { width: 20px; height: 20px; flex: none; }
.lateral-pie { margin-top: auto; padding: 12px; font-size: 13px; opacity: .8; border-top: 1px solid rgba(255, 255, 255, .12); }
.lateral-pie b { display: block; }

.principal { min-width: 0; }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--borde); background: rgba(245, 244, 234, .92); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.miga { font-size: 14px; color: var(--suave); }
.barra-der { display: flex; align-items: center; gap: 10px; }
.estado-guardado { font-size: 12px; color: var(--suave); display: flex; align-items: center; gap: 6px; }
.estado-guardado::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--v600); }
.estado-guardado.sin-red::before { background: var(--naranja); }
.icono-boton { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--borde); background: var(--tarjeta); display: grid; place-items: center; }
.icono-boton svg { width: 19px; height: 19px; }
.barra-movil { display: none; }
.contenido { padding: 24px 28px 60px; max-width: 1180px; }
.nav-abajo { display: none; }

/* ─── Portada ─── */
.portada { position: relative; overflow: hidden; border-radius: 24px; padding: 30px 30px 28px; color: #fff; margin-bottom: 20px;
  background: radial-gradient(circle at 88% 18%, rgba(234, 240, 154, .22) 0 60px, transparent 61px),
              radial-gradient(circle at 78% 70%, rgba(214, 64, 52, .55) 0 22px, transparent 23px),
              radial-gradient(circle at 93% 58%, rgba(234, 200, 90, .7) 0 16px, transparent 17px),
              radial-gradient(circle at 70% 30%, rgba(214, 64, 52, .45) 0 12px, transparent 13px),
              linear-gradient(120deg, #0a3424 0%, #0f4a33 55%, #1b5e3f 100%); }
.portada::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .12); }
.portada .fecha { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--amarillo); font-weight: 600; }
.portada h1 { font-size: clamp(28px, 4vw, 40px); margin: 8px 0 6px; font-weight: 800; }
.portada p { margin: 0 0 18px; opacity: .85; }
.botones { display: flex; flex-wrap: wrap; gap: 10px; }

/* ─── Botones ─── */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--borde); background: var(--tarjeta); color: var(--texto); padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 15px; text-decoration: none; min-height: 44px; }
.boton:hover { border-color: #c9cebf; }
.boton.principal-b { background: var(--v800); border-color: var(--v800); color: #fff; }
.boton.principal-b:hover { background: var(--v700); }
.boton.amarillo { background: var(--amarillo); border-color: var(--amarillo); color: var(--v900); }
.boton.peligro { color: var(--rojo); }
.boton.lleno { width: 100%; }
.boton.peque { padding: 7px 12px; min-height: 36px; font-size: 14px; border-radius: 11px; }
.boton:disabled { opacity: .5; cursor: not-allowed; }
.boton svg { width: 18px; height: 18px; }
.enlace { background: none; border: 0; color: var(--v700); font-weight: 600; padding: 4px; }

/* ─── Filtro ─── */
.filtro { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; }
.chip { white-space: nowrap; border: 1px solid var(--borde); background: transparent; padding: 8px 14px; border-radius: 999px; font-size: 14px; color: var(--suave); font-weight: 500; }
.chip.activo { background: var(--tarjeta); color: var(--texto); font-weight: 700; box-shadow: var(--sombra); }

/* ─── Tarjetas y cifras ─── */
.cifras { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.cifra { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); }
.cifra.destacada { background: var(--amarillo); border-color: var(--amarillo-f); }
.cifra .etiqueta { font-size: 14px; color: var(--suave); font-weight: 500; }
.cifra.destacada .etiqueta { color: var(--v900); }
.cifra .valor { font-size: 28px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.02em; }
.cifra .nota { font-size: 13px; color: var(--suave); }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra); margin-bottom: 18px; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 26px 0 12px; }
.cabecera h2 { font-size: 24px; font-weight: 700; }
.cabecera p { margin: 4px 0 0; color: var(--suave); font-size: 14px; }
.tarjeta h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.sub { color: var(--suave); font-size: 14px; }
.vacio { text-align: center; color: var(--suave); padding: 24px 10px; }
.vacio b { display: block; color: var(--texto); font-size: 17px; margin-bottom: 4px; }

/* ─── Avisos ─── */
.avisos { display: grid; gap: 10px; }
.aviso { display: flex; gap: 12px; align-items: center; justify-content: space-between; border-radius: 14px; padding: 12px 14px; background: var(--v100); border-left: 4px solid var(--v600); }
.aviso.naranja { background: var(--naranja-f); border-color: var(--naranja); }
.aviso.rojo { background: var(--rojo-f); border-color: var(--rojo); }
.aviso.azul { background: var(--azul-f); border-color: var(--azul); }
.aviso b { display: block; font-size: 15px; }
.aviso span { font-size: 14px; color: var(--suave); }
.aviso .boton { flex: none; }

/* ─── Extras ─── */
.rejilla-extras { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.extra { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 22px; overflow: hidden; box-shadow: var(--sombra); }
.extra-cab { padding: 18px 20px; color: #fff; position: relative; overflow: hidden; }
.extra-cab::after { content: ''; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.tema-verde { background: linear-gradient(135deg, #0f4a33, #1f7a54); }
.tema-azul { background: linear-gradient(135deg, #0e3d73, #1f6fb8 60%, #23a0c9); }
.tema-rojo { background: linear-gradient(135deg, #7d1414, #c22a2a 60%, #e0573c); }
.tema-dorado { background: linear-gradient(135deg, #6b4a06, #b8871b 60%, #d9b44a); }
.extra-cab .precio { position: absolute; right: 18px; top: 16px; background: rgba(255, 255, 255, .95); color: var(--texto); border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 14px; z-index: 1; }
.extra-cab small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.extra-cab h3 { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.extra-cab .fecha-s { opacity: .9; font-size: 14px; }
.extra-cuerpo { padding: 16px 20px 20px; }
.limite { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 14px; background: var(--v100); }
.limite.naranja { background: var(--naranja-f); }
.limite.rojo { background: var(--rojo-f); color: var(--rojo); }
.limite b { display: block; font-size: 15px; color: var(--texto); }
.limite.rojo b { color: var(--rojo); }
.grande { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.grande b { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.grande span { color: var(--suave); font-size: 14px; }
.donde { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.donde div { background: var(--crema); border-radius: 12px; padding: 8px 10px; }
.donde b { font-size: 20px; display: block; }
.donde span { font-size: 12px; color: var(--suave); }
.linea { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--borde); font-size: 15px; }
.linea:last-child { border-bottom: 0; }
.linea span { color: var(--suave); }
.linea b { text-align: right; }
.linea.total { font-size: 17px; border-top: 2px solid var(--texto); border-bottom: 0; margin-top: 4px; padding-top: 10px; }
.barra-tramo { height: 8px; background: var(--crema); border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.barra-tramo i { display: block; height: 100%; background: var(--v600); border-radius: 99px; }
.acciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.acciones .boton { font-size: 14px; padding: 9px 10px; }

/* ─── Listas ─── */
.lista { display: grid; }
.fila { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--borde); }
.fila:last-child { border-bottom: 0; }
.fila-icono { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--v100); color: var(--v700); flex: none; font-weight: 800; }
.fila-icono svg { width: 20px; height: 20px; }
.fila-texto { flex: 1; min-width: 0; }
.fila-texto b { display: block; font-size: 15px; }
.fila-texto span { font-size: 13px; color: var(--suave); }
.fila-valor { text-align: right; font-weight: 700; white-space: nowrap; }
.fila-valor small { display: block; font-weight: 500; color: var(--suave); font-size: 12px; }
.fila.anulada .fila-texto b, .fila.anulada .fila-valor { text-decoration: line-through; opacity: .55; }
.etiqueta-p { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--rojo-f); color: var(--rojo); margin-left: 6px; text-decoration: none; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.botonera-fila { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ─── Formularios ─── */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(8, 30, 20, .45); display: grid; place-items: center; padding: 16px; }
.caja-modal { background: #fbfbf6; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; border-radius: 24px; padding: 24px; position: relative; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.caja-modal .cerrar { position: absolute; right: 14px; top: 14px; width: 40px; height: 40px; border: 0; background: none; font-size: 26px; color: var(--suave); }
.caja-modal .pre { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--suave); font-weight: 600; }
.caja-modal h2 { font-size: 24px; margin: 4px 0 16px; font-weight: 700; }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.campo input, .campo select, .campo textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--borde); border-radius: 12px; background: #fff; font-size: 16px; min-height: 46px; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--v600); outline-offset: 0; border-color: transparent; }
.campo small { display: block; color: var(--suave); font-size: 13px; margin-top: 5px; }
.campo.error input, .campo.error select { border-color: var(--rojo); }
.par { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.paso { display: grid; grid-template-columns: 46px 1fr 46px; border: 1px solid var(--borde); border-radius: 12px; overflow: hidden; background: #fff; }
.paso button { border: 0; background: var(--v100); font-size: 22px; color: var(--v800); }
.paso input { border: 0 !important; text-align: center; font-size: 22px !important; font-weight: 700; border-radius: 0 !important; outline: none !important; -moz-appearance: textfield; }
.paso input::-webkit-outer-spin-button, .paso input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.total-vivo { display: flex; justify-content: space-between; align-items: center; background: var(--v100); border-radius: 14px; padding: 14px 16px; margin: 4px 0 16px; }
.total-vivo b { font-size: 26px; font-weight: 800; }
.dias { display: flex; flex-wrap: wrap; gap: 6px; }
.dias label { flex: 1; min-width: 40px; }
.dias input { position: absolute; opacity: 0; }
.dias span { display: block; text-align: center; padding: 10px 0; border: 1px solid var(--borde); border-radius: 10px; background: #fff; font-weight: 600; }
.dias input:checked + span { background: var(--v800); color: #fff; border-color: var(--v800); }
.dias input:focus-visible + span { outline: 2px solid var(--v600); }
.casilla { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; font-size: 15px; }
.casilla input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--v700); }
.error-form { background: var(--rojo-f); color: var(--rojo); border-radius: 12px; padding: 12px 14px; font-weight: 600; margin: 0 0 12px; }
.nota-form { background: var(--azul-f); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 14px; }
.nota-form.naranja { background: var(--naranja-f); }
.resumen-conf .linea b { font-weight: 700; }
.pie-modal { display: flex; gap: 10px; margin-top: 18px; }
.pie-modal .boton { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--v900); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100vw - 32px); }
.toast.error { background: var(--rojo); }

/* ─── Acceso ─── */
.acceso { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.acceso-arte { background: linear-gradient(140deg, #0a3424, #166042); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.acceso-arte h1 { font-size: clamp(34px, 5vw, 54px); font-weight: 800; }
.acceso-arte h1 em { font-style: normal; color: var(--amarillo); }
.acceso-arte p { opacity: .85; max-width: 420px; }
.acceso-form { padding: 48px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.pestañas { display: flex; gap: 6px; background: #e9e9dc; border-radius: 14px; padding: 4px; margin-bottom: 20px; }
.pestañas button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 11px; font-weight: 600; color: var(--suave); }
.pestañas button.activo { background: #fff; color: var(--texto); box-shadow: var(--sombra); }

/* ─── Móvil ─── */
@media (max-width: 900px) {
  .cifras { grid-template-columns: 1fr 1fr; }
  .dos { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .marco { display: block; }
  .lateral, .barra { display: none; }
  .barra-movil { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; position: sticky; top: 0; z-index: 5; background: rgba(245, 244, 234, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--borde); }
  .barra-movil .marca { padding: 0; }
  .barra-movil .marca-icono { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; background: var(--v800); color: var(--amarillo); }
  .barra-movil .marca b { font-size: 22px; color: var(--v900); }
  .contenido { padding: 16px 16px 110px; }
  .portada { padding: 22px 20px; border-radius: 20px; }
  .cifra { padding: 14px; }
  .cifra .valor { font-size: 23px; }
  .cifra .etiqueta { font-size: 13px; }
  .rejilla-extras { grid-template-columns: 1fr; }
  .cabecera h2 { font-size: 21px; }
  .nav-abajo { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--borde); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .nav-abajo button { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--suave); padding: 6px 0; border-radius: 12px; font-weight: 500; }
  .nav-abajo button svg { width: 22px; height: 22px; }
  .nav-abajo button.activo { color: var(--v800); font-weight: 700; background: var(--v100); }
  .modal { place-items: end center; padding: 0; }
  .caja-modal { border-radius: 24px 24px 0 0; max-height: 92vh; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); }
  .acceso { grid-template-columns: 1fr; }
  .acceso-arte { padding: 32px 22px; }
  .acceso-form { padding: 24px 18px 40px; }
  .toast { bottom: 84px; }
  .aviso { flex-direction: column; align-items: stretch; }
}
@media (max-width: 340px) {
  .cifras { grid-template-columns: 1fr; }
  .acciones { grid-template-columns: 1fr; }
}

/* Imagen oficial del cupón en la tarjeta del extra */
.cupon-img { display: block; width: 100%; max-width: 300px; height: auto; margin: 26px auto 14px; border-radius: 10px; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); position: relative; z-index: 1; transform: rotate(-1.5deg); }

/* Estadísticas */
.leyenda { display: flex; gap: 16px; font-size: 14px; color: var(--suave); margin: 8px 0 4px; }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.grafica { position: relative; }
.grafica svg { width: 100%; height: auto; display: block; overflow: visible; }
.grafica .eje { font-size: 12px; fill: var(--suave); font-family: var(--fuente); }
.grafica .valor-barra { font-size: 12px; font-weight: 700; fill: var(--texto); font-family: var(--fuente); }
.grafica rect[data-tip] { cursor: pointer; }
.grafica rect[data-tip].activo, .grafica rect[data-tip]:hover { fill: rgba(10, 52, 36, .05); }
.grafica .tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--v900); color: #fff; padding: 8px 12px; border-radius: 10px; font-size: 13px; pointer-events: none; white-space: nowrap; box-shadow: var(--sombra); }
.grafica .tip b { display: block; }
.grafica .tip span { opacity: .8; }
.tabla-datos { margin-top: 12px; }
.tabla-datos summary { cursor: pointer; color: var(--v700); font-weight: 600; padding: 6px 0; }
.tabla-datos table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.tabla-datos th, .tabla-datos td { text-align: right; padding: 7px 6px; border-bottom: 1px solid var(--borde); }
.tabla-datos th:first-child, .tabla-datos td:first-child { text-align: left; }
.tabla-datos th { color: var(--suave); font-weight: 600; }

/* Foto del informe y alarmas */
.foto-boton { cursor: pointer; margin-top: 4px; }
.pasos-ntfy { padding-left: 20px; margin: 12px 0 0; display: grid; gap: 10px; font-size: 15px; }
.tema-ntfy { display: flex; gap: 8px; align-items: center; margin: 6px 0 2px; flex-wrap: wrap; }
.tema-ntfy code { background: var(--crema); border: 1px solid var(--borde); padding: 6px 10px; border-radius: 8px; font-size: 14px; word-break: break-all; }
@media (max-width: 760px) {
  .nav-abajo { grid-template-columns: repeat(6, 1fr); }
  .nav-abajo button { font-size: 10px; }
}

/* Cupón del extra elegido en los formularios */
.cupon-form { display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 10px; margin: -4px 0 16px; color: #fff; }
.cupon-form img { width: 128px; height: auto; border-radius: 6px; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); flex: none; }
.cupon-form span { font-size: 14px; font-weight: 600; line-height: 1.3; }
