/* Mesón Charly — hoja de estilos (sustituye a los estilos inline del
   prototipo JS). Misma paleta oklch y tipografía (Prata + Work Sans). */

:root {
  color-scheme: light;
  --bg: oklch(97% 0.015 75);
  --ink: oklch(24% 0.02 50);
  --muted: oklch(50% 0.02 50);
  --border: oklch(88% 0.02 70);
  --panel: oklch(99% 0.008 75);
  --panel-hover: oklch(90% 0.015 70);
  --tint: oklch(96% 0.015 60);
  --wine: oklch(35% 0.14 25);
  --wine-dark: oklch(28% 0.13 25);
  --gold: oklch(74% 0.12 85);
  --gold-dark: oklch(80% 0.12 85);
  --cream: oklch(98% 0.01 75);
  --amber-bg: oklch(90% 0.05 85);
  --amber-fg: oklch(35% 0.08 70);
  --green-bg: oklch(88% 0.07 145);
  --green-fg: oklch(35% 0.1 145);
  --gray-bg: oklch(90% 0.02 30);
  --gray-fg: oklch(45% 0.04 30);
  --red-fg: oklch(50% 0.15 30);
  --red-border: oklch(65% 0.15 30);
}

* {
  box-sizing: border-box;
  /* Quita el resalte negro que ponen los móviles (Safari/Chrome) al tocar
     un botón, enlace o el plano de mesas — es puramente visual, no afecta
     al foco por teclado ni a la accesibilidad. */
  -webkit-tap-highlight-color: transparent;
}
html, body { margin: 0; }
body {
  font-family: 'Work Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a { color: var(--wine); text-decoration: none; }
a:hover { color: var(--wine-dark); }
img { max-width: 100%; }

.page { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- Header / nav ---------- */

.nav-toggle-input { display: none; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  row-gap: 10px; padding: 14px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--border); background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand-logo { width: 44px; height: 44px; }
.brand-name { font-family: 'Prata', serif; font-size: 22px; letter-spacing: 0.5px; }

.nav-desktop { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link {
  font-weight: 600; font-size: 15px; padding: 10px 16px; border-radius: 8px; color: var(--ink);
}
.nav-link:hover { background: var(--panel-hover); }
.nav-link-active { background: var(--panel-hover); }

.nav-burger {
  display: none; border: 1px solid var(--border); background: none; width: 44px; height: 44px;
  border-radius: 8px; cursor: pointer; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
}
.nav-burger span { width: 20px; height: 2px; background: var(--ink); display: block; }

.nav-mobile {
  display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--panel);
  border-bottom: 1px solid var(--border); flex-direction: column; padding: 8px;
  box-shadow: 0 8px 16px oklch(30% 0.02 50 / 0.08); z-index: 30;
}
.nav-mobile-link { font-weight: 600; font-size: 16px; padding: 14px 16px; border-radius: 8px; color: var(--ink); }
.nav-mobile-link:hover { background: var(--panel-hover); }

.lang-switch { display: flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 10px; border-left: 1px solid var(--border); }
.lang-link { font-weight: 700; font-size: 13px; padding: 8px 10px; border-radius: 8px; color: var(--muted); }
.lang-link:hover { background: var(--panel-hover); color: var(--ink); }
.lang-active, .lang-active:hover { color: var(--wine); background: var(--panel-hover); }
.lang-switch-mobile { margin: 8px 16px 0; padding: 12px 0 0; border-left: none; border-top: 1px solid var(--border); }

@media (max-width: 759px) {
  .nav-desktop { display: none; }
  .nav-burger { display: flex; }
  .nav-toggle-input:checked ~ .site-header .nav-mobile { display: flex; }
}

.site-main { flex: 1; display: flex; flex-direction: column; }

/* ---------- Flash messages ---------- */

.flash-stack { max-width: 1000px; margin: 16px auto 0; width: 100%; padding: 0 clamp(16px, 6vw, 40px); box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; }
.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.flash-success { background: var(--green-bg); color: var(--green-fg); }
.flash-error { background: oklch(90% 0.05 30); color: var(--red-fg); }

/* ---------- Layout helpers ---------- */

.section-narrow { max-width: 1000px; margin: 0 auto; padding: clamp(20px, 5vw, 40px); width: 100%; box-sizing: border-box; }
.section-wide { max-width: 1100px; margin: 0 auto; padding: 40px; width: 100%; box-sizing: border-box; }
.section-form { max-width: 640px; margin: 0 auto; padding: clamp(28px, 6vw, 56px) clamp(16px, 5vw, 24px); width: 100%; box-sizing: border-box; }
.section-tinted { width: 100%; background: var(--tint); padding: clamp(40px, 8vw, 64px) clamp(16px, 6vw, 40px); box-sizing: border-box; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: 14px; }
.mt-12 { margin-top: 12px; }
.mt-18 { margin-top: 18px; }
.mt-24 { margin-top: 24px; }
.mb-12 { margin-bottom: 12px; }
.mb-24 { margin-bottom: 24px; }
.w-60 { width: 60px; }
.capitalize { text-transform: capitalize; }

.page-title { font-family: 'Prata', serif; font-size: clamp(26px, 5vw, 34px); margin: 0 0 24px; }
.page-title-inline { margin-bottom: 0; }
.section-title { font-family: 'Prata', serif; font-size: clamp(24px, 4vw, 30px); margin: 0 0 16px; }
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--wine); margin-bottom: 10px; }
.eyebrow-warm { color: oklch(55% 0.16 35); }
.prose { color: oklch(40% 0.02 50); font-size: 15.5px; line-height: 1.7; margin: 0 0 16px; }
.prose.center { text-align: center; max-width: 520px; margin-left: auto; margin-right: auto; }
.lede { color: var(--muted); font-size: 15.5px; max-width: 520px; margin: 0 auto 36px; text-align: center; }
.accent-text { color: oklch(50% 0.17 30); }
.accent-strong { font-weight: 700; color: var(--wine); }

/* ---------- Buttons ---------- */

.btn { display: inline-block; border: none; font-weight: 700; font-size: 15px; padding: 14px 26px; border-radius: 10px; cursor: pointer; text-align: center; }
.btn-primary { background: var(--wine); color: var(--cream); }
.btn-primary:hover { background: var(--wine-dark); color: var(--cream); }
.btn-accent { background: var(--gold); color: oklch(20% 0.02 50); }
.btn-accent:hover { background: var(--gold-dark); color: oklch(20% 0.02 50); }
.btn-outline-light { border: 2px solid var(--cream); background: none; color: var(--cream); }
.btn-outline-light:hover { background: oklch(98% 0.01 75 / 0.15); color: var(--cream); }
.btn-outline-primary { border: 1px solid var(--wine); color: var(--wine); background: none; }
.btn-outline-primary:hover { background: oklch(35% 0.14 25 / 0.06); }
.btn-outline-danger { border: 1px solid var(--red-border); color: var(--red-fg); background: none; }
.btn-outline-danger:hover { background: oklch(50% 0.15 30 / 0.08); }
.btn-outline-gold { border: 1px solid var(--gold); color: oklch(45% 0.1 85); background: none; }
.btn-outline-gold:hover { background: oklch(74% 0.12 85 / 0.15); }
.btn-ghost { border: 1px solid var(--border); color: var(--muted); background: none; }
.btn-ghost:hover { background: var(--panel-hover); color: var(--ink); }
.btn-block { width: 100%; }
.btn-small { font-size: 14px; padding: 10px 18px; }
.btn-tiny { font-size: 12.5px; padding: 7px 12px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.btn-link { border: none; background: none; color: var(--muted); font-weight: 700; font-size: 13px; cursor: pointer; padding: 8px; border-radius: 8px; }
.btn-link:hover { color: var(--wine); background: var(--panel-hover); }

/* ---------- Home / hero ---------- */

.hero {
  width: 100%; min-height: clamp(320px, 50vw, 420px); position: relative;
  background: repeating-linear-gradient(45deg, var(--border), var(--border) 14px, oklch(92% 0.015 70) 14px, oklch(92% 0.015 70) 28px);
  display: flex; align-items: center; justify-content: center;
}
.hero-overlay { position: absolute; inset: 0; background: linear-gradient(0deg, oklch(20% 0.02 40 / 0.55), oklch(20% 0.02 40 / 0.15)); }
.hero-content { position: relative; text-align: center; color: var(--cream); padding: 0 24px; }
.hero-title { font-family: 'Prata', serif; font-size: clamp(34px, 7vw, 52px); font-weight: 400; margin: 0 0 12px; }
.hero-sub { font-size: clamp(15px, 2.5vw, 18px); max-width: 520px; margin: 0 auto 28px; opacity: 0.95; }
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.home-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px;
  max-width: 1000px; width: 100%; margin: 0 auto; padding: clamp(24px, 6vw, 48px) clamp(16px, 6vw, 40px); box-sizing: border-box;
}
.home-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 26px; color: var(--ink); display: block; }
.home-card:hover { background: var(--panel-hover); color: var(--ink); }
.home-card-title { font-family: 'Prata', serif; font-size: 20px; margin: 0 0 8px; }
.home-card-text { color: var(--muted); font-size: 14px; }


.event-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.event-card { background: var(--panel); border-radius: 12px; padding: 26px 18px; }
.event-title { font-family: 'Prata', serif; font-size: 17px; margin: 0 0 8px; }
.event-text { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; text-align: left; align-items: start; }
.contact-info { display: flex; flex-direction: column; gap: 18px; }
.contact-label { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.contact-text { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.contact-map { position: relative; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 24px oklch(30% 0.02 50 / 0.1); aspect-ratio: 4/3; }
/* El mapa es solo visual: si se pudiera tocar/arrastrar, Google Maps entra
   en modo interactivo y recarga sus propios tiles (el "parpadeo negro" y
   la sensación de recarga). Para moverse por el mapa de verdad, está el
   botón de abajo, que lo abre en Google Maps en una pestaña nueva. */
.contact-map iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.contact-map-link {
  position: absolute; bottom: 12px; right: 12px; background: var(--wine); color: var(--cream);
  font-size: 12.5px; font-weight: 700; padding: 9px 16px; border-radius: 999px;
  box-shadow: 0 4px 12px oklch(30% 0.02 50 / 0.25);
}
.contact-map-link:hover { background: var(--wine-dark); color: var(--cream); }

/* ---------- Carta ---------- */

.pill-row { display: flex; gap: 10px; margin-bottom: 32px; flex-wrap: wrap; }
.pill { border: 1px solid var(--border); background: var(--panel); font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px; color: var(--ink); cursor: pointer; }
.pill:hover { color: var(--ink); background: var(--panel-hover); }
.pill-active { border-color: var(--wine); color: var(--wine); }

/* Filtro de la carta: radios ocultos + selector de hermanos, sin recargar
   la página (evita el parpadeo de una navegación completa). */
.carta-filter { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 32px; }
.carta-filter-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.carta-filter-radio:checked + .pill { border-color: var(--wine); color: var(--wine); }
.carta-filter .dish-grid { flex: 1 1 100%; margin-top: 22px; }
.carta-filter .dish-card, .carta-filter .dish-cat-heading { display: none; }

.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; }
.dish-cat-heading { grid-column: 1 / -1; font-family: 'Prata', serif; font-size: 20px; color: var(--wine); margin: 0; }
.dish-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.dish-photo {
  width: 100%; height: 140px; display: flex; align-items: center; justify-content: center; text-align: center;
  background: oklch(93% 0.015 70); color: var(--muted); font-size: 12px; padding: 8px; box-sizing: border-box;
}
.dish-body { padding: 16px; }
.dish-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; gap: 8px; }
.dish-name { font-weight: 700; font-size: 16px; }
.dish-price { font-weight: 700; color: var(--wine); font-size: 15px; white-space: nowrap; }
.dish-desc { color: var(--muted); font-size: 13.5px; }

/* ---------- Forms (reservas / admin) ---------- */

.form-header { text-align: center; margin-bottom: 32px; }

.error-page { text-align: center; padding: 48px 0; }
.error-code { font-family: 'Prata', serif; font-size: clamp(56px, 12vw, 84px); line-height: 1; color: var(--wine); opacity: 0.35; margin-bottom: 4px; }
.error-page .prose.center { margin-left: auto; margin-right: auto; margin-bottom: 28px; }
.form-sub { color: var(--muted); font-size: 15px; }
.card-form { background: var(--panel); border: 1px solid var(--border); border-radius: 18px; padding: clamp(20px, 5vw, 36px); box-shadow: 0 12px 32px oklch(30% 0.02 50 / 0.06); }
.card-form.center { text-align: center; }

.booked-box { background: var(--green-bg); border-radius: 14px; padding: 20px 24px; margin-bottom: 24px; text-align: center; }
.booked-box-title { font-weight: 700; color: var(--green-fg); font-size: 15px; margin-bottom: 6px; }
.booked-box-text { color: oklch(35% 0.08 145); font-size: 14px; margin: 0 0 10px; }
.booked-box-link { font-size: 13px; font-weight: 600; text-decoration: underline; }
.form-section-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--wine); margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; margin-bottom: 26px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-full { grid-column: 1 / -1; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink); }
input, select, textarea {
  padding: 13px 14px; border-radius: 10px; border: 1px solid oklch(85% 0.02 70); font-size: 15px;
  font-family: 'Work Sans', sans-serif; background: oklch(99% 0.005 75); color: var(--ink); width: 100%;
}
textarea { resize: vertical; }
.divider { border: none; height: 1px; background: oklch(90% 0.015 70); margin-bottom: 26px; }

.table-picker { margin-bottom: 28px; }
.table-picker-label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--wine); margin-bottom: 10px; }

.zone-pref-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.zone-pref-radio:checked + .pill { border-color: var(--wine); color: var(--wine); background: oklch(35% 0.14 25 / 0.06); }

/* ---------- Mesa (pedir en mesa) ---------- */

.scan-box { max-width: 380px; margin: 60px auto; text-align: center; }

.mesa-layout { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; align-items: flex-start; }
.mesa-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.badge-gold { background: var(--gold); color: oklch(20% 0.02 50); font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px; }
.mesa-items { display: flex; flex-direction: column; gap: 12px; }
.mesa-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; scroll-margin-top: 90px; }
.mesa-item-name { font-weight: 700; font-size: 15px; }
.mesa-item-line { color: var(--muted); font-size: 13px; }

@media (max-width: 380px) {
  .mesa-item { grid-template-columns: 1fr; }
  .mesa-item form { display: flex; }
  .mesa-item .btn { width: 100%; }
}

.mesa-cart { position: sticky; top: 90px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; scroll-margin-top: 90px; }
.mesa-cart-title { font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.cart-lines { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cart-line { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.cart-line-qty { display: flex; align-items: center; gap: 8px; }
.qty-btn { border: 1px solid var(--border); background: none; width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-weight: 700; padding: 0; }
.qty-btn:hover { background: var(--panel-hover); }
.qty-value { min-width: 16px; text-align: center; }
.cart-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 16px; }
.cart-line-sent { align-items: flex-start; color: var(--muted); }
.sent-order-time { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 2px; }
.cart-total-grand { border-top: 2px solid var(--wine); color: var(--wine); font-size: 16px; margin-top: 4px; margin-bottom: 0; }

/* ---------- Admin: calendario de reservas ---------- */

.reservas-calendar-layout { margin-bottom: 24px; }

/* De los tres meses precargados (anterior/actual/siguiente) solo se ve el
   que tenga su radio marcado (#monthpick-...; regla generada en la
   plantilla) — moverse de uno a otro no recarga la página. */
.admin-month-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.month-block { display: none; grid-template-columns: minmax(280px, 380px) 1fr; gap: 24px; align-items: start; }

.calendar-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.calendar-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.calendar-nav-btn { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: var(--ink); cursor: pointer; }
.calendar-nav-btn:hover { background: var(--panel-hover); }
.calendar-month-label { font-family: 'Prata', serif; font-size: 16px; flex: 1; text-align: center; text-transform: capitalize; }
.calendar-today-btn { flex: 0 0 auto; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekday { font-size: 10.5px; font-weight: 700; text-transform: uppercase; text-align: center; color: var(--muted); padding-bottom: 6px; }
.calendar-day {
  position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); background: oklch(97% 0.008 75);
}
.calendar-day:hover { background: var(--panel-hover); }
.calendar-day-out { color: oklch(82% 0.01 70); background: none; pointer-events: none; }
.calendar-day-today { box-shadow: inset 0 0 0 2px var(--wine); }
.calendar-day-has { background: oklch(88% 0.07 145); color: oklch(30% 0.08 145); }
.calendar-day-pending { background: var(--amber-bg); color: var(--amber-fg); }
.calendar-day-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.calendar-day-radio:checked + .calendar-day { box-shadow: 0 0 0 2px var(--wine); border-radius: 50%; }
.calendar-day-radio:focus-visible + .calendar-day { outline: 2px solid var(--wine); outline-offset: 2px; }
.calendar-day-count {
  position: absolute; bottom: 2px; right: 3px; font-size: 9px; font-weight: 700; line-height: 1.4;
  background: oklch(0% 0 0 / 0.18); border-radius: 999px; padding: 0 4px;
}

.calendar-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.calendar-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.calendar-dot-pending { background: var(--amber-fg); }
.calendar-dot-has { background: oklch(35% 0.1 145); }

.calendar-day-panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.calendar-day-panel-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 700; font-size: 15px; margin-bottom: 14px; text-transform: capitalize; }
.calendar-day-panel-title .muted { font-weight: 600; text-transform: none; font-size: 13px; }

/* Cambiar de día en el calendario marca un radio oculto, no navega: las
   reglas :has() generadas en la plantilla muestran el panel del día
   marcado. Si en el mes visible no hay ningún día marcado todavía (recién
   cambiado de mes) se ve, según el mes, el panel por defecto (el día ya
   elegido en el servidor, si cae en ese mes) o el aviso de "elige un día". */
.day-panel { display: none; }
.day-panel-default, .month-empty-fallback { display: none; }
.month-block:not(:has(.calendar-day-radio:checked)) .day-panel-default,
.month-block:not(:has(.calendar-day-radio:checked)) .month-empty-fallback { display: block; }

@media (max-width: 700px) {
  .month-block { grid-template-columns: 1fr; }
}

/* ---------- Admin ---------- */

.login-box { max-width: 340px; margin: 60px auto; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 12px; }

.admin-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }

.icon { width: 17px; height: 17px; flex: 0 0 auto; vertical-align: -3px; }

.admin-tabs-scroll { overflow-x: auto; margin: 0 clamp(-20px, -5vw, -40px) 28px; padding: 0 clamp(20px, 5vw, 40px); border-bottom: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.admin-tabs { display: flex; gap: 4px; width: max-content; min-width: 100%; }
.admin-tab { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; padding: 12px 14px; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; cursor: pointer; }
.admin-tab:hover { color: var(--wine); background: var(--panel-hover); border-radius: 8px 8px 0 0; }
.admin-tab-count { background: var(--border); color: var(--ink); font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.admin-tab-count-warn { background: var(--red-border); color: oklch(99% 0.01 30); }

/* Las seis pestañas del panel están todas ya cargadas en la página; cuál
   se ve depende de qué radio oculto está marcado (#tabpick-...), no de una
   recarga — así cambiar de pestaña no dispara el parpadeo en negro que
   pinta el navegador en modo oscuro entre una carga y la siguiente. */
.admin-tab-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.admin-tab-panel { display: none; }
#tabpick-resumen:checked ~ #tabpanel-resumen,
#tabpick-reservas:checked ~ #tabpanel-reservas,
#tabpick-pedidos:checked ~ #tabpanel-pedidos,
#tabpick-stock:checked ~ #tabpanel-stock,
#tabpick-carta:checked ~ #tabpanel-carta,
#tabpick-stats:checked ~ #tabpanel-stats { display: block; }
#tabpick-resumen:checked ~ .admin-tabs-scroll label[for="tabpick-resumen"],
#tabpick-reservas:checked ~ .admin-tabs-scroll label[for="tabpick-reservas"],
#tabpick-pedidos:checked ~ .admin-tabs-scroll label[for="tabpick-pedidos"],
#tabpick-stock:checked ~ .admin-tabs-scroll label[for="tabpick-stock"],
#tabpick-carta:checked ~ .admin-tabs-scroll label[for="tabpick-carta"],
#tabpick-stats:checked ~ .admin-tabs-scroll label[for="tabpick-stats"] { color: var(--wine); border-bottom-color: var(--wine); }

.admin-list { display: flex; flex-direction: column; gap: 12px; }
.admin-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.admin-row-compact { padding: 12px 16px; }
.admin-row-title { font-weight: 700; font-size: 15px; }
.admin-row-sub { color: var(--muted); font-size: 13px; }
.admin-row-mesa { color: var(--wine); font-size: 12.5px; font-weight: 700; margin-top: 2px; }
.admin-row-comment { color: var(--muted); font-size: 12.5px; font-style: italic; margin-top: 4px; }
.admin-row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-edit-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-edit-form input, .admin-edit-form select { width: auto; padding: 7px 9px; border-radius: 7px; font-size: 12.5px; }

/* Confirmación antes de borrar (dos pasos, sin JS) */
.confirm-box { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.confirm-box-fill { flex: 1 1 auto; }
.confirm-text { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--red-fg); }
.confirm-icon { width: 16px; height: 16px; flex: 0 0 auto; color: var(--red-fg); }

/* Filtros y buscador (reservas / carta) */
.admin-filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 20px; }
.search-field { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; flex: 1 1 220px; max-width: 320px; }
.search-field input { border: none; background: none; padding: 10px 0; }
.search-field input:focus { outline: none; }
.search-icon { width: 17px; height: 17px; flex: 0 0 auto; color: var(--muted); }
.pill-row-compact { margin-bottom: 0; }
.pill-btn { border: 1px solid var(--border); background: var(--panel); font: inherit; }

/* Estados vacíos */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; color: var(--muted); font-size: 14px; text-align: center; }
.empty-state-icon { width: 32px; height: 32px; color: oklch(80% 0.02 70); }

/* Resumen (dashboard) */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 32px; }
.kpi-card { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.kpi-card-warn { border-color: var(--red-border); }
.kpi-icon { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 10px; background: var(--tint); color: var(--wine); display: flex; align-items: center; justify-content: center; }
.kpi-icon .icon { width: 22px; height: 22px; }
.kpi-value { font-family: 'Prata', serif; font-size: 24px; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.resumen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; align-items: start; }
.resumen-block-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.resumen-block-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }

.badge { font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 999px; }
.badge-amber { background: var(--amber-bg); color: var(--amber-fg); }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-gray { background: var(--gray-bg); color: var(--gray-fg); }

.admin-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.admin-card-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.loyverse-text { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: oklch(45% 0.1 145); margin-top: 6px; }
.loyverse-text-ok { color: var(--green-fg); }
.loyverse-text-error { color: var(--red-fg); }
.icon-tiny { width: 14px; height: 14px; flex: 0 0 auto; }

.table-order-card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; border-left: 3px solid transparent; }
.table-order-card-attention { border-left-color: var(--amber-fg); }
.table-order-total { font-weight: 700; color: var(--wine); font-size: 15px; }
.table-order-ticket { padding-top: 12px; }
.table-order-ticket + .table-order-ticket { border-top: 1px solid var(--border); margin-top: 8px; }
.table-order-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-order-time { font-size: 12px; color: var(--muted); }
.table-order-line-total { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.table-order-items { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.table-order-qty { font-weight: 700; color: var(--wine); display: inline-block; min-width: 26px; }

.empty-state-sub { font-size: 12.5px; color: var(--muted); max-width: 320px; margin-top: -4px; }

.qr-details { margin-bottom: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.qr-details summary { font-weight: 700; font-size: 13.5px; cursor: pointer; }

.closed-orders-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 4px; }
.closed-order-row { padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.closed-order-row:last-child { border-bottom: none; padding-bottom: 0; }
.closed-order-top { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.closed-order-time { color: var(--muted); font-size: 12px; }
.closed-order-table { font-weight: 700; flex: 1; }
.closed-order-total { font-weight: 700; color: var(--wine); }
.closed-order-items { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.closed-orders-history-link { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 700; color: var(--wine); text-decoration: none; }
.closed-orders-history-link:hover { text-decoration: underline; }

.pedidos-top-actions { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.pedidos-top-actions .btn-link { display: flex; align-items: center; gap: 6px; }
.pedidos-top-actions .icon { width: 16px; height: 16px; }

.google-sync-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.google-sync-head { display: flex; align-items: center; gap: 10px; }
.google-sync-title { font-weight: 700; font-size: 14px; }
.btn-google {
  display: inline-flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border);
  color: #3c4043; font-weight: 700; font-size: 14px; padding: 11px 20px; border-radius: 10px; text-decoration: none;
}
.btn-google:hover { background: oklch(95% 0.01 70); color: #3c4043; }
.btn-google .icon { width: 18px; height: 18px; }

.qr-test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
.qr-test-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px; text-align: center; }
.qr-test-label { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.qr-test-image { background: #fff; border-radius: 8px; padding: 10px; display: inline-block; }
.qr-test-image svg { width: 130px; height: 130px; display: block; }
.qr-test-link { display: block; margin-top: 10px; font-size: 12.5px; font-weight: 600; }
.qr-test-actions { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.qr-test-edit-form { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.qr-test-edit-actions { display: flex; justify-content: center; gap: 6px; }

@media print {
  .site-header, .site-footer, .admin-header a, .qr-test-link, .new-dish-form, .qr-test-actions { display: none; }
  .qr-test-grid { grid-template-columns: repeat(3, 1fr); }
  .qr-test-card { break-inside: avoid; }
}

.stock-summary { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.stock-summary .icon { width: 20px; height: 20px; }
.stock-summary-warn { color: var(--red-fg); }

.stock-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.stock-row-low { border-color: var(--red-border); }
.stock-status { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.stock-status-low { color: var(--red-fg); }
.stock-controls { display: flex; align-items: center; gap: 10px; }
.stock-controls .qty-btn { width: 30px; height: 30px; font-size: 16px; }
.stock-qty { min-width: 70px; font-weight: 700; }
.stock-history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }

.new-dish-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.new-dish-form select, .new-dish-form input { flex: 1 1 160px; width: auto; padding: 10px 12px; font-size: 14px; }
.new-dish-form select { flex: 1 1 100%; }

.cat-translate-box { margin-bottom: 28px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.cat-translate-box summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.cat-translate-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.cat-translate-row { display: flex; align-items: center; gap: 10px; }
.cat-translate-name { flex: 1 1 140px; font-weight: 600; font-size: 13.5px; }
.cat-translate-row input { flex: 2 1 200px; padding: 8px 10px; font-size: 13.5px; width: auto; }

.menu-admin-list { display: flex; flex-direction: column; gap: 28px; }
.menu-admin-cat { font-family: 'Prata', serif; font-size: 18px; margin-bottom: 12px; }
.menu-admin-item { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.menu-admin-row { display: flex; flex-wrap: wrap; gap: 10px; flex: 1 1 auto; align-items: center; }
.menu-admin-row input { padding: 8px 10px; font-size: 13.5px; width: auto; }
.menu-admin-name { flex: 1 1 120px; font-weight: 600; }
.menu-admin-desc { flex: 1 1 140px; }
.menu-admin-price { flex: 1 1 90px; }
.menu-admin-delete { flex: 0 0 auto; }

.stats-filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 24px; }
.stats-filters select { width: auto; padding: 10px 12px; font-size: 14px; }
.stat-cards { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.stat-card { flex: 1; min-width: 180px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--wine); }
.stat-value-plain { color: var(--ink); }
.stats-subheading { font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.stat-row-meta { font-size: 13px; color: var(--muted); }
.bar-track { height: 8px; background: oklch(92% 0.015 70); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar-fill { height: 100%; background: var(--gold); border-radius: 999px; }

/* ---------- Panel: formularios en tablet / móvil ---------- */

@media (max-width: 640px) {
  .admin-edit-form, .menu-admin-row, .new-dish-form, .stats-filters { flex-direction: column; align-items: stretch; }
  .admin-edit-form input, .admin-edit-form select,
  .menu-admin-row input, .menu-admin-name, .menu-admin-desc, .menu-admin-price,
  .new-dish-form input, .new-dish-form select,
  .stats-filters select { width: 100%; flex: none; }
  .admin-edit-form .btn, .admin-edit-form a.btn,
  .menu-admin-row .btn,
  .new-dish-form .btn,
  .stats-filters .btn { width: 100%; }
  .menu-admin-item { flex-direction: column; align-items: stretch; }
  .menu-admin-delete { width: 100%; text-align: center; }
  .search-field { max-width: none; flex-basis: 100%; }
  .kpi-card { padding: 16px; }
}

/* ---------- Footer ---------- */

.site-footer { padding: 40px 24px 24px; border-top: 1px solid var(--border); background: var(--panel); }
.footer-grid { max-width: 900px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; }
.footer-title { font-family: 'Prata', serif; font-size: 18px; margin-bottom: 10px; }
.footer-heading { font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.footer-text { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
