/* NLT Funding -- adaptación para teléfonos (funding.html, funding-dashboard.html, funding-certificado.html).
   Principios: nada gigante (títulos y espacios medidos), botones y controles de al menos 44 px para el dedo, texto nunca menor de 12 px, sin scroll horizontal,
   tablas que se deslizan con pista visual, formularios con letra de 16 px (el iPhone no hace zoom al escribir) y respeto a las zonas seguras (muesca y barra inferior). */
@media (max-width: 640px) {
    /* ---- ritmo general ---- */
    .fx-wrap { padding-inline: 18px; }
    .fx-sec { padding-block: 40px; }
    .fx-hero { padding: 104px 0 20px; }
    .fx-hero .fx-title { font-size: clamp(27px, 8.2vw, 34px); margin: 14px auto 14px; }
    .fx-lead { font-size: 15.5px; line-height: 1.55; }
    .fx-title { font-size: clamp(25px, 7.6vw, 32px); }
    .fx-sec .fx-title { font-size: clamp(23px, 7vw, 29px) !important; margin-top: 8px !important; }
    .fx-demo { font-size: 12px; padding: 6px 12px; margin-bottom: 14px; }
    .fx-hero-cta { gap: 10px; } .fx-hero-cta .fx-btn { flex: 1 1 140px; }
    .fx-strip { margin-top: 28px; } .fx-strip > div { padding: 16px 10px; } .fx-strip b { font-size: 20px; } .fx-strip span { font-size: 12px; }
    .fx-card { padding: 18px 16px; border-radius: 20px; }

    /* ---- tocar fácil: 44 px ---- */
    .fx-btn { min-height: 44px; padding: 11px 20px; font-size: 14px; }
    .fx-btn.sm { min-height: 40px; padding: 9px 14px; font-size: 13px; }
    .fx-seg button { min-height: 40px; padding: 9px 18px; font-size: 14px; }
    .fx-size { min-height: 44px; }
    .fx-input, .fx-select { min-height: 46px; font-size: 16px; }          /* 16 px: el iPhone no amplía la pantalla al escribir */
    #btnCupon, .fx-faq summary, details summary { min-height: 44px; }
    .nav-blur .fx-btn, #headerCTA .fx-btn, #headerCTA button, #headerCTA a { min-height: 40px; }
    footer a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; }

    /* ---- texto legible: nunca menos de 12 px ---- */
    .fx-label, small, .fv-chip span, .fv-nota, .fv-cifras small, .fd-lab, .fd-trio small, .fd-hstats small, .fd-ends, .fd-leyenda { font-size: 12px !important; }
    .fx-disc, .fx-dim { font-size: 12.5px; }

    /* ---- landing ---- */
    .fx-rule { flex-direction: column; align-items: flex-start; gap: 3px; padding: 11px 0; }       /* etiqueta arriba, valor debajo: nada de columnas estrechas */
    .fx-rule b { text-align: left; font-size: 14.5px; }
    .fx-plan-l, .fx-plan-r { padding: 20px 16px; }
    .fx-sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .fx-price { font-size: 38px; }
    .fv-chips { grid-template-columns: 1fr 1fr; gap: 8px; }
    .fv-chip { padding: 10px 10px; gap: 9px; } .fv-chip i { font-size: 19px; } .fv-chip b { font-size: 17px; }
    .fv-chart { padding: 14px 8px 10px; }
    .fv-rango { height: 10px; } .fv-rango::-webkit-slider-thumb { width: 30px; height: 30px; } .fv-rango::-moz-range-thumb { width: 22px; height: 22px; }
    .fv-calc { gap: 18px; } .fv-cifras b { font-size: 26px; }
    .fp-sec .fx-lead { font-size: 15px; }
    .fx-table-wrap { position: relative; }
    .fx-table-wrap::after { content: ''; position: sticky; right: 0; top: 0; display: block; float: right; width: 22px; height: 100%; margin-top: -100%; background: linear-gradient(90deg, transparent, rgba(5, 9, 32, .75)); pointer-events: none; }
    .fx-step { padding: 16px; }

    /* ---- dashboard ---- */
    body.h-screen { height: 100vh; height: 100dvh; }
    .fx-dash { padding: 14px 14px calc(34px + env(safe-area-inset-bottom)); gap: 14px; }
    header .fx-btn span, header .fx-hide-sm { }
    .fd-nav { margin-inline: -2px; }
    .fd-nav button { min-height: 44px; padding: 10px 14px; font-size: 13.5px; }
    .fd-card { padding: 18px 16px; border-radius: 20px; }
    .fd-grid2 { gap: 14px; }
    .fd-anillo { width: 104px; height: 104px; } .fd-av { font-size: 28px; } .fd-medalla { width: 30px; height: 30px; font-size: 16px; }
    .fd-nombre { font-size: 21px; } .fd-tier { margin-bottom: 14px; font-size: 13px; }
    .fd-big b { font-size: 36px; }
    .fd-radar text { font-size: 15px; }
    .fd-acts { grid-template-columns: 1fr; gap: 12px; }
    .fd-bal b { font-size: 28px; }
    .fd-habitos { padding: 16px 14px; } .fd-heat { gap: 3px; } .fd-hstats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .fd-cta { padding: 18px; } .fd-cta b { font-size: 16px; }
    .fd-list { gap: 10px; } .fd-hola { padding: 16px; } .fd-items { gap: 10px; margin-inline: -14px; padding-inline: 14px; scroll-snap-type: x mandatory; }
    .fd-item { flex: 0 0 min(78vw, 280px); scroll-snap-align: start; }
    .fd-filtros { grid-template-columns: 1fr 1fr; } .fd-filtros .fx-select { min-height: 44px; font-size: 14px; padding: 10px 12px; }
    .fd-comprar { min-height: 46px; }
    .fd-head { gap: 12px; } .fd-idc h2 { font-size: 20px; } .fd-acciones { width: 100%; } .fd-acciones .fx-btn { flex: 1; }
    .fd-row-sc { gap: 14px; } .fd-gv { font-size: 20px; }
    .fx-kpis { grid-template-columns: 1fr 1fr; gap: 10px; } .fx-kpi { padding: 14px; } .fx-kpi b { font-size: 20px; }
    .fx-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .fx-tabs { margin-inline: -14px; padding-inline: 14px; } .fx-tabs button { min-height: 42px; }
    .fd-premio { min-height: 0; padding-right: 16px; } .fd-trofeo { transform: scale(.55); transform-origin: top right; right: 6px; top: 8px; }
    .fd-premio-t { padding-right: 70px; } .fd-recomp .fd-r-top .fd-card h3 { font-size: 18px; }
    .fd-tabla { padding: 18px 0 8px; } .fx-table th, .fx-table td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }
    .fd-pref { gap: 12px; } .fd-switch { width: 52px; height: 30px; } .fd-switch::after { width: 24px; height: 24px; } .fd-switch.on::after { transform: translateX(22px); }
    .fx-cert-grid.nc-grid { grid-template-columns: 1fr; }
    .fx-banner { padding: 14px; gap: 12px; } .fx-banner i { font-size: 22px; }
    .fx-modal-box { width: calc(100vw - 20px); max-height: calc(100dvh - 24px); overflow-y: auto; }

    /* ---- certificado ---- */
    .nc { padding: 26px 18px; border-radius: 20px; }
    .nc-nombre { font-size: clamp(26px, 9vw, 34px); } .nc-titulo { font-size: clamp(24px, 8vw, 32px); }
    .nc-datos { gap: 14px 22px; margin-top: 20px; } .nc-datos b { font-size: 17px; }
    .nc-texto { font-size: 14.5px; }
}

/* teléfonos muy angostos */
@media (max-width: 360px) {
    .fx-hero-cta .fx-btn { flex-basis: 100%; }
    .fv-chips { grid-template-columns: 1fr; }
    .fd-trio b { font-size: 15px; } .fd-hstats { grid-template-columns: 1fr 1fr; }
}

/* en pantallas táctiles (cualquier ancho): zonas seguras y sin zoom accidental al tocar dos veces */
@media (pointer: coarse) {
    html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    button, a, select, summary, .fd-item, .fd-act { touch-action: manipulation; -webkit-tap-highlight-color: rgba(var(--fx-em-rgb, 57, 255, 20), .18); }
    .fx-input, .fx-select { font-size: 16px; }
    .fd-act:hover, .fd-item:hover, .fx-kpi:hover, .fd-chip:hover { transform: none; }
}
@supports (padding: env(safe-area-inset-top)) {
    header.nav-blur, header[class*="nav-blur"] { padding-top: env(safe-area-inset-top); }
    footer { padding-bottom: calc(36px + env(safe-area-inset-bottom)) !important; }
}

/* cabecera del dashboard en el celular: una sola fila, botones con icono y el nombre corto */
@media (max-width: 640px) {
    header .fx-txt-sm { display: none; }
    header .fx-btn { padding: 0; width: 42px; height: 42px; min-height: 42px; border-radius: 14px; }
    header .fx-btn i { font-size: 19px; margin: 0; }
    header h1 { font-size: 18px !important; }
    header .fx-row { gap: 8px !important; }
}

/* ---- que NADA se salga de la pantalla ---- */
.fd-split > *, .fd-shell > *, .fd-grid2 > *, .fd-row-sc > *, .fd-main > * { min-width: 0; }
@media (max-width: 1100px) { .fd-split { grid-template-columns: minmax(0, 1fr); } .fd-list { max-width: 100%; } }
@media (max-width: 900px) { .fd-shell { grid-template-columns: minmax(0, 1fr); } .fd-grid2, .fd-row-sc { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
    .fx-badge, .fd-sec, .nc-id, .nc-ok, .nc-pie span, .nc small, label { font-size: 12px !important; }
    .fd-crumbs { flex-wrap: wrap; gap: 2px 6px; } .fd-crumbs button { min-height: 40px; padding: 0 6px; }
    .fd-switch { height: 32px; } .fd-ajustes a, .fx-legal-note a { display: inline-block; padding: 6px 0; min-height: 40px; }
    .fd-head { align-items: flex-start; } .fd-chips { width: 100%; }
    .fd-items { max-width: calc(100vw - 0px); }
}

/* menú del dashboard en el celular: los 5 iconos caben en la pantalla; solo el activo muestra su nombre */
@media (max-width: 560px) {
    .fd-nav { justify-content: space-between; overflow-x: hidden; }
    .fd-nav button { flex: 1 1 0; justify-content: center; padding: 10px 6px; gap: 6px; min-width: 44px; }
    .fd-nav button span { display: none; }
    .fd-nav button.on { flex: 2.4 1 0; } .fd-nav button.on span { display: inline; font-size: 13px; }
    .fd-nav button i { font-size: 20px; }
}
@media (max-width: 640px) { .fd-hola { display: none; } .fd-list { gap: 8px; } .fd-scbody .fd-big { position: static; justify-content: center; margin-top: 4px; } }

/* rendimiento en el celular: sin mezcla de capas ni desenfoque de fondo (lo más caro para la GPU de un teléfono) */
@media (hover: none), (pointer: coarse) {
    #nlt-funding .nlt-luz { display: none; }
    #nlt-funding .fx-card.flat, #nlt-funding footer, .fx-card, .fd-card, .fd-nav, .nav-blur, header { -webkit-backdrop-filter: none; backdrop-filter: none; }
    #nlt-funding .fx-card, #nlt-funding .fd-card, #nlt-funding .fd-nav { background-color: rgba(7, 12, 36, .94); }
    .fd-spot::before { display: none; }
}

/* ---- tablas del dashboard en el celular: cada fila es una tarjeta con «Nombre ... valor» (nada de deslizar de lado) ---- */
@media (max-width: 640px) {
    .fx-dash .fx-table-wrap { overflow: visible; background: none !important; border-radius: 0; }
    .fx-dash .fx-table-wrap::after { display: none; }
    .fx-dash .fx-table, .fx-dash .fx-table tbody, .fx-dash .fx-table tr, .fx-dash .fx-table td { display: block; width: 100%; min-width: 0; }
    .fx-dash .fx-table thead { display: none; }
    .fx-dash .fx-table tr { background: rgba(7, 12, 36, .92); border: 1px solid rgba(255, 255, 255, .12); border-radius: 16px; padding: 8px 14px; margin: 0 0 10px; }
    .fx-dash .fx-table td { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0 !important; border: 0 !important; white-space: normal !important; text-align: right; max-width: none !important; font-size: 13.5px; }
    .fx-dash .fx-table td::before { content: attr(data-l); flex: none; color: var(--fx-mute); font-size: 12px; font-weight: 500; text-align: left; }
    .fx-dash .fx-table td:empty { display: none; }
    .fd-tabla { padding: 18px 14px 8px; } .fd-tabla .fd-lab { padding-inline: 0; }
    .fd-nav button.on { flex: 3 1 0; }
}
@media (max-width: 640px) { .fx-dash .fx-table-wrap, .fx-dash .fx-table { border: 0 !important; box-shadow: none !important; } }
@media (max-width: 640px) {
    .fx-tabs { gap: 6px; } .fx-tabs button { flex: 1 1 auto; padding: 9px 6px; font-size: 12.5px; min-height: 42px; }
}
@media (max-width: 640px) { footer, footer * { font-size: 12px !important; line-height: 1.6; } footer a { min-height: 40px; } }
@media (max-width: 640px) { .nc-cab { flex-direction: column; align-items: center; gap: 4px; text-align: center; } .nc-id { display: none; } .nc-marca b { font-size: 15px; } }
