/* Layout: una columna angosta (lista tipo góndola), header azul con pestañas, etiquetas de precio amarillas */
:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --fg: #151a2d;
  --muted: #5d6480;
  --line: #dfe2ec;
  --accent: #1d3fb8;
  --accent-fg: #ffffff;
  --tag: #ffd43b;
  --tag-fg: #2a2100;
  --error: #c0262d;
  --open: #12805c;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --surface: #181c2e;
    --fg: #e9ebf5;
    --muted: #9aa1bd;
    --line: #2a3048;
    --accent: #6f8cff;
    --accent-fg: #0b0f20;
    --tag: #ffd43b;
    --tag-fg: #2a2100;
    --error: #ff6b70;
    --open: #4cd69f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 var(--font-body);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2 { font-family: var(--font-display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
code { font-size: 0.9em; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }

/* Header */
.top {
  background: #1d3fb8;
  color: #fff;
  padding-top: calc(env(safe-area-inset-top, 0px) + 18px);
  position: sticky; top: 0; z-index: 5;
}
.top-inner { display: grid; gap: 14px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand h1 { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.sub { margin: 2px 0 0; font-size: 0.85rem; opacity: 0.8; }
.tag {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--tag); color: var(--tag-fg);
  font: 800 1.4rem var(--font-display);
  border-radius: 8px 8px 8px 2px;
  transform: rotate(-6deg);
}
.tabs { display: flex; gap: 4px; }
.tab {
  flex: 1; border: 0; background: transparent; color: #fff; opacity: 0.75;
  padding: 10px 8px 12px; cursor: pointer; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tab.active { opacity: 1; border-bottom-color: var(--tag); }

main { padding-block: 18px 48px; }

.banner {
  background: var(--surface); border: 1px dashed var(--muted); border-radius: var(--radius);
  padding: 10px 14px; font-size: 0.875rem; color: var(--muted); margin: 0 0 16px;
}

/* Búsqueda */
.search {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 16px; min-height: 52px;
}
.search svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 12px 0; font-size: 1rem; }
.search:focus-within { border-color: var(--accent); }

.products, .prices { list-style: none; margin: 0; padding: 0; }
.products { display: grid; gap: 8px; }
.product {
  width: 100%; text-align: left; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.product:hover { border-color: var(--accent); }
.product-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.product-meta { font-size: 0.85rem; color: var(--muted); }
.from { text-align: right; flex: none; }
.from small { display: block; font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.money { font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.15rem; }

/* Detalle */
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 4px 0; font-weight: 600; }
.detail-head { margin: 10px 0 16px; }
.detail-head h2 { font-size: 1.7rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.detail-head p { margin: 4px 0 0; }
.prices { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.price-row { display: grid; grid-template-columns: 2rem 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; }
.price-row + .price-row { border-top: 1px solid var(--line); }
.rank { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.kiosk { min-width: 0; }
.kiosk-name { font-weight: 600; overflow-wrap: anywhere; }
.kiosk-meta { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.price-row .money { text-align: right; }
.price-row.best .money {
  background: var(--tag); color: var(--tag-fg); padding: 2px 10px;
  border-radius: 6px 6px 6px 2px;
}
.best-label { display: block; text-align: right; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 2px; }
.diff { display: block; text-align: right; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Formulario */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form { display: grid; gap: 16px; }
.form h2 { font-size: 1.4rem; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field small { color: var(--muted); font-size: 0.8rem; }
.opt { font-weight: 400; color: var(--muted); }
.field input, .price-input {
  width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); padding: 10px 12px; font-size: 1rem;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.price-input { display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.price-input:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.price-input span { font: 800 1.2rem var(--font-display); color: var(--muted); }
.price-input input { border: 0; background: transparent; padding: 10px 0; min-height: 0; outline: 0 !important; font: 800 1.2rem var(--font-display); font-variant-numeric: tabular-nums; }
.error { color: var(--error); margin: 0; font-weight: 500; }

.btn {
  border: 0; border-radius: 10px; cursor: pointer; font-weight: 600;
  background: var(--accent); color: var(--accent-fg); padding: 12px 18px; width: 100%;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-big { min-height: 52px; font-size: 1.05rem; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty .btn { width: auto; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  background: var(--fg); color: var(--bg); padding: 12px 18px; border-radius: 999px;
  font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,0.2); max-width: calc(100% - 32px);
}

/* Horarios: estado en la lista */
.group-title {
  font: 600 0.75rem var(--font-body); text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); padding: 12px 16px 6px; border-top: 1px solid var(--line);
}
.group-title:first-child { border-top: 0; }
.price-row { grid-template-columns: 1fr auto; }
.group-title + .price-row { border-top: 0; }
.status {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0;
  font-size: 0.85rem; cursor: pointer; color: var(--muted); text-align: left;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status.open { color: var(--open); font-weight: 600; }
.status.open::before { background: var(--open); }
.status.closed::before { background: var(--error); }
.status.unknown { text-decoration: underline dotted; text-underline-offset: 3px; }
.price-row.is-closed .kiosk-name, .price-row.is-closed .money { opacity: 0.6; }
.small { font-size: 0.8rem; }

/* Editor de horario */
.hours-box summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; padding: 4px 0; }
.hours-box[open] summary { margin-bottom: 8px; }
.hours-box > p { margin: 0 0 10px; }
.hours-editor { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.hrow { display: grid; grid-template-columns: 6.5rem 1fr auto 1fr; gap: 8px; align-items: center; }
.hrow .hlabel { font-size: 0.9rem; font-weight: 500; display: grid; gap: 2px; }
.hrow .hlabel .check { font-weight: 400; color: var(--muted); }
.hrow .hlabel .check input { width: 16px; height: 16px; }
.hrow input[type="time"] {
  min-width: 0; width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); padding: 6px 8px; font-variant-numeric: tabular-nums;
}
.hrow .hclosed { grid-column: 2 / -1; }
.hrow.is-off input[type="time"], .hrow.is-off .sep { display: none; }
.hours-editor.all-day .hrow { display: none; }

/* Diálogo */
.dialog {
  border: 0; padding: 0; border-radius: 16px; width: min(480px, calc(100% - 24px));
  max-height: calc(100% - 24px); background: var(--surface); color: var(--fg);
}
.dialog::backdrop { background: rgba(10, 14, 30, 0.55); }
.dialog-body { display: grid; gap: 12px; padding: 20px; }
.dialog-body h2 { font-size: 1.35rem; overflow-wrap: anywhere; }
.dialog-body h3 { margin: 8px 0 0; font-size: 1rem; }
.dialog-body p { margin: 0; }
.week { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.week li { display: flex; justify-content: space-between; gap: 12px; }
.week li.today { font-weight: 700; }
.dialog-actions { display: flex; gap: 8px; }
.btn-secondary { background: var(--bg); color: var(--fg); border: 1px solid var(--line); }

/* Fotos */
.thumb {
  width: 48px; height: 48px; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  font: 800 1.2rem var(--font-display); color: var(--muted);
}
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; display: block; }
.thumb.lg { width: 84px; height: 84px; font-size: 1.8rem; }
.thumb.xl { width: 104px; height: 104px; font-size: 2.2rem; border-radius: 14px; }
.thumb-btn { padding: 0; cursor: zoom-in; }
.thumb-btn:disabled { cursor: default; }
.viewer-img { width: 100%; max-height: 60vh; object-fit: contain; background: #fff; border-radius: 10px; }
.product { justify-content: flex-start; }
.product .product-name { flex: 1; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; }
.detail-text { min-width: 0; flex: 1; display: grid; gap: 4px; justify-items: start; }
.detail-text p { margin: 0; }
.field .label { font-weight: 600; font-size: 0.9rem; }
.photo-pick { display: flex; gap: 12px; align-items: flex-start; }
.photo-side { min-width: 0; flex: 1; display: grid; gap: 8px; }
.photo-picker { display: grid; gap: 8px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-actions .btn { width: auto; padding: 8px 12px; font-size: 0.875rem; }
.file-btn { display: inline-block; text-align: center; }
.file-btn:focus-within { outline: 3px solid var(--tag); outline-offset: 2px; }
.photo-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.photo-option {
  display: grid; gap: 4px; padding: 4px; cursor: pointer; text-align: center;
  border: 2px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 0.7rem; line-height: 1.25; color: var(--muted);
}
.photo-option img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 6px; max-width: 100%; }
.photo-option span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.photo-option.selected { border-color: var(--accent); }

/* Cuenta */
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.account { display: flex; align-items: center; gap: 8px; flex: none; }
.account-label { font-size: 0.8rem; opacity: 0.8; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn {
  border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; color: #fff;
  border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.account-btn:hover { background: rgba(255, 255, 255, 0.12); }
.tabs { align-items: center; }
.tab-group { display: flex; gap: 4px; flex: 1; min-width: 0; }
.tabs > .account-btn { flex: none; margin-bottom: 3px; }

/* Ciudad */
.city-btn {
  border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit;
  font-weight: 600; text-decoration: underline; text-decoration-color: var(--tag);
  text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.city-btn::after { content: " ▾"; font-size: 0.8em; }
.city-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.city-option {
  width: 100%; text-align: left; cursor: pointer; display: grid; gap: 1px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 10px; padding: 10px 12px;
}
.city-option:hover { border-color: var(--accent); }
.city-option small { color: var(--muted); }

/* Votos y reportes */
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.vote {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; font-weight: 500;
}
.vote .count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.vote.on { border-color: var(--open); color: var(--open); }
.vote.no.on { border-color: var(--error); color: var(--error); }
.vote:disabled { opacity: 0.6; cursor: wait; }
.report-link {
  border: 0; background: none; padding: 4px 2px; cursor: pointer;
  color: var(--muted); font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px;
}
.photo-links { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.pending-box { margin-bottom: 16px; display: grid; gap: 6px; }
.pending-box h3 { margin: 0; font: 600 1rem var(--font-display); }
.pending-box p { margin: 0 0 4px; }
.pending-box .prices { border-style: dashed; }
.reasons { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.reasons .check { font-size: 0.95rem; }

@media (min-width: 720px) {
  .top-inner { grid-template-columns: 1fr auto; align-items: end; }
  .tabs, .tab-group { gap: 8px; }
  .top-inner > .tabs { justify-self: end; }
  .tab { flex: none; padding-inline: 16px; }
  main { padding-top: 28px; }
}
@media (prefers-reduced-motion: no-preference) {
  .product, .btn { transition: border-color .15s, filter .15s; }
}

/* Pie de página */
.site-footer { text-align: center; padding-top: 32px; padding-bottom: 40px; color: var(--muted); font-size: .85rem; }
.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--fg); }
