/* Loqui — sistema de diseño. La paleta SALE DEL LOGO: troncal indigo, un solo
   cálido (gold = AL AIRE) y los 6 rayos = los idiomas.
   Dos superficies a propósito, mismo sistema: marketing CLARO / app TINTA.
   Ver design/"Loqui - Logo y Landing.md" */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
    /* ── Marca (tomada del logo) ─────────────────────────────────── */
    --indigo: #2B295A;          /* troncal: titulares, CTA primaria sólida */
    --indigo-dark: #211F45;
    --gold: #EFAB37;            /* AL AIRE / acción. ÚNICO cálido, con intención */
    --gold-ink: #2B295A;        /* texto sobre gold */
    --gold-deep: #B9852A;       /* gold legible como texto sobre claro */

    /* ── Los 6 rayos = los idiomas (orden del abanico, arriba→abajo) ── */
    --ray-coral: #EE695A;
    --ray-rust: #B35A2B;
    --ray-gold: #EFAB37;
    --ray-teal: #348789;
    --ray-sky: #439EB8;
    --ray-purple: #7A66A3;
    /* acentos de UI del oyente/consola (mic, play, señal buena) */
    --teal: #348789;
    --sky: #439EB8;
    /* tints (mismo hue de marca, solo más claros) para TEXTO sobre tinta:
       el teal/sky base no llegan a contraste legible en 11-13px sobre #14161F */
    --teal-lite: #5CB0B2;
    --sky-lite: #6FBDD4;

    /* ── Superficie CLARA (landing / precios) ────────────────────── */
    --light: #FBFBFD;
    --light-card: #FFFFFF;
    --light-2: #F5F5FA;
    --light-border: #ECECF3;
    --light-border-2: #E6E6EF;
    --text-dark-hi: #2B295A;
    --text-dark-md: #5B5A73;
    --text-dark-lo: #9A9AAE;

    /* ── TINTA (app / consola / oyente) ──────────────────────────── */
    --ink: #14161F;
    --ink-0: #0C0D12;
    --ink-2: #191C27;
    --ink-3: #1B1E29;
    --ink-surface: #171A24;
    --ink-surface-2: #1E212D;
    --ink-border: #23283a;
    --ink-border-2: #2C3142;
    --text-hi: #F1F3F8;
    --text-md: #C3C8D6;
    --text-lo: #A6ACBE;
    --text-faint: #6C7286;

    --danger: #C6483E;

    /* alias deprecado: el ámbar viejo #EFAB37 ya no existe, apunta al gold */
    --amber: var(--gold);
    --amber-ink: var(--gold-ink);

    --font-display: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    background: var(--light);
    color: var(--text-dark-hi);
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }

@keyframes loqPulse { 0%,100% { opacity: 1; } 50% { opacity: .28; } }
@keyframes loqRing { 0% { transform: scale(.65); opacity: .6; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes loqSpin { to { transform: rotate(360deg); } }
@keyframes loqBreath { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
@keyframes loqBar { 0%,100% { transform: scaleY(.28); } 50% { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- shell ---------- */
.body-dark { background: var(--ink); color: var(--text-hi); min-height: 100vh; }
.body-light { background: var(--light); color: var(--text-dark-hi); min-height: 100vh; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-dot { position: relative; width: 22px; height: 22px; display: grid; place-items: center; flex: none; }
.brand-dot::before {
    content: ''; position: absolute; inset: 0; border-radius: 999px;
    background: radial-gradient(circle, rgba(239,171,55,.5), transparent 70%);
}
.brand-dot::after {
    content: ''; width: 9px; height: 9px; border-radius: 999px; background: var(--amber);
    box-shadow: 0 0 10px rgba(239,171,55,.8);
}
.brand-name {
    font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -.02em;
}
.body-light .brand-name { color: var(--ink); }

/* ---------- marca: logo oficial (ver _brand.php) ---------- */
.brand-logo { display: block; width: auto; user-select: none; -webkit-user-drag: none; }
.brand-lockup { display: inline-flex; align-items: center; flex: none; }
/* El mismo lockup en dos anchos: completo donde hay lugar, isotipo donde aprieta.
   !important porque _brand.php emite `display:block` INLINE y el inline le gana
   a la clase (si no, se ven los dos logos juntos). */
.brand-tight { display: none !important; }
@media (max-width: 760px) {
    .brand-wide { display: none !important; }
    .brand-tight { display: block !important; }
}

/* ---------- chrome de MARKETING (claro): landing + precios ----------
   Una sola superficie clara, el hábitat natural del logo. Ver _mkt_nav.php */
.mkt-nav { position: sticky; top: 0; z-index: 50; background: rgba(251,251,253,.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--light-border); }
.mkt-nav-in { display: flex; align-items: center; justify-content: space-between; padding: 16px 40px; max-width: 1200px; margin: 0 auto; }
.mkt-links { display: flex; align-items: center; gap: 30px; }
.mkt-links a { font-size: 15px; color: var(--text-dark-md); white-space: nowrap; text-decoration: none; }
.mkt-links a:hover { color: var(--indigo); }
.mkt-btn-indigo { display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 600; color: var(--light) !important; background: var(--indigo); padding: 10px 20px; border-radius: 10px; white-space: nowrap; text-decoration: none; transition: background .12s ease; }
.mkt-btn-indigo:hover { background: var(--indigo-dark); color: var(--light) !important; }
.mkt-btn-gold { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600; color: var(--gold-ink) !important; background: var(--gold); padding: 15px 28px; border-radius: 12px; text-decoration: none; box-shadow: 0 14px 30px -12px rgba(239,171,55,.7); transition: filter .12s ease; }
.mkt-btn-gold:hover { filter: brightness(.96); color: var(--gold-ink) !important; }
.mkt-footer { background: var(--light-card); border-top: 1px solid var(--light-border); }
.mkt-footer-in { max-width: 1200px; margin: 0 auto; padding: 40px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 18px; }
.mkt-footer a { font-size: 14.5px; color: var(--text-dark-md); text-decoration: none; }
.mkt-footer a:hover { color: var(--indigo); }
/* la firma del abanico: los 6 rayos en degradé */
.mkt-rays { height: 4px; background: linear-gradient(90deg, var(--ray-coral), var(--ray-rust), var(--ray-gold), var(--ray-teal), var(--ray-sky), var(--ray-purple)); }
@media (max-width: 720px) {
    .mkt-nav-in, .mkt-footer-in { padding-left: 20px; padding-right: 20px; }
    .mkt-links { gap: 14px; }
    .mkt-links .mkt-hide { display: none; }
}

/* ---------- nav ---------- */
.nav {
    display: flex; align-items: center; justify-content: space-between;
    padding: 22px 0;
}
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14.5px; }
.nav-links a { color: var(--text-lo); }
.nav-links a:hover { color: var(--text-hi); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 15px; font-weight: 600; border-radius: 11px; padding: 13px 24px;
    border: none; transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-amber { background: var(--amber); color: var(--amber-ink); box-shadow: 0 0 30px -8px rgba(239,171,55,.5); }
/* los botones dentro del nav conservan su color propio: si no, `.nav-links a`
   (más específico) les pisa el texto con el gris de los links → ilegible sobre ámbar */
.nav-links a.btn-amber { color: var(--amber-ink); }
.nav-links a.btn-light { color: var(--ink); }
.nav-links a.btn:hover { color: var(--amber-ink); }
.btn-light { background: var(--text-hi); color: var(--ink); }
.btn-ghost-dark { background: transparent; color: var(--text-hi); border: 1px solid var(--ink-border-2); }
.btn-ghost-light { background: transparent; color: var(--text-dark-hi); border: 1px solid var(--light-border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { padding: 18px 28px; font-size: 17px; border-radius: 14px; }

/* ---------- cards / surfaces ---------- */
.card-dark { background: var(--ink-surface); border: 1px solid var(--ink-border); border-radius: 14px; padding: 22px 24px; }
.card-light { background: #fff; border: 1px solid var(--light-border); border-radius: 14px; padding: 24px; }

/* ---------- pills / badges ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 8px; border-radius: 999px;
    padding: 8px 15px; font-size: 12px; font-family: var(--font-mono); letter-spacing: .08em;
}
.pill-air { border: 1px solid rgba(239,171,55,.4); background: rgba(239,171,55,.08); color: var(--amber); }
.pill-air .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--amber); position: relative; }
.pill-reconnect { border: 1px solid var(--ink-border-2); color: var(--text-lo); }
.pill-reconnect .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--text-lo); }
.pill-pause { border: 1px solid var(--ink-border-2); color: var(--text-faint); }
.pill-pause .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--text-faint); }
.pill-error { border: 1px solid rgba(198,72,62,.4); background: rgba(198,72,62,.08); color: var(--danger); }
.pill-error .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--danger); }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-lo); margin-bottom: 8px; }
.body-light .field label { color: var(--text-dark-md); }
.field input, .field select {
    width: 100%; background: var(--ink-3); border: 1px solid var(--ink-border-2); border-radius: 10px;
    padding: 13px 14px; font-size: 15px; color: var(--text-hi); font-family: inherit;
}
.field input:focus, .field select:focus {
    outline: none; border-color: rgba(239,171,55,.55); box-shadow: 0 0 0 3px rgba(239,171,55,.12);
}
.body-light .field input, .body-light .field select {
    background: #fff; border-color: var(--light-border); color: var(--text-dark-hi);
}

/* ---------- typography helpers ---------- */
.mono { font-family: var(--font-mono); }
.display { font-family: var(--font-display); letter-spacing: -.02em; }
.eyebrow {
    font-family: var(--font-mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
    color: var(--text-faint);
}

/* ---------- language channel chip ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
    background: var(--ink-3); border: 1px solid var(--ink-border);
}
.chip .swatch { width: 10px; height: 10px; border-radius: 999px; flex: none; }

/* ---------- app shell (orador) — desktop: sidebar + main ---------- */
.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.app-sidebar {
    width: 230px; flex: none; background: #111219; border-right: 1px solid var(--ink-border);
    padding: 24px 18px; display: flex; flex-direction: column;
}
.app-nav { display: flex; flex-direction: column; gap: 3px; }
.app-navlink {
    display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 9px;
    font-size: 14.5px; font-weight: 500; color: var(--text-faint); white-space: nowrap;
}
.app-navlink.is-active { background: var(--ink-surface-2); color: var(--text-hi); }
.app-sidebar-foot { margin-top: auto; }
.app-main { flex: 1; min-width: 0; padding: 38px 44px; }

/* ---------- console (consola en vivo) ---------- */
.console-metrics { display: flex; gap: 22px; flex-wrap: wrap; }
.fanout-box { height: 280px; }
.console-actions { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    .container { padding: 0 18px; }
    .hide-mobile { display: none !important; }
}

/* Mobile-first del lado del orador: el sidebar fijo se transforma en barra
   superior compacta y el contenido apila. El oyente ya es mobile-first. */
@media (max-width: 760px) {
    /* ── Header de la app en mobile: UNA sola fila compacta ──────────────
       Antes tenía flex-wrap:wrap y se partía en 3 filas (logo / nav / Salir)
       comiéndose media pantalla. Ahora: iso + nav scrolleable + Salir chico,
       todo en una línea que nunca envuelve. */
    .app-shell { flex-direction: column; min-height: auto; }
    .app-sidebar {
        width: 100%; flex-direction: row; align-items: center; gap: 8px; flex-wrap: nowrap;
        padding: 8px 12px; border-right: none; border-bottom: 1px solid var(--ink-border);
        position: sticky; top: 0; z-index: 50;
        padding-top: calc(8px + env(safe-area-inset-top));
    }
    .app-sidebar .brand { padding: 0 !important; margin: 0; flex: none; }
    .app-nav {
        flex-direction: row; flex: 1 1 auto; min-width: 0; gap: 4px;
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .app-nav::-webkit-scrollbar { display: none; }
    /* en 390px no entran ícono+etiqueta ×3 + Salir: la etiqueta comunica más que
       el ícono, así que en mobile mandan las palabras (y entran las tres enteras) */
    .app-navlink { padding: 8px 10px; font-size: 13.5px; gap: 0; flex: none; }
    .app-navlink svg { display: none; }
    /* !important: el markup del pie trae estilos inline (display:flex, column) que
       sin esto le ganan al colapso mobile → chip + Salir gigante apilados (bug). */
    .app-sidebar-foot { margin-top: 0; flex-direction: row !important; align-items: center; flex: none; }
    .app-sidebar-foot .plan-meter { display: none !important; }  /* el dashboard ya muestra los minutos en grande */
    .app-sidebar-foot .btn { padding: 8px 12px; font-size: 13px; width: auto; margin-top: 0 !important; }
    .app-sidebar-foot .user-chip { display: none !important; }
    .app-main { padding: 22px 18px; }

    /* ── Topbar de las focus-screens / consola en mobile ────────────────
       Compacta y sin wrap descontrolado: la identidad (iso + estado + nombre)
       arriba, y las métricas (cronómetro) en su propia fila. */
    .focus-topbar { padding: 10px 14px !important; gap: 10px !important; padding-top: calc(10px + env(safe-area-inset-top)) !important; }
    .focus-topbar .back { gap: 10px; }
    .focus-topbar h1 { font-size: 17px !important; }

    .console-metrics { gap: 16px 22px; }
    .fanout-box { height: 200px; }
    .console-actions .btn { flex: 1 1 100%; }             /* botones grandes, one-hand */
    .console-actions .console-code { flex: 1 1 100%; margin-left: 0 !important; justify-content: center; }
}

/* ── Consola en mobile: el header no puede comerse la pantalla ────────── */
@media (max-width: 760px) {
    .cons-topbar { gap: 8px !important; }
    .cons-topbar .cons-id { flex: 1 1 auto; min-width: 0; gap: 8px !important; }
    .cons-topbar #session-name { font-size: 13.5px !important; }
    .cons-topbar .cons-header-center {
        order: 3; flex: 1 1 100%; justify-content: flex-start; gap: 10px;
        padding-top: 8px; border-top: 1px solid var(--ink-border);
    }
    .cons-topbar #elapsed { font-size: 19px !important; }
    .cons-topbar .cons-topbar-right { flex: none; gap: 10px !important; }
    .cons-topbar #quality .q-label { display: none; }     /* dejamos las barritas, sacamos "Excelente" */
    .cons-topbar #end-btn { padding: 9px 14px !important; font-size: 13px !important; }
}

/* pantallas muy chicas: tipografía de héroe y padding aún más contenidos */
@media (max-width: 420px) {
    .btn-lg { padding: 15px 22px; font-size: 16px; }
}

/* ============================================================
   Layouts enfocados (crear / pre-flight / consola / resumen):
   pantallas full-width sin sidebar, con su propia barra superior.
   ============================================================ */
.focus-wrap { min-height: 100vh; min-height: 100dvh; background: var(--ink); display: flex; flex-direction: column; }
.focus-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 20px 32px; border-bottom: 1px solid var(--ink-border); background: var(--ink-2);
    position: sticky; top: 0; z-index: 40; padding-top: calc(20px + env(safe-area-inset-top));
}
.focus-topbar .back { display: flex; align-items: center; gap: 14px; min-width: 0; }
.focus-body { flex: 1; }

/* split de dos columnas que APILA en mobile (crear, pre-flight, consola) */
.split { display: flex; }
.split > * { min-width: 0; }
.split-divider { border-right: 1px solid var(--ink-border); }

/* grilla de stats (resumen) */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* pantalla del oyente: contenido a pantalla completa, centrado en desktop */
.listen-wrap {
    min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
    width: 100%; max-width: 440px; margin: 0 auto; position: relative;
    padding: calc(14px + env(safe-area-inset-top)) 26px calc(16px + env(safe-area-inset-bottom));
}

@media (max-width: 880px) {
    .split { flex-direction: column; }
    .split-divider { border-right: none; border-bottom: 1px solid var(--ink-border); }
    .focus-topbar { padding: 14px 18px; padding-top: calc(14px + env(safe-area-inset-top)); }
    .focus-pad { padding-left: 18px !important; padding-right: 18px !important; }
}
@media (max-width: 640px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
