:root {
  --rojo: #b3202a;
  --rojo-osc: #8c1820;
  --verde: #1f7a4d;
  --fondo: #f7f3ee;
  --card: #fff;
  --texto: #222;
  --muted: #6b6b6b;
  --borde: #e5ddd3;
  --radio: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 16px;
  line-height: 1.4;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--rojo); color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.top h1 { font-size: 1.1rem; margin: 0; }
.top .link { color: #fff; }

main { max-width: 560px; margin: 0 auto; padding: 12px; }

.card {
  background: var(--card); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 14px 16px; margin-bottom: 12px;
}
.card h2, .card h3 { margin: 0 0 8px; }
.destacado { border: 2px solid var(--verde); text-align: center; }
.destacado h2 { font-size: 1.6rem; color: var(--verde); }

.muted { color: var(--muted); font-size: .9rem; margin: 4px 0; }

label { display: block; font-size: .9rem; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 12px; margin-top: 4px;
  border: 1px solid var(--borde); border-radius: 10px; background: #fff;
}
textarea { resize: vertical; }

button, .btn {
  display: inline-block; width: 100%; margin-top: 12px;
  font: inherit; font-weight: 600; text-align: center; text-decoration: none;
  padding: 12px; border: 0; border-radius: 10px;
  background: var(--rojo); color: #fff; cursor: pointer;
}
button:active, .btn:active { background: var(--rojo-osc); }
button.sec { background: #fff; color: var(--rojo); border: 1px solid var(--rojo); }
button.chico { width: auto; padding: 6px 12px; margin: 6px 6px 0 0; font-size: .85rem; }
button.link { background: none; color: var(--rojo); width: auto; padding: 4px; margin: 0; font-weight: 500; }
button:disabled { opacity: .5; }

.fila { display: flex; gap: 8px; }
.fila > * { flex: 1; }

.item { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--borde); }
.item:first-of-type { border-top: 0; }
.item img { width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fafafa; flex: none; }
.item .info { flex: 1; min-width: 0; }
.item .titulo { font-weight: 600; overflow-wrap: anywhere; }
.item a { color: var(--rojo); }

.badge { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #eee; margin: 4px 4px 0 0; }
.badge.ok { background: #dff3e8; color: var(--verde); }
.badge.no { background: #fbe3e4; color: var(--rojo); }
.badge.alta { background: #fff1c2; }

.comprado { color: var(--verde); font-size: .9rem; margin-top: 4px; }

.lista { list-style: none; padding: 0; margin: 0; }
.lista li { padding: 12px 0; border-top: 1px solid var(--borde); }
.lista li:first-child { border-top: 0; }
.lista a { color: inherit; text-decoration: none; display: flex; justify-content: space-between; }

#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; background: #fff; border-top: 1px solid var(--borde);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs[hidden] { display: none; }
#tabs a {
  flex: 1; text-align: center; padding: 8px 0 10px; font-size: 1.2rem;
  color: var(--muted); text-decoration: none;
}
#tabs a span { display: block; font-size: .7rem; }
#tabs a.activo { color: var(--rojo); }
#tabs a[hidden] { display: none; }

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: 90%;
  background: #222; color: #fff; padding: 10px 16px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 10;
}
#toast.ver { opacity: 1; }
#toast.error { background: var(--rojo); }
