/* ==========================================================================
   CurrenX - Conversor de Divisas en Tiempo Real
   Estilos CSS3 Modernos y Puros (Sin Frameworks)
   Tema: Minimalista, Oscuro, Responsive
   ========================================================================== */

:root {
  --bg-main: #0a0e17;
  --bg-header: rgba(13, 18, 28, 0.85);
  --bg-card: #111726;
  --bg-card-subtle: #141c2e;
  --bg-input: #080c14;
  --bg-chip: #192338;
  --bg-chip-active: #00d2b4;
  --bg-chip-active-text: #05141b;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-focus: #00d2b4;
  --border-hover: rgba(255, 255, 255, 0.16);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-emerald: #10e599;
  --text-cyan: #00d2b4;

  --accent-teal: #00d2b4;
  --accent-teal-glow: rgba(0, 210, 180, 0.25);
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-blue: #3b82f6;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 9999px;

  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px -5px rgba(0, 210, 180, 0.2);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Reset y base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fondo de luz ambiental sutil */
body {
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 210, 180, 0.12), transparent 70%),
    radial-gradient(ellipse 60% 40% at 85% 60%, rgba(37, 99, 235, 0.05), transparent 70%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font-family: inherit;
  color: inherit;
  outline: none;
  border: none;
}

button {
  cursor: pointer;
  background: none;
}

/* Layout General */
.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* ==========================================================================
   Header Superior
   ========================================================================== */
.main-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
}

.header-content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, rgba(0, 210, 180, 0.2), rgba(0, 210, 180, 0.05));
  border: 1px solid rgba(0, 210, 180, 0.4);
  border-radius: var(--radius-sm);
  color: var(--accent-teal);
  font-size: 16px;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--accent-green);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.dot-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Nav tabs */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 14, 23, 0.6);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
  transition: all 0.25s ease;
}

.status-pill.offline {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.3);
}

.btn-offline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-offline-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-offline-toggle.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
}

/* Botón Cron Job en Cabecera */
.btn-cron-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 210, 180, 0.08);
  border: 1px solid rgba(0, 210, 180, 0.3);
  border-radius: var(--radius-pill);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-cron-badge:hover {
  background: rgba(0, 210, 180, 0.18);
  border-color: var(--accent-teal);
  transform: translateY(-1px);
}

.cron-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-teal);
  box-shadow: 0 0 6px var(--accent-teal);
  animation: pulse-cron 2s infinite;
}

@keyframes pulse-cron {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.cron-title-text {
  color: var(--accent-teal);
  font-weight: 700;
}

.cron-time-val {
  font-family: var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

/* Botón de Instalación APK / PWA */
.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(0, 210, 180, 0.2), rgba(16, 185, 129, 0.3));
  border: 1px solid rgba(0, 210, 180, 0.5);
  border-radius: var(--radius-pill);
  color: #00d2b4;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 210, 180, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-install-pwa:hover {
  background: #00d2b4;
  color: #0b0f19;
  box-shadow: 0 4px 18px rgba(0, 210, 180, 0.4);
  transform: translateY(-1px);
}

.btn-install-pwa.installed {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-secondary);
  pointer-events: auto;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00d2b4, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #03151b;
  font-weight: 700;
  font-size: 14px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Hero & Estado Superior
   ========================================================================== */
.hero-wrapper {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.hero-left {
  max-width: 680px;
}

.hero-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-teal);
  margin-bottom: 8px;
}

.hero-title {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 10px;
}

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

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.meta-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-secondary);
}

.meta-badge.highlight {
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.06);
}

.meta-badge.highlight.offline {
  color: var(--accent-amber);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}

.btn-test-fallback {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--accent-amber);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-test-fallback:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

/* ==========================================================================
   Tarjeta Principal del Conversor
   ========================================================================== */
.converter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  margin-bottom: 24px;
}

.converter-inputs-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.currency-input-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  transition: all 0.2s ease;
}

.currency-input-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.input-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.label-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-teal);
  font-size: 11px;
}

.label-indicator.dest {
  color: var(--accent-teal);
}

.input-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.amount-input-wrapper {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.currency-symbol {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
}

.amount-input {
  width: 100%;
  background: transparent;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  padding: 0;
}

.amount-result {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  color: var(--text-emerald);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.amount-result.loading {
  opacity: 0.6;
}

/* Botón Selector de Divisa */
.btn-select-currency {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-select-currency:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-subtle);
}

.currency-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e293b;
  color: #38bdf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.currency-badge.eur {
  background: #064e3b;
  color: #34d399;
}

.currency-badge.gbp {
  background: #4c1d95;
  color: #c084fc;
}

.currency-badge.usdt {
  background: rgba(38, 161, 123, 0.25);
  color: #26a17b;
  border-color: rgba(38, 161, 123, 0.5);
  font-weight: 800;
}

.currency-badge.ves {
  background: rgba(245, 158, 11, 0.25);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.5);
  font-weight: 800;
}

.chevron-icon {
  font-size: 12px;
  color: var(--text-muted);
}

/* Fila de chips rápidos */
.quick-currencies {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.quick-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  margin-right: 4px;
}

.chip-currency {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-chip);
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.chip-currency:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.chip-currency.active {
  background: var(--bg-chip-active);
  color: var(--bg-chip-active-text);
  font-weight: 700;
}

/* Botón central de Intercambio (Swap) - Grande, visible y prominente */
.btn-swap-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 5;
}

.btn-swap {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #112239 0%, #0c182b 100%);
  border: 2px solid var(--accent-teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-teal);
  box-shadow: 0 4px 20px rgba(0, 210, 180, 0.35), 0 2px 10px rgba(0, 0, 0, 0.6);
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  outline: none;
}

.btn-swap .swap-icon-svg {
  width: 28px;
  height: 28px;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-swap:hover {
  background: linear-gradient(135deg, #163050 0%, #10243e 100%);
  border-color: var(--accent-green);
  color: #ffffff;
  box-shadow: 0 6px 26px rgba(16, 229, 153, 0.5), 0 0 16px rgba(0, 210, 180, 0.4);
  transform: scale(1.1);
}

.btn-swap:hover .swap-icon-svg {
  transform: rotate(180deg);
}

.btn-swap:active {
  transform: scale(0.95);
}

/* Barra de información de tasa */
.rate-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 0 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
}

.rate-info-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-primary);
  font-weight: 500;
}

.rate-highlight {
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rate-separator {
  color: var(--text-muted);
}

.rate-tag {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.fee-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 210, 180, 0.08);
  border: 1px solid rgba(0, 210, 180, 0.25);
  color: var(--accent-teal);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
}

/* Notificación de Respaldo Local */
.backup-notice-box {
  margin-top: 16px;
  background: rgba(10, 14, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.backup-notice-box.offline-active {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.backup-icon {
  font-size: 16px;
  color: var(--accent-teal);
  flex-shrink: 0;
  margin-top: 1px;
}

.backup-notice-box.offline-active .backup-icon {
  color: var(--accent-amber);
}

.backup-title {
  font-weight: 700;
  color: var(--text-primary);
}

.backup-notice-box.offline-active .backup-title {
  color: #fef08a;
}

/* ==========================================================================
   Historial de Conversiones Recientes
   ========================================================================== */
.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.history-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 210, 180, 0.1);
  color: var(--accent-teal);
  border: 1px solid rgba(0, 210, 180, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.history-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.storage-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
}

.history-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-count {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-clear-history {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.btn-clear-history:hover {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Tabla de Historial */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.custom-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.custom-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.custom-table tr:hover td {
  background: rgba(255, 255, 255, 0.015);
}

.col-date {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.currency-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.currency-cell.dest {
  color: var(--text-emerald);
}

.country-mini-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.rate-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.btn-reuse {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: rgba(0, 210, 180, 0.08);
  border: 1px solid rgba(0, 210, 180, 0.25);
  color: var(--accent-teal);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-reuse:hover {
  background: rgba(0, 210, 180, 0.18);
  border-color: var(--accent-teal);
}

.history-arrow-mobile {
  display: none;
}

.history-rate-label {
  display: none;
}

.history-cell-icon {
  margin-right: 4px;
}

.empty-history-msg {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Sección de Tasas Populares
   ========================================================================== */
.popular-section {
  margin-bottom: 28px;
  width: 100%;
}

/* Tarjeta Popular */
.popular-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
  width: 100%;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.card-badge.resilient {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Tabla de Populares */
.popular-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.popular-table th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  text-transform: uppercase;
}

.popular-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.popular-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.platform-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.platform-binance { background: rgba(243, 186, 47, 0.15); color: #f3ba2f; border: 1px solid rgba(243, 186, 47, 0.3); }
.platform-bybit { background: rgba(247, 166, 0, 0.15); color: #f7a600; border: 1px solid rgba(247, 166, 0, 0.3); }
.platform-okx { background: rgba(255, 255, 255, 0.12); color: #ffffff; border: 1px solid rgba(255, 255, 255, 0.25); }
.platform-bitget { background: rgba(0, 240, 255, 0.15); color: #00f0ff; border: 1px solid rgba(0, 240, 255, 0.3); }
.platform-bingx { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.platform-mexc { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.platform-saldo { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }

.price-ask {
  color: #10e599;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.price-bid {
  color: #38bdf8;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.spread-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
}

.p2p-mobile-label {
  display: none;
}

.active-platform-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(0, 210, 180, 0.15);
  color: var(--accent-teal);
  border: 1px solid rgba(0, 210, 180, 0.35);
  font-weight: 600;
}

.leader-badge {
  font-size: 9px;
  padding: 1px 5px;
}

.pair-badge {
  font-weight: 700;
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.delta-pos {
  color: var(--accent-green);
  font-weight: 600;
  font-size: 12px;
}

.delta-neg {
  color: var(--accent-rose);
  font-weight: 600;
  font-size: 12px;
}

.sparkline-svg {
  width: 60px;
  height: 20px;
  overflow: visible;
}

.sparkline-path {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sparkline-pos {
  stroke: var(--accent-green);
}

.sparkline-neg {
  stroke: var(--accent-rose);
}

.popular-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.live-feeds-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent-green);
  font-weight: 600;
}

/* Tarjeta Estado de Fuentes de Datos */
.source-block {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.source-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.source-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.source-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.source-badge.op {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.source-badge.sync {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.source-badge.offline-warn {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #00d2b4);
  border-radius: var(--radius-pill);
}

.source-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.contingency-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 14, 23, 0.5);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
}

.contingency-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contingency-icon {
  color: var(--accent-teal);
  font-size: 16px;
}

.contingency-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.contingency-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.pill-switch-speed {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ==========================================================================
   Modal Selector de Divisas
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.currency-modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: #111726;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.open .currency-modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 20px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: all 0.2s;
}

.btn-close-modal:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.modal-search-wrapper {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.search-input-box:focus-within {
  border-color: var(--accent-teal);
}

.search-icon {
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  background: transparent;
  font-size: 14px;
  color: var(--text-primary);
}

.modal-currencies-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 16px;
}

.currency-list-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
  text-align: left;
}

.currency-list-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.currency-list-item.selected {
  background: rgba(0, 210, 180, 0.12);
  border: 1px solid rgba(0, 210, 180, 0.3);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1e293b;
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
}

.item-info {
  display: flex;
  flex-direction: column;
}

.item-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.item-name {
  font-size: 12px;
  color: var(--text-muted);
}

.item-rate {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  max-width: 420px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: #271f11;
  color: #fde68a;
}

.toast.success {
  border-color: rgba(16, 185, 129, 0.5);
  background: #0d2820;
  color: #a7f3d0;
}

/* Spinner indicador de carga */
.loader-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 210, 180, 0.2);
  border-top-color: var(--accent-teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Cron Job & PWA Modals Styling
   ========================================================================== */
.cron-modal,
.pwa-modal {
  max-width: 520px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header-icon-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-bubble {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(0, 210, 180, 0.12);
  border: 1px solid rgba(0, 210, 180, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.cron-modal-body,
.pwa-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Tarjeta de Cuenta Regresiva de Cron */
.cron-countdown-card {
  background: linear-gradient(135deg, rgba(0, 210, 180, 0.06), rgba(11, 15, 25, 0.9));
  border: 1px solid rgba(0, 210, 180, 0.25);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.cron-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cron-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-teal);
  background: rgba(0, 210, 180, 0.12);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.cron-interval-tag {
  font-size: 12px;
  color: var(--text-muted);
}

.cron-big-countdown {
  font-size: 42px;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--accent-teal);
  text-shadow: 0 0 20px rgba(0, 210, 180, 0.3);
  margin: 6px 0;
}

.cron-countdown-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Grilla de Métricas del Cron */
.cron-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.cron-stat-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cron-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cron-stat-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono, monospace);
}

/* Opciones de Cron */
.cron-options-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 14px;
}

.cron-option-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}

.cron-option-row input[type="checkbox"] {
  accent-color: var(--accent-teal);
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
}

.cron-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cron-option-text strong {
  font-size: 13px;
  color: var(--text-primary);
}

.cron-option-text span {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Botones de acción modal */
.cron-actions-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary-action {
  flex: 1;
  padding: 12px 18px;
  background: linear-gradient(135deg, #00d2b4, #059669);
  border: none;
  border-radius: 10px;
  color: #0b0f19;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(0, 210, 180, 0.25);
  transition: all 0.2s ease;
}

.btn-primary-action:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 210, 180, 0.4);
}

.btn-secondary-action {
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* PWA Modal Componentes */
.pwa-hero-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 14px;
}

.pwa-hero-info h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.pwa-hero-info p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.pwa-features-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pwa-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 210, 180, 0.1);
  border: 1px solid rgba(0, 210, 180, 0.2);
  color: var(--accent-teal);
  font-weight: 600;
}

.pwa-platform-tabs {
  display: flex;
  gap: 6px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.pwa-tab-btn {
  flex: 1;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pwa-tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.pwa-tab-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pwa-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
}

.step-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 210, 180, 0.15);
  color: var(--accent-teal);
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc strong {
  display: block;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.step-desc p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.pwa-note {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.4;
}

/* Flash de animación cuando el Cron se ejecuta */
@keyframes cron-flash {
  0% { box-shadow: 0 0 0 0 rgba(0, 210, 180, 0.8); }
  70% { box-shadow: 0 0 0 15px rgba(0, 210, 180, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 210, 180, 0); }
}

.cron-updating {
  animation: cron-flash 1.5s ease-out;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 900px) {
  .hero-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-right {
    align-items: flex-start;
  }
  .converter-inputs-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .btn-swap-wrapper {
    margin: -4px auto;
  }
  .btn-swap {
    width: 56px;
    height: 56px;
  }
  .btn-swap .swap-icon-svg {
    transform: rotate(90deg);
  }
  .btn-swap:hover .swap-icon-svg {
    transform: rotate(270deg);
  }
  .popular-section {
    width: 100%;
  }
  .nav-menu {
    display: none; /* Ocultar tabs en móvil para no saturar barra */
  }
}

@media (max-width: 600px) {
  .app-container {
    padding: 0 12px 24px;
  }
  .header-content {
    padding: 12px 14px;
  }
  .status-pill {
    display: none;
  }
  .converter-card {
    padding: 16px;
  }
  .currency-input-box {
    padding: 12px 14px;
  }
  .rate-info-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .cron-title-text {
    display: none;
  }
  .btn-cron-badge {
    padding: 5px 8px;
    font-size: 11px;
  }
  .btn-install-pwa {
    padding: 5px 10px;
    font-size: 11px;
  }
  .cron-big-countdown {
    font-size: 32px;
  }
  .cron-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Historial de Conversiones Responsivo (Mobile: Flex-Wrap sin Scroll Horizontal)
   ========================================================================== */
@media (max-width: 768px) {
  .history-card {
    padding: 16px;
  }

  .history-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }

  .history-title-group {
    gap: 10px;
  }

  .history-title {
    font-size: 15px;
  }

  .history-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  /* Eliminar scroll horizontal forzado: permitir flujo vertical y flex fluido */
  .history-card .table-responsive {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
  }

  .history-card .custom-table {
    display: block;
    width: 100%;
    border: none;
  }

  /* Ocultar cabeceras fijas de tabla en móvil */
  .history-card .custom-table thead {
    display: none;
  }

  .history-card .custom-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* Cada fila del historial es una tarjeta independiente con flex-wrap */
  .history-card .custom-table tr.history-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 10px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 12px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
  }

  .history-card .custom-table tr.history-row:hover {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(0, 210, 180, 0.35);
  }

  .history-card .custom-table td {
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
  }

  /* 1. Encabezado de la tarjeta: Fecha a la izquierda, Botón Reutilizar a la derecha */
  .history-card .col-date {
    order: 1;
    flex: 1 1 auto;
    font-size: 11.5px;
    color: var(--text-muted);
    gap: 5px;
  }

  .history-card .col-action {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .history-card .btn-reuse {
    padding: 4px 10px;
    font-size: 11px;
    height: 30px;
    border-radius: var(--radius-sm);
  }

  /* 2. Cuerpo de conversión con Flex-Wrap: Origen ➔ Destino */
  .history-card .col-from {
    order: 3;
    flex: 0 1 auto;
    padding: 2px 0;
  }

  .history-card .col-to {
    order: 4;
    flex: 0 1 auto;
    padding: 2px 0;
    display: flex;
    align-items: center;
  }

  .history-card .currency-cell {
    font-size: 13.5px;
    gap: 6px;
    flex-wrap: wrap;
  }

  .history-card .currency-amount {
    font-weight: 700;
  }

  /* Flecha indicadora entre montos en móvil */
  .history-card .history-arrow-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-teal);
    font-size: 13px;
    margin: 0 6px 0 2px;
  }

  /* 3. Pie de la tarjeta: Tasa Aplicada al 100% de ancho */
  .history-card .col-rate {
    order: 5;
    width: 100%;
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 8px;
    margin-top: 2px;
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    font-size: 11.5px;
    color: var(--text-muted);
  }

  .history-card .history-rate-label {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .history-card .rate-cell {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-left: auto;
  }

  .history-card .empty-history-msg {
    display: block;
    width: 100%;
    text-align: center;
    padding: 24px 12px;
    border: none;
  }
}

@media (max-width: 480px) {
  .history-card {
    padding: 12px;
  }

  .history-card .custom-table tr.history-row {
    padding: 10px 12px;
  }

  .history-card .col-from,
  .history-card .col-to {
    flex: 1 1 100%;
  }

  .history-card .history-arrow-mobile {
    margin: 0 4px 0 0;
  }
}

/* ==========================================================================
   Sección Cotizaciones P2P Responsiva (Mobile: Flex-Wrap sin Scroll Horizontal)
   ========================================================================== */
@media (max-width: 768px) {
  .popular-card {
    padding: 16px;
  }

  .card-header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
  }

  .card-badge#popular-base-label {
    align-self: flex-start;
  }

  /* Desactivar scroll horizontal */
  .p2p-table-responsive {
    overflow-x: visible;
    overflow-y: visible;
    width: 100%;
  }

  .popular-table {
    display: block;
    width: 100%;
    border: none;
  }

  .popular-table thead {
    display: none;
  }

  .popular-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  /* Tarjeta interactiva para cada plataforma con flex-wrap */
  .popular-table tr.p2p-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 12px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 13px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
  }

  .popular-table tr.p2p-row:hover,
  .popular-table tr.p2p-row:active {
    background: rgba(255, 255, 255, 0.045);
    border-color: rgba(0, 210, 180, 0.35);
  }

  .popular-table tr.p2p-row.selected-row {
    background: rgba(0, 210, 180, 0.07);
    border-color: rgba(0, 210, 180, 0.45);
    box-shadow: 0 0 16px rgba(0, 210, 180, 0.08);
  }

  .popular-table td {
    padding: 0;
    border: none;
    background: transparent;
  }

  /* 1. Cabecera de la fila: Nombre de Plataforma e Icono a la izquierda */
  .popular-table .col-platform {
    order: 1;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
  }

  .popular-table .platform-pill {
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
  }

  /* 2. Spread Tag a la derecha superior */
  .popular-table .col-spread {
    order: 2;
    flex: 0 0 auto;
    margin-left: auto;
    display: flex;
    align-items: center;
  }

  .popular-table .col-spread .spread-tag {
    font-size: 11px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  /* 3. Bloque de Precios con Flex-Wrap: Compra y Venta */
  .popular-table .col-ask,
  .popular-table .col-bid {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    box-sizing: border-box;
  }

  .popular-table .col-ask {
    order: 3;
    flex: 1 1 calc(50% - 6px);
  }

  .popular-table .col-bid {
    order: 4;
    flex: 1 1 calc(50% - 6px);
  }

  .popular-table .p2p-mobile-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }

  .popular-table .col-spread .p2p-mobile-label.spread-lbl {
    display: none;
  }

  .popular-table .price-ask {
    font-size: 13.5px;
    font-weight: 700;
    color: #10e599;
  }

  .popular-table .price-bid {
    font-size: 13.5px;
    font-weight: 700;
    color: #38bdf8;
  }

  .popular-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding-top: 14px;
  }
}

@media (max-width: 480px) {
  .popular-card {
    padding: 12px;
  }

  .popular-table tr.p2p-row {
    padding: 11px 12px;
    gap: 8px 8px;
  }

  .popular-table .price-ask,
  .popular-table .price-bid {
    font-size: 12.5px;
  }
}
