:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.bg-grid {
  background-image:
    linear-gradient(rgba(148, 163, 184, .055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .055) 1px, transparent 1px);
  background-size: 34px 34px;
}

.glass {
  background: rgba(15, 23, 42, .72);
  border: 1px solid rgba(148, 163, 184, .14);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.glass-light {
  background: rgba(255, 255, 255, .82);
  border: 1px solid rgba(148, 163, 184, .2);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.text-gradient {
  background: linear-gradient(100deg, #fff 0%, #b9e8ff 42%, #52c4ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { scrollbar-width: none; }

.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(148,163,184,.25); border-radius: 999px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.4); }

.input-base {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(15,23,42,.7);
  color: #f8fafc;
  padding: .78rem .95rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.input-base::placeholder { color: #64748b; }
.input-base:focus {
  border-color: rgba(82,196,255,.8);
  box-shadow: 0 0 0 4px rgba(42,167,255,.12);
  background: rgba(15,23,42,.9);
}

.input-light {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #0f172a;
  padding: .78rem .95rem;
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-light::placeholder { color: #94a3b8; }
.input-light:focus { border-color: #2aa7ff; box-shadow: 0 0 0 4px rgba(42,167,255,.12); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2aa7ff, #1588f4);
  color: #fff;
  padding: .7rem 1rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(42,167,255,.22);
  transition: transform .18s ease, filter .18s ease, opacity .18s ease;
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(15,23,42,.55);
  color: #e2e8f0;
  padding: .7rem 1rem;
  font-weight: 700;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.btn-secondary:hover { background: rgba(30,41,59,.85); border-color: rgba(148,163,184,.36); transform: translateY(-1px); }

.btn-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid #dbe3ef;
  background: #fff;
  color: #334155;
  padding: .65rem .9rem;
  font-weight: 700;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.btn-light:hover { background: #f8fafc; border-color: #cbd5e1; transform: translateY(-1px); }

.card-hover { transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.card-hover:hover { transform: translateY(-4px); box-shadow: 0 24px 70px rgba(15,23,42,.16); border-color: rgba(42,167,255,.28); }

.fade-in { animation: fadeIn .25s ease both; }
.slide-up { animation: slideUp .3s ease both; }
.pulse-soft { animation: pulseSoft 2.2s ease-in-out infinite; }
.sleep-float { animation: sleepFloat 3s ease-in-out infinite; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseSoft { 0%,100% { opacity: .65; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.03); } }
@keyframes sleepFloat { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }

.ai-orb {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.7), transparent 18%),
    radial-gradient(circle at 70% 65%, rgba(42,167,255,.9), transparent 35%),
    linear-gradient(145deg, #b9e8ff, #2aa7ff 55%, #1559b1);
  box-shadow: inset 0 0 26px rgba(255,255,255,.24), 0 15px 35px rgba(42,167,255,.3);
}
.ai-orb::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,.32);
}

.status-dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }

.table-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 16px; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th { background: #f8fafc; color: #64748b; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: .85rem 1rem; white-space: nowrap; }
.table-wrap td { color: #334155; padding: .85rem 1rem; border-top: 1px solid #eef2f7; vertical-align: middle; }

@media (max-width: 768px) {
  .mobile-sheet { border-radius: 24px 24px 0 0 !important; align-self: end; max-height: 92vh; overflow-y: auto; }
}

.voice-live {
  animation: voiceLive 1.05s ease-in-out infinite;
  box-shadow: inset 0 0 28px rgba(255,255,255,.28), 0 0 0 0 rgba(244,63,94,.42), 0 15px 38px rgba(42,167,255,.34);
}

.voice-speaking {
  animation: voiceSpeaking 1.35s ease-in-out infinite;
}

button:disabled {
  cursor: not-allowed;
}

@keyframes voiceLive {
  0%, 100% { transform: scale(.96); box-shadow: inset 0 0 28px rgba(255,255,255,.28), 0 0 0 0 rgba(244,63,94,.42), 0 15px 38px rgba(42,167,255,.34); }
  50% { transform: scale(1.06); box-shadow: inset 0 0 30px rgba(255,255,255,.34), 0 0 0 12px rgba(244,63,94,0), 0 18px 42px rgba(42,167,255,.42); }
}

@keyframes voiceSpeaking {
  0%, 100% { transform: scale(.98) rotate(-1deg); filter: saturate(.95); }
  35% { transform: scale(1.05) rotate(1deg); filter: saturate(1.25); }
  70% { transform: scale(1.01) rotate(-.5deg); filter: saturate(1.1); }
}

/* V15: modales largos con scroll real en móvil y escritorio. */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

.modal-scroll-backdrop {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-scroll-panel {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.modal-scroll-panel::-webkit-scrollbar { width: 8px; }
.modal-scroll-panel::-webkit-scrollbar-track { background: transparent; }
.modal-scroll-panel::-webkit-scrollbar-thumb { background: rgba(100,116,139,.28); border-radius: 999px; }

@media (max-width: 768px) {
  .modal-scroll-backdrop { align-items: flex-end !important; }
  .modal-scroll-panel.mobile-sheet {
    max-height: calc(100dvh - .5rem) !important;
    overflow-y: auto !important;
    border-radius: 24px 24px 0 0 !important;
  }
}

/* V17: retroalimentación visible del carrito y modo de voz minimizado. */
.cart-action-flash {
  animation: cartActionFlash 1.45s ease both;
}

.cart-action-badge {
  animation: cartBadgePop .5s cubic-bezier(.2,.9,.25,1.35) both;
}

.cart-bounce {
  animation: cartBounce .68s cubic-bezier(.2,.9,.25,1.35) 2;
}

.cart-feedback-toast {
  animation: cartFeedbackIn .4s ease both;
}

@keyframes cartActionFlash {
  0% { transform: scale(.97); box-shadow: 0 0 0 0 rgba(16,185,129,.4); }
  35% { transform: scale(1.025); box-shadow: 0 0 0 9px rgba(16,185,129,.12), 0 20px 55px rgba(15,23,42,.18); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

@keyframes cartBadgePop {
  from { opacity: 0; transform: translateY(-8px) scale(.75); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cartBounce {
  0%,100% { transform: scale(1) rotate(0); }
  35% { transform: scale(1.12) rotate(-4deg); }
  70% { transform: scale(1.06) rotate(3deg); }
}

@keyframes cartFeedbackIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
