/* Inicio funcionalidad Variables visuales */
:root {
    --ai-bg: #f5f7fb;
    --ai-dark: #0b1220;
    --ai-primary: #123a7a;
    --ai-primary-2: #0072ff;
    --ai-accent: #7c3aed;
    --ai-soft: #eaf1ff;
    --ai-border: rgba(15, 23, 42, 0.09);
    --ai-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', 'Segoe UI', Arial, sans-serif; background: var(--ai-bg); color: #172033; overflow: hidden; }
/* Fin funcionalidad Variables visuales */

/* Inicio funcionalidad Login */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(circle at top left, rgba(0,114,255,.22), transparent 36%), linear-gradient(135deg, #07111f, #123a7a 50%, #7c3aed); }
.login-card { width: 100%; max-width: 420px; background: rgba(255,255,255,.94); backdrop-filter: blur(16px); border-radius: 28px; padding: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.55); }
.login-logo { display: block; width: 333px; margin: 0 auto 18px; filter: drop-shadow(0 16px 28px rgba(18, 58, 122, .25)); }
.login-title { text-align: center; font-weight: 800; color: var(--ai-dark); margin-bottom: 8px; }
.login-subtitle { text-align: center; color: #64748b; margin-bottom: 26px; }
.form-control { border-radius: 14px; min-height: 48px; border: 1px solid var(--ai-border); }
.btn-ai { border: 0; border-radius: 16px; min-height: 48px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-2), var(--ai-accent)); box-shadow: 0 14px 26px rgba(0,114,255,.28); transition: transform .25s ease, box-shadow .25s ease; }
.btn-ai:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 18px 32px rgba(0,114,255,.36); }
.demo-credentials { border-radius: 16px; padding: 12px 14px; background: #f1f5f9; color: #475569; font-size: 13px; margin-top: 18px; }
/* Fin funcionalidad Login */

/* Inicio funcionalidad Toast */
.toast-stack { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.ai-toast { min-width: 260px; max-width: 360px; padding: 13px 16px; border-radius: 16px; color: #fff; box-shadow: var(--ai-shadow); animation: toastIn .25s ease; background: #0f172a; }
.ai-toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.ai-toast.error { background: linear-gradient(135deg, #dc2626, #ef4444); }
.ai-toast.info { background: linear-gradient(135deg, #123a7a, #0072ff); }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
/* Fin funcionalidad Toast */

/* Inicio funcionalidad Shell responsive */
.app-shell { height: 100vh; display: grid; grid-template-columns: 280px 1fr; grid-template-rows: 74px 1fr; background: var(--ai-bg); overflow: hidden; }
.app-header { grid-column: 1 / 3; height: 74px; background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border-bottom: 1px solid var(--ai-border); display: flex; align-items: center; justify-content: space-between; padding: 0 22px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; color: var(--ai-dark); }
.brand img { width: 44px; height: 44px; border-radius: 14px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.user-pill { background: var(--ai-soft); border-radius: 999px; padding: 9px 14px; font-weight: 700; color: var(--ai-primary); }
.btn-ghost { border: 1px solid var(--ai-border); background: #fff; color: #334155; border-radius: 14px; padding: 9px 14px; font-weight: 700; }
.sidebar { grid-column: 1; grid-row: 2; background: #0b1220; color: #fff; padding: 20px 16px; overflow-y: auto; }
.sidebar-title { color: #94a3b8; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; margin: 6px 10px 14px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-item { border: 0; width: 100%; text-align: left; color: #dbeafe; background: transparent; border-radius: 16px; padding: 14px 14px; display: flex; align-items: center; gap: 12px; font-weight: 700; transition: all .25s ease; }
.menu-item:hover, .menu-item.active { background: linear-gradient(135deg, rgba(0,114,255,.26), rgba(124,58,237,.24)); color: #fff; transform: translateX(2px); }
.workspace { grid-column: 2; grid-row: 2; padding: 16px; min-width: 0; overflow: auto; }
.workspace-frame { width: 100%; height: 100%; border: 0; border-radius: 24px; background: #fff; box-shadow: var(--ai-shadow); }
.mobile-menu-btn { display: none; }
.install-banner { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #0f172a; color: #fff; border-radius: 20px; padding: 12px 14px; box-shadow: var(--ai-shadow); z-index: 999; display: none; align-items: center; gap: 12px; }
@media (max-width: 820px) {
    body { overflow: hidden; }
    .app-shell { grid-template-columns: 1fr; grid-template-rows: 68px 1fr 72px; }
    .app-header { grid-column: 1; height: 68px; padding: 0 14px; }
    .brand span { display: none; }
    .user-pill { display: none; }
    .sidebar { grid-column: 1; grid-row: 3; padding: 8px; overflow-x: auto; overflow-y: hidden; display: flex; align-items: center; }
    .sidebar-title { display: none; }
    .menu-list { flex-direction: row; width: 100%; gap: 6px; }
    .menu-item { justify-content: center; min-width: 70px; flex-direction: column; gap: 3px; padding: 8px 6px; font-size: 11px; }
    .workspace { grid-column: 1; grid-row: 2; padding: 10px; }
    .workspace-frame { border-radius: 18px; }
}
/* Fin funcionalidad Shell responsive */

/* Inicio funcionalidad Paginas internas */
.page-body { overflow: auto; background: #fff; min-height: 100vh; padding: 24px; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-kicker { color: var(--ai-primary-2); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.page-title { font-weight: 850; color: var(--ai-dark); margin: 4px 0 6px; }
.page-description { color: #64748b; margin: 0; }
.ai-card { border: 1px solid var(--ai-border); border-radius: 24px; padding: 22px; background: #fff; box-shadow: 0 10px 30px rgba(15,23,42,.07); height: 100%; }
.metric-card { border-radius: 24px; padding: 22px; background: linear-gradient(135deg, #f8fbff, #eef5ff); border: 1px solid var(--ai-border); }
.metric-card .value { font-size: 34px; font-weight: 850; color: var(--ai-dark); }
.metric-card .label { color: #64748b; font-weight: 700; }
.fake-chart { height: 250px; display: flex; align-items: flex-end; gap: 14px; padding: 20px; border-radius: 20px; background: #f8fafc; }
.fake-bar { flex: 1; min-width: 28px; border-radius: 14px 14px 6px 6px; background: linear-gradient(180deg, #0072ff, #7c3aed); opacity: .9; }
.table { background: #fff; }
.table th { color: #475569; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.unauthorized { min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 28px; background: #f8fafc; }
.unauthorized-box { max-width: 460px; background: #fff; padding: 32px; border-radius: 26px; box-shadow: var(--ai-shadow); }
@media (max-width: 600px) { .page-body { padding: 16px; } .page-header { flex-direction: column; } }
/* Fin funcionalidad Paginas internas */

/* Inicio funcionalidad Animacion agente voz */
.voice-center { text-align: center; padding: 8px 0 18px; }
.voice-toggle-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; margin: 16px 0 20px; }
.voice-ring { position: absolute; width: 190px; height: 190px; border-radius: 999px; border: 2px solid rgba(0,114,255,.2); opacity: 0; pointer-events: none; }
.voice-toggle-wrap.on .voice-ring.r1 { animation: voiceWave 1.8s infinite; }
.voice-toggle-wrap.on .voice-ring.r2 { animation: voiceWave 1.8s .55s infinite; }
.voice-toggle { position: relative; z-index: 2; width: 150px; height: 150px; border: none; border-radius: 999px; padding: 18px; font-weight: 800; transition: all 0.35s ease; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; cursor: pointer; }
.voice-toggle i { font-size: 34px; }
.voice-toggle.off { background: linear-gradient(135deg, #6c757d, #475569); color: #ffffff; box-shadow: 0 12px 28px rgba(71, 85, 105, 0.28); }
.voice-toggle.on { background: linear-gradient(135deg, #00c6ff, #0072ff, #7f00ff); color: #ffffff; box-shadow: 0 0 34px rgba(0, 114, 255, 0.72); animation: voicePulse 1.5s infinite; }
.voice-text { font-size: 13px; line-height: 1.2; }
@keyframes voicePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 114, 255, 0.55); }
    70% { transform: scale(1.045); box-shadow: 0 0 0 20px rgba(0, 114, 255, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 114, 255, 0); }
}
@keyframes voiceWave {
    0% { transform: scale(.7); opacity: .55; }
    100% { transform: scale(1.7); opacity: 0; }
}
.status-pill { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 9px 14px; font-weight: 800; background: #f1f5f9; color: #475569; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #94a3b8; }
.status-pill.on { background: #ecfeff; color: #0369a1; }
.status-pill.on .status-dot { background: #06b6d4; box-shadow: 0 0 0 8px rgba(6,182,212,.12); }
.transcript-box { min-height: 170px; border-radius: 20px; padding: 16px; background: #0b1220; color: #dbeafe; font-family: Consolas, monospace; overflow: auto; }
.command-button { border-radius: 14px; border: 1px solid var(--ai-border); background: #fff; padding: 10px 12px; font-weight: 700; color: #334155; transition: all .2s ease; }
.command-button:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(15,23,42,.09); color: var(--ai-primary); }
.widget-placeholder { border: 2px dashed rgba(0,114,255,.26); border-radius: 22px; padding: 20px; background: #f8fbff; color: #475569; }
/* Fin funcionalidad Animacion agente voz */
/* Inicio funcionalidad Boton instalar PWA en login */
.install-pwa-btn {
    border-radius: 50px;
    font-weight: 600;
    padding: 12px 18px;
    transition: all 0.3s ease;
}

.install-pwa-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.25);
}

.install-pwa-btn i {
    transition: transform 0.3s ease;
}

.install-pwa-btn:hover i {
    transform: translateY(2px);
}
/* Fin funcionalidad Boton instalar PWA en login */
/* Inicio funcionalidad Praxis legal AI */
.gap-fix { gap: 10px; }
.elevenlabs-widget-box { position: fixed; right: 18px; bottom: 86px; z-index: 998; }
.result-panel { min-height: 360px; border-radius: 22px; background: #fff; }
.empty-state { display: flex; min-height: 360px; align-items: center; justify-content: center; text-align: center; flex-direction: column; color: #64748b; background: linear-gradient(135deg, #f8fafc, #eef5ff); border: 1px dashed rgba(18,58,122,.2); }
.empty-state i { font-size: 46px; color: var(--ai-primary-2); margin-bottom: 12px; }
.result-content h4 { color: var(--ai-dark); font-weight: 850; margin-bottom: 18px; }
.result-content h6 { color: var(--ai-primary); font-weight: 850; margin-top: 18px; }
.draft-box { border-left: 5px solid #c8a24a; background: #fffbeb; padding: 18px; border-radius: 16px; line-height: 1.65; color: #334155; }
.processing-box { border-radius: 18px; padding: 14px 16px; background: #eff6ff; color: #123a7a; font-weight: 750; margin-bottom: 14px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--ai-border); padding-top: 14px; }
.legal-result { border-radius: 20px; background: #f8fafc; border: 1px solid var(--ai-border); padding: 16px; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .11em; color: #c8a24a; font-weight: 900; margin-bottom: 8px; }
.risk { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 5px 10px; font-weight: 850; font-size: 12px; }
.risk.alto { background: #fee2e2; color: #991b1b; }
.risk.medio { background: #fef3c7; color: #92400e; }
.risk.bajo { background: #dcfce7; color: #166534; }
.case-list { display: flex; flex-direction: column; gap: 10px; }
.case-item { width: 100%; border: 1px solid var(--ai-border); background: #fff; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; text-align: left; gap: 4px; transition: all .2s ease; }
.case-item strong { color: var(--ai-primary); }
.case-item span { font-weight: 800; color: var(--ai-dark); }
.case-item small { color: #64748b; }
.case-item:hover, .case-item.active { background: linear-gradient(135deg, #f8fbff, #eef5ff); box-shadow: 0 10px 24px rgba(15,23,42,.08); transform: translateY(-1px); border-color: rgba(18,58,122,.25); }
.upload-sim { border: 1px dashed rgba(18,58,122,.25); background: #f8fafc; border-radius: 18px; padding: 16px; }
@media (max-width: 820px) { .elevenlabs-widget-box { right: 12px; bottom: 86px; transform: scale(.88); transform-origin: bottom right; } .result-actions .btn { width: 100%; } }
/* Fin funcionalidad Praxis legal AI */
.praxis-elevenlabs-widget {
  position: fixed !important;
  z-index: 9999 !important;
}

.praxis-elevenlabs-widget.bottom-right {
  right: 24px !important;
  bottom: 24px !important;
}

.praxis-elevenlabs-widget.bottom-left {
  left: 24px !important;
  bottom: 24px !important;
}

.praxis-elevenlabs-widget.top-right {
  right: 24px !important;
  top: 24px !important;
}

.praxis-elevenlabs-widget.top-left {
  left: 24px !important;
  top: 24px !important;
}

@media (max-width: 768px) {
  .praxis-elevenlabs-widget {
    right: 12px !important;
    left: 12px !important;
    bottom: 12px !important;
  }
}
/* Inicio funcionalidad Fix Menu Inferior Mobile Praxis */

/* Área principal: deja espacio real para que el menú inferior no tape contenido */
.app-main,
.main-content,
.workspace,
#appContent,
#workspace {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* Menú inferior fijo */
.bottom-menu,
.mobile-bottom-menu,
.app-bottom-nav,
.footer-menu {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;

    height: calc(72px + env(safe-area-inset-bottom));
    min-height: calc(72px + env(safe-area-inset-bottom));

    padding-bottom: env(safe-area-inset-bottom);
    padding-left: 8px;
    padding-right: 8px;

    background: #061a3a;
    z-index: 99999;

    display: flex;
    align-items: center;
    justify-content: space-around;

    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}

/* Botones internos del menú */
.bottom-menu a,
.bottom-menu button,
.mobile-bottom-menu a,
.mobile-bottom-menu button,
.app-bottom-nav a,
.app-bottom-nav button,
.footer-menu a,
.footer-menu button {
    min-height: 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;

    padding: 6px 8px;
    border-radius: 18px;

    line-height: 1.1;
    font-size: 12px;
    white-space: nowrap;
}

/* Íconos del menú */
.bottom-menu i,
.mobile-bottom-menu i,
.app-bottom-nav i,
.footer-menu i {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
}

/* Evita que iframes o contenedores internos tapen el menú */
iframe,
.app-frame,
.workspace-frame {
    max-height: calc(100dvh - 150px);
}

/* Ajuste específico para celular real */
@media (max-width: 768px) {
    html,
    body {
        min-height: 100dvh;
        overflow-x: hidden;
    }

    body {
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .app-main,
    .main-content,
    .workspace,
    #appContent,
    #workspace {
        min-height: calc(100dvh - 84px);
        padding-bottom: calc(104px + env(safe-area-inset-bottom));
    }

    .bottom-menu,
    .mobile-bottom-menu,
    .app-bottom-nav,
    .footer-menu {
        height: calc(78px + env(safe-area-inset-bottom));
        min-height: calc(78px + env(safe-area-inset-bottom));
    }
}

/* Si el navegador viejo no soporta env(), mantiene espacio mínimo */
@supports not (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-menu,
    .mobile-bottom-menu,
    .app-bottom-nav,
    .footer-menu {
        height: 84px;
        min-height: 84px;
        padding-bottom: 12px;
    }

    body,
    .app-main,
    .main-content,
    .workspace,
    #appContent,
    #workspace {
        padding-bottom: 110px;
    }
}

/* Fin funcionalidad Fix Menu Inferior Mobile Praxis */

/* Inicio funcionalidad Menu Derecho Vertical Show Hide Praxis */
.app-shell {
    height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 74px 1fr;
    background: var(--ai-bg);
    overflow: hidden;
}

.app-header {
    grid-column: 1;
    grid-row: 1;
    z-index: 9000;
}

.workspace {
    grid-column: 1;
    grid-row: 2;
    padding: 16px;
    min-width: 0;
    overflow: auto;
}

.workspace-frame {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--ai-shadow);
}

.menu-toggle-button {
    position: fixed;
    top: 92px;
    right: 18px;
    width: 54px;
    height: 54px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--ai-primary), var(--ai-primary-2));
    color: #fff;
    font-size: 22px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease;
}

.menu-toggle-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.34);
}

.menu-toggle-button:focus {
    outline: 3px solid rgba(0, 114, 255, .22);
    outline-offset: 3px;
}

.sidebar,
.right-sidebar {
    position: fixed !important;
    top: 74px !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    width: 310px;
    max-width: 86vw;
    grid-column: auto !important;
    grid-row: auto !important;
    background: #0b1220;
    color: #fff;
    padding: 22px 16px 18px;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(105%);
    transition: transform 0.28s ease;
    z-index: 10000;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -18px 0 42px rgba(15, 23, 42, 0.28);
}

.sidebar.open,
.right-sidebar.open {
    transform: translateX(0);
}

.menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: none;
}

body.menu-open .menu-backdrop {
    display: block;
}

.sidebar-title {
    display: block !important;
    color: #94a3b8;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 8px 10px 16px;
}

.menu-list {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
}

.menu-item {
    width: 100% !important;
    min-width: 0 !important;
    border: 0;
    text-align: left;
    color: #dbeafe;
    background: transparent;
    border-radius: 16px;
    padding: 14px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    gap: 12px !important;
    font-size: 14px !important;
    font-weight: 700;
    transition: all .25s ease;
}

.menu-item i {
    width: 22px;
    text-align: center;
    font-size: 18px;
}

.menu-item:hover,
.menu-item.active {
    background: linear-gradient(135deg, rgba(0,114,255,.26), rgba(124,58,237,.24));
    color: #fff;
    transform: translateX(-2px);
}

body.menu-open {
    overflow: hidden;
}

@media (max-width: 820px) {
    body {
        overflow: hidden;
        padding-bottom: 0 !important;
    }

    .app-shell {
        grid-template-columns: 1fr !important;
        grid-template-rows: 68px 1fr !important;
        height: 100dvh;
    }

    .app-header {
        grid-column: 1 !important;
        grid-row: 1 !important;
        height: 68px;
        padding: 0 12px;
    }

    .brand img {
        width: 44px;
        height: 44px;
    }

    .brand h1 {
        font-size: 32px;
        margin: 0;
    }

    .header-actions .user-pill {
        display: none;
    }

    .header-actions .btn-ghost {
        padding: 9px 12px;
        border-radius: 16px;
        font-size: 14px;
    }

    .workspace {
        grid-column: 1 !important;
        grid-row: 2 !important;
        padding: 10px;
        padding-bottom: 10px !important;
        min-height: 0;
    }

    .workspace-frame {
        border-radius: 18px;
    }

    .menu-toggle-button {
        top: 82px;
        right: 12px;
        width: 50px;
        height: 50px;
        border-radius: 16px;
        font-size: 20px;
    }

    .sidebar,
    .right-sidebar {
        top: 68px !important;
        width: 300px;
        max-width: 86vw;
        padding: 18px 14px;
        display: block !important;
        align-items: stretch !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .menu-list {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .menu-item {
        min-width: 0 !important;
        flex-direction: row !important;
        justify-content: flex-start !important;
        padding: 14px 14px !important;
        font-size: 14px !important;
    }
}
/* Fin funcionalidad Menu Derecho Vertical Show Hide Praxis */

