:root {
  --bg: #07080b;
  --surface: rgba(18, 20, 26, 0.88);
  --ink: #f2efe8;
  --muted: #9a958c;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #e6c15a;
  --accent-ink: #16120a;
  --danger: #e8614f;
  --ok: #4ad39a;
  --hold: #f0a500;
  --reserved: #8b7cf7;
  --font-display: "Syne", sans-serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(230, 193, 90, 0.1), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(40, 90, 140, 0.14), transparent 50%),
    linear-gradient(180deg, #090a0e 0%, #0c0e14 100%);
}

.topbar {
  position: relative;
  z-index: 26;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

body.zone-open .topbar {
  max-width: none;
  padding: 0.65rem 1rem;
  background: rgba(8, 10, 14, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

body.zone-open .brand-block {
  display: none;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  animation: rise 0.7s var(--ease) both;
}

.tagline {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  animation: rise 0.8s 0.08s var(--ease) both;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hold-timer {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: rgba(240, 165, 0, 0.12);
  border: 1px solid rgba(240, 165, 0, 0.35);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--hold);
}

.hold-timer strong {
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.map-stage {
  padding: 0.5rem 1rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.overview-map {
  animation: rise 0.9s 0.1s var(--ease) both;
}

.overview-map #overviewMap {
  display: block;
  width: 100%;
  min-width: 320px;
  height: auto;
}

.zone-hit {
  cursor: pointer;
  transition: fill-opacity 0.2s var(--ease);
}

.zone-hit:hover {
  fill-opacity: 0.28;
}

.zone-btn {
  cursor: pointer;
  transition: fill-opacity 0.2s var(--ease), stroke-opacity 0.2s var(--ease), filter 0.2s var(--ease);
}

.zone-btn:hover,
.zone-btn:focus {
  fill-opacity: 0.32;
  stroke-opacity: 0.95;
  outline: none;
  filter: brightness(1.12);
}

.zone-panel {
  pointer-events: none;
}

.zone-panel .zone-panel-bg {
  transition: fill 0.2s var(--ease);
}

.zone-btn:hover + .zone-panel .zone-panel-bg,
.zone-poly.zone-btn:focus ~ .zone-panel {
  /* panels are siblings in labels layer; hover handled via zone fill */
}

/* Pantalla completa de zona */
.zone-focus {
  position: fixed;
  inset: 0;
  top: 52px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: focusIn 0.35s var(--ease);
}

@keyframes focusIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.focus-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--focus-color, #e6c15a) 16%, transparent), transparent 55%),
    rgba(12, 14, 18, 0.94);
  backdrop-filter: blur(12px);
}

.focus-back {
  white-space: nowrap;
}

.focus-identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.focus-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid color-mix(in srgb, var(--focus-color, #e6c15a) 55%, transparent);
  color: var(--focus-color, #e6c15a);
}

.focus-icon svg {
  width: 30px;
  height: 30px;
  overflow: visible;
}

.focus-eyebrow {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--focus-color, var(--accent));
  font-weight: 600;
}

.focus-title {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 2rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
}

.focus-sub {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.focus-meta {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.focus-meta span {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.focus-meta span.ok {
  color: var(--ok);
  border-color: rgba(74, 211, 154, 0.35);
  background: rgba(74, 211, 154, 0.1);
}

.zone-focus .legend {
  padding: 0.55rem 1rem 0;
  margin: 0;
}

.focus-map {
  flex: 1;
  margin: 0.65rem 1rem 1rem;
  min-height: 0;
  display: flex;
  align-items: stretch;
  animation: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 20%, color-mix(in srgb, var(--focus-color, #e6c15a) 10%, transparent), transparent 60%),
    rgba(255, 255, 255, 0.02);
}

.focus-map #floorMap {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 280px;
}

@media (min-width: 720px) {
  .focus-bar {
    padding: 1rem 1.35rem;
    grid-template-columns: auto 1fr auto;
  }

  .focus-meta {
    display: flex;
  }

  .focus-map {
    margin: 0.75rem 1.35rem 1.35rem;
  }
}

body.zone-open #zonesOverview {
  visibility: hidden;
  pointer-events: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.map-viewport {
  width: 100%;
  overflow: auto;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  touch-action: pan-x pan-y;
}

#floorMap {
  display: block;
  width: 100%;
  height: auto;
}

.zone-poly {
  fill-opacity: 0.16;
  stroke-width: 1.5;
  stroke-opacity: 0.5;
}

.zone-poly.amenity-zone {
  fill-opacity: 0.2;
  stroke-dasharray: 5 4;
}

.table-node.is-preview {
  cursor: default;
  opacity: 0.92;
}

.table-node {
  cursor: pointer;
  outline: none;
}

.table-node.selected .table-top {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.table-node.is-reserved {
  cursor: not-allowed;
}

.table-label {
  fill: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  pointer-events: none;
  text-anchor: middle;
  dominant-baseline: central;
}

.reserved-badge,
.hold-ring {
  pointer-events: none;
}

.hold-ring {
  animation: holdPulse 1.4s ease-in-out infinite;
}

@keyframes holdPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@media (min-width: 720px) {
  .focus-bar {
    padding: 1rem 1.35rem;
  }

  .focus-meta {
    display: flex;
  }

  .focus-map {
    margin: 0.75rem 1.35rem 1.35rem;
  }
}

/* Botones */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), opacity 0.2s;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.packages-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--line);
}

.packages-btn:hover {
  background: rgba(230, 193, 90, 0.15);
  color: var(--accent);
}

.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(232, 97, 79, 0.5);
  animation: ping 1.6s ease infinite;
}

@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(232, 97, 79, 0.45); }
  70% { box-shadow: 0 0 0 8px rgba(232, 97, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 97, 79, 0); }
}

/* Toast */
.toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 360px;
  padding: 1rem 1.1rem 1.1rem;
  padding-right: 2.5rem;
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.45s var(--ease);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-close {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.toast-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.toast-title {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.toast-body {
  margin: 0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.toast-cta {
  width: 100%;
}

/* Modal paquetes */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: min(560px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  background: #12141a;
  border-radius: 20px 20px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  animation: sheetUp 0.35s var(--ease);
}

.modal-head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal-head .sheet-close {
  position: absolute;
  top: -0.15rem;
  right: 0;
  z-index: 2;
}

.modal-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.modal-head h2 {
  margin: 0.2rem 0 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
}

.packages-grid {
  display: grid;
  gap: 0.75rem;
}

.package-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  transition: border-color 0.2s var(--ease);
}

.package-card:hover {
  border-color: rgba(230, 193, 90, 0.35);
}

.package-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.package-card .price {
  margin: 0.2rem 0 0;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.05rem;
}

.package-card p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.package-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.package-meta span {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
  color: var(--muted);
}

/* Sheet reserva */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-height: 78vh;
  overflow: auto;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  background: #12141a;
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.4);
  animation: sheetUp 0.35s var(--ease);
}

.sheet .sheet-close {
  z-index: 2;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.sheet h2 {
  margin: 0 2rem 0.35rem 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  letter-spacing: 0.02em;
}

#sheetMeta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-pill {
  display: inline-block;
  margin: 0.75rem 0;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.08);
}

.status-pill.status-RESERVADA,
.status-pill.status-OCUPADA {
  background: rgba(76, 29, 149, 0.45);
  color: #ddd6fe;
}

.status-pill.status-BLOQUEADA_TEMPORAL {
  background: rgba(240, 165, 0, 0.18);
  color: var(--hold);
}

.status-pill.status-DISPONIBLE {
  background: rgba(74, 211, 154, 0.16);
  color: var(--ok);
}

.sheet-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkout {
  display: grid;
  gap: 0.65rem;
}

.checkout label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.checkout input,
.checkout select {
  width: 100%;
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--ink);
  font: inherit;
}

.capacity-fixed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  color: var(--muted);
}

.capacity-fixed strong {
  color: var(--ink);
  font-size: 1rem;
}

.checkout .check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-template-columns: none;
}

.msg {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

@media (min-width: 900px) {
  .modal-backdrop {
    place-items: center;
    padding: 1.5rem;
  }

  .modal {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    max-height: 80vh;
  }

  .sheet {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    width: min(380px, 92vw);
    max-height: 85vh;
    border-radius: var(--radius);
    border: 1px solid var(--line);
  }

  .toast {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
  }
}
