/* RePorta · estilos (tokens según IDENTIDAD_MARCA.md) */
:root {
  --rp-bosque: #0A1F2E;
  --rp-petroleo: #0E7C66;
  --rp-petroleo-osc: #0A6453;
  --rp-petroleo-claro: #E2F2EE;
  --rp-lima: #C6DE1F;
  --rp-fondo: #F3F7F9;
  --rp-blanco: #FFFFFF;
  --rp-borde: #DCE2EC;
  --rp-texto: #1B2A36;
  --rp-suave: #4A5566;
  --rp-alerta: #B54708;
  --rp-alerta-claro: #FEF0E6;
  --rp-error: #B42318;
  --rp-error-claro: #FDECEA;
  --rp-ok: #0E7A4F;
  --rp-ok-claro: #E6F4EC;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(10, 31, 46, .06), 0 2px 8px rgba(10, 31, 46, .06);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color: var(--rp-texto);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--rp-fondo); min-height: 100vh; display: flex; flex-direction: column; font-size: 15px; line-height: 1.45; }
a { color: var(--rp-petroleo); }
h1, h2, h3 { color: var(--rp-bosque); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

/* Barra superior */
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--rp-blanco); border-bottom: 1px solid var(--rp-borde); position: sticky; top: 0; z-index: 10; }
.marca { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.marca-texto { font-size: 1.3rem; letter-spacing: -.01em; }
.marca-texto .re { color: var(--rp-petroleo); }
.marca-texto .porta { color: var(--rp-bosque); }
.barra-der { display: flex; align-items: center; gap: 10px; font-size: .85rem; color: var(--rp-suave); min-width: 0; }
.barra-der .correo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.etiqueta-demo { background: var(--rp-lima); color: var(--rp-bosque); font-weight: 700; font-size: .75rem; padding: 2px 8px; border-radius: 99px; }

.contenido { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.pie { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 14px 16px; font-size: .8rem; color: var(--rp-suave); border-top: 1px solid var(--rp-borde); background: var(--rp-blanco); }
.cargando { color: var(--rp-suave); }

/* Botones y formularios */
button, .boton { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent; padding: 9px 14px; font-weight: 600; background: var(--rp-petroleo); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; }
button:hover, .boton:hover { background: var(--rp-petroleo-osc); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--rp-lima); outline-offset: 1px; }
button.sec, .boton.sec { background: var(--rp-blanco); color: var(--rp-petroleo); border-color: var(--rp-borde); }
button.sec:hover { background: var(--rp-petroleo-claro); }
button.peligro { background: var(--rp-blanco); color: var(--rp-error); border-color: #F1C9C4; }
button.peligro:hover { background: var(--rp-error-claro); }
button.chico { padding: 5px 10px; font-size: .85rem; }
button.link { background: none; border: 0; padding: 0; color: var(--rp-petroleo); font-weight: 500; text-decoration: underline; }
button:disabled { opacity: .55; cursor: wait; }

label { display: block; font-weight: 500; font-size: .9rem; margin-bottom: 12px; color: var(--rp-texto); }
label .ayuda { display: block; font-weight: 400; color: var(--rp-suave); font-size: .8rem; margin-top: 2px; }
input, select, textarea { font: inherit; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--rp-borde); border-radius: 8px; background: #fff; color: var(--rp-texto); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; vertical-align: middle; }
label.check { display: flex; align-items: center; font-weight: 500; }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.acciones.der { justify-content: flex-end; }

/* Tarjetas */
.tarjeta { background: var(--rp-blanco); border: 1px solid var(--rp-borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); margin-bottom: 16px; }
.cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.cabecera h1 { margin: 0; }
.sub { color: var(--rp-suave); font-size: .9rem; margin: 2px 0 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--rp-blanco); border: 1px solid var(--rp-borde); border-radius: var(--radio); padding: 14px; box-shadow: var(--sombra); }
.kpi .titulo { font-size: .8rem; color: var(--rp-suave); font-weight: 500; }
.kpi .valor { font-size: 1.6rem; font-weight: 700; color: var(--rp-bosque); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .detalle { font-size: .8rem; color: var(--rp-suave); margin-top: 2px; }
.kpi.destacado { background: var(--rp-petroleo-claro); border-color: #BFE3D9; }
.sube { color: var(--rp-ok); font-weight: 600; }
.baja { color: var(--rp-error); font-weight: 600; }
.meta { height: 8px; background: var(--rp-borde); border-radius: 99px; margin-top: 8px; overflow: hidden; position: relative; }
.meta > span { display: block; height: 100%; background: var(--rp-lima); border-radius: 99px; }

/* Pestañas */
.pestanas { display: flex; gap: 4px; border-bottom: 1px solid var(--rp-borde); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.pestanas a { padding: 10px 14px; text-decoration: none; color: var(--rp-suave); font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.pestanas a.activa { color: var(--rp-bosque); border-bottom-color: var(--rp-petroleo); font-weight: 600; }

/* Tablas */
.tabla-env { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rp-borde); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--rp-suave); font-weight: 600; background: #FAFCFB; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 2px solid var(--rp-borde); }
.vacio { color: var(--rp-suave); text-align: center; padding: 24px 10px; }

/* Lista de centros */
.lista-centros { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.centro-item { display: block; text-decoration: none; color: inherit; background: var(--rp-blanco); border: 1px solid var(--rp-borde); border-radius: var(--radio); padding: 16px; box-shadow: var(--sombra); }
.centro-item:hover { border-color: var(--rp-petroleo); }
.centro-item h3 { margin-bottom: 4px; }

/* Insignias */
.fr { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.fr i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.15); flex: none; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.badge.ok { background: var(--rp-ok-claro); color: var(--rp-ok); }
.badge.pend { background: var(--rp-alerta-claro); color: var(--rp-alerta); }
.badge.rech { background: var(--rp-error-claro); color: var(--rp-error); }
.badge.neutro { background: var(--rp-petroleo-claro); color: var(--rp-petroleo-osc); }
.estimado { font-size: .72rem; color: var(--rp-suave); margin-left: 4px; }

.alerta { background: var(--rp-alerta-claro); border: 1px solid #F6D3BC; color: #7A2E0B; border-radius: var(--radio); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.info { background: var(--rp-petroleo-claro); border: 1px solid #BFE3D9; color: var(--rp-petroleo-osc); border-radius: var(--radio); padding: 10px 14px; margin-bottom: 16px; font-size: .9rem; }
.error { color: var(--rp-error); font-size: .9rem; margin: 8px 0; }

/* Selector de mes */
.mes { display: inline-flex; align-items: center; gap: 4px; }
.mes button { padding: 6px 10px; }
.mes strong { min-width: 140px; text-align: center; color: var(--rp-bosque); text-transform: capitalize; }

/* Botones de llenado */
.opciones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.opciones button { background: var(--rp-blanco); color: var(--rp-texto); border-color: var(--rp-borde); min-width: 56px; justify-content: center; }
.opciones button[aria-pressed=true] { background: var(--rp-petroleo); color: #fff; border-color: var(--rp-petroleo); }

/* Login */
.login { max-width: 380px; margin: 6vh auto 0; }
.login .tarjeta { padding: 24px; }
.login h1 { font-size: 1.35rem; }
.bajada { color: var(--rp-suave); margin: 0 0 18px; }

/* Modal */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 31, 46, .35); }
dialog form { padding: 20px; }
dialog h2 { margin-bottom: 14px; }

/* Aviso flotante */
.aviso { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--rp-bosque); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--sombra); z-index: 50; max-width: calc(100vw - 32px); font-size: .9rem; }
.aviso.error { background: var(--rp-error); }

.oculto-movil { }
@media (max-width: 640px) {
  .oculto-movil { display: none; }
  h1 { font-size: 1.3rem; }
  .kpi .valor { font-size: 1.35rem; }
  th, td { padding: 8px 6px; }
}

/* ---------- Diagnóstico (etapa 4) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips button { background: var(--rp-blanco); color: var(--rp-texto); border: 1px solid var(--rp-borde); font-weight: 500; padding: 7px 12px; border-radius: 99px; }
.chips button:hover { background: var(--rp-petroleo-claro); }
.chips button[aria-checked=true], .chips button[aria-pressed=true] { background: var(--rp-petroleo); color: #fff; border-color: var(--rp-petroleo); }
.dg-form { display: grid; gap: 0; padding-bottom: 80px; }
.dg-sec { border: 1px solid var(--rp-borde); margin: 0 0 16px; }
.dg-sec legend { padding: 0; float: left; width: 100%; }
.dg-sec legend + * { clear: both; }
.dg-sec h2 { margin: 0 0 6px; }
.dg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; clear: both; }
.dg-campo { display: block; margin: 0 0 12px; font-weight: 500; font-size: .9rem; min-width: 0; }
.dg-ancho { grid-column: 1 / -1; }
.dg-lab { display: block; }
.dg-clave { display: inline-block; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: #EEF6D6; color: #4C5E10; padding: 1px 6px; border-radius: 99px; vertical-align: 1px; margin-left: 4px; }
.dg-num { display: flex; align-items: center; gap: 6px; }
.dg-num i { font-style: normal; color: var(--rp-suave); font-size: .85rem; white-space: nowrap; margin-top: 4px; }
.dg-lista { display: grid; gap: 6px; margin: 6px 0 8px; }
.dg-fila { display: grid; grid-template-columns: repeat(var(--n, 3), minmax(0, 1fr)) auto; gap: 6px; align-items: center; }
.dg-fila input, .dg-fila select { margin-top: 0; }
.dg-gen select, .dg-gen input { margin-top: 0; padding: 6px 8px; }
.dg-gen td { padding: 6px; }
.dg-fotos .acciones { margin-top: 8px; }
.dg-fotos .dg-cat { width: auto; margin-top: 0; }
.dg-miniaturas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.dg-miniaturas figure { margin: 0; width: 120px; position: relative; }
.dg-miniaturas img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rp-borde); background: var(--rp-fondo); display: block; }
.dg-miniaturas figcaption { font-size: .75rem; color: var(--rp-suave); margin-top: 2px; }
.dg-miniaturas figure button { position: absolute; top: 4px; right: 4px; padding: 2px 7px; }
.dg-barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--rp-blanco); border-top: 1px solid var(--rp-borde); box-shadow: 0 -2px 10px rgba(10,31,46,.08);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.dg-listado { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.cmp td:first-child { white-space: nowrap; }
.cmp th a { color: var(--rp-bosque); text-decoration: none; }
@media (max-width: 640px) { .dg-barra .acciones button { padding: 8px 10px; } .dg-fila { grid-template-columns: 1fr 1fr auto; } }

/* Familia ACLabs: Sora en títulos y nombre */
h1, h2, h3, .marca-texto, .kpi .valor { font-family: Sora, Inter, system-ui, sans-serif; }
.marca { gap: 10px; }
.marca .div { width: 1.5px; height: 30px; background: var(--rp-borde); }
.marca .txt { display: flex; flex-direction: column; line-height: 1; }
.marca-texto { font-weight: 800; }
.marca .by { font-family: Sora, Inter, sans-serif; font-size: .58rem; letter-spacing: .2em; color: var(--rp-suave); margin-top: 3px; font-weight: 500; }
@media (max-width: 640px) { .marca .by, .marca .div { display: none; } }

/* ---------- Aceites y grasas ---------- */
.ac-alertas { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ac-alertas li { padding: 8px 12px 8px 30px; border-radius: 8px; font-size: .9rem; position: relative; }
.ac-alertas li::before { content: ""; position: absolute; left: 12px; top: 50%; width: 8px; height: 8px; border-radius: 50%; transform: translateY(-50%); }
.ac-alertas li.rojo { background: var(--rp-error-claro); color: #7A1F17; }
.ac-alertas li.rojo::before { background: var(--rp-error); }
.ac-alertas li.amarillo { background: var(--rp-alerta-claro); color: #7A2E0B; }
.ac-alertas li.amarillo::before { background: var(--rp-alerta); }
.tarjeta h3 { margin: 16px 0 6px; }
@media (max-width: 640px) { #panel td .sub { white-space: nowrap; } }

/* ---------- Peligrosos ---------- */
.pg-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.pg-cats span { font-size: .72rem; background: var(--rp-fondo); border: 1px solid var(--rp-borde); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.pg-check { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 12px; margin-bottom: 8px; }
.pg-check label.check { margin-bottom: 6px; font-size: .85rem; }
dialog h3 { margin: 12px 0 6px; font-size: .95rem; }

/* ---------- Pendientes ---------- */
details.pend summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
details.pend summary::-webkit-details-marker { display: none; }
details.pend summary h2 { margin: 0; }
details.pend summary::after { content: "▾"; margin-left: auto; color: var(--rp-suave); }
details.pend:not([open]) summary::after { content: "▸"; }
details.pend .ac-alertas { margin-top: 10px; }
details.pend .ac-alertas a { margin-left: 6px; font-weight: 600; white-space: nowrap; }

/* Gráfico de barras apiladas por semana (ficha del local y vista del locatario) */
.grafico { display: flex; align-items: flex-end; gap: 6px; height: 140px; border-bottom: 1px solid var(--rp-borde); padding-top: 8px; }
.grafico .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.grafico .pila { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 4px 4px 0 0; overflow: hidden; min-height: 2px; }
.grafico .pila i { display: block; width: 100%; }
.grafico .col span { font-size: .7rem; color: var(--rp-suave); }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: .8rem; color: var(--rp-suave); }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.grafico { position: relative; }
.grafico .esperado { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--rp-error); pointer-events: none; }
.grafico .esperado span { position: absolute; right: 0; top: -1.4em; font-size: .7rem; color: var(--rp-error); background: var(--rp-blanco); padding: 0 4px; }
.leyenda .linea-esp { display: inline-block; width: 14px; border-top: 2px dashed var(--rp-error); margin-right: 4px; vertical-align: 3px; }
.barra-h { height: 10px; background: var(--rp-borde); border-radius: 99px; overflow: hidden; min-width: 80px; }
.barra-h > span { display: block; height: 100%; border-radius: 99px; }
tr.clic { cursor: pointer; }
tr.clic:hover td { background: var(--rp-petroleo-claro); }
.reclamo { background: var(--rp-error-claro); border-radius: 8px; padding: 8px 10px; margin-top: 4px; font-size: .85rem; }
.grafico.solo { padding-top: 0; }
.ejes { display: flex; gap: 6px; margin-top: 4px; }
.ejes span { flex: 1; min-width: 0; text-align: center; font-size: .7rem; color: var(--rp-suave); }
.qr { display: flex; margin: 12px 0; }
.qr img, .qr canvas { border: 10px solid #fff; border-radius: 8px; box-shadow: 0 0 0 1px var(--rp-borde); }
