/* Qué Como · panel para locales. Estética "Papel": tinta azul y tomate sobre papel crema. */
:root {
  --papel: #F6ECD9;
  --papel-claro: #FBF5EA;
  --papel-tostado: #EFE2C8;
  --linea: #E2D5BC;
  --tinta: #1F3552;
  --tinta-2: #5C6478;
  --tinta-3: #666B79; /* texto tenue: 4.9:1 sobre el papel (antes #8A8F9C, no llegaba a 4.5) */
  --tomate: #E0452B;
  --tomate-osc: #A92F1B;
  --tomate-texto: #BC331C; /* tomate para letras: 4.6:1 sobre el papel */
  --tomate-fuerte: #C5351D; /* fondo de botones con letra clara: 4.6:1 */
  --tomate-suave: #F9DDD5;
  --mantel: #4A63C8; /* serie "emitidos" en los gráficos (validado contra el papel) */
  --verde: #447633; /* 4.8:1 sobre el papel */
  --display: "Caprasimo", "Cooper Black", Georgia, serif;
  --hand: "Caveat Brush", "Comic Sans MS", cursive;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papel); color: var(--tinta); font: 500 15.5px/1.5 var(--body); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--tinta); text-decoration-color: var(--tomate); text-underline-offset: 3px; }
a:hover { color: var(--tomate-texto); }
:focus-visible { outline: 3px solid var(--tomate); outline-offset: 2px; border-radius: 6px; }
img { max-width: 100%; }
code { font: 700 0.9em ui-monospace, Menlo, Consolas, monospace; }

/* ---------- estructura ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1.5px solid var(--linea); background: var(--papel-claro); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-name { font-family: var(--display); font-size: 22px; color: var(--tomate-texto); line-height: 1; }
.brand-sub { font-family: var(--hand); font-size: 19px; color: var(--tinta-2); }
.who { display: flex; align-items: center; gap: 14px; font-size: 14px; flex-wrap: wrap; }
.who form { margin: 0; }
.email { color: var(--tinta-2); }
.pill-link { font-weight: 700; font-size: 13px; padding: 4px 10px; border: 1.5px solid var(--tinta); border-radius: 999px; text-decoration: none; }

.local-bar { padding: 20px 20px 0; border-bottom: 1.5px solid var(--linea); background: var(--papel); }
.local-head { max-width: 1040px; margin: 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.eyebrow { font-family: var(--hand); font-size: 19px; color: var(--tinta-2); }
.local-name { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 5vw, 40px); line-height: 1.05; margin: 0; }
.tabs { max-width: 1040px; margin: 14px auto 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px; text-decoration: none; font-weight: 700; font-size: 14.5px; color: var(--tinta-2); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--tinta); border-bottom-color: var(--tomate); }
.tabs a:hover { color: var(--tinta); }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 20px 48px; flex: 1; }
.foot { text-align: center; padding: 18px 20px 28px; color: var(--tinta-3); font-size: 13px; }

/* ---------- tipografía ---------- */
.h2 { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1.1; margin: 0 0 6px; }
.h3 { font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1.15; margin: 0 0 8px; }
.hand { font-family: var(--hand); font-size: 22px; line-height: 1.15; margin: 0; }
.accent { color: var(--tomate-texto); }
.big { font-size: 30px; }
.muted { color: var(--tinta-2); }
.small { font-size: 13.5px; }
.tiny { font-size: 12px; }
p { margin: 0 0 8px; }
em { font-style: normal; }

/* ---------- bloques ---------- */
.card { background: var(--papel-claro); border: 1.5px solid var(--linea); border-radius: var(--r); padding: 20px; }
.narrow { max-width: 460px; margin: 24px auto; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-wrap { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row-wrap form { margin: 0; }
.grow { flex: 1; min-width: 0; }
.align-end { align-self: flex-end; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 20px; }
.empty-art { color: var(--tinta-3); text-align: center; padding: 20px 0; font-size: 24px; }

.flash, .error { padding: 12px 16px; border-radius: 12px; margin: 0 0 18px; font-weight: 600; }
.flash { background: #E4EEDC; border: 1.5px solid #B9D1A8; color: #2F5A22; }
.error { background: var(--tomate-suave); border: 1.5px solid var(--tomate); color: var(--tomate-osc); }
.banner { border-radius: 12px; padding: 14px 16px; border: 1.5px dashed var(--tinta-3); background: var(--papel-claro); }
.banner-wait { border-color: #C9A25A; background: #FBF1DC; }
.banner-bad { border-color: var(--tomate); background: var(--tomate-suave); }

.status { font-size: 12.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; border: 1.5px solid; white-space: nowrap; }
.status-approved { color: var(--verde); border-color: var(--verde); background: #EEF4E8; }
.status-pending { color: #8A6A1C; border-color: #C9A25A; background: #FBF1DC; }
.status-rejected { color: var(--tomate-osc); border-color: var(--tomate); background: var(--tomate-suave); }
.status-paused { color: var(--tinta-2); border-color: var(--tinta-3); background: var(--papel); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: var(--papel-tostado); color: var(--tinta-2); vertical-align: 1px; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; min-width: 0; }
.field > span:first-child em { font-weight: 500; }
input, select, textarea { font: 600 16px/1.3 var(--body); color: var(--tinta); background: #fff; border: 1.5px solid var(--tinta); border-radius: 12px; padding: 11px 13px; width: 100%; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--tomate); }
input[type="time"] { width: auto; min-width: 110px; }
input[type="file"] { padding: 9px; background: var(--papel); border-style: dashed; }
input[readonly] { background: var(--papel); color: var(--tinta-2); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; padding: 0; }
.suffix { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.suffix input { max-width: 120px; }
.search-row { display: flex; gap: 10px; }
.search-row input { flex: 1; }
.code-input { font: 700 26px/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 800 15px/1 var(--body); padding: 13px 18px; border-radius: 14px; border: 2px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--tomate-fuerte); color: var(--papel-claro); border-bottom: 4px solid var(--tomate-osc); }
.btn.primary:hover { color: var(--papel-claro); filter: brightness(1.04); }
.btn.primary:active { transform: translateY(2px); border-bottom-width: 2px; }
.btn.ink { background: var(--tinta); color: var(--papel-claro); }
.btn.ink:hover { color: var(--papel-claro); }
.btn.ghost { background: transparent; color: var(--tinta); border-color: var(--tinta); }
.btn.wide { width: 100%; }
.small-btn { padding: 8px 12px; font-size: 13.5px; }
.link { background: none; border: 0; padding: 0; font: 700 14px var(--body); color: var(--tinta); text-decoration: underline; text-decoration-color: var(--tomate); text-underline-offset: 3px; cursor: pointer; }
.link.danger { color: var(--tomate-osc); }

/* opciones grandes (tipo de premio, frecuencia) */
.kinds, .weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.kinds legend { grid-column: 1 / -1; }
.kind { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1.5px solid var(--linea); border-radius: 14px; background: #fff; cursor: pointer; }
.kind:has(input:checked) { border-color: var(--tomate); background: var(--tomate-suave); }
.kind input { margin-top: 3px; }
.kind span { display: flex; flex-direction: column; }
.kind small { color: var(--tinta-2); font-weight: 500; }
.days { display: flex; gap: 8px; flex-wrap: wrap; }
.day-pill { position: relative; }
.day-pill input { position: absolute; opacity: 0; inset: 0; }
.day-pill span { display: inline-block; min-width: 52px; text-align: center; padding: 8px 10px; border-radius: 999px; border: 1.5px solid var(--tinta); font-weight: 800; font-size: 14px; background: #fff; }
.day-pill input:checked + span { background: var(--tinta); color: var(--papel-claro); }
.day-pill input:focus-visible + span { outline: 3px solid var(--tomate); outline-offset: 2px; }
.slot { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }

/* horarios */
.hours { display: flex; flex-direction: column; gap: 4px; margin: 14px 0 18px; }
.day { display: grid; grid-template-columns: 110px 110px 1fr; align-items: center; gap: 12px; padding: 10px 0; border-top: 1.5px dashed var(--linea); }
.day legend { float: left; margin: 0; font-family: var(--display); font-weight: 400; font-size: 18px; }
.day .slots { display: flex; gap: 14px; flex-wrap: wrap; }
.day.is-closed .slots { opacity: 0.35; pointer-events: none; }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 700; font-size: 14px; }
.plain-list { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; }
.plain-list li { padding: 10px 0; border-bottom: 1.5px dashed var(--linea); }
.plain-list form { margin: 0; }

/* mapa */
.map { height: 320px; border-radius: 14px; border: 1.5px solid var(--tinta); margin-top: 6px; background: var(--papel-tostado); z-index: 0; }

/* listas de locales */
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.list-item { padding: 0; }
.list-link { display: flex; align-items: center; gap: 14px; padding: 16px 18px; text-decoration: none; }
.list-link .grow { display: flex; flex-direction: column; }
.avatar { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--papel-tostado); color: var(--tomate-texto); font-family: var(--display); font-size: 20px; flex-shrink: 0; }

/* ingreso */
.login { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: center; max-width: 880px; margin: 24px auto; }
.login-art { text-align: center; }
.login-art .hand { font-size: 34px; color: var(--tomate-texto); margin-top: 12px; }
.login-card { display: flex; flex-direction: column; gap: 14px; }

/* resumen */
.checklist { list-style: none; counter-reset: paso; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { counter-increment: paso; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.checklist li::before { content: counter(paso); width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--tinta-3); display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--tinta-2); flex-shrink: 0; }
.checklist li.done::before { content: "✓"; background: var(--verde); border-color: var(--verde); color: #fff; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--papel-claro); border: 1.5px solid var(--linea); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 13px; font-weight: 700; color: var(--tinta-2); }
.kpi-value { font-family: var(--display); font-size: 36px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--tinta-2); }

/* fotos */
.photos { list-style: none; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.photo { background: #fff; border: 1.5px solid var(--linea); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.photo-actions { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; gap: 8px; }
.photo-actions form { margin: 0; }

/* premios */
.prizes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.prize { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.prize.is-off { opacity: 0.65; }
.prize-chip { font-family: var(--display); font-size: 22px; color: var(--papel-claro); background: var(--tomate-fuerte); border-radius: 14px; min-width: 84px; padding: 10px 12px; text-align: center; transform: rotate(-3deg); }
.prize.is-off .prize-chip { background: var(--tinta-3); }
.prize-title { font-size: 16px; }
.prize-caps { margin-top: 4px; }
.prize-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.prize-actions form { margin: 0; }

/* canje */
.redeem-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.redeem-card { display: flex; flex-direction: column; gap: 14px; }
.scanner { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.scanner video { width: 100%; max-height: 340px; border-radius: 14px; background: #000; object-fit: cover; }
.result { border-radius: 14px; padding: 16px 18px; border: 2px solid; }
.result-title { font-family: var(--display); font-size: 24px; margin: 0 0 4px; }
.result-prize { font-family: var(--display); font-size: 44px; color: var(--tomate-texto); line-height: 1; margin: 6px 0; }
.result-ok { border-color: var(--verde); background: #EEF4E8; }
.result-ok .result-title { color: var(--verde); }
.result-used, .result-expired, .result-notfound { border-color: var(--tomate); background: var(--tomate-suave); }
.result-used .result-title, .result-expired .result-title, .result-notfound .result-title { color: var(--tomate-osc); }

/* administración */
.review { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.big-name { font-family: var(--display); font-weight: 400; font-size: 20px; }
.review-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; min-width: 200px; }
.review-actions form { margin: 0; }
.review-actions details form { margin-top: 10px; }
summary.link { list-style: none; }
summary.link::-webkit-details-marker { display: none; }

/* tablas */
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th { text-align: left; font-size: 12.5px; color: var(--tinta-2); font-weight: 700; padding: 8px 8px 8px 0; border-bottom: 1.5px solid var(--linea); }
.data td { padding: 10px 8px 10px 0; border-bottom: 1px dashed var(--linea); font-variant-numeric: tabular-nums; vertical-align: top; }
.data td form { margin: 0; }

/* ---------- gráficos ---------- */
.chart-card { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.chart-card figcaption { display: flex; flex-direction: column; gap: 2px; }
.legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; gap: 16px; font-size: 13px; font-weight: 700; color: var(--tinta-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-issued { background: var(--mantel); }
.sw-redeemed { background: var(--tomate); }
.chart { position: relative; height: 220px; padding-left: 0; }
.gridlines { position: absolute; inset: 0 0 26px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.gridlines span { border-top: 1px solid var(--linea); position: relative; }
.gridlines span[data-v]::after { content: attr(data-v); position: absolute; right: 0; top: -17px; font-size: 11.5px; color: var(--tinta-3); font-variant-numeric: tabular-nums; }
.cols { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.col { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; outline: none; min-width: 0; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; border-bottom: 1.5px solid var(--tinta-3); }
.bar { display: block; width: 100%; max-width: 14px; min-height: 0; border-radius: 4px 4px 0 0; }
.bar-issued { background: var(--mantel); }
.bar-redeemed { background: var(--tomate); }
.chart-hours .bar { max-width: 18px; }
.col-label { height: 26px; line-height: 26px; font-size: 11px; color: var(--tinta-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.col:hover .bars, .col:focus .bars { background: rgba(31, 53, 82, 0.05); border-radius: 6px 6px 0 0; }
.tip { position: absolute; bottom: calc(100% - 20px); left: 50%; transform: translateX(-50%); background: var(--tinta); color: var(--papel-claro); font-size: 12.5px; line-height: 1.35; padding: 8px 10px; border-radius: 10px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s; z-index: 2; }
.col:hover .tip, .col:focus .tip { opacity: 1; }
.col:first-child .tip { left: 0; transform: none; }
.col:last-child .tip { left: auto; right: 0; transform: none; }
.table-view summary { cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--tinta-2); }
.table-view table { margin-top: 10px; border-collapse: collapse; font-size: 13.5px; width: 100%; }
.table-view th, .table-view td { text-align: left; padding: 4px 8px 4px 0; border-bottom: 1px dashed var(--linea); font-variant-numeric: tabular-nums; }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; gap: 12px; }
  .login-art img { width: 80px; height: 80px; }
  .redeem-layout { grid-template-columns: 1fr; }
  .day { grid-template-columns: 1fr auto; }
  .day .slots { grid-column: 1 / -1; }
  .search-row { flex-direction: column; }
  .prize-actions { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }
  .col-label { font-size: 9.5px; }
  .who .email { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Logo: vista previa de la tarjeta de la grilla de la app (3 columnas en el teléfono) */
.logo-card { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: start; }
@media (max-width: 560px) { .logo-card { grid-template-columns: 1fr; } }
.logo-preview { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.tile { width: 124px; background: var(--papel-claro); border: 1px solid var(--linea); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 10px rgba(31, 53, 82, .08); }
.tile-img { aspect-ratio: 1; background: var(--papel-tostado); display: grid; place-items: center; }
.tile-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-initial { font: 400 38px/1 var(--display); color: var(--tomate-texto); }
.tile-text { padding: 7px 8px 9px; display: flex; flex-direction: column; line-height: 1.25; }
.tile-text strong { font-weight: 800; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-text span { font-size: 11px; color: var(--tinta-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Registro de canjes */
.attempts li { padding: 8px 0; border-bottom: 1px dashed var(--linea); }
.attempts li:last-child { border-bottom: 0; }
.tag-ok { background: #E3EFDB; color: var(--verde); border-color: var(--verde); }
.tag-warn { background: #FBF1DC; color: #8A6417; border-color: #C9A25A; }
.tag-bad { background: var(--tomate-suave); color: var(--tomate-osc); border-color: var(--tomate); }
.result-bad_pass, .result-missing_pass, .result-locked { border-color: var(--tomate); background: var(--tomate-suave); }
.result-bad_pass .result-title, .result-missing_pass .result-title, .result-locked .result-title { color: var(--tomate-osc); }
.alert-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.alert-table th, .alert-table td { text-align: left; padding: 8px 6px; border-bottom: 1px dashed var(--linea); vertical-align: top; }
.alert-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--tinta-2); }

/* Atribución del mapa (Leaflet): el enlace se distingue por el subrayado, no solo por el color. */
.leaflet-control-attribution a { color: var(--tinta) !important; text-decoration: underline !important; }
