/* ==========================================================
   Sol Plaza — sistema de diseño
   Tipografía: Fraunces (display) + Manrope (texto/UI)
   ========================================================== */

:root {
  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --surface-2: #FBF1E4;
  --ink: #1E2420;
  --ink-soft: #636B63;
  --line: #EDE2D3;
  --accent: #FF6B35;
  --accent-deep: #D8501F;
  --accent-ink: #FFF4EC;
  --teal: #0F3B3E;
  --teal-ink: #EAF4F3;
  --gold: #D89A00;
  --danger: #C4432B;
  --chair: #A98961;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow: 0 8px 24px -12px rgba(30, 36, 32, 0.25);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12181A;
    --surface: #1B2224;
    --surface-2: #212A2B;
    --ink: #F5EFE6;
    --ink-soft: #B4BDB7;
    --line: #2B3436;
    --accent: #FF8355;
    --accent-deep: #FF9E76;
    --accent-ink: #2A150C;
    --teal: #7FC7C4;
    --teal-ink: #0B2426;
    --gold: #F2C230;
    --danger: #FF8C74;
    --shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #12181A;
  --surface: #1B2224;
  --surface-2: #212A2B;
  --ink: #F5EFE6;
  --ink-soft: #B4BDB7;
  --line: #2B3436;
  --accent: #FF8355;
  --accent-deep: #FF9E76;
  --accent-ink: #2A150C;
  --teal: #7FC7C4;
  --teal-ink: #0B2426;
  --gold: #F2C230;
  --danger: #FF8C74;
  --shadow: 0 8px 28px -12px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* El atributo hidden pierde contra cualquier regla nuestra que fije display
   (ej. los botones "✕" con display:flex) porque un estilo de autor siempre
   gana sobre el estilo por defecto del navegador. Esta regla lo garantiza
   para cualquier elemento, sin tener que acordarse en cada componente. */
[hidden] { display: none !important; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.45;
  padding-bottom: 96px;
}
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
}
a { color: inherit; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding-inline: 18px;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 18px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}
.brand-tag {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-top: -2px;
}

.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.tab.active {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

.view { display: none; }
.view.active { display: block; }

/* ---------- Buscador de menú ---------- */
.search-wrap {
  padding-top: 14px;
}
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .search-icon {
  position: absolute;
  left: 14px;
  font-size: 0.9rem;
  opacity: 0.6;
  pointer-events: none;
}
.search-box input[type="search"] {
  width: 100%;
  padding: 11px 38px 11px 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
}
.search-box input[type="search"]::-webkit-search-cancel-button { display: none; }
.search-box input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}
.search-box .search-clear {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Category chips ---------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 18px 10px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.chip.active {
  background: var(--teal);
  color: var(--teal-ink);
  border-color: var(--teal);
}

/* ---------- Menu ---------- */
.area-heading {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 22px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.category-heading {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 14px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.item-card {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 10px;
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 700; font-size: 0.98rem; }
.item-desc {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.item-price {
  font-weight: 800;
  color: var(--accent-deep);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.special-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--teal-ink);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
  white-space: nowrap;
}
.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.stepper button {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}
.stepper .qty { min-width: 18px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.add-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- Floating cart bar ---------- */
.cart-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: none;
  justify-content: center;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--bg) 55%, transparent);
}
.cart-bar.show { display: flex; }
.cart-bar-inner {
  width: 100%;
  max-width: 604px;
  background: var(--teal);
  color: var(--teal-ink);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  cursor: pointer;
  border: none;
  font-family: inherit;
}
.cart-bar-inner .count {
  background: rgba(255,255,255,0.18);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  margin-right: 8px;
}
.cart-bar-inner .total { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Sheet / modal ---------- */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 20, 18, 0.5);
  z-index: 40;
  display: none;
}
.sheet-overlay.show { display: block; }
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 41;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px 18px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow);
}
.sheet.show { transform: translateY(0); }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 0 auto 14px;
}
.sheet-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin-bottom: 14px;
}
.sheet-close {
  position: absolute;
  top: 16px; right: 16px;
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  font-size: 1rem;
  cursor: pointer;
}

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 5px;
}
.field input, .field textarea, .field select {
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}
.field textarea { resize: vertical; min-height: 60px; }

/* ---------- Combo de búsqueda (bebida de reserva) ---------- */
.drink-combo { position: relative; }
.drink-combo-input-wrap { position: relative; }
.drink-combo-input-wrap input {
  width: 100%;
  padding: 11px 34px 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
}
.drink-combo-input-wrap input:focus { outline: none; border-color: var(--accent); }
.drink-combo-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.drink-combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.drink-combo-group {
  padding: 8px 12px 4px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.drink-combo-item {
  padding: 10px 12px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.drink-combo-item:hover, .drink-combo-item.highlighted { background: var(--surface-2); }
.drink-combo-item .price { color: var(--ink-soft); white-space: nowrap; }
.drink-combo-empty { padding: 14px 12px; font-size: 0.85rem; color: var(--ink-soft); text-align: center; }
.code-input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}
.code-input-group .code-prefix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.code-input-group input {
  border: none !important;
  background: transparent !important;
  flex: 1;
  min-width: 0;
}
.btn-gps {
  margin-top: 8px;
  width: 100%;
  background: var(--surface-2);
  color: var(--teal, var(--accent));
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}
.btn-gps:disabled { opacity: 0.6; cursor: wait; }
.btn-gps.gps-ok { border-style: solid; border-color: var(--accent); color: var(--accent); }
.gps-status {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.gps-status.gps-error { color: #c0392b; }
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.seg button {
  flex: 1;
  padding: 11px 8px;
  background: var(--surface-2);
  border: none;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--ink);
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.seg button.seg-disabled, .seg button:disabled {
  color: var(--ink-soft);
  background: var(--surface-2);
  cursor: not-allowed;
  opacity: 0.55;
}
.field-note {
  font-size: 0.78rem;
  color: #7A5B00;
  background: #FBF0D9;
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 8px;
}

.checkout-total-line {
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.6;
  background: var(--surface-soft, #F7F4EE);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 4px 0 14px;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 999px;
  padding: 14px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 6px;
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  width: 100%;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  margin-top: 8px;
}

.combo-section-title {
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  margin: 18px 0 6px;
}
.combo-section-hint {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin: -4px 0 8px;
}
.combo-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--surface);
}
.combo-option input { accent-color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; }
.combo-option .combo-option-name { flex: 1; font-size: 0.92rem; }
.combo-option .combo-option-price { font-size: 0.82rem; color: var(--ink-soft); font-weight: 700; }
.combo-option-stepper { cursor: default; }
.combo-option-stepper .stepper-slot { flex-shrink: 0; }
.combo-empty { font-size: 0.85rem; color: var(--ink-soft); padding: 20px 0; text-align: center; }
.plato-block {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 12px 4px;
  margin-bottom: 14px;
  background: var(--surface-2);
}
.plato-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.plato-block-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
}
.plato-block-remove {
  background: none;
  border: none;
  color: var(--danger, #c0392b);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}
.plato-block-remove[hidden] { display: none; }

.cart-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.cart-line .name { font-weight: 700; font-size: 0.92rem; }
.cart-line .sub { font-size: 0.78rem; color: var(--ink-soft); }
.cart-totals {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-display);
  font-size: 1.15rem;
  padding-top: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Reservas ---------- */
.date-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 18px;
}
.date-card {
  flex-shrink: 0;
  width: 84px;
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
}
.date-card.active { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
.date-card .dow { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; opacity: 0.75; }
.date-card .num { font-family: var(--font-display); font-size: 1.4rem; margin-top: 2px; }

.table-grid {
  padding: 4px 18px 18px;
}

/* ---------- Plano de mesas (Terraza Bar) ---------- */
.fp-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 18px 6px;
  font-size: 0.76rem;
  color: var(--ink-soft);
}
.fp-legend-item { display: flex; align-items: center; gap: 5px; }
.fp-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; background: var(--teal); }
.fp-swatch.active { background: var(--accent); }
.fp-swatch.taken { opacity: 0.35; }

.fp-hint {
  padding: 0 18px;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0 0 8px;
}
@media (min-width: 760px) { .fp-hint { display: none; } }

.floorplan-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 18px 10px;
}
.floorplan { min-width: 900px; }

.fp-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 4px 0 20px;
}
.fp-title-row .line { flex: 1; height: 1px; background: var(--line); }
.fp-title-row .txt {
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.fp-zones {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}
.fp-standalone-wrap { display: flex; align-items: center; padding-top: 44px; }

.fp-zone {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  padding: 14px 12px;
}
.fp-zone-grid { display: grid; gap: 9px 11px; }

.fp-table {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 7px;
  background: var(--teal);
  color: var(--teal-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.76rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}
.fp-table::before, .fp-table::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 18px;
  border-radius: 2px;
  background: var(--chair, #A98961);
}
.fp-table::before { left: -6px; }
.fp-table::after { right: -6px; }
.fp-table.empty { visibility: hidden; }
.fp-table.active { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px var(--accent-deep); }
.fp-table.active::before, .fp-table.active::after { background: var(--accent-deep); }
.fp-table.taken { opacity: 0.35; cursor: not-allowed; }

.fp-bottom-row {
  display: flex;
  gap: 8px;
  margin-top: 26px;
}
.fp-bottom-table {
  flex: 1;
  height: 46px;
  width: auto;
  border-radius: 6px;
}
.fp-bottom-table::before, .fp-bottom-table::after { display: none; }

.fp-extra-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.fp-feature-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  padding-top: 8px;
  align-self: stretch;
}
.fp-feature {
  min-width: 96px;
  padding: 12px 10px;
  border: 1.5px dashed var(--ink-soft);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
}
.fp-feature-tarima {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--surface-2);
}

/* ---------- Alerta de uso de base de datos (Reportes) ---------- */
.db-usage-card {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface);
}
.db-usage-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.86rem;
  font-weight: 700;
}
.db-usage-bar {
  height: 8px;
  border-radius: 5px;
  background: var(--surface-2);
  margin: 8px 0 6px;
  overflow: hidden;
}
.db-usage-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--teal);
  transition: width 0.3s;
}
.db-usage-note { font-size: 0.76rem; color: var(--ink-soft); }

.db-usage-card.db-usage-warn { border-color: var(--gold); }
.db-usage-card.db-usage-warn .db-usage-fill { background: var(--gold); }
.db-usage-card.db-usage-crit { border-color: var(--danger); }
.db-usage-card.db-usage-crit .db-usage-fill { background: var(--danger); }
.db-usage-card.db-usage-crit .db-usage-top,
.db-usage-card.db-usage-crit .db-usage-note { color: var(--danger); }

/* ---------- Confirmation ---------- */
.confirm-box {
  text-align: center;
  padding: 24px 18px 8px;
}
.confirm-code {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-deep);
  margin: 10px 0;
  letter-spacing: 0.02em;
}
.confirm-status {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 6px;
}
.confirm-eta {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 6px;
}

/* ---------- Aviso de horario cerrado ---------- */
.closed-banner-card {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--gold);
  background: #FBF0D9;
  color: #7A5B00;
  font-size: 0.86rem;
  font-weight: 600;
  margin-top: 14px;
}

/* ---------- Pedir de nuevo (banner de repetir pedido) ---------- */
.reorder-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-top: 14px;
}
.reorder-card-body { flex: 1; min-width: 0; }
.reorder-card-title { font-size: 0.86rem; font-weight: 800; margin-bottom: 2px; }
.reorder-card-items {
  font-size: 0.8rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reorder-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.reorder-card-close {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.9rem;
  cursor: pointer;
  align-self: flex-end;
}

/* ---------- Tracking ---------- */
.track-result {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
}
.status-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  background: var(--surface-2);
}
.status-pill.recibido { background: #FDEBD8; color: #A65A11; }
.status-pill.preparando { background: #FDEBD8; color: #A65A11; }
.status-pill.en_camino, .status-pill.listo { background: #DCEEF2; color: #0F3B3E; }
.status-pill.entregado { background: #DFF0DA; color: #2E6B22; }
.status-pill.cancelado, .status-pill.confirmada, .status-pill.cancelada { background: #F6DAD3; color: #93321B; }
.status-pill.no_show { background: #EAE3D6; color: #6B5B3A; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

/* ---------- Admin ---------- */
.admin-body { padding-bottom: 40px; }
.admin-header {
  background: var(--teal);
  color: var(--teal-ink);
  padding: 18px;
}
.admin-header h1 { font-size: 1.2rem; }
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.admin-tabs button {
  padding: 12px 14px;
  border: none;
  background: none;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.admin-tabs button.active { color: var(--accent-deep); border-bottom-color: var(--accent); }
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 18px; }
.order-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}
.order-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.order-code { font-family: var(--font-display); font-weight: 700; }
.order-meta { font-size: 0.82rem; color: var(--ink-soft); margin: 4px 0; }
.order-items-list { font-size: 0.85rem; margin: 8px 0; }
.status-select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.82rem;
}
.login-box {
  max-width: 340px;
  margin: 80px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
}
.admin-grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.small-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.small-btn.danger { color: var(--danger); }
.small-btn.warn { color: #8A6300; border-color: var(--gold); }
.item-agotado { opacity: 0.7; }
.agotado-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  color: #8A6300;
  background: #FBF0D9;
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

/* ---------- Alerta de pedido/reserva nuevo (panel de admin) ---------- */
/* Verde vivo a propósito (no un token del sistema de diseño): es una alerta
   que debe distinguirse de cualquier otro color de la app a simple vista,
   incluso de reojo desde el otro lado de la cocina. */
.new-arrival-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: #1DB954;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
  padding: 16px;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
  box-shadow: 0 6px 18px -6px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.new-arrival-banner.show {
  transform: translateY(0);
  animation: newArrivalPulse 0.9s ease-in-out 3;
}
@keyframes newArrivalPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}

@media (max-width: 420px) {
  .admin-grid-form { grid-template-columns: 1fr; }
}

/* ---------- Recibo de impresión (rollo térmico POS 80mm) ---------- */
#print-receipt { display: none; }
.receipt-box {
  font-family: 'Courier New', monospace;
  color: #000;
  width: 100%;
  font-size: 12px;
  line-height: 1.35;
}
.receipt-box h2 { font-size: 15px; margin: 0 0 2px; text-align: center; letter-spacing: 0.5px; }
.receipt-box .receipt-sub { text-align: center; font-size: 11px; margin-bottom: 8px; }
.receipt-box hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.receipt-box .receipt-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  gap: 6px;
  word-break: break-word;
}
.receipt-box .receipt-total { font-size: 14px; font-weight: 800; }
.receipt-box .receipt-note { font-size: 11px; margin-top: 8px; }
.receipt-box .receipt-item { margin-bottom: 5px; }
.receipt-box .receipt-item-name { font-weight: 700; word-break: break-word; }
.receipt-box .receipt-qr { text-align: center; margin-top: 10px; }
.receipt-box .receipt-qr img { width: 120px; height: 120px; }
.receipt-box .receipt-qr-label { font-size: 10px; margin-top: 2px; }

@page {
  size: 80mm auto;
  margin: 0;
}

/* Al imprimir solo existe el recibo: el resto de la página se quita por
   completo (display:none, no solo invisible). Antes se ocultaba con
   visibility:hidden, que deja el espacio ocupado y el panel entero seguía
   generando hojas en blanco después del recibo. */
@page { margin: 0; }
@media print {
  html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body > *:not(#print-receipt) { display: none !important; }
  #print-receipt {
    display: block;
    position: static;
    width: 80mm;
    box-sizing: border-box;
    padding: 3mm 4mm;
    margin: 0;
  }
  .receipt-box { break-inside: avoid; page-break-inside: avoid; }
}

/* ---------- Reportes ---------- */
#report-range-seg { flex-wrap: wrap; }
#report-range-seg button { flex: 1 1 45%; }
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.report-kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  text-align: center;
}
.report-kpi-value {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-deep);
}
.report-kpi-label {
  font-size: 0.76rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.report-kpi-compare {
  font-size: 0.72rem;
  font-weight: 700;
  margin-top: 5px;
}
.report-kpi-compare.up { color: #2E6B22; }
.report-kpi-compare.down { color: var(--danger); }
.report-kpi-compare.flat { color: var(--ink-soft); }
.report-table-wrap { overflow-x: auto; }
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.report-table th, .report-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.report-table th {
  background: var(--surface-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}
.report-table tbody tr:last-child td { border-bottom: none; }

/* ---------- Módulo de delivery: app del repartidor y pestaña Repartos ---------- */
.rider-body { padding-bottom: 40px; }
.rider-hint {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.rider-count { font-size: 0.78rem; color: var(--accent-deep); }
.rider-zone { font-weight: 800; font-size: 1.05rem; margin: 4px 0; }
.rider-customer { font-weight: 800; font-size: 1.05rem; }
.rider-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.rider-actions a { text-decoration: none; padding: 9px 12px; font-size: 0.86rem; }
.rider-route {
  text-align: center;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #DCEEF2;
  color: #0F3B3E;
  font-size: 1rem;
}
.rider-route.late { background: #F6DAD3; color: #93321B; }
.rider-pct { font-family: var(--font-display); font-size: 3rem; font-weight: 700; line-height: 1.1; margin-top: 6px; }
.rider-level {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--surface-2);
}
.rider-level.oro { background: #FBF0D9; color: #8A6300; }
.rider-level.plata { background: #ECEEF0; color: #4A5058; }
.rider-level.bronce { background: #F6E1D3; color: #8A4B22; }
.rider-stat {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.rider-stat:last-child { border-bottom: none; }
.repartos-seg { margin-bottom: 14px; flex-wrap: wrap; }
.repartos-h { font-size: 1rem; margin: 18px 0 8px; }
.order-row.repartos-alert { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.rider-avail { margin: 0 0 12px; }
.rider-avail.on { width: 100%; background: #DFF0DA; color: #2E6B22; border-color: #2E6B22; font-weight: 800; }
.rider-offer { border: 2px solid var(--accent); text-align: center; }
.rider-offer .order-row-top, .rider-offer .order-meta { text-align: left; }
.rider-offer-title { font-weight: 800; font-size: 1.1rem; }
.rider-countdown { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; color: var(--accent-deep); }
.rider-countdown.urgent { color: var(--danger); }


/* ---------- Calificar el pedido ---------- */
.review-box { margin-top: 12px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.review-title { font-weight: 800; margin-bottom: 8px; }
.review-stars { display: flex; gap: 6px; margin-bottom: 10px; }
.review-star { background: none; border: 0; padding: 2px 4px; font-size: 2rem; line-height: 1; color: var(--gold); cursor: pointer; }
.review-star.on { transform: scale(1.05); }
.review-comment, .review-phone { width: 100%; margin-bottom: 10px; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
.review-done-stars { color: var(--gold); letter-spacing: 2px; }
