/* Paleta tomada del logo de la Agencia: guinda, dorado, gris y acentos de la franja */
:root {
  --guinda: #7a1f3d; --guinda-o: #5a1530; --guinda-c: #f6ecef;
  --dorado: #b08d57; --dorado-c: #f7f0e4;
  --morado: #6b3fa0; --teal: #1c8c8c; --verde: #2e8b57; --naranja: #d9731f; --rojo: #c62828; --amarillo: #b7791f;
  --fondo: #f5f3f1; --texto: #22252d; --gris: #5f6676; --linea: #e6e1dc; --blanco: #fff;
  --sombra: 0 1px 2px rgba(34, 37, 45, .06), 0 4px 14px rgba(34, 37, 45, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--fondo); color: var(--texto); }

/* ---------- Encabezado con bandera colgante ---------- */
header.barra { position: sticky; top: 0; z-index: 30; background: linear-gradient(180deg, var(--guinda) 0%, var(--guinda-o) 100%); color: #fff; min-height: 66px; padding: 10px 124px 10px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
header.barra .tit { flex: 1 1 220px; min-width: 0; }
header.barra h1 { font-size: 17px; margin: 0; line-height: 1.2; }
header.barra .sub { font-size: 12px; opacity: .85; margin-top: 2px; }
header.barra .acciones { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
header.barra .chip { font-size: 12px; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.25); padding: 6px 10px; border-radius: 999px; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
header.barra a.btn-h, header.barra button.btn-h { width: auto; margin: 0; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid rgba(255,255,255,.45); padding: 7px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
header.barra a.btn-h:hover, header.barra button.btn-h:hover { background: rgba(255,255,255,.12); }
.bandera { position: absolute; top: 0; right: 16px; width: 96px; height: 104px; background: var(--guinda); clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%); filter: drop-shadow(0 3px 4px rgba(0,0,0,.25)); }
.bandera::after { content: ""; position: absolute; inset: 0 4px 5px 4px; background: #fff; clip-path: polygon(0 0, 100% 0, 100% 78%, 50% 100%, 0 78%); }
.bandera img { position: absolute; z-index: 1; left: 9px; right: 9px; top: 14px; width: 78px; height: auto; }
.franja { height: 5px; background: linear-gradient(90deg, #7a1f3d 0 10%, #8e3b5e 10% 20%, #6b3fa0 20% 30%, #1c8c8c 30% 40%, #2e8b57 40% 50%, #8bb33f 50% 60%, #d9a21f 60% 70%, #d9731f 70% 80%, #c2452d 80% 90%, #7a1f3d 90%); }
.demo { background: var(--dorado); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; margin-left: 6px; vertical-align: middle; letter-spacing: .5px; }

main { max-width: 1120px; margin: 0 auto; padding: 46px 16px 16px; }
.tarjeta { background: #fff; border-radius: 16px; padding: 18px; margin-bottom: 14px; box-shadow: var(--sombra); border: 1px solid #efeae6; }
.tarjeta h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.tarjeta h2 .ico { font-size: 18px; }
label { display: block; font-size: 13px; color: var(--gris); margin: 10px 0 4px; font-weight: 600; }
input, select, textarea { width: 100%; font: inherit; font-size: 17px; padding: 11px 12px; border: 1px solid #d5cfca; border-radius: 10px; background: #fff; color: var(--texto); }
input:focus, select:focus { outline: 2px solid var(--guinda); outline-offset: 1px; border-color: var(--guinda); }
button, .boton { display: inline-block; width: 100%; font: inherit; font-size: 16px; font-weight: 700; padding: 13px; border: 0; border-radius: 11px; background: var(--guinda); color: #fff; cursor: pointer; text-align: center; text-decoration: none; margin-top: 10px; }
button:hover, .boton:hover { background: var(--guinda-o); }
button.secundario, .boton.secundario { background: #eee8e4; color: var(--texto); }
button.secundario:hover, .boton.secundario:hover { background: #e3dbd5; }
button.dorado, .boton.dorado { background: var(--dorado); }
button.chico { width: auto; padding: 8px 12px; font-size: 13px; margin: 0; }
button:disabled { opacity: .5; cursor: default; }
.fila { display: flex; gap: 8px; align-items: center; }
.fila > * { flex: 1; }
.muted { color: var(--gris); font-size: 13px; }
.oculto { display: none !important; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }

/* ---------- Indicadores ---------- */
.kpi { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--sombra); border: 1px solid #efeae6; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--acento, var(--guinda)); }
.kpi .t { font-size: 12px; font-weight: 800; color: var(--gris); text-transform: uppercase; letter-spacing: .6px; display: flex; align-items: center; gap: 6px; }
.kpi .p { font-size: 44px; font-weight: 800; line-height: 1.1; margin: 6px 0 2px; color: var(--guinda); }
.barra-p { height: 10px; background: #ece6e8; border-radius: 6px; overflow: hidden; margin-top: 8px; }
.barra-p > div { height: 100%; background: linear-gradient(90deg, var(--guinda), #a33a5f); border-radius: 6px; transition: width .7s ease; }

/* Aforo destacado */
.aforo { background: linear-gradient(135deg, var(--guinda) 0%, #8e2a4c 60%, var(--guinda-o) 100%); color: #fff; border-radius: 18px; padding: 18px 20px; box-shadow: var(--sombra); margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.aforo .lbl { font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; opacity: .9; }
.aforo .num { font-size: 46px; font-weight: 800; line-height: 1; }
.aforo .de { font-size: 15px; opacity: .9; }
.aforo .barra-p { background: rgba(255,255,255,.25); }
.aforo .barra-p > div { background: linear-gradient(90deg, #f3d9a4, #fff); }
.aforo .ritmo { background: rgba(255,255,255,.16); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 700; }

/* Anillos */
.anillos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.anillo-card { background: #fff; border: 1px solid #efeae6; border-radius: 16px; padding: 14px 10px 12px; text-align: center; box-shadow: var(--sombra); font: inherit; color: var(--texto); margin: 0; width: 100%; }
button.anillo-card { cursor: pointer; } button.anillo-card:hover { background: #fff; border-color: var(--guinda); }
.anillo-card .n { font-weight: 800; font-size: 14px; margin-top: 6px; }
.anillo-card .d { font-size: 12px; color: var(--gris); margin-top: 2px; }
.anillo-card .e { min-height: 20px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-bottom: 1px solid #f0ebe7; vertical-align: top; }
th { color: var(--gris); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.tabla { overflow-x: auto; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { width: auto; margin: 0; padding: 9px 14px; font-size: 14px; background: #fff; color: var(--texto); border: 1px solid var(--linea); }
.tabs button:hover { background: var(--guinda-c); }
.tabs button.activo { background: var(--guinda); color: #fff; border-color: var(--guinda); }
.etq { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.etq.ok { background: #e3f3ea; color: #1d6b42; }
.etq.warn { background: #fdf1d8; color: #7a4f00; }
.etq.bad { background: #fde3e3; color: #8e1b1b; }
.etq.info { background: var(--guinda-c); color: var(--guinda); }

.modal-fondo { position: fixed; inset: 0; background: rgba(20, 10, 15, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: #fff; width: 100%; max-width: 480px; border-radius: 18px; overflow: hidden; max-height: 92vh; overflow-y: auto; }
.modal.ancho { max-width: 980px; }
.modal .cab { padding: 16px; color: #fff; font-size: 19px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cab.verde { background: var(--verde); } .cab.amarillo { background: var(--amarillo); } .cab.rojo { background: var(--rojo); } .cab.guinda { background: var(--guinda); }
.modal .cuerpo { padding: 16px; }
.toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); background: var(--verde); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; z-index: 60; box-shadow: 0 4px 12px rgba(0,0,0,.2); max-width: 90vw; }
.opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.opciones button { margin: 0; background: #fff; color: var(--texto); border: 2px solid var(--linea); text-align: left; }
.opciones button:hover { background: var(--guinda-c); }
.opciones button.activo { border-color: var(--guinda); background: var(--guinda-c); }
.opciones button small { display: block; font-size: 11px; color: var(--gris); font-weight: 600; margin-top: 2px; }
.foto-mini { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: #eee; }

/* ---------- Pie con logo de WolfTech ---------- */
footer.pie { text-align: center; font-size: 12px; color: var(--gris); padding: 26px 16px 34px; line-height: 1.6; }
footer.pie .lobo { width: 74px; height: 74px; border-radius: 50%; background: #fff; border: 3px solid var(--guinda); box-shadow: 0 0 0 4px var(--dorado-c), var(--sombra); display: inline-flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 8px; }
footer.pie .lobo img { width: 86%; height: 86%; object-fit: contain; }
footer.pie a { color: var(--guinda); }

@media (max-width: 520px) {
  header.barra { padding-right: 96px; }
  .bandera { width: 76px; height: 86px; right: 10px; }
  .bandera img { left: 7px; right: 7px; top: 11px; width: 62px; }
  .kpi .p { font-size: 38px; }
  .aforo .num { font-size: 40px; }
}
@media print { header.barra, .bandera, .franja, .no-print, footer.pie { display: none !important; } body { background: #fff; } main { padding-top: 0; } .tarjeta { box-shadow: none; } }

/* ---------- Versión 5 ---------- */
header.barra button.chip { width: auto; margin: 0; font: inherit; font-size: 12px; color: #fff; cursor: pointer; }
header.barra .chip.red { background: rgba(255,255,255,.18); }
header.barra .chip.red.mal { background: #f3d38a; color: #4a2c00; border-color: #f3d38a; font-weight: 800; }
button.peligro, .boton.peligro { background: var(--rojo); } button.peligro:hover { background: #a31f1f; }
.dato { margin: 4px 0; }
.foto-botones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.foto-botones label { margin: 0; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 13px 8px; border: 2px dashed #d5cfca; border-radius: 11px; background: #fff; color: var(--texto); font-size: 15px; font-weight: 700; cursor: pointer; text-align: center; }
.foto-botones label:hover { border-color: var(--guinda); background: var(--guinda-c); }
.foto-botones input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.foto-lista { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 14px; }
.aviso-red { background: #fff4dc; border: 1px solid #f0dca0; color: #5a4300; border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; margin: 8px 0; }
.alerta-caja { background: #fde3e3; border: 1px solid #f5bcbc; color: #7a1b1b; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin: 8px 0; }
.codigo-grande { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--guinda); text-align: center; margin: 8px 0; }
.qr-caja { text-align: center; } .qr-caja img { width: 180px; height: 180px; image-rendering: pixelated; }
.herr { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.herr .tarjeta { margin: 0; }
td input, td select { font-size: 14px; padding: 7px 8px; min-width: 70px; }
.acc { display: flex; gap: 6px; flex-wrap: wrap; }
.acc button { width: auto; margin: 0; padding: 7px 10px; font-size: 12px; }
.pend-local { background: #fff8e6; }
