/* ============================================================
   Intercambios — Main Stylesheet v4
   Colores: #ef6c24 | #1f295a | #4a85e9
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&display=swap');

:root {
  --orange:     #ef6c24;
  --navy:       #1f295a;
  --blue:       #4a85e9;
  --orange-l:   #ff8c50;
  --navy-l:     #2e3f7f;
  --blue-l:     #6fa3f5;
  --bg:         #f0f4ff;
  --white:      #ffffff;
  --gray-1:     #f7f8fc;
  --gray-2:     #e8ecf4;
  --gray-3:     #b0bbd0;
  --gray-4:     #6b7a99;
  --text:       #1a2340;
  --shadow-sm:  0 2px 8px rgba(31,41,90,.08);
  --shadow-md:  0 8px 30px rgba(31,41,90,.12);
  --radius:     14px;
  --radius-sm:  8px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --navbar-h:   64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

/* ══════════════════════════════════════════════════════════
   NAVBAR
   ══════════════════════════════════════════════════════════ */
.navbar {
  background: var(--white);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-h);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

/* Logo imagen */
.navbar-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--navy);
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 20px;
}
.navbar-brand span { color: var(--orange); }
.navbar-logo-img {
  height: 64px;
  width: auto;
  display: block;
}

/* Nav links desktop */
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}
.navbar-nav a, .navbar > a:not(.navbar-brand) {
  color: var(--navy);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.navbar-nav a:hover, .navbar-nav a.active { background: var(--gray-1); color: var(--navy); }

/* Estilo específico para Cerrar Sesión (asegura visibilidad en PC) */
.navbar a.logout, 
.navbar a[href*="logout"] { 
  color: #d32f2f !important; 
  font-weight: 600; 
}
.navbar a.logout:hover, 
.navbar a[href*="logout"]:hover { 
  background: #fff5f5 !important; 
}

/* Hamburger button — oculto en desktop */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════
   PAGE HERO
   ══════════════════════════════════════════════════════════ */
.page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-l) 60%, #1a3a8f 100%);
  padding: 52px 24px;
  text-align: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%234a85e9' fill-opacity='0.06'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.page-hero h1 {
  font-family: 'Sora', sans-serif;
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 800;
  margin-bottom: 8px;
  position: relative;
}
.page-hero p { opacity: .75; font-size: clamp(13px, 2vw, 16px); position: relative; }

/* ══════════════════════════════════════════════════════════
   CONTAINERS
   ══════════════════════════════════════════════════════════ */
.container    { max-width: 960px;  margin: 0 auto; padding: 0 20px; }
.container-lg { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ══════════════════════════════════════════════════════════
   CARD
   ══════════════════════════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-2);
}
.card-body { padding: 28px; }

/* ══════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════ */
.form-section  { margin-bottom: 32px; }

.section-title {
  font-family: 'Sora', sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--orange);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--gray-2); }

.form-grid          { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-3   { grid-template-columns: 1fr 1fr 1fr; }
.form-grid.cols-1   { grid-template-columns: 1fr; }
.form-group         { display: flex; flex-direction: column; gap: 5px; }
.form-group.full    { grid-column: 1 / -1; }

label { font-size: 13px; font-weight: 600; color: var(--gray-4); }
label .req { color: var(--orange); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,133,233,.15);
}
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a99' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  cursor: pointer;
}

/* ── File Upload ─────────────────────────────────────────── */
.file-upload {
  border: 2px dashed var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-1);
  position: relative;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.file-upload:hover { border-color: var(--blue); background: #eef3fd; }
.file-upload input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-upload .icon        { font-size: 24px; margin-bottom: 6px; }
.file-upload .label-text  { font-size: 13px; font-weight: 600; color: var(--navy); }
.file-upload .hint        { font-size: 11px; color: var(--gray-3); margin-top: 3px; }
.file-upload .filename    { font-size: 11px; color: var(--blue); margin-top: 6px; font-weight: 500; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary  { background: var(--orange); color: #fff; box-shadow: 0 4px 14px rgba(239,108,36,.3); }
.btn-primary:hover  { background: var(--orange-l); transform: translateY(-1px); }
.btn-secondary{ background: var(--navy);   color: #fff; }
.btn-secondary:hover{ background: var(--navy-l); transform: translateY(-1px); }
.btn-blue     { background: var(--blue);   color: #fff; box-shadow: 0 4px 14px rgba(74,133,233,.3); }
.btn-blue:hover { background: var(--blue-l); transform: translateY(-1px); }
.btn-outline  { background: transparent; border: 1.5px solid var(--gray-2); color: var(--gray-4); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-lg  { padding: 13px 32px; font-size: 15px; }
.btn-sm  { padding: 6px 14px;  font-size: 12px; }
.btn-full{ width: 100%; }

/* ══════════════════════════════════════════════════════════
   CONVERSION WIDGET
   ══════════════════════════════════════════════════════════ */
.conversion-box {
  background: linear-gradient(135deg, var(--navy), #2a3f8f);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  margin-bottom: 24px;
}
.conversion-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}
.conversion-field { flex: 1; min-width: 120px; }
.conversion-field label {
  color: rgba(255,255,255,.65);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 8px;
  display: block;
}
.conversion-field input {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.2);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}
.conversion-field input::placeholder { color: rgba(255,255,255,.4); }
.conversion-field input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(239,108,36,.25); }

.conversion-arrow { font-size: 22px; opacity: .6; padding-bottom: 4px; flex-shrink: 0; }

.conversion-result {
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  flex: 1;
  min-width: 140px;
}
.conversion-result .amount   { font-family: 'Sora',sans-serif; font-size: 22px; font-weight: 800; }
.conversion-result .currency { font-size: 12px; opacity: .65; margin-top: 2px; }

.tasa-info  { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 12px; opacity: .6; flex-wrap: wrap; }
.tasa-dot   { width: 7px; height: 7px; background: #4cdb8e; border-radius: 50%; flex-shrink: 0; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ══════════════════════════════════════════════════════════
   RADIO CARDS
   ══════════════════════════════════════════════════════════ */
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.radio-card {
  border: 2px solid var(--gray-2);
  border-radius: var(--radius-sm);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.radio-card:has(input:checked) { border-color: var(--orange); background: #fff5ef; }
.radio-card input[type="radio"] { position: absolute; opacity: 0; }
.radio-card .rc-icon  { font-size: 24px; margin-bottom: 6px; }
.radio-card .rc-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.radio-card .rc-desc  { font-size: 12px; color: var(--gray-4); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   FRECUENTES
   ══════════════════════════════════════════════════════════ */
.frecuentes-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.frecuente-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  background: var(--white);
}
.frecuente-item:hover { border-color: var(--blue); background: #eef3fd; }
.frecuente-avatar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.frecuente-info .name   { font-weight: 600; font-size: 14px; }
.frecuente-info .detail { font-size: 12px; color: var(--gray-4); }

/* Botón eliminar frecuente */
.btn-delete-frecuente {
  background: var(--gray-2);
  color: var(--gray-4);
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}
.btn-delete-frecuente:hover { background: #fee2e2; color: #dc2626; }

/* ══════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.alert-success { background: #e6f9ef; color: #1a7a42; border: 1px solid #b3eece; }
.alert-error   { background: #fef0ec; color: #c0360a; border: 1px solid #fcc4ae; }
.alert-info    { background: #e8f0fe; color: #2a5fd4; border: 1px solid #b3ccfa; }

/* ══════════════════════════════════════════════════════════
   TABS
   ══════════════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 4px;
  background: var(--gray-1);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}
.tab-btn {
  flex: 1; padding: 10px 12px; border: none;
  background: transparent; border-radius: 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px; font-weight: 600; color: var(--gray-4);
  cursor: pointer; transition: var(--transition);
  white-space: nowrap;
}
.tab-btn.active { background: var(--white); color: var(--navy); box-shadow: var(--shadow-sm); }

/* ══════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-activo    { background: #e6f9ef; color: #1a7a42; }
.badge-revision  { background: #fff8e0; color: #8a6200; }
.badge-cancelado { background: #fef0ec; color: #c0360a; }
.badge-pendiente { background: #e8f0fe; color: #2a5fd4; }

/* ══════════════════════════════════════════════════════════
   TABLE
   ══════════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 14px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--gray-4); border-bottom: 2px solid var(--gray-2); text-align: left;
}
tbody td  { padding: 13px 14px; font-size: 13px; border-bottom: 1px solid var(--gray-2); vertical-align: middle; }
tbody tr:hover { background: var(--gray-1); }
tbody tr:last-child td { border-bottom: none; }

/* ══════════════════════════════════════════════════════════
   FOOTER — pegado sin espacio
   ══════════════════════════════════════════════════════════ */
footer {
  background: var(--navy);
  color: rgba(255,255,255,.5);
  text-align: center;
  padding: 22px 20px;
  font-size: 13px;
  margin-top: 0;
}
footer a { color: rgba(255,255,255,.6); text-decoration: none; }
footer a:hover { color: #fff; }

/* ══════════════════════════════════════════════════════════
   STEPS
   ══════════════════════════════════════════════════════════ */
.steps { display: flex; align-items: center; margin-bottom: 32px; }
.step  { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step::after {
  content: ''; position: absolute; top: 17px; left: 50%;
  width: 100%; height: 2px; background: var(--gray-2); z-index: 0;
}
.step:last-child::after { display: none; }
.step-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gray-2); color: var(--gray-4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; position: relative; z-index: 1;
  transition: var(--transition);
}
.step.active .step-circle { background: var(--orange); color: #fff; box-shadow: 0 4px 12px rgba(239,108,36,.4); }
.step.done   .step-circle { background: var(--blue);   color: #fff; }
.step.done::after          { background: var(--blue); }
.step-label { font-size: 11px; font-weight: 600; color: var(--gray-4); margin-top: 5px; text-align: center; }
.step.active .step-label   { color: var(--orange); }
.step.done   .step-label   { color: var(--blue); }

/* ══════════════════════════════════════════════════════════
   ===== PHONE SELECTOR DROPDOWN =====
   Nuevo: estilos completos para el selector de código de país
   ══════════════════════════════════════════════════════════ */

/* Contenedor principal */
.phone-input-wrap {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius-sm);
  overflow: visible;           /* DEBE ser visible para que el dropdown salga */
  background: var(--white);
  transition: var(--transition);
  position: relative;
}
/* Recortar bordes redondeados sin usar overflow:hidden */
.phone-input-wrap > *:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.phone-input-wrap > *:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.phone-input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,133,233,.15);
}

/* Botón selector de código */
.phone-code-selector {
  position: relative;
  flex-shrink: 0;
}
.phone-code-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  background: var(--gray-1);
  border: none;
  border-right: 1.5px solid var(--gray-2);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  height: 100%;
  transition: var(--transition);
}
.phone-code-btn:hover {
  background: var(--gray-2);
}

/* Flecha del botón */
.phone-arrow {
  font-size: 10px;
  color: var(--gray-4);
  margin-left: 2px;
  transition: transform .2s;
}
.phone-code-dropdown.open + .phone-code-btn .phone-arrow,
.phone-code-btn[aria-expanded="true"] .phone-arrow {
  transform: rotate(180deg);
}

/* Dropdown */
.phone-code-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9999;               /* muy alto para no quedar tapado */
  background: var(--white);
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(31,41,90,.18);
  width: 300px;
  max-width: calc(100vw - 24px);
  max-height: 360px;
  display: none;               /* hidden por defecto con display:none */
  flex-direction: column;
  overflow: hidden;
}
.phone-code-dropdown.open {
  display: flex;               /* mostrar con display:flex */
}

/* Buscador */
.phone-search-wrap {
  padding: 12px;
  border-bottom: 1px solid var(--gray-2);
  flex-shrink: 0;
}
#phoneSearch {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-2);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: var(--transition);
}
#phoneSearch:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,133,233,.15);
}
#phoneSearch::placeholder {
  color: var(--gray-3);
}

/* Lista de países */
.phone-code-list {
  overflow-y: auto;
  flex: 1;
  padding: 6px;
}

/* Item de país — EL FIX PRINCIPAL */
.phone-code-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.phone-code-item:hover,
.phone-code-item.selected {
  background: var(--gray-1);
}

/* Bandera */
.pci-flag {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Nombre del país */
.pci-nombre {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

/* Código del país */
.pci-codigo {
  color: var(--gray-4);
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  background: var(--gray-1);
  padding: 2px 8px;
  border-radius: 6px;
  font-family: 'Sora', sans-serif;
}

/* Input del número de teléfono */
#telefonoNumero {
  border: none;
  outline: none;
  flex: 1;
  padding: 11px 14px;
  font-size: 15px;
  background: transparent;
  min-width: 0;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
}
#telefonoNumero::placeholder {
  color: var(--gray-3);
}

/* Scrollbar elegante */
.phone-code-list::-webkit-scrollbar {
  width: 5px;
}
.phone-code-list::-webkit-scrollbar-track {
  background: transparent;
}
.phone-code-list::-webkit-scrollbar-thumb {
  background: var(--gray-3);
  border-radius: 3px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
   ══════════════════════════════════════════════════════════ */

/* ── Tablet (≤ 900px) ─────────────────────────────────── */
@media (max-width: 900px) {
  .navbar { padding: 0 20px; }

  .form-grid.cols-3 { grid-template-columns: 1fr 1fr; }

  .stats-grid-home { grid-template-columns: 1fr 1fr; }
}

/* ── Mobile grande (≤ 768px) ─────────────────────────── */
@media (max-width: 768px) {
  :root { --navbar-h: 58px; }

  /* Navbar mobile */
  .navbar { padding: 0 16px; position: fixed; width: 100%; top: 0; left: 0; right: 0; }

  .nav-toggle { display: flex; z-index: 201; }

  .navbar-nav {
    display: none;
    position: fixed;
    top: var(--navbar-h);
    left: 0; right: 0;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px 16px;
    gap: 2px;
    border-top: 1px solid var(--gray-2);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 200;
    max-height: calc(100vh - var(--navbar-h));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav li   { width: 100%; }
  .navbar-nav a    {
    padding: 13px 16px;
    font-size: 15px;
    display: block;
    border-radius: var(--radius-sm);
    color: var(--navy);
    border-bottom: 1px solid var(--gray-1);
  }
  .navbar-nav li:last-child a { border-bottom: none; }

  /* Empujar contenido bajo navbar fixed */
  body > nav + *,
  body > .tasa-bar + *,
  .page-hero { margin-top: 0; }
  body { padding-top: var(--navbar-h); }

  /* Hero */
  .page-hero { padding: 36px 16px; }

  /* Card */
  .card-body { padding: 20px 16px; }

  /* Grids */
  .form-grid        { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .form-grid.full   { grid-column: 1; }
  .form-group.full  { grid-column: 1; }

  /* Radio cards */
  .radio-cards { grid-template-columns: 1fr; }

  /* Conversion widget */
  .conversion-row   { flex-direction: column; gap: 12px; }
  .conversion-field { width: 100%; }
  .conversion-result{ width: 100%; }
  .conversion-arrow { display: none; }

  /* Tabs */
  .tab-btn { font-size: 12px; padding: 9px 8px; }

  /* Buttons */
  .btn-lg { padding: 13px 20px; font-size: 14px; }

  /* Tables */
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap th, .table-wrap td, .table-wrap tr {
    display: block;
  }
  .table-wrap thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .table-wrap tr {
    border: 1px solid var(--gray-2);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    background: #fff;
    padding: 12px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  }
  .table-wrap td {
    border: none;
    position: relative;
    padding: 8px 0 8px 45% !important;
    text-align: right;
    border-bottom: 1px solid var(--gray-1);
  }
  .table-wrap td:last-child { border-bottom: none; }
  .table-wrap td::before {
    position: absolute;
    left: 0;
    width: 40%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    color: var(--gray-4);
    content: attr(data-label);
    font-size: 11px;
    text-transform: uppercase;
  }

  /* Steps */
  .step-label { font-size: 10px; }

  /* ===== PHONE DROPDOWN MOBILE (≤768px) ===== */
  .phone-code-dropdown {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    max-height: 75vh;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.25);
    z-index: 10001;
    display: none;
  }
  .phone-code-dropdown.open {
    display: flex;
  }
  .phone-code-list {
    max-height: 65vh;
  }
  .phone-code-item {
    padding: 14px 16px;
  }
  .pci-flag   { font-size: 22px; width: 32px; }
  .pci-nombre { font-size: 15px; }
  .pci-codigo { font-size: 14px; padding: 3px 10px; }
  #phoneSearch { padding: 12px 16px; font-size: 16px; }
}

/* ── Mobile pequeño (≤ 480px) ────────────────────────── */
@media (max-width: 480px) {
  .navbar-logo-img { height: 26px; }

  .page-hero h1 { font-size: 22px; }
  .page-hero p  { font-size: 13px; }

  .card-body { padding: 16px 14px; }

  .btn-full-mobile { width: 100%; }

  /* Hero buttons en columna */
  .hero-actions {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .hero-actions .btn { text-align: center; }

  /* Tabs en columna si no caben */
  .tabs { flex-direction: column; }
  .tab-btn { text-align: center; }

  /* Sección features 1 columna */
  .features-grid { grid-template-columns: 1fr !important; }

  /* Tasa info wrap */
  .tasa-info { font-size: 11px; }

  /* Phone input más compacto */
  .phone-code-btn {
    padding: 10px;
    font-size: 13px;
    min-width: 100px;
  }
  #telefonoNumero {
    padding: 10px 12px;
    font-size: 16px; /* anti-zoom iOS */
  }
}

/* ── Muy pequeño (≤ 360px) ───────────────────────────── */
@media (max-width: 360px) {
  .navbar { padding: 0 12px; }
  .card-body { padding: 14px 12px; }
  .btn { padding: 10px 16px; font-size: 13px; }

  .phone-code-btn {
    min-width: 85px;
    padding: 9px 8px;
    font-size: 12px;
    gap: 4px;
  }
  .pci-flag {
    font-size: 18px;
    width: 24px;
  }
  .phone-code-item {
    padding: 12px 10px;
    gap: 8px;
  }
}

/* ══════════════════════════════════════════════════════════
   TOUCH & ACCESIBILIDAD
   ══════════════════════════════════════════════════════════ */
@media (hover: none) {
  .btn:hover { transform: none; }
  .frecuente-item:hover { border-color: var(--gray-2); background: var(--white); }
}

/* Focus visible para accesibilidad teclado */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE FIXES — all pages
   ══════════════════════════════════════════════════════════ */

/* ── Conversion box full responsive ─────────────────────── */
@media (max-width: 600px) {
  .conversion-box {
    padding: 16px;
  }
  .conversion-row {
    flex-direction: column;
    gap: 10px;
  }
  .conversion-field,
  .conversion-result {
    width: 100%;
  }
  .conversion-arrow {
    display: none;
  }
  .conversion-field input {
    font-size: 18px;
  }
  .conversion-result .amount {
    font-size: 20px;
  }
}

/* ── Tabs responsive ────────────────────────────────────── */
@media (max-width: 500px) {
  .tabs {
    flex-direction: column;
    gap: 6px;
  }
  .tab-btn {
    font-size: 13px;
    padding: 10px 12px;
    text-align: center;
  }
}

/* ── Radio cards 1 column on mobile ─────────────────────── */
@media (max-width: 500px) {
  .radio-cards {
    grid-template-columns: 1fr;
  }
}

/* ── Form grid always 1 col on small phones ─────────────── */
@media (max-width: 480px) {
  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr !important;
  }
  .form-group.full {
    grid-column: 1 !important;
  }
  .card-body {
    padding: 16px 14px;
  }
}

/* ── Frecuentes list on mobile ───────────────────────────── */
.frecuente-item {
  flex-wrap: nowrap;
  gap: 10px;
}
.frecuente-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.frecuente-info .name,
.frecuente-info .detail {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 480px) {
  .frecuente-item {
    padding: 10px 12px;
  }
  .frecuente-avatar {
    width: 34px;
    height: 34px;
    font-size: 12px;
    flex-shrink: 0;
  }
  .frecuentes-list .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }
}

/* ── Buttons full width on small mobile ─────────────────── */
@media (max-width: 400px) {
  .btn-lg {
    width: 100%;
    justify-content: center;
  }
}

/* ── Hero text smaller on mobile ────────────────────────── */
@media (max-width: 480px) {
  .page-hero {
    padding: 28px 16px;
  }
  .page-hero h1 {
    font-size: 20px;
  }
  .page-hero p {
    font-size: 13px;
  }
}

/* ── Container padding on tiny screens ──────────────────── */
@media (max-width: 360px) {
  .container,
  .container-lg {
    padding: 0 10px;
  }
}

/* ── Prevent horizontal scroll globally ─────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* ── File upload on mobile ───────────────────────────────── */
@media (max-width: 480px) {
  .file-upload {
    padding: 14px 12px;
    min-height: 90px;
  }
  .file-upload .icon {
    font-size: 20px;
  }
  .file-upload .label-text {
    font-size: 12px;
  }
}

/* ── Login page centered on mobile ──────────────────────── */
@media (max-width: 480px) {
  .login-wrap {
    padding: 20px 16px;
    align-items: flex-start;
    padding-top: 40px;
  }
}

/* ── Historial table on mobile ───────────────────────────── */
@media (max-width: 600px) {
  .table-wrap {
    border-radius: var(--radius-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Section title truncate ─────────────────────────────── */
.section-title {
  overflow: hidden;
}

/* ── Alias input box full width ──────────────────────────── */
#aliasWrapVEpm input,
#aliasWrapVEcb input,
#aliasWrapCL input {
  box-sizing: border-box;
  max-width: 100%;
}

/* ══════════════════════════════════════════════════════════
   BARRA DE TASAS EN VIVO — Mejorada con alta/baja
   ══════════════════════════════════════════════════════════ */
.tasa-bar {
  background: var(--orange);
  width: 100%;
  overflow: hidden;
}

/* ── Centrado total ──────────────────────────────────── */
.tasa-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;   /* centrado horizontal */
  gap: 0;
  padding: 0;
  flex-wrap: nowrap;
}

.tasa-live-dot {
  width: 7px;
  height: 7px;
  background: #4cdb8e;
  border-radius: 50%;
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.tasa-bar-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #fff;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.25);
  flex-shrink: 0;
}

/* Grupo de tasas (CLP o BS) */
.tasa-bar-items {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;            /* no crece ni achica — solo lo que necesita */
}

.tasa-bar-group {
  display: flex;
  align-items: center;
  border-right: 1px solid rgba(255,255,255,.2);
  flex-shrink: 0;
}
.tasa-bar-group:last-child { border-right: none; }

.tasa-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 7px 16px;
  color: #fff;
  min-width: 100px;
  text-align: center;
}
.tasa-bar-item .t-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 3px;
  white-space: nowrap;
}
.tasa-bar-item .t-value {
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}
.tasa-bar-item.alta    .t-label { color: #a8f0c6; }
.tasa-bar-item.baja    .t-label { color: #ffd89b; }
.tasa-bar-item.general .t-label { color: rgba(255,255,255,.75); }

.tasa-bar-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.2);
  flex-shrink: 0;
  align-self: center;
}

/* Fecha — oculta en tablets/móvil */
.tasa-bar-fecha {
  padding: 7px 14px;
  font-size: 10px;
  color: rgba(255,255,255,.6);
  white-space: nowrap;
  border-left: 1px solid rgba(255,255,255,.2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ── Responsive tasa-bar ─────────────────────────────── */
@media (max-width: 1024px) {
  .tasa-bar-fecha { display: none; }
}

@media (max-width: 768px) {
  /* En móvil: scroll horizontal, todo centrado */
  .tasa-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tasa-bar::-webkit-scrollbar { display: none; }
  .tasa-bar-inner {
    justify-content: flex-start;   /* scroll desde izq en móvil */
    min-width: max-content;
    padding: 0 8px;
  }
  .tasa-bar-label { padding: 8px 12px; font-size: 10px; }
  .tasa-bar-item  { padding: 6px 12px; min-width: 80px; }
  .tasa-bar-item .t-value { font-size: 12px; }
  .tasa-bar-item .t-label { font-size: 8px; }
}

@media (max-width: 480px) {
  .tasa-bar-label { padding: 7px 10px; font-size: 9px; letter-spacing: .5px; }
  .tasa-bar-item  { padding: 5px 10px; min-width: 72px; }
  .tasa-bar-item .t-value { font-size: 11px; }
  .tasa-bar-item .t-label { font-size: 7px; }
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE GLOBAL MEJORADO
   ══════════════════════════════════════════════════════════ */

/* Prevenir scroll horizontal */
html, body { overflow-x: hidden; max-width: 100vw; }

/* iOS: prevenir zoom al enfocar inputs */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  input[type="date"],
  select,
  textarea { font-size: 16px !important; }
}

/* Touch: sin hover que se quede pegado */
@media (hover: none) {
  .btn:hover       { transform: none; box-shadow: inherit; }
  .card:hover      { transform: none; }
  .frecuente-item:hover { background: var(--white); border-color: var(--gray-2); }
  .file-upload:hover    { background: var(--gray-1); border-color: var(--gray-2); }
}

/* Contenedor padding seguro */
@media (max-width: 480px) {
  .container, .container-lg { padding: 0 12px; }
  .card-body { padding: 16px 14px; }
}
@media (max-width: 360px) {
  .container, .container-lg { padding: 0 10px; }
  .card-body { padding: 14px 12px; }
  .btn { padding: 10px 14px; font-size: 13px; }
  .navbar { padding: 0 10px; }
}

/* Grids responsive */
@media (max-width: 768px) {
  .form-grid,
  .form-grid.cols-3 { grid-template-columns: 1fr !important; }
  .form-group.full  { grid-column: 1 !important; }
  .radio-cards      { grid-template-columns: 1fr !important; }
}

/* Conversion widget */
@media (max-width: 640px) {
  .conversion-box   { padding: 16px 14px; }
  .conversion-row   { flex-direction: column; gap: 10px; }
  .conversion-field,
  .conversion-result { width: 100%; min-width: 0; }
  .conversion-arrow  { display: none; }
  .conversion-field input { font-size: 18px; }
  .conversion-result .amount { font-size: 20px; }
  .tasa-info { font-size: 11px; gap: 4px; }
}

/* Tabs */
@media (max-width: 540px) {
  .tabs     { flex-direction: column; gap: 4px; }
  .tab-btn  { font-size: 13px; padding: 11px 12px; text-align: center; white-space: normal; }
}

/* Hero */
@media (max-width: 480px) {
  .page-hero     { padding: 28px 14px; }
  .page-hero h1  { font-size: 20px; }
  .page-hero p   { font-size: 13px; }
}

/* Buttons full width en móvil pequeño */
@media (max-width: 420px) {
  .btn-lg { width: 100%; justify-content: center; }
  div[style*="justify-content:flex-end"] { flex-wrap: wrap; }
  div[style*="justify-content:flex-end"] .btn { flex: 1; min-width: 140px; }
}

/* Frecuentes */
.frecuente-item  { flex-wrap: nowrap; }
.frecuente-info  { flex: 1; min-width: 0; overflow: hidden; }
.frecuente-info .name,
.frecuente-info .detail { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 480px) {
  .frecuente-item   { padding: 10px 12px; gap: 8px; }
  .frecuente-avatar { width: 34px; height: 34px; font-size: 12px; }
  .frecuente-info .name { font-size: 13px; }
  .frecuente-info .detail { font-size: 11px; }
  .frecuentes-list .btn-sm { padding: 5px 10px; font-size: 11px; }
}

/* File upload */
@media (max-width: 480px) {
  .file-upload { padding: 14px 12px; min-height: 90px; }
  .file-upload .icon { font-size: 20px; }
  .file-upload .label-text { font-size: 12px; }
}

/* Tables responsive — cards en móvil */
@media (max-width: 640px) {
  .table-wrap { border-radius: var(--radius-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Steps */
@media (max-width: 480px) {
  .step-circle { width: 30px; height: 30px; font-size: 11px; }
  .step-label  { font-size: 9px; }
}

/* Focus accesible */
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { outline: none; }
