/* Catas Los Pepellies — móvil primero */
:root {
  --fondo: #FBF8F4;
  --tarjeta: #FFFFFF;
  --borde: #ECE4DA;
  --vino: #7A1F3D;
  --vino-oscuro: #5E1730;
  --vino-suave: #F6E9ED;
  --texto: #2B2320;
  --texto-2: #6F635C;
  --ok: #2F7A4B;
  --ok-suave: #E6F3EA;
  --error: #B3261E;
  --error-suave: #FBE9E7;
  --info-suave: #F3EFE8;
  --radio: 14px;
  --toque: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.75rem; color: var(--vino); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
a { color: var(--vino); }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; }
.oculto { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Cabecera */
.cabecera { background: var(--tarjeta); border-bottom: 1px solid var(--borde); position: sticky; top: 0; z-index: 10; }
.cabecera .dentro { display: flex; align-items: center; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--vino); font-family: "Fraunces", Georgia, serif; font-weight: 600; }
.logo img { height: 34px; width: auto; }
.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button { min-height: var(--toque); display: inline-flex; align-items: center; padding: 0 10px; border-radius: 10px;
  color: var(--texto); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.nav a:hover, .nav button:hover { background: var(--vino-suave); }

.dentro { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.dentro.ancho { max-width: 1100px; }
main.dentro { padding: 20px 16px 64px; }

/* Tarjetas */
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px; margin-bottom: 16px; }
.tarjeta > :last-child { margin-bottom: 0; }
.tarjeta.destacada { border-color: var(--vino); }
.rejilla { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.fila { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.fila.entre { justify-content: space-between; }
.suave { color: var(--texto-2); font-size: .92rem; }
.grande { font-size: 1.5rem; font-weight: 600; }

/* Botones */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--toque); padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--vino); background: var(--vino); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.boton:hover { background: var(--vino-oscuro); }
.boton.secundario { background: var(--tarjeta); color: var(--vino); }
.boton.secundario:hover { background: var(--vino-suave); }
.boton.peligro { background: var(--tarjeta); color: var(--error); border-color: var(--error); }
.boton.bloque { width: 100%; }
.boton.peque { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.boton[disabled] { opacity: .5; cursor: not-allowed; }

/* Formularios */
label { display: block; font-weight: 600; margin: 0 0 6px; }
.campo { margin-bottom: 14px; }
.campo .ayuda { font-weight: 400; color: var(--texto-2); font-size: .88rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local],
input[type=file], select, textarea {
  width: 100%; min-height: var(--toque); padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px;
  background: #fff; font: inherit; color: var(--texto);
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus, .chip:focus-within, .boton:focus-visible { outline: 2px solid var(--vino); outline-offset: 1px; }
.codigo-input { text-transform: uppercase; letter-spacing: .3em; font-size: 1.4rem; text-align: center; font-weight: 700; }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--toque); font-weight: 400; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--vino); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip span { display: inline-flex; align-items: center; min-height: var(--toque); padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--borde); background: #fff; user-select: none; }
.chip input:checked + span { background: var(--vino); border-color: var(--vino); color: #fff; }
.chip input:disabled + span { opacity: .45; }
.chip.correcta span { border-color: var(--ok); background: var(--ok-suave); color: var(--ok); }
.chip.fallo span { border-color: var(--error); background: var(--error-suave); color: var(--error); text-decoration: line-through; }
.chip.acierto span { border-color: var(--ok); background: var(--ok); color: #fff; }
.chip.nuevo span { border-style: dashed; }
.contador { font-weight: 400; color: var(--texto-2); font-size: .9rem; }

/* Escala de 3 niveles */
.escala { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.escala .chip span { width: 100%; justify-content: center; border-radius: 10px; padding: 0 6px; font-size: .92rem; }
.eje { margin-bottom: 12px; }
.eje-titulo { font-size: .9rem; color: var(--texto-2); margin-bottom: 4px; }

/* Avisos */
.aviso { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; }
.aviso.ok { background: var(--ok-suave); border-color: #bfdcc9; }
.aviso.error { background: var(--error-suave); border-color: #f0c4bf; }
.aviso.info { background: var(--info-suave); border-color: var(--borde); }
.errores { margin: 0; padding-left: 18px; }

/* Progreso de vinos */
.pasos { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pasos a { min-width: var(--toque); min-height: var(--toque); display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid var(--borde); background: #fff; text-decoration: none; color: var(--texto); font-weight: 600; }
.pasos a.hecho { background: var(--vino-suave); border-color: var(--vino-suave); }
.pasos a.actual { background: var(--vino); color: #fff; border-color: var(--vino); }
.barra { height: 8px; background: var(--borde); border-radius: 99px; overflow: hidden; }
.barra > i { display: block; height: 100%; background: var(--vino); }

/* Vino */
.vino-cab { display: flex; gap: 14px; align-items: center; }
.vino-cab img { width: 64px; height: 96px; object-fit: contain; background: var(--fondo); border-radius: 10px; flex: none; }
.etiqueta { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 99px; background: var(--vino-suave); color: var(--vino); font-weight: 600; }
.etiqueta.gris { background: var(--info-suave); color: var(--texto-2); }
.etiqueta.verde { background: var(--ok-suave); color: var(--ok); }

/* Autocompletar */
.autocompletar { position: relative; }
.autocompletar ul { position: absolute; z-index: 5; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px; list-style: none;
  background: #fff; border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 8px 24px rgba(43,35,32,.08); max-height: 260px; overflow: auto; }
.autocompletar li { min-height: var(--toque); display: flex; align-items: center; padding: 0 10px; border-radius: 8px; cursor: pointer; }
.autocompletar li:hover, .autocompletar li.activo { background: var(--vino-suave); }

/* Tablas */
.tabla { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabla th, .tabla td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla th { font-size: .82rem; color: var(--texto-2); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tabla tr.yo td { background: var(--vino-suave); font-weight: 600; }
.tabla .num { text-align: right; white-space: nowrap; }
.desliza { overflow-x: auto; }

/* Ranking */
.puesto { font-family: "Fraunces", Georgia, serif; font-size: 2.6rem; color: var(--vino); line-height: 1; }

/* Catálogo para elegir */
.vino-opcion { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--borde); border-radius: 12px; background: #fff; cursor: pointer; min-height: 64px; }
.vino-opcion img { width: 36px; height: 54px; object-fit: contain; flex: none; }
.vino-opcion input { width: 22px; height: 22px; accent-color: var(--vino); flex: none; }
.vino-opcion:has(input:checked) { border-color: var(--vino); background: var(--vino-suave); }

.admin-menu { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-menu a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 99px; border: 1px solid var(--borde); background: #fff; text-decoration: none; color: var(--texto); }
.admin-menu a.activo { background: var(--vino); color: #fff; border-color: var(--vino); }

.qr-caja { display: flex; justify-content: center; padding: 12px; background: #fff; }
.codigo-grande { font-family: "Fraunces", Georgia, serif; font-size: 2.4rem; letter-spacing: .25em; color: var(--vino); text-align: center; font-weight: 700; }

.pie { text-align: center; color: var(--texto-2); font-size: .85rem; padding: 24px 0; }

@media (min-width: 720px) {
  h1 { font-size: 2.1rem; }
  .dos-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}
@media print {
  .cabecera, .no-imprimir, .pie { display: none !important; }
  body { background: #fff; }
}
