/* ============================================
   KIPEI — Design System
   Palette: Deep Navy + Electric Teal + Soft White + Lime Accent
   Font: Inter (system) + custom weight scale
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Core palette */
  --navy:        #0A0F1E;
  --navy-card:   #111827;
  --navy-light:  #1a2236;
  --teal:        #00D4C8;
  --teal-dim:    #00a89e;
  --teal-glow:   rgba(0, 212, 200, 0.15);
  --lime:        #C8F135;
  --lime-dim:    rgba(200, 241, 53, 0.15);
  --white:       #FFFFFF;
  --off-white:   #F0F4FF;
  --gray-100:    #E8EDF8;
  --gray-300:    #8896B3;
  --gray-500:    #4B5A7A;
  --gray-700:    #2A3452;

  /* Semantic */
  --bg-main:     var(--navy);
  --bg-card:     var(--navy-card);
  --bg-elevated: var(--navy-light);
  --accent:      var(--teal);
  --accent-2:    var(--lime);
  --text-primary: var(--white);
  --text-secondary: var(--gray-300);
  --text-muted:  var(--gray-500);
  --border:      rgba(255,255,255,0.07);
  --border-accent: rgba(0, 212, 200, 0.3);

  /* Category colors */
  --cat-bencina:  #FF8A00;
  --cat-gastro:   #FF4B6E;
  --cat-super:    #00C48C;
  --cat-farma:    #5B8EFF;

  /* Radius & shadow */
  --r-sm:   10px;
  --r-md:   16px;
  --r-lg:   24px;
  --r-xl:   32px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 32px rgba(0,212,200,0.2);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  padding-bottom: 80px;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }

/* ── Typography ── */
.text-xs   { font-size: 11px; }
.text-sm   { font-size: 13px; }
.text-base { font-size: 15px; }
.text-lg   { font-size: 18px; }
.text-xl   { font-size: 22px; }
.text-2xl  { font-size: 28px; }
.text-3xl  { font-size: 36px; }
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fw-900 { font-weight: 900; }

.text-accent   { color: var(--teal); }
.text-lime     { color: var(--lime); }
.text-muted    { color: var(--text-secondary); }
.text-dimmed   { color: var(--text-muted); }
.text-center   { text-align: center; }
.uppercase     { text-transform: uppercase; letter-spacing: 0.08em; }

/* ── Layout ── */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

.section { margin-bottom: 32px; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}
.section-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
}

/* ── Header ── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--white);
  flex-shrink: 0;
}

.header-logo span {
  color: var(--teal);
}

.search-bar {
  flex: 1;
  position: relative;
}

.search-bar input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 9px 16px 9px 38px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { border-color: var(--border-accent); }

.search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ── Hero Banner ── */
.hero-banner {
  background: linear-gradient(135deg, #0d1f3c 0%, #0A1628 60%, #061018 100%);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 20px;
  margin: 16px 0 24px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: var(--teal-glow);
  filter: blur(40px);
  pointer-events: none;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--white);
  margin-bottom: 8px;
}

.hero-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.link-asistente {
  color: var(--teal);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}

.link-asistente:hover {
  color: var(--white);
  border-bottom-color: var(--teal);
}

.hero-stats {
  display: flex;
  gap: 24px;
}

.hero-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
}

.hero-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── Category Grid ── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 32px;
}

.cat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.cat-card:active { transform: scale(0.96); }
.cat-card:hover { border-color: rgba(255,255,255,0.15); }

.cat-icon-wrap {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}

.cat-bencina  .cat-icon-wrap { background: rgba(255,138,0,0.15); color: var(--cat-bencina); }
.cat-gastro   .cat-icon-wrap { background: rgba(255,75,110,0.15); color: var(--cat-gastro); }
.cat-super    .cat-icon-wrap { background: rgba(0,196,140,0.15);  color: var(--cat-super); }
.cat-farma    .cat-icon-wrap { background: rgba(91,142,255,0.15); color: var(--cat-farma); }

.cat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.2;
}

/* ── Benefit Card ── */
.benefit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: block;
  transition: border-color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  margin-bottom: 10px;
}

.benefit-card:last-child { margin-bottom: 0; }
.benefit-card:hover { border-color: rgba(255,255,255,0.12); }
.benefit-card:active { transform: scale(0.99); }

.benefit-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.benefit-card-info { flex: 1; min-width: 0; }

.benefit-bank {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.benefit-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  line-height: 1.3;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.benefit-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discount-badge {
  background: var(--lime-dim);
  color: var(--lime);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.benefit-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.benefit-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.benefit-cta {
  font-size: 11px;
  font-weight: 700;
  color: var(--teal);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Benefit Detail ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 16px 0 8px;
  transition: color 0.2s;
}
.back-link:hover { color: var(--white); }

.detail-hero {
  background: linear-gradient(145deg, var(--navy-light), var(--navy-card));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.detail-hero::after {
  content: '';
  position: absolute;
  bottom: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--teal-glow);
  filter: blur(30px);
  pointer-events: none;
}

.detail-bank-tag {
  display: inline-block;
  background: var(--teal-glow);
  color: var(--teal);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.detail-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.25;
  margin-bottom: 16px;
}

.detail-discount-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.detail-discount-value {
  font-size: 48px;
  font-weight: 900;
  color: var(--lime);
  line-height: 1;
}

.detail-discount-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.detail-section {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }

.detail-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.detail-section-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.meta-item {
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  padding: 14px;
}

.meta-item-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 5px;
}

.meta-item-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
}

.cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--teal);
  color: var(--navy);
  font-size: 15px;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--r-md);
  border: none;
  transition: background 0.2s, transform 0.1s;
  margin-bottom: 12px;
}

.cta-button:hover { background: var(--teal-dim); }
.cta-button:active { transform: scale(0.98); }

.cta-note {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--navy-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 0;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--teal); }
.nav-item:hover { color: var(--gray-300); }

/* ── Chat ── */
.chat-fab {
  position: fixed;
  bottom: 88px; right: 16px;
  width: 52px; height: 52px;
  background: var(--teal);
  color: var(--navy);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: var(--shadow-glow);
  cursor: pointer;
  z-index: 99;
  transition: transform 0.2s, background 0.2s;
}
.chat-fab:hover { background: var(--teal-dim); transform: scale(1.05); }
.chat-fab:active { transform: scale(0.95); }

.chat-window {
  position: fixed;
  bottom: 88px; right: 16px;
  width: min(calc(100vw - 32px), 360px);
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 480px;
  z-index: 200;
  overflow: hidden;
}

.chat-window.hidden { display: none; }

.chat-header {
  background: var(--bg-elevated);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 6px var(--teal);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px;
  line-height: 1;
}
.chat-close:hover { color: var(--white); }

/* ══════════════════════════════════════
   QUICKSTART — atajos por botones en el chat
   (categoría · banco/emisor · tipo de tarjeta)
══════════════════════════════════════ */
.chat-quickstart-reopen {
  position: relative; /* ancla para el tooltip */
  background: none;
  border: none;
  color: var(--lime);
  font-size: 15px;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.2s;
}
.chat-quickstart-reopen:hover { color: var(--lime); }

/* Tooltip custom del ícono ⚡: no usamos el atributo title nativo
   porque no se muestra en dispositivos táctiles (la mayoría de las
   visitas a esta PWA), así que el usuario nunca podría descubrir qué
   hace el ícono con solo un tap. Se muestra en hover/foco (desktop) y
   también se fuerza brevemente con la clase .show-tooltip desde
   main.js cada vez que se abre el chat (funciona igual en móvil). */
.icon-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: -8px;
  width: 190px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-accent);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  text-align: left;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  pointer-events: none;
  z-index: 210;
}
.icon-tooltip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 14px;
  border: 6px solid transparent;
  border-bottom-color: var(--border-accent);
}
.chat-quickstart-reopen:hover .icon-tooltip,
.chat-quickstart-reopen:focus-visible .icon-tooltip,
.chat-quickstart-reopen.show-tooltip .icon-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chat-quickstart {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  max-height: 280px;
  overflow-y: auto;
}
.chat-quickstart.collapsed { display: none; }

.quickstart-intro {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.45;
}
.quickstart-intro i { color: var(--lime); font-size: 12px; margin-top: 2px; flex-shrink: 0; }

.quickstart-step-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.quickstart-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quickstart-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--r-xl);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.quickstart-btn:hover { border-color: var(--border-accent); color: var(--white); }
.quickstart-btn.selected {
  background: rgba(0, 212, 200, 0.15);
  border-color: var(--teal);
  color: var(--teal);
}
.quickstart-btn i { font-size: 11px; }

.quickstart-skip {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 2px 0;
}
.quickstart-skip:hover { color: var(--text-secondary); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-bubble.assistant {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--teal);
  color: var(--navy);
  font-weight: 500;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* Listas dentro de una respuesta del asistente (render markdown ligero) */
.chat-bubble-list {
  margin: 4px 0 4px 18px;
  padding: 0;
}
.chat-bubble-list li { margin-bottom: 4px; }

/* Indicador de "escribiendo…" mientras llega el primer fragmento del stream */
.chat-bubble.assistant.typing::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 2px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: kipei-typing-dot 1s ease-in-out infinite;
}
@keyframes kipei-typing-dot {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.9; }
}

.chat-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 10px 16px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-input:focus { border-color: var(--border-accent); }
.chat-input:disabled { opacity: 0.6; cursor: not-allowed; }

.chat-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--navy);
  border: none;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, opacity 0.2s;
}
.chat-send:hover { background: var(--teal-dim); }
.chat-send:disabled,
.chat-send.sending {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Page Header (category/search) ── */
.page-header {
  padding: 20px 0 8px;
}

.page-header-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 4px;
}

.page-header-sub {
  font-size: 13px;
  color: var(--text-secondary);
}

.page-header-scope {
  display: inline-block;
  margin-left: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  vertical-align: middle;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}

.empty-state-icon {
  font-size: 40px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-700); border-radius: 4px; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.3s ease forwards; }

/* ── Responsive ── */
@media (max-width: 360px) {
  .hero-title { font-size: 22px; }
  .category-grid { gap: 8px; }
  .cat-icon-wrap { width: 36px; height: 36px; font-size: 16px; }
}

/* ══════════════════════════════════════
   MODAL — Legal (T&C / Privacidad)
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 500;
  display: flex; align-items: flex-end;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-sheet {
  background: var(--navy-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  width: 100%; max-width: 480px;
  margin: 0 auto;
  padding: 0 0 32px;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px;
  background: var(--gray-700);
  border-radius: 2px;
  margin: 12px auto 16px;
}

.modal-header {
  padding: 0 20px 12px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--white); }
.modal-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 18px; padding: 4px;
}
.modal-close:hover { color: var(--white); }

.modal-body {
  padding: 20px;
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.7;
}
.modal-body h3 { font-size: 14px; font-weight: 700; color: var(--white); margin: 16px 0 6px; }
.modal-body h3:first-child { margin-top: 0; }
.modal-body p { margin-bottom: 10px; }

/* ══════════════════════════════════════
   CONSENT BANNER
══════════════════════════════════════ */
.consent-banner {
  position: fixed; bottom: 72px; left: 0; right: 0;
  z-index: 300;
  max-width: 480px; margin: 0 auto;
  background: var(--navy-light);
  border: 1px solid var(--border-accent);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 16px 16px 12px;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.consent-banner.visible { transform: translateY(0); }

.consent-text {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.55; margin-bottom: 12px;
}
.consent-text a {
  color: var(--teal); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.consent-checkbox {
  width: 18px; height: 18px;
  accent-color: var(--teal);
  flex-shrink: 0; cursor: pointer;
}
.consent-label {
  font-size: 12px; color: var(--text-secondary);
  line-height: 1.4; cursor: pointer;
}

.consent-btn {
  width: 100%;
  background: var(--teal); color: var(--navy);
  font-size: 14px; font-weight: 700;
  padding: 12px; border-radius: var(--r-md);
  border: none; transition: background 0.2s, opacity 0.2s;
}
.consent-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.consent-btn:not(:disabled):hover { background: var(--teal-dim); }

/* ══════════════════════════════════════
   PWA INSTALL BANNER
══════════════════════════════════════ */
.pwa-banner {
  display: none;
  position: fixed; bottom: 72px; left: 0; right: 0;
  z-index: 290;
  max-width: 480px; margin: 0 auto;
  background: var(--navy-light);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 14px 16px;
  flex-direction: column; gap: 10px;
}
.pwa-banner.visible { display: flex; }

.pwa-banner-content {
  display: flex; align-items: center; gap: 12px;
}
.pwa-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--navy-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 22px; font-weight: 900; color: var(--white);
}
.pwa-icon span { color: var(--teal); }
.pwa-info-title { font-size: 14px; font-weight: 700; color: var(--white); }
.pwa-info-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.pwa-dismiss {
  margin-left: auto; background: none; border: none;
  color: var(--text-muted); font-size: 16px; flex-shrink: 0;
}

.pwa-actions { display: flex; gap: 8px; }
.pwa-btn-install {
  flex: 1; background: var(--teal); color: var(--navy);
  font-size: 13px; font-weight: 700; padding: 10px;
  border-radius: var(--r-md); border: none;
}
.pwa-btn-later {
  background: var(--bg-elevated); color: var(--text-secondary);
  font-size: 13px; font-weight: 600; padding: 10px 16px;
  border-radius: var(--r-md); border: 1px solid var(--border);
}

/* ══════════════════════════════════════
   VOICE BUTTON in chat
══════════════════════════════════════ */
.chat-voice {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-voice:hover { color: var(--white); border-color: var(--border-accent); }
.chat-voice.listening {
  background: rgba(255,75,75,0.15);
  border-color: rgba(255,75,75,0.5);
  color: #ff4b4b;
  animation: pulse-mic 1s infinite;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,75,75,0.3); }
  50%       { box-shadow: 0 0 0 8px rgba(255,75,75,0); }
}

/* ══════════════════════════════════════
   GEOLOCATION BUTTON in chat (opt-in)
══════════════════════════════════════ */
.chat-geo {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}
.chat-geo:hover { color: var(--white); border-color: var(--border-accent); }
.chat-geo.active {
  background: rgba(45, 212, 191, 0.15);
  border-color: var(--teal);
  color: var(--teal);
}
.chat-geo.loading {
  opacity: 0.6;
  animation: pulse-mic 1s infinite;
}
.chat-geo:disabled { cursor: not-allowed; }

/* Sucursales cercanas devueltas junto a una respuesta del asistente */
.chat-branches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chat-branch-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.35);
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-xl);
}
.chat-branch-chip i { font-size: 10px; }

/* ══════════════════════════════════════
   VOICE NOT SUPPORTED TOOLTIP
══════════════════════════════════════ */
.voice-tip {
  font-size: 11px; color: var(--text-muted);
  text-align: center; padding: 4px 0 0;
}
