/* ============================================================
   Panorama Mercados — Experiência Mobile
   Carregado em todas as páginas. Tudo que é visual fica dentro de
   @media (max-width: 767px), exceto as transições entre páginas.
   ============================================================ */

/* ---------- Transição suave entre páginas (Chrome/Edge/Safari recentes) ---------- */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: m-page-out 160ms cubic-bezier(.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: m-page-in 260ms cubic-bezier(.2, .8, .2, 1) both; }
::view-transition-group(m-tabbar) { animation: none; }

@keyframes m-page-out { to { opacity: 0; transform: scale(.985); } }
@keyframes m-page-in  { from { opacity: 0; transform: translateY(10px); } }

/* Fallback para navegadores sem View Transitions (classe aplicada via JS) */
html.m-fade-in body { animation: m-page-in 280ms cubic-bezier(.2, .8, .2, 1) both; }

/* ---------- Título "PANORAMA MERCADOS": dourado passando pelas letras (todas as telas) ---------- */
header .silver-text,
.typewriter-effect .silver-text,
#brand-logo .silver-text {
    background-image: linear-gradient(100deg, #e5e7eb 0%, #a1a1aa 30%, #f59e0b 42%, #fde68a 48%, #fffbeb 50%, #fbbf24 54%, #a1a1aa 68%, #e5e7eb 100%) !important;
    background-size: 280% 100% !important;
    background-repeat: no-repeat;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent;
    animation: m-title-gold 4.5s cubic-bezier(.45, 0, .25, 1) infinite;
}
/* "PRO" do pro.html mantém a cor própria */
header .silver-text span { -webkit-text-fill-color: currentColor; }
@keyframes m-title-gold {
    0% { background-position: 100% 0; }
    70%, 100% { background-position: 0% 0; }
}

/* ---------- Market Pulse: brilho amarelo contínuo nos 4 cards (todas as telas) ---------- */
#market-pulse-grid .pulse-card { isolation: isolate; }
#market-pulse-grid .pulse-card > * { position: relative; z-index: 1; }
#market-pulse-grid .pulse-card::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 28%, rgba(251, 191, 36, .14) 44%, rgba(253, 230, 138, .3) 50%, rgba(251, 191, 36, .14) 56%, transparent 72%);
    transform: translateX(-120%);
    animation: mp-sweep 3.4s ease-in-out infinite;
}
#market-pulse-grid .pulse-card:nth-child(2)::after { animation-delay: .4s; }
#market-pulse-grid .pulse-card:nth-child(3)::after { animation-delay: .8s; }
#market-pulse-grid .pulse-card:nth-child(4)::after { animation-delay: 1.2s; }
#market-pulse-grid .pulse-card { animation: mp-border 3.4s ease-in-out infinite; }
#market-pulse-grid .pulse-card:nth-child(2) { animation-delay: .4s; }
#market-pulse-grid .pulse-card:nth-child(3) { animation-delay: .8s; }
#market-pulse-grid .pulse-card:nth-child(4) { animation-delay: 1.2s; }
/* logos das criptos em destaque, com aro dourado */
#market-pulse-grid img {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50%;
    background: #fff;
    padding: 1px;
    box-shadow: 0 0 0 1.5px rgba(251, 191, 36, .75), 0 0 10px rgba(251, 191, 36, .35);
}
@keyframes mp-sweep { 0%, 35% { transform: translateX(-120%); } 75%, 100% { transform: translateX(120%); } }
@keyframes mp-border {
    0%, 30%, 100% { border-color: rgba(255, 255, 255, .07); }
    55% { border-color: rgba(251, 191, 36, .55); }
}

/* ---------- Ticker de criptos + "Adicionar Ativo" na mesma seção ---------- */
.ticker-section {
    padding: 10px 10px 12px;
    border-radius: 16px;
    background: rgba(10, 16, 23, .55);
    border: 1px solid rgba(251, 191, 36, .1);
}
.ticker-customize-btn { position: relative; overflow: hidden; isolation: isolate; border-color: rgba(251, 191, 36, .35) !important; color: #fbbf24 !important; }
.ticker-customize-btn > * { position: relative; z-index: 1; }
.ticker-customize-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(110deg, transparent 25%, rgba(251, 191, 36, .25) 45%, rgba(255, 244, 200, .45) 50%, rgba(251, 191, 36, .25) 55%, transparent 75%);
    transform: translateX(-120%);
    animation: mp-sweep 2.8s ease-in-out infinite;
}

/* ---------- Dica flutuante sobre o ticker: aparece, pulsa e some ----------
   (mesmo estilo do "Deslize para ver todas as colunas" do calendário) */
:has(> .ticker-hint) { position: relative; }
.ticker-hint {
    position: absolute;
    top: 44px;
    left: 50%;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 7px 12px;
    border-radius: 999px;
    white-space: nowrap;
    font: 700 11px/1 'Plus Jakarta Sans', system-ui, sans-serif;
    color: #0b0f15;
    background: #fbbf24;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .55), 0 0 0 4px rgba(251, 191, 36, .18);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 8px) scale(.96);
    animation: ticker-hint-life 5.5s cubic-bezier(.2, .8, .2, 1) .8s forwards;
}
.ticker-hint.is-done { animation: ticker-hint-out .3s ease forwards; }
.ticker-hint svg { width: 15px; height: 15px; flex-shrink: 0; animation: ticker-tap 1.2s ease-in-out infinite; }
.ticker-hint b { display: inline-block; animation: ticker-down 1.2s ease-in-out infinite; }
@keyframes ticker-hint-life {
    0% { opacity: 0; transform: translate(-50%, 8px) scale(.96); }
    8%, 88% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -6px) scale(.98); visibility: hidden; }
}
/* Variante da tabela Top 100: fica sobre as primeiras linhas e só anima quando a seção aparece */
.ticker-hint--table { top: 118px; animation-play-state: paused; }
.ticker-hint--table.is-play { animation-play-state: running; }
@media (max-width: 767px) { .ticker-hint--table { white-space: normal; text-align: center; width: max-content; max-width: calc(100% - 24px); line-height: 1.3; } }
@keyframes ticker-hint-out { to { opacity: 0; transform: translate(-50%, -6px) scale(.98); visibility: hidden; } }
@keyframes ticker-tap { 0%, 100% { transform: translateY(0) scale(1); } 40% { transform: translateY(2px) scale(.88); } }
@keyframes ticker-down { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

/* ---------- Botão X nas notificações (todas as telas) ---------- */
.toast-popup { position: relative; padding-right: 36px !important; }
.toast-close {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    color: #9ca3af;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}
.toast-close:hover, .toast-close:active { color: #fff; background: rgba(239, 68, 68, .25); }

@media (max-width: 767px) {

    /* ---------- Base: toque rápido, sem estouro lateral ---------- */
    html {
        -webkit-text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
        scroll-padding-top: 76px;
    }
    body {
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }
    a, button, [role="button"], input, select, label, summary {
        touch-action: manipulation;
    }
    img, video, iframe, svg { max-width: 100%; }
    pre, code { white-space: pre-wrap; word-break: break-word; }

    /* Inputs com 16px evitam o zoom automático do iOS ao focar */
    input, select, textarea { font-size: 16px !important; }

    /* Feedback tátil leve em tudo que é clicável */
    a, button, .glass-panel[onclick], [onclick] {
        transition: transform 140ms ease, opacity 140ms ease, background-color 200ms ease;
    }
    a:active, button:active, [onclick]:active { transform: scale(.97); opacity: .85; }

    /* ---------- Header: padrão do pro.html em todas as páginas ----------
       pílula de vidro flutuante, logo à esquerda, ícones (alertas/conta/sair)
       à direita, sem hambúrguer (a navegação mora na barra inferior). */
    header.sticky {
        margin: calc(8px + env(safe-area-inset-top)) 10px 0 !important;
        top: calc(8px + env(safe-area-inset-top)) !important;
        padding: 8px 12px !important;
        border-radius: 16px !important;
        background: rgba(10, 16, 23, .8) !important;
        -webkit-backdrop-filter: saturate(160%) blur(16px);
        backdrop-filter: saturate(160%) blur(16px);
        border: 1px solid rgba(251, 191, 36, .09) !important;
        box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
        transition: transform 320ms cubic-bezier(.2, .8, .2, 1), opacity 320ms ease;
        will-change: transform;
    }
    html.m-header-hidden header.sticky {
        transform: translateY(calc(-100% - 20px - env(safe-area-inset-top)));
        opacity: 0;
    }
    header.sticky > .container { padding: 0 !important; }
    header.sticky a[href="panorama.html"] img { width: 32px !important; height: 32px !important; }
    header.sticky a[href="panorama.html"] .silver-text {
        font-size: 15px !important;
        font-weight: 900 !important;
        letter-spacing: -0.03em;
    }
    /* Ícones de alertas/conta/sair visíveis no mobile, como no pro.html */
    header.sticky .hidden.md\:flex:has(#alerts-btn),
    header.sticky .hidden.md\:flex:has(#nav-account-desktop) {
        display: flex !important;
        gap: 8px;
    }
    header.sticky .hidden.md\:flex:has(#alerts-btn) > * + * { margin-left: 0 !important; }
    /* Selo "PRO TERMINAL" (eua/brasil/ouro/risk) fora do cabeçalho mobile: fica igual ao panorama */
    header.sticky .relative:has(> #pro-terminal-badge) { display: none !important; }
    header.sticky .nav-profile-btn,
    header.sticky #logout-btn { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
    body.m-has-tabbar header.sticky #menu-button,
    body.m-has-tabbar header.sticky #mobile-menu { display: none !important; }
    #alerts-panel { position: fixed !important; top: calc(70px + env(safe-area-inset-top)) !important; right: 10px !important; left: 10px; width: auto !important; }

    /* O menu hambúrguer antigo abre com animação em vez de "pular" */
    #mobile-menu:not(.hidden) {
        animation: m-drop 240ms cubic-bezier(.2, .8, .2, 1) both;
        max-height: calc(100dvh - 140px);
        overflow-y: auto;
    }
    @keyframes m-drop { from { opacity: 0; transform: translateY(-8px); } }

    /* ---------- Espaço para a barra inferior ---------- */
    body.m-has-tabbar {
        padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
    }
    /* Toasts/avisos fixos no rodapé sobem acima da barra */
    body.m-has-tabbar #sync-notification,
    body.m-has-tabbar .fixed.bottom-4,
    body.m-has-tabbar .fixed.bottom-5,
    body.m-has-tabbar .fixed.bottom-6,
    body.m-has-tabbar .fixed.bottom-8 {
        bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    }

    /* Chat flutuante (pro.html) fica acima da barra inferior, sem cobrir o "Mais" */
    body.m-has-tabbar #chat-widget {
        right: 14px !important;
        bottom: calc(84px + env(safe-area-inset-bottom)) !important;
    }
    body.m-has-tabbar #chat-btn { width: 50px; height: 50px; }
    /* Chat compacto no celular: barra de emojis e campo de texto mais baixos, mais mensagens visíveis */
    #chat-panel { width: calc(100vw - 20px) !important; max-width: none !important; }
    #chat-emoji-bar { padding: 2px .5rem !important; }
    #chat-emoji-bar .chat-emoji-btn { font-size: .95rem; padding: 3px; }
    #chat-form { padding: .4rem .5rem !important; gap: 6px !important; }
    #chat-send-btn { width: 34px !important; height: 34px !important; }
    body.m-has-tabbar #chat-panel { max-height: calc(100dvh - 230px - env(safe-area-inset-bottom)); }
    /* Notificações logo acima da barra inferior (acima do chat, se ele existir) */
    body.m-has-tabbar #toast-container {
        bottom: calc(84px + env(safe-area-inset-bottom)) !important;
        left: 10px !important;
        right: 10px !important;
        align-items: stretch;
    }
    body.m-has-tabbar:has(#chat-widget:not(.hidden)) #toast-container { bottom: calc(146px + env(safe-area-inset-bottom)) !important; }
    #toast-container .toast-popup { width: auto !important; max-width: none; }

    /* ---------- Painéis e tabelas ---------- */
    .glass-panel { border-radius: 16px; }
    .m-scroll-x {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        max-width: 100%;
        mask-image: linear-gradient(to right, #000 92%, transparent);
        -webkit-mask-image: linear-gradient(to right, #000 92%, transparent);
    }
    .m-scroll-x.m-end { mask-image: none; -webkit-mask-image: none; }
    .m-scroll-x::-webkit-scrollbar { display: none; }

    /* Cards de indicadores (Monitoramento, Juros, Hedge...) sem texto cortado */
    .pulse-card { min-width: 0; padding: .8rem .7rem !important; }
    .pulse-card .pulse-label { letter-spacing: .08em !important; overflow-wrap: anywhere; line-height: 1.3; }
    .pulse-card .pulse-value { font-size: clamp(.8rem, 3.8vw, 1.05rem) !important; overflow-wrap: anywhere; line-height: 1.25; }
    .pulse-card .pulse-sub { font-size: 10px !important; overflow-wrap: anywhere; }

    /* Indicadores Rápidos: onda dourada em cada card quando ele entra na tela rolando */
    a.pulse-card.m-gold {
        animation: m-card-gold 1.5s cubic-bezier(.2, .8, .2, 1) both;
        animation-delay: var(--m-gold-delay, 0ms);
    }
    a.pulse-card.m-gold::after {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background: linear-gradient(110deg, transparent 25%, rgba(251, 191, 36, .28) 45%, rgba(255, 244, 200, .45) 50%, rgba(251, 191, 36, .28) 55%, transparent 75%);
        transform: translateX(-110%);
        animation: m-card-sweep 1.1s ease-out both;
        animation-delay: var(--m-gold-delay, 0ms);
    }
    @keyframes m-card-gold {
        0% { border-color: rgba(255, 255, 255, .07); }
        35% { border-color: rgba(251, 191, 36, .85); background-color: rgba(251, 191, 36, .1); box-shadow: 0 0 22px rgba(251, 191, 36, .3); }
        100% { border-color: rgba(251, 191, 36, .28); background-color: rgba(251, 191, 36, .04); box-shadow: 0 0 0 rgba(251, 191, 36, 0); }
    }
    @keyframes m-card-sweep { to { transform: translateX(110%); } }

    /* Controles & Atalhos de teclado não fazem sentido no toque */
    .m-hide-mobile { display: none !important; }

    /* Badge da próxima reunião do FED quebra linha em vez de cortar */
    #fomc-countdown-badge { flex-wrap: wrap; margin-left: 0 !important; row-gap: 2px; }

    /* ---------- Calendário Econômico: todas as colunas visíveis ----------
       O widget do Investing é um iframe de outro domínio (não dá para estilizar
       por dentro), então ele ganha largura de tabela real e o usuário desliza
       para o lado; a altura acompanha a tela. */
    div:has(> .calendar-wrapper) { height: min(78vh, 720px) !important; }
    div:has(> .calendar-wrapper) + div[style*="height"] { height: auto !important; }
    /* Order Flow vira seção própria acima do calendário (movido via JS) */
    .m-orderflow-section { margin-bottom: 0; }
    .calendar-wrapper,
    .calendar-iframe-container {
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }
    .calendar-iframe-container { height: min(78vh, 720px) !important; }
    .calendar-wrapper iframe,
    .calendar-iframe-container iframe {
        width: 680px !important;
        min-width: 680px;
    }
    /* Dica de "deslize" que some ao primeiro toque */
    .m-swipe-hint { position: relative; }
    .m-swipe-hint::after {
        content: "Deslize para ver todas as colunas →";
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 5;
        padding: 6px 10px;
        border-radius: 999px;
        font: 700 10px/1 'Plus Jakarta Sans', system-ui, sans-serif;
        color: #0b0f15;
        background: #fbbf24;
        box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
        pointer-events: none;
        animation: m-hint 2.4s ease-in-out infinite;
    }
    @keyframes m-hint { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }


    /* ---------- Revelação ao rolar ---------- */
    .m-reveal {
        opacity: 0;
        transform: translateY(18px);
        transition: opacity 520ms cubic-bezier(.2, .8, .2, 1), transform 520ms cubic-bezier(.2, .8, .2, 1);
        transition-delay: var(--m-delay, 0ms);
    }
    .m-reveal.m-in { opacity: 1; transform: none; }

    /* ---------- Barra de navegação inferior ---------- */
    #m-tabbar {
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 900;
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        height: 62px;
        padding: 6px;
        border-radius: 20px;
        background: rgba(10, 14, 20, .82);
        -webkit-backdrop-filter: saturate(170%) blur(18px);
        backdrop-filter: saturate(170%) blur(18px);
        border: 1px solid rgba(255, 255, 255, .07);
        box-shadow: 0 12px 32px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .04);
        view-transition-name: m-tabbar;
        transition: transform 320ms cubic-bezier(.2, .8, .2, 1), opacity 320ms ease;
        animation: m-tabbar-in 420ms cubic-bezier(.2, .8, .2, 1) both;
    }
    @keyframes m-tabbar-in { from { transform: translateY(120%); opacity: 0; } }
    html.m-header-hidden #m-tabbar { transform: translateY(8px) scale(.97); opacity: .92; }
    #m-tabbar.m-off { display: none; }

    .m-tab {
        position: relative;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        border-radius: 14px;
        color: #7c8ba1;
        font: 600 10px/1 'Plus Jakarta Sans', system-ui, sans-serif;
        letter-spacing: .02em;
        text-decoration: none;
        background: none;
        border: 0;
        padding: 0;
        transition: color 200ms ease, background-color 200ms ease, transform 140ms ease;
    }
    .m-tab svg { width: 22px; height: 22px; transition: transform 260ms cubic-bezier(.3, 1.6, .5, 1); }
    .m-tab:active { transform: scale(.92); opacity: 1; }
    .m-tab.m-active { color: #fbbf24; background: rgba(251, 191, 36, .09); }
    .m-tab.m-active svg { transform: translateY(-1px) scale(1.08); }
    .m-tab.m-active::after {
        content: "";
        position: absolute;
        top: 3px;
        width: 4px;
        height: 4px;
        border-radius: 50%;
        background: #fbbf24;
        box-shadow: 0 0 8px #fbbf24;
    }
    /* ---------- Botão PRO: pílula compacta "black & gold" com efeitos ----------
       Borda dourada girando, reflexo de luz, brilho pulsando, estrela e faíscas.
       Só transform/opacity/background-position animam (leve para a GPU). */
    .m-tab-pro { background: none !important; overflow: visible; color: #fbbf24; }
    .m-tab-pro.m-active { background: none !important; color: #fde68a; }
    .m-tab-pro.m-active::after { display: none; }
    .m-tab-pro > svg, .m-tab-pro .m-pro-label { position: relative; z-index: 2; }

    .m-pro-bg {
        position: absolute;
        inset: 3px 4px;
        z-index: 0;
        border-radius: 14px;
        overflow: hidden;
        isolation: isolate;
    }
    .m-pro-bg::before {               /* borda metálica girando */
        content: "";
        position: absolute;
        inset: -150% -50%;
        z-index: -2;
        background: conic-gradient(from 0deg, transparent 0 20%, #fbbf24 30%, #fffbeb 35%, #f59e0b 42%, transparent 55% 70%, #d97706 80%, #fde68a 85%, transparent 95%);
        animation: m-spin 2.8s linear infinite;
    }
    .m-pro-bg::after {                /* miolo escuro com toque dourado */
        content: "";
        position: absolute;
        inset: 1.5px;
        z-index: -1;
        border-radius: 12.5px;
        background: radial-gradient(120% 90% at 50% 0%, rgba(251, 191, 36, .28), transparent 60%), linear-gradient(180deg, #1d1606, #0c0903);
    }
    .m-pro-shine {                    /* reflexo atravessando */
        position: absolute;
        inset: 0;
        z-index: 1;
        background: linear-gradient(105deg, transparent 30%, rgba(255, 236, 170, .45) 48%, transparent 66%);
        transform: translateX(-130%);
        animation: m-pro-shine 3.2s ease-in-out infinite .6s;
    }
    .m-tab-pro::before {              /* brilho externo pulsando */
        content: "";
        position: absolute;
        inset: 3px 4px;
        border-radius: 14px;
        box-shadow: 0 0 14px 1px rgba(251, 191, 36, .55), inset 0 0 10px rgba(251, 191, 36, .25);
        opacity: .35;
        pointer-events: none;
        animation: m-pro-glow 2.2s ease-in-out infinite;
    }
    .m-tab-pro > svg {
        width: 20px;
        height: 20px;
        color: #fbbf24;
        animation: m-pro-star 2.8s ease-in-out infinite;
    }
    .m-pro-label {
        font-weight: 900;
        letter-spacing: .16em;
        margin-right: -.16em;
        background: linear-gradient(90deg, #d97706, #fbbf24, #fffbeb, #fbbf24, #d97706);
        background-size: 250% 100%;
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        animation: m-pro-text 3s linear infinite;
    }
    .m-pro-spark {
        position: absolute;
        z-index: 3;
        width: 7px;
        height: 7px;
        pointer-events: none;
        background: #fff7d6;
        clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
        opacity: 0;
        animation: m-pro-spark 2.4s ease-in-out infinite;
    }
    .m-pro-spark:nth-of-type(1) { top: 2px; right: 8px; animation-delay: .1s; }
    .m-pro-spark:nth-of-type(2) { bottom: 14px; left: 8px; width: 5px; height: 5px; animation-delay: .9s; }
    .m-pro-spark:nth-of-type(3) { top: 12px; left: 14px; width: 4px; height: 4px; animation-delay: 1.7s; }

    @keyframes m-spin { to { transform: rotate(360deg); } }
    @keyframes m-pro-shine { 0%, 50% { transform: translateX(-130%); } 80%, 100% { transform: translateX(130%); } }
    @keyframes m-pro-glow { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
    @keyframes m-pro-star { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.15) rotate(-12deg); } }
    @keyframes m-pro-spark { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0); } 45% { opacity: 1; transform: scale(1.3) rotate(45deg); } 60% { opacity: 0; } }
    @keyframes m-pro-text { to { background-position: -250% 0; } }

    /* ---------- Bottom sheet ---------- */
    #m-sheet-backdrop {
        position: fixed;
        inset: 0;
        z-index: 950;
        background: rgba(0, 0, 0, .5);
        opacity: 0;
        pointer-events: none;
        transition: opacity 260ms ease;
    }
    #m-sheet-backdrop.m-open { opacity: 1; pointer-events: auto; }

    #m-sheet {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 960;
        max-height: 78dvh;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
        border-radius: 22px 22px 0 0;
        background: #0a1017;
        border-top: 1px solid rgba(251, 191, 36, .14);
        box-shadow: 0 -20px 50px rgba(0, 0, 0, .6);
        transform: translateY(105%);
        transition: transform 340ms cubic-bezier(.2, .8, .2, 1);
        visibility: hidden;
    }
    #m-sheet.m-open { transform: none; visibility: visible; }
    #m-sheet.m-dragging { transition: none; }

    .m-sheet-grip {
        width: 40px;
        height: 4px;
        border-radius: 4px;
        background: rgba(255, 255, 255, .18);
        margin: 4px auto 14px;
    }
    .m-sheet-title {
        font: 800 11px/1 'Plus Jakarta Sans', system-ui, sans-serif;
        letter-spacing: .18em;
        text-transform: uppercase;
        color: #7c8ba1;
        margin: 0 4px 10px;
    }
    .m-sheet-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .m-sheet-item {
        display: flex;
        flex-direction: column;
        gap: 8px;
        padding: 14px;
        border-radius: 14px;
        text-decoration: none;
        background: rgba(255, 255, 255, .03);
        border: 1px solid rgba(255, 255, 255, .06);
        color: #e6edf3;
        opacity: 0;
        transform: translateY(10px);
    }
    #m-sheet.m-open .m-sheet-item {
        animation: m-item-in 360ms cubic-bezier(.2, .8, .2, 1) both;
        animation-delay: calc(var(--i) * 35ms + 60ms);
    }
    @keyframes m-item-in { to { opacity: 1; transform: none; } }
    .m-sheet-item.m-current { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .07); }
    .m-sheet-item .m-ico {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, .05);
        overflow: hidden;
        font-size: 16px;
    }
    .m-sheet-item .m-ico img { width: 22px; height: 22px; object-fit: contain; border-radius: 4px; }
    .m-sheet-item b { font-size: 13px; font-weight: 700; }
    .m-sheet-item small { font-size: 11px; color: #7c8ba1; line-height: 1.3; }
}

/* ============================================================
   Barra inferior premium (v11): vidro com borda metálica, pílula de luz
   deslizante na aba ativa, ondinha no toque e botão PRO prateado flutuante.
   Sobrescreve o visual anterior acima sem mexer na estrutura.
   ============================================================ */
@media (max-width: 767px) {
    #m-tabbar {
        left: 12px; right: 12px; height: 66px; padding: 7px 6px; border-radius: 26px; overflow: visible;
        background: linear-gradient(180deg, rgba(24, 29, 39, .84) 0%, rgba(8, 11, 17, .94) 100%);
        border: 0;
        box-shadow: 0 18px 40px -8px rgba(0, 0, 0, .75), 0 2px 0 rgba(255, 255, 255, .03) inset, 0 -1px 0 rgba(0, 0, 0, .4) inset;
    }
    #m-tabbar::before {             /* borda fina metálica (prata → ouro → prata) */
        content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
        background: linear-gradient(110deg, rgba(226, 232, 240, .35), rgba(251, 191, 36, .28) 35%, rgba(255, 255, 255, .06) 55%, rgba(203, 213, 225, .3));
        -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
        mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
    }
    #m-tabbar::after {              /* reflexo de vidro no topo */
        content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 1px; pointer-events: none;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
    }

    .m-tab-glider {
        position: absolute; left: 0; top: 7px; bottom: 7px; width: 0; border-radius: 18px; pointer-events: none; opacity: 0;
        background: radial-gradient(90% 120% at 50% 0%, rgba(251, 191, 36, .2), rgba(251, 191, 36, .05) 60%, transparent), rgba(255, 255, 255, .03);
        box-shadow: inset 0 0 0 1px rgba(251, 191, 36, .16);
        transition: transform 420ms cubic-bezier(.3, 1.3, .5, 1), width 420ms cubic-bezier(.3, 1.3, .5, 1), opacity 240ms ease;
    }
    .m-tab-glider::before {         /* filete de luz no topo da pílula */
        content: ""; position: absolute; top: -1px; left: 30%; right: 30%; height: 2px; border-radius: 2px;
        background: linear-gradient(90deg, transparent, #fcd34d, transparent); box-shadow: 0 0 10px #fbbf24;
    }
    .m-tab-glider.m-on { opacity: 1; }

    .m-tab { color: #7d8aa0; gap: 4px; overflow: hidden; border-radius: 18px; font-size: 9.5px; letter-spacing: .04em; }
    .m-tab svg { width: 21px; height: 21px; }
    .m-tab span { transition: color 200ms ease, transform 300ms cubic-bezier(.3, 1.4, .5, 1); }
    .m-tab.m-active { color: #fde68a; background: none; }
    .m-tab.m-active svg { transform: translateY(-1px) scale(1.12); filter: drop-shadow(0 0 6px rgba(251, 191, 36, .55)); }
    .m-tab.m-active::after { display: none; }
    .m-tab:active { transform: scale(.9); }
    .m-ripple {
        position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; pointer-events: none; z-index: 0;
        background: radial-gradient(circle, rgba(255, 255, 255, .35), rgba(251, 191, 36, .15) 60%, transparent 70%);
        animation: m-ripple 600ms ease-out forwards;
    }
    @keyframes m-ripple { to { transform: scale(14); opacity: 0; } }

    /* ---------- botão PRO: orbe prateado (cromo) flutuando acima da barra ---------- */
    .m-tab-pro {
        flex: 0 0 62px; height: 62px; align-self: center; margin: -30px 4px 0; border-radius: 50%;
        overflow: visible; color: #f1f5f9; gap: 1px;
    }
    .m-tab-pro.m-active { color: #fff; }
    .m-tab-pro .m-pro-bg { inset: 0; border-radius: 50%; box-shadow: 0 10px 24px -6px rgba(0, 0, 0, .8), 0 0 0 4px rgba(8, 11, 17, .95); }
    .m-pro-bg::before {             /* aro de cromo girando */
        background: conic-gradient(from 0deg, #64748b, #f8fafc 12%, #94a3b8 25%, #e2e8f0 38%, #475569 50%, #f1f5f9 62%, #94a3b8 75%, #ffffff 87%, #64748b);
        animation-duration: 4s;
    }
    .m-pro-bg::after {              /* miolo grafite com brilho prateado */
        inset: 2px; border-radius: 50%;
        background: radial-gradient(80% 70% at 35% 25%, rgba(255, 255, 255, .28), transparent 55%), radial-gradient(100% 100% at 50% 100%, rgba(148, 163, 184, .25), transparent 60%), linear-gradient(160deg, #2a3140, #0d1118 70%);
    }
    .m-pro-shine { background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .55) 48%, transparent 66%); }
    .m-tab-pro::before {            /* halo prateado pulsando */
        inset: -4px; border-radius: 50%;
        box-shadow: 0 0 18px 2px rgba(226, 232, 240, .45), inset 0 0 12px rgba(226, 232, 240, .2);
    }
    .m-tab-pro > svg { width: 19px; height: 19px; color: #f8fafc; filter: drop-shadow(0 0 5px rgba(255, 255, 255, .6)); }
    .m-pro-label {
        font-size: 9px;
        background: linear-gradient(90deg, #94a3b8, #e2e8f0, #ffffff, #e2e8f0, #94a3b8);
        background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
    }
    .m-pro-spark { background: #ffffff; filter: drop-shadow(0 0 3px #fff); }
    .m-pro-spark:nth-of-type(1) { top: -2px; right: 2px; }
    .m-pro-spark:nth-of-type(2) { bottom: 6px; left: -2px; }
    .m-pro-spark:nth-of-type(3) { top: 8px; left: 2px; }
    #m-sheet { border-top-color: rgba(226, 232, 240, .14); }
}

/* ---------- Cabeçalho no celular: a marca "PANORAMA MERCADOS" encolhe (com reticências)
   e não passa mais por cima dos botões de alertas, conta e sair ---------- */
@media (max-width: 767px) {
    header.sticky > .container.flex,
    header.sticky.flex { flex-wrap: nowrap; gap: 8px; }
    header.sticky > .container > div:first-child,
    header.sticky.flex > div:first-child { flex: 1 1 auto; min-width: 0; }
    header.sticky > .container > div:first-child > a,
    header.sticky.flex > div:first-child > a,
    header.sticky.flex > div:first-child > div { flex-shrink: 1 !important; min-width: 0; overflow: hidden; }
    header.sticky .silver-text.uppercase {
        display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-size: clamp(11.5px, 3.6vw, 14px) !important; letter-spacing: .01em;
    }
    header.sticky > .container > div:last-child,
    header.sticky.flex > div:last-child { flex: none; display: flex; align-items: center; gap: 6px; }
    header.sticky > .container > div:last-child > * + *,
    header.sticky.flex > div:last-child > * + * { margin-left: 0 !important; }
    header.sticky .nav-profile-btn { width: 34px; height: 34px; }
    header.sticky.flex > div:last-child > a[href="#"].h-9 { display: none; }   /* selo "Institutional access" (Fundos BR) */
}

/* ---------- Etiquetas FREE / PRO nos menus Mercados e Dados ---------- */
@media (max-width: 767px) {
    .m-sheet-item { position: relative; }
    .m-plano {
        font-style: normal; font: 800 8.5px/1 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: .12em;
        padding: 4px 7px; border-radius: 999px; white-space: nowrap;
    }
    .m-sheet-item .m-plano { position: absolute; top: 12px; right: 12px; }
    .m-plano--free { color: #34d399; background: rgba(16, 185, 129, .12); border: 1px solid rgba(52, 211, 153, .35); }
    .m-plano--pro {
        color: #0b0f16; border: 1px solid rgba(255, 255, 255, .5);
        background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 45%, #94a3b8 70%, #e2e8f0 100%);
        box-shadow: 0 0 10px rgba(226, 232, 240, .25), inset 0 1px 0 rgba(255, 255, 255, .7);
    }
    .m-sheet-legenda { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -2px 4px 12px; font-size: 10.5px; color: #7c8ba1; }
    .m-sheet-legenda span { display: inline-flex; align-items: center; gap: 6px; }
    .m-sheet-item .m-ico .m-ico-svg { width: 24px; height: 24px; filter: drop-shadow(0 0 6px rgba(245, 158, 11, .35)); }
    .m-sheet-item[href="hedge.html"] .m-ico { background: radial-gradient(circle at 30% 25%, rgba(253, 230, 138, .18), rgba(245, 158, 11, .06) 70%); box-shadow: inset 0 0 0 1px rgba(245, 158, 11, .25); }
}

/* ---------- Respeita quem prefere menos movimento ---------- */
@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
    html.m-fade-in body, #m-tabbar, #m-sheet.m-open .m-sheet-item, #mobile-menu:not(.hidden) { animation: none !important; }
    .m-tab-glider { transition: none; }
    .m-sheet-item { opacity: 1; transform: none; }
    .m-reveal { opacity: 1; transform: none; transition: none; }
}
