        * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

        /* Esconde a barra de rolagem em todo o sistema (scroll continua funcionando) */
        * { scrollbar-width: none; -ms-overflow-style: none; }
        *::-webkit-scrollbar { width: 0; height: 0; display: none; }

        @keyframes nexus-magma {
            0%   { border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%; transform: rotate(0deg); }
            25%  { border-radius: 40% 60% 45% 55% / 60% 40% 55% 45%; transform: rotate(90deg); }
            50%  { border-radius: 55% 45% 60% 40% / 45% 55% 45% 55%; transform: rotate(180deg); }
            75%  { border-radius: 45% 55% 40% 60% / 55% 45% 60% 40%; transform: rotate(270deg); }
            100% { border-radius: 60% 40% 55% 45% / 50% 60% 40% 50%; transform: rotate(360deg); }
        }

        .nexus-glow {
            position: absolute;
            inset: -2px;
            background: rgba(14, 165, 233, 0.28);
            filter: blur(7px);
            border-radius: 12px;
        }
        body {
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
            color: #f8fafc;
            min-height: 100vh;
        }

        :root {
            --header-offset-mob: 92px;
            --header-offset-pc: 92px;
        }
        body.header-min {
            --header-offset-mob: 24px;
            --header-offset-pc: 48px;
        }

        #nav-content {
            transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin 0.3s ease;
            max-height: 500px;
            opacity: 1;
        }
        body.header-min #nav-content {
            max-height: 0;
            opacity: 0;
            margin: 0;
            pointer-events: none;
        }
        body.header-min #main-header {
            top: 0 !important;
            background: transparent !important;
            border-color: transparent !important;
            box-shadow: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }

        body.header-min #btn-header-toggle {
            height: 1.75rem;
            bottom: -1.75rem;
            width: 5rem;
        }
        body.header-min #header-toggle-label {
            display: block;
        }

        main.content-main {
            padding-top: 16px;
        }
        @media (min-width: 640px) {
            main.content-main {
                padding-top: 92px;
            }
            body.header-min main.content-main {
                padding-top: 24px;
            }
            #tab-externo,
            #tab-agenda-visual {
                transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            }
            body.header-min #tab-externo,
            body.header-min #tab-agenda-visual {
                top: 24px !important;
            }
        }

        .glass-panel {
            background: #131c2e;
            border: 1px solid rgba(148, 163, 184, 0.12);
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
        }

        /* Campos padrão da Nova OS */
        .labelnv { display: block; font-size: 11px; font-weight: 700; color: #94a3b8; margin-bottom: 4px; }
        .inputnv {
            width: 100%;
            background: rgba(15, 23, 42, 0.55);
            border: 1px solid #334155;
            border-radius: 9px;
            padding: 9px 12px;
            font-size: 14px;
            color: #f1f5f9;
            outline: none;
            transition: border-color .15s, box-shadow .15s;
        }
        .inputnv::placeholder { color: #64748b; }
        .inputnv:focus { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .12); }

        .glass-card {
            background: #182238;
            border: 1px solid rgba(148, 163, 184, 0.10);
            transition: transform 0.2s, border-color 0.2s;
        }
        .glass-card:hover {
            border-color: rgba(99, 102, 241, 0.4);
            transform: translateY(-2px);
        }

        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

        .view { display: none !important; }
        .view.active { display: flex !important; }
        .tab-content { display: none !important; }
        .tab-content.active { display: block !important; }

        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        .animate-fade { animation: fadeIn 0.3s ease-out forwards; }

        /* ═══ Tela de Login — Split Screen ═══ */
        #view-login.login-split {
            position: relative;
            padding: 0;
            gap: 0;
            overflow-x: hidden;
            overflow-y: auto;
            align-items: stretch;
            justify-content: flex-end;
            min-height: 100dvh;
            background: #0c1426;
        }
        /* Foto full-bleed nítida no fundo inteiro (fixa: não rola junto do conteúdo) */
        #view-login.login-split::before {
            content: "";
            position: fixed;
            inset: 0;
            z-index: 0;
            background: url('../assets/icons/fundo.png') center center / cover no-repeat;
        }
        /* Bloco de marca ancorado ao rodapé-esquerdo (fora do técnico) */
        .login-brand {
            position: absolute;
            left: 0;
            bottom: 0;
            z-index: 1;
            max-width: min(620px, 62%);
            padding: clamp(2rem, 5vw, 4.75rem);
            color: #eaf1fb;
            pointer-events: none;
            background:
                linear-gradient(0deg, rgba(3,7,20,.88) 0%, rgba(3,7,20,.55) 42%, rgba(3,7,20,0) 100%),
                linear-gradient(90deg, rgba(3,7,20,.62) 0%, rgba(3,7,20,0) 82%);
        }
        .login-eyebrow {
            align-self: flex-start;
            display: inline-flex;
            align-items: center;
            gap: .5rem;
            margin-bottom: 1.35rem;
            padding: .38rem .9rem;
            font-size: 12.5px;
            font-weight: 700;
            letter-spacing: .18em;
            text-transform: uppercase;
            color: #7dd3fc;
            border: 1px solid rgba(14,165,233,.38);
            border-radius: 999px;
            background: rgba(14,165,233,.10);
            box-shadow: 0 2px 12px rgba(14,165,233,.15);
        }
        .login-headline {
            margin: 0 0 1.1rem;
            font-size: clamp(2.1rem, 4.4vw, 3.5rem);
            font-weight: 800;
            line-height: 1.06;
            letter-spacing: -.025em;
            text-shadow: 0 2px 24px rgba(0,0,0,.55);
        }
        /* Efeito ShinyText (CSS puro): degradê azul→branco→laranja varrendo */
        .login-headline .hl-accent {
            background-image: linear-gradient(110deg,
                #0EA5E9 0%, #38bdf8 28%, #ffffff 50%, #fdba74 70%, #F97316 100%);
            background-size: 220% auto;
            background-position: 0% center;
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            color: transparent;
        }

        /* Wordmark grande acima do card de login */
        .login-wordmark {
            position: relative;
            z-index: 6;
            text-align: center;
            white-space: nowrap;
            font-weight: 900;
            letter-spacing: .005em;
            line-height: 1;
            font-size: clamp(2.7rem, 6vw, 4.6rem);
            margin-bottom: 1rem;
            pointer-events: none;
        }
        /* Brilho suave atrás do wordmark (estilo .nexus-glow da logo) */
        .login-wordmark::before {
            content: "";
            position: absolute;
            inset: -18% -8%;
            z-index: -1;
            pointer-events: none;
            border-radius: 999px;
            filter: blur(30px);
            background:
                radial-gradient(55% 120% at 28% 50%, rgba(37,99,235,.36), transparent 72%),
                radial-gradient(55% 120% at 72% 50%, rgba(124,58,237,.36), transparent 72%);
        }
        /* Pontinhos de luz (estrelas) cintilando atrás do wordmark */
        .login-wordmark::after {
            content: "";
            position: absolute;
            inset: -70% -28%;
            z-index: -1;
            pointer-events: none;
            background-repeat: no-repeat;
            background-image:
                radial-gradient(1.6px 1.6px at 8% 32%, #fff, transparent),
                radial-gradient(1.2px 1.2px at 20% 72%, rgba(255,255,255,.85), transparent),
                radial-gradient(1px 1px at 33% 22%, #fff, transparent),
                radial-gradient(2px 2px at 47% 58%, rgba(255,255,255,.9), transparent),
                radial-gradient(1.3px 1.3px at 58% 30%, #fff, transparent),
                radial-gradient(1px 1px at 68% 74%, rgba(255,255,255,.8), transparent),
                radial-gradient(1.7px 1.7px at 80% 40%, #fff, transparent),
                radial-gradient(1.1px 1.1px at 91% 66%, rgba(255,255,255,.85), transparent),
                radial-gradient(1.2px 1.2px at 40% 82%, #fff, transparent),
                radial-gradient(1.4px 1.4px at 74% 18%, #fff, transparent);
            opacity: .6;
        }
        .login-wordmark .wm-nexus,
        .login-wordmark .wm-atlas {
            display: inline-block;
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            color: transparent;
            /* Contorno branco bem fraquinho */
            -webkit-text-stroke: .6px rgba(255,255,255,.18);
            text-stroke: .6px rgba(255,255,255,.18);
            paint-order: stroke fill;
            /* Esvaecimento leve: só o topo das letras dissolve no céu do fundo */
            -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 100%);
                    mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 100%);
            opacity: .96;
        }
        /* Degradê da própria cor, mais escuro (claro em cima → escuro embaixo) */
        .login-wordmark .wm-nexus {
            background-image: linear-gradient(180deg, #3b82f6 0%, #1d4ed8 55%, #1e3a8a 100%);
        }
        .login-wordmark .wm-atlas {
            background-image: linear-gradient(180deg, #a855f7 0%, #6d28d9 55%, #4c1d95 100%);
        }
        .login-sub {
            margin: 0;
            max-width: 44ch;
            font-size: clamp(1rem, 1.25vw, 1.12rem);
            line-height: 1.6;
            color: #cbd8ea;
            text-shadow: 0 1px 12px rgba(0,0,0,.5);
        }
        /* Coluna do formulário: degradê com as cores da foto (navy + azul rede + laranja horizonte) */
        .login-form-side {
            position: relative;
            z-index: 2;
            flex: 0 0 min(720px, 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem 1.6rem;
            background: transparent;
        }
        /* Pilha wordmark + card, envolta por um painel arredondado com blur */
        .login-stack {
            position: relative;
            z-index: 1;
            display: flex;
            flex-direction: column;
            align-items: stretch;
            width: 100%;
            max-width: 42rem;
            min-height: min(88dvh, 720px);
            margin-right: clamp(1rem, 4vw, 3.5rem);
            padding: clamp(1.5rem, 3.5vw, 3rem);
        }
        /* Zona do meio: logo + nome + formulário centralizados */
        .login-stack > .login-card {
            flex: 1 1 auto;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        /* Botões colados no rodapé do painel */
        #login-actions { margin-top: 1.25rem; }
        /* Quadrado de cantos arredondados com blur atrás do card */
        .login-stack::before {
            content: "";
            position: absolute;
            inset: 0;
            z-index: -1;
            pointer-events: none;
            border-radius: 32px;
            background:
                radial-gradient(120% 90% at 20% 0%, rgba(37,99,235,.28), transparent 60%),
                radial-gradient(120% 90% at 90% 100%, rgba(124,58,237,.26), transparent 60%),
                rgba(9,16,32,.52);
            border: 1px solid rgba(148,163,184,.16);
            box-shadow: 0 30px 80px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
            backdrop-filter: blur(18px) saturate(120%);
            -webkit-backdrop-filter: blur(18px) saturate(120%);
        }
        @media (max-width: 900px) {
            /* Empilha em coluna e centraliza — sem herdar o flex-end do desktop */
            #view-login.login-split {
                flex-direction: column;
                justify-content: center;
                align-items: center;
                padding: 1.5rem 1.1rem;
                overflow-x: hidden;
            }
            .login-brand { display: none; }
            #view-login .login-form-side {
                flex: 0 0 auto;
                width: 100%;
                max-width: 100%;
                justify-content: center;
                margin: 0;
                padding: 0;
            }
            /* Foto vertical dedicada ao telefone (com scrim para legibilidade) */
            #view-login.login-split::before {
                background:
                    linear-gradient(180deg, rgba(3,7,20,.55) 0%, rgba(3,7,20,.30) 40%, rgba(3,7,20,.80) 100%),
                    url('../assets/icons/fundo_telefone.png') center center / cover no-repeat;
            }
            /* Painel arredondado centralizado, nunca ultrapassa a largura da tela */
            #view-login .login-stack {
                margin: 0 auto;
                width: 100%;
                max-width: min(30rem, 100%);
                padding: 1.7rem 1.4rem;
            }
            #nexus-gate .gate-bg { background-image: url('../assets/icons/fundo_telefone.png'); }
        }
        /* Janelas baixas: painel abraça o conteúdo e o formulário pode rolar sem cortar */
        @media (max-height: 760px) {
            #view-login .login-stack {
                min-height: auto;
                padding-top: clamp(1.25rem, 3vh, 2rem);
                padding-bottom: clamp(1.25rem, 3vh, 2rem);
            }
            #view-login .login-form-side { padding-top: 1.25rem; padding-bottom: 1.25rem; }
        }
        /* Janelas bem baixas: encolhe respiros do card para caber melhor */
        @media (max-height: 620px) {
            #view-login .login-card .mb-5 { margin-bottom: .85rem; }
            #view-login .login-card .mb-7 { margin-bottom: 1rem; }
            #view-login .login-wordmark { margin-bottom: .5rem; }
        }
        /* Achatou mais: some a logo (ícone) para ganhar altura */
        @media (max-height: 560px) {
            #view-login #login-logo { display: none; }
        }
        /* Achatou ainda mais: some o subtítulo da logo */
        @media (max-height: 500px) {
            #view-login #login-subtitle { display: none; }
        }
        /* ═══ Card de login moderno ═══ */
        .login-card {
            width: 100%;
            background: transparent;
            border: none;
            border-radius: 22px;
            box-shadow: none;
            padding: 0;
        }
        /* Subcard interno: envolve o campo de login (card dentro do card) */
        .login-subcard:not(.hidden) {
            padding: 1.35rem 1.25rem 1.5rem;
            border-radius: 18px;
            background: rgba(2,6,23,.42);
            border: 1px solid rgba(148,163,184,.14);
            box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 12px 30px rgba(0,0,0,.28);
        }
        /* Mini-botões lado a lado (ícone em cima, texto curto embaixo) */
        .login-mini-btn {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: .3rem;
            padding: .7rem .5rem;
            border-radius: 14px;
            font-size: 11.5px;
            font-weight: 700;
            border: 1px solid rgba(148,163,184,.16);
            background: rgba(2,6,23,.4);
            color: #cbd5e1;
            transition: background .15s, border-color .15s, transform .05s;
        }
        /* Alerta: falta de permissões — pisca em amarelo translúcido */
        .login-mini-alert {
            animation: permsPulse 1.5s ease-in-out infinite;
        }
        @keyframes permsPulse {
            0%, 100% { background: rgba(2,6,23,.4); border-color: rgba(148,163,184,.16); }
            50% { background: rgba(245,158,11,.20); border-color: rgba(245,158,11,.6); }
        }
        /* Badge no canto do botão */
        .mini-badge {
            position: absolute;
            top: -6px;
            right: -6px;
            width: 18px;
            height: 18px;
            border-radius: 999px;
            color: #fff;
            font-size: 9px;
            font-weight: 900;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 0 2px #0f1a2e;
        }
        /* Exclamação vermelha (falta permissão) */
        .login-mini-alert .mini-badge { background: #ef4444; box-shadow: 0 0 0 2px #0f1a2e, 0 2px 6px rgba(239,68,68,.5); }
        /* Check verde (tudo concedido) */
        .login-mini-ok .mini-badge { background: #22c55e; box-shadow: 0 0 0 2px #0f1a2e, 0 2px 6px rgba(34,197,94,.5); }
        .login-mini-btn > i { font-size: 16px; }
        .login-mini-btn:active { transform: translateY(1px); }
        .login-mini-sky > i { color: #38bdf8; }
        .login-mini-sky:hover { border-color: rgba(14,165,233,.45); background: rgba(14,165,233,.10); color: #e0f2fe; }
        .login-mini-amber > i { color: #fbbf24; }
        .login-mini-amber:hover { border-color: rgba(245,158,11,.45); background: rgba(245,158,11,.10); color: #fef3c7; }
        /* Tudo OK: verde fixo, sem piscar */
        .login-mini-green { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.12); color: #dcfce7; }
        .login-mini-green > i { color: #4ade80; }
        .login-mini-green:hover { border-color: rgba(34,197,94,.6); background: rgba(34,197,94,.18); }

        /* Popup centralizado (menu refeito) */
        .login-modal {
            position: fixed;
            inset: 0;
            z-index: 60;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1.25rem;
            background: rgba(3,7,20,.62);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
        }
        .login-modal.hidden { display: none; }
        .login-modal-card {
            position: relative;
            width: 100%;
            max-width: 25rem;
            padding: 1.9rem 1.6rem 1.75rem;
            border-radius: 22px;
            text-align: center;
            background:
                radial-gradient(120% 90% at 20% 0%, rgba(37,99,235,.20), transparent 62%),
                #0f1a2e;
            border: 1px solid rgba(148,163,184,.16);
            box-shadow: 0 34px 90px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.05);
        }
        .login-modal-x {
            position: absolute;
            top: .85rem;
            right: .95rem;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            color: #94a3b8;
            background: none;
            border: none;
            cursor: pointer;
            transition: color .15s, background .15s;
        }
        .login-modal-x:hover { color: #e2e8f0; background: rgba(148,163,184,.12); }
        .login-modal-ico {
            width: 56px;
            height: 56px;
            margin: 0 auto 1rem;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 22px;
        }
        .login-modal-tt {
            font-size: 1.15rem;
            font-weight: 800;
            color: #f1f5f9;
            margin: 0 0 .4rem;
        }
        .login-modal-sub {
            font-size: .82rem;
            line-height: 1.5;
            color: #94a3b8;
            margin: 0;
        }

        .login-field { position: relative; }
        .login-field > .field-ico {
            position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
            color: #64748b; font-size: 14px; pointer-events: none; transition: color .15s;
        }
        .login-field:focus-within > .field-ico { color: #0EA5E9; }
        .login-input {
            width: 100%;
            background: rgba(2,6,23,.5);
            border: 1px solid #26324a;
            border-radius: 12px;
            padding: 12px 42px;
            font-size: 16px;
            color: #f1f5f9;
            outline: none;
            transition: border-color .15s, box-shadow .15s, background .15s;
        }
        .login-input::placeholder { color: #64748b; }
        .login-input:focus {
            border-color: #0EA5E9;
            box-shadow: 0 0 0 3px rgba(14,165,233,.18);
            background: rgba(2,6,23,.7);
        }
        .pass-toggle {
            position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
            width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
            color: #64748b; background: none; border: none; cursor: pointer; border-radius: 8px;
            transition: color .15s, background .15s;
        }
        .pass-toggle:hover { color: #cbd5e1; background: rgba(148,163,184,.1); }
        .login-btn {
            width: 100%; padding: 12px; border-radius: 12px;
            font-weight: 700; font-size: 15px; color: #fff;
            background: linear-gradient(135deg, #0EA5E9, #0284C7);
            border: 1px solid rgba(56,189,248,.4);
            box-shadow: 0 10px 26px rgba(14,165,233,.28);
            transition: filter .15s, transform .05s;
        }
        .login-btn:hover { filter: brightness(1.08); }
        .login-btn:active { transform: translateY(1px); }

        /* Modal "Como deseja acessar?" — cards de opção */
        .access-opt {
            display: flex; align-items: center; gap: 14px; width: 100%;
            padding: 14px 16px; border-radius: 16px; text-align: left; cursor: pointer;
            background: rgba(2,6,23,.4);
            border: 1px solid rgba(148,163,184,.14);
            transition: transform .15s, border-color .15s, background .15s, box-shadow .15s;
        }
        .access-opt:hover { transform: translateY(-2px); }
        .access-opt .ao-ico {
            width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
            display: flex; align-items: center; justify-content: center; font-size: 18px;
        }
        .access-opt .ao-tt { font-weight: 700; font-size: 15px; color: #f1f5f9; }
        .access-opt .ao-ds { font-size: 12px; color: #94a3b8; margin-top: 1px; }
        .access-opt .ao-arrow { margin-left: auto; color: #475569; transition: transform .15s, color .15s; }
        .access-opt:hover .ao-arrow { transform: translateX(3px); }
        .access-opt.ao-sky .ao-ico { background: rgba(14,165,233,.15); color: #38bdf8; }
        .access-opt.ao-sky:hover { border-color: rgba(14,165,233,.5); background: rgba(14,165,233,.08); box-shadow: 0 10px 30px rgba(14,165,233,.15); }
        .access-opt.ao-sky:hover .ao-arrow { color: #38bdf8; }
        .access-opt.ao-orange .ao-ico { background: rgba(249,115,22,.15); color: #fb923c; }
        .access-opt.ao-orange:hover { border-color: rgba(249,115,22,.5); background: rgba(249,115,22,.08); box-shadow: 0 10px 30px rgba(249,115,22,.15); }
        .access-opt.ao-orange:hover .ao-arrow { color: #fb923c; }
        .access-opt.ao-green .ao-ico { background: rgba(34,197,94,.15); color: #4ade80; }
        .access-opt.ao-green:hover { border-color: rgba(34,197,94,.5); background: rgba(34,197,94,.08); box-shadow: 0 10px 30px rgba(34,197,94,.15); }
        .access-opt.ao-green:hover .ao-arrow { color: #4ade80; }

        /* Entrada estática do card de login — sem animações */

        /* ═══ Gate de ID da empresa — mesmo tema do login, com morph fluido ═══ */
        #nexus-gate {
            position: fixed; inset: 0; z-index: 9999;
            display: flex; align-items: center; justify-content: center;
            padding: 20px; overflow: hidden;
            opacity: 1; transition: opacity 1.1s cubic-bezier(.4,0,.2,1);
        }
        #nexus-gate.gate--out { opacity: 0; }
        #nexus-gate .gate-bg {
            position: absolute; inset: -40px; z-index: 0;
            background: url('../assets/icons/fundo.png') center center / cover no-repeat;
            filter: blur(18px) brightness(.78);
            transform: scale(1.12);
            transition: filter 1.2s cubic-bezier(.4,0,.2,1), transform 1.2s cubic-bezier(.4,0,.2,1);
        }
        #nexus-gate .gate-scrim {
            position: absolute; inset: 0; z-index: 1;
            background:
                radial-gradient(120% 90% at 20% 0%, rgba(14,165,233,.22), transparent 55%),
                radial-gradient(120% 90% at 95% 100%, rgba(249,115,22,.20), transparent 55%),
                linear-gradient(180deg, rgba(7,12,24,.70), rgba(5,9,20,.86));
            transition: opacity .6s ease;
        }
        #nexus-gate .gate-card {
            position: relative; z-index: 2;
            margin: 0; width: 100%; max-width: 380px;
            transition: transform 1s cubic-bezier(.65,0,.35,1), opacity .9s ease;
            will-change: transform, opacity;
        }
        #nexus-gate.gate--go .gate-bg { filter: blur(0) brightness(1); transform: scale(1); }
        #nexus-gate.gate--go .gate-scrim { opacity: 0; }
        #nexus-gate.gate--go .gate-card { transform: translateX(var(--gate-dx, 0)) scale(.96); opacity: 0; }
        @media (prefers-reduced-motion: reduce) {
            #nexus-gate .gate-bg, #nexus-gate .gate-card, #nexus-gate .gate-scrim,
            #nexus-gate { transition-duration: .01ms; }
        }

        @keyframes tag-destaque {
            0%, 100% {
                box-shadow: 0 0 5px var(--tg, #fff6), 0 0 0px var(--tg, #fff3);
                transform: scale(1) translateX(0);
            }
            30%  { transform: scale(1.06) translateX(-1px); }
            40%  { transform: scale(1.06) translateX(1px); }
            50%  { transform: scale(1.06) translateX(-1px); }
            60%  { transform: scale(1.06) translateX(0); }
            80%  { box-shadow: 0 0 14px var(--tg, #fffa), 0 0 5px var(--tg, #fff8); }
        }
        .tag-destaque-anim {
            animation: tag-destaque 2.4s ease-in-out infinite;
            display: inline-block;
        }

        .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
        .cal-dia {
            aspect-ratio: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            border: 1px solid transparent;
            transition: all 0.2s;
            position: relative;
        }
        .cal-dia:hover:not(:disabled) { background: rgba(99, 102, 241, 0.2); border-color: rgba(99, 102, 241, 0.4); }
        .cal-dia.selecionado { background: #4f46e5; color: white; border-color: #6366f1; }
        .cal-dia.hoje:not(.selecionado) { border-color: #4f46e5; color: #818cf8; }
        .cal-dia:disabled { opacity: 0.3; cursor: not-allowed; }
        .cal-dot {
            position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
            width: 4px; height: 4px; border-radius: 50%; background: #f59e0b;
        }

        #mapa-atribuicao { border-radius: 0.75rem; z-index: 10; }
        .leaflet-popup-content-wrapper { background: #1e293b; color: #f8fafc; border: 1px solid rgba(255,255,255,0.1); }
        .leaflet-popup-tip { background: #1e293b; }
        .leaflet-tooltip { background: #1e293b; color: #f8fafc; border: 1px solid rgba(255,255,255,0.15); box-shadow: 0 4px 12px rgba(0,0,0,0.4); font-size: 12px; padding: 5px 10px; }
        .leaflet-tooltip::before { border-right-color: #1e293b; }

        /* ── MAPA MOBILE ── */
        @media (max-width: 639px) {
            #mapa-mobile-bar { display: flex !important; }
            .mapa-controles-desktop { display: none !important; }

            #painel-lista-os {
                top: auto !important; left: 0 !important; right: 0 !important;
                bottom: 56px !important; width: 100% !important;
                max-height: 55vh !important;
                border-radius: 16px 16px 0 0 !important;
                transform: translateY(calc(100% + 60px));
                transition: transform 0.3s cubic-bezier(.4,0,.2,1);
            }
            #painel-lista-os.mob-open  { transform: translateY(0) !important; }

            #painel-atribuicao {
                top: auto !important; left: 0 !important; right: 0 !important;
                bottom: 56px !important; width: 100% !important;
                max-height: 65vh !important;
                border-radius: 16px 16px 0 0 !important;
                transform: translateY(calc(100% + 60px));
                transition: transform 0.3s cubic-bezier(.4,0,.2,1);
            }
            #painel-atribuicao.mob-open { transform: translateY(0) !important; }

            #painel-lista-os::before, #painel-atribuicao::before {
                content: ''; display: block; width: 36px; height: 4px;
                background: rgba(148,163,184,.35); border-radius: 2px;
                margin: 0 auto 10px;
            }

            /* ── AGENDA (telefone) ── */
            /* Barra de controles: rola na horizontal em vez de cortar botões */
            #tab-agenda-visual > div:first-child {
                justify-content: flex-start;
                overflow-x: auto;
                overflow-y: hidden;
                -webkit-overflow-scrolling: touch;
                scrollbar-width: none;
            }
            #tab-agenda-visual > div:first-child::-webkit-scrollbar { display: none; }
            #tab-agenda-visual > div:first-child > * { flex-shrink: 0; }
            /* Painel de detalhes da OS e filtro: caber na largura do telefone */
            #av-painel-os {
                left: 8px !important; right: 8px !important; width: auto !important;
                top: 64px !important; max-height: calc(100% - 72px) !important; padding: 16px !important;
            }
            #av-filtro-panel { right: 8px !important; left: 8px !important; min-width: 0 !important; }

            /* ── CHAT (telefone) ── */
            /* Container ocupa a altura VISÍVEL (dvh evita a barra do navegador empurrar o input pra fora) */
            #tab-chat { padding: 6px !important; overflow: hidden !important; }
            #tab-chat > div {
                height: calc(100dvh - var(--header-offset-mob) - 44px) !important;
                min-height: 0 !important;
                gap: 6px !important;
            }
            /* Um painel por vez em largura total — neutraliza conflitos de w-full/w-72 */
            #chat-sidebar, #chat-main {
                width: 100% !important; max-width: 100% !important;
                border-radius: 20px !important;
            }
            /* Garante que o painel oculto realmente suma (hidden vence flex) */
            #chat-sidebar.hidden, #chat-main.hidden { display: none !important; }
            /* Input de mensagem pode encolher (min-width:auto empurraria a linha pra fora) */
            #tab-chat input[type="text"] { min-width: 0 !important; }
            /* Área da conversa divide a altura com a barra "Menu Principal" — h-full estouraria e cortaria o input */
            #chat-ativo, #chat-privado-ativo {
                flex: 1 1 0% !important;
                height: auto !important;
                min-height: 0 !important;
            }
            /* Lista de mensagens rola em vez de crescer e empurrar o campo de escrever */
            #chat-mensagens, #chat-priv-mensagens { min-height: 0 !important; }

            /* ── TAREFAS (telefone) — mesma arquitetura do chat ── */
            #tab-tarefas { padding: 6px !important; overflow: hidden !important; }
            #tab-tarefas > div {
                height: calc(100dvh - var(--header-offset-mob) - 44px) !important;
                min-height: 0 !important;
                border-radius: 20px !important;
            }
            /* Um painel por vez em largura total — neutraliza conflitos de w-full/w-80 */
            #tarefas-sidebar, #tarefas-main {
                width: 100% !important; max-width: 100% !important;
            }
            /* Painel oculto realmente some (hidden vence flex) */
            #tarefas-sidebar.hidden, #tarefas-main.hidden { display: none !important; }
            /* Área de detalhe divide a altura com a barra "Ver Lista" — h-full estouraria e cortaria o rodapé */
            #tab-tarefas-desig-detalhe {
                flex: 1 1 0% !important;
                height: auto !important;
                min-height: 0 !important;
            }
            /* Listas/inputs: rolar em vez de crescer, e permitir encolher */
            #tab-tarefas-desig-lista-items { min-height: 0 !important; }
            #tab-tarefas-desig-form > .flex-1 { min-height: 0 !important; }
            #tab-tarefas input[type="text"] { min-width: 0 !important; }
            /* Reduz o padding lateral generoso (px-8) para aproveitar a tela */
            #tab-tarefas .px-8 { padding-left: 1rem !important; padding-right: 1rem !important; }

            /* ── LEMBRETES (telefone) — sidebar colapsável, um painel por vez (como Chat/Tarefas) ── */
            #tab-lembreites { padding: 6px !important; overflow: hidden !important; }
            #tab-lembreites > div {
                height: calc(100dvh - var(--header-offset-mob) - 44px) !important;
                min-height: 0 !important;
                border-radius: 20px !important;
            }
            /* Um painel por vez em largura total */
            #lemb-sidebar, #lemb-main {
                width: 100% !important; max-width: 100% !important;
            }
            /* Painel oculto realmente some (hidden vence flex) */
            #lemb-sidebar.hidden, #lemb-main.hidden { display: none !important; }
            /* Cabeçalho da área principal: quebra em vez de estourar a largura */
            #lemb-main-header {
                flex-wrap: wrap !important; gap: 8px !important; padding: 10px 12px !important;
            }
            #lemb-main > div:last-child { min-height: 0 !important; }
            #lemb-view-lista, #lemb-view-agenda, #lemb-view-calendario {
                padding-left: 10px !important; padding-right: 10px !important;
            }
            #lemb-btn-lista, #lemb-btn-agenda, #lemb-btn-cal { padding: 6px 10px !important; }
        }
        @media (min-width: 640px) { #mapa-mobile-bar { display: none !important; } }

        .av-tec-col.av-drop-zone { background: rgba(99,102,241,0.09) !important; }
        .av-os-block { transition: opacity 0.15s, filter 0.15s; user-select: none; }
        .av-os-block:hover { filter: brightness(1.2); }
        .av-os-block:active { cursor: grabbing; }

        #signature-pad { touch-action: none; background: #cbd5e1; border-radius: 0.5rem; }

        /* Loading overlay */
        #loading-firebase {
            position: fixed; inset: 0; z-index: 9999;
            background: #020617;
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
        }
        #loading-firebase.hidden { display: none; }
        .spinner {
            width: 40px; height: 40px; border: 3px solid rgba(99,102,241,0.2);
            border-top-color: #6366f1; border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        @keyframes spin { to { transform: rotate(360deg); } }

        /* ── MÃO TÉCNICA — scroll apenas vertical ── */
        #view-tecnico,
        #modal-exec-os,
        #modal-detalhe-os-tec,
        #modal-agenda-tec,
        #modal-nao-exec {
            max-width: 100vw;
            overflow-x: hidden;
        }
        #view-tecnico .flex-1,
        #modal-exec-os .flex-1 {
            overflow-x: hidden;
        }
        /* garante que textos longos quebrem dentro dos cards da mão técnica */
        #view-tecnico p,
        #view-tecnico span,
        #view-tecnico div,
        #modal-exec-os p,
        #modal-exec-os span,
        #modal-detalhe-os-tec p,
        #modal-detalhe-os-tec span {
            word-break: break-word;
            overflow-wrap: break-word;
        }
        /* exceção: o seletor de dias da mão técnica pode rolar pro lado */
        #view-tecnico .scrollbar-none {
            overflow-x: auto !important;
        }

        /* ── IA CHAT ── */
        @keyframes ia-bounce {
            0%,80%,100% { transform: translateY(0); opacity:.4; }
            40%          { transform: translateY(-5px); opacity:1; }
        }
        .ia-dot {
            display: inline-block; width: 7px; height: 7px; border-radius: 50%;
            background: #a78bfa;
            animation: ia-bounce 1.2s infinite ease-in-out;
        }
        .ia-dot:nth-child(2) { animation-delay: .15s; }
        .ia-dot:nth-child(3) { animation-delay: .30s; }
        .ia-link {
            color: #818cf8; text-decoration: underline; text-underline-offset: 2px;
            word-break: break-all;
        }
        .ia-link:hover { color: #a5b4fc; }
        .ia-bubble-copy {
            opacity: 0; transition: opacity .15s;
        }
        .ia-msg-row:hover .ia-bubble-copy { opacity: 1; }
        #tab-ia.active { display: flex !important; flex-direction: column; }

        /* ── VoIP softphone ── */
        .voip-tecla {
            aspect-ratio: 1;
            display: flex; align-items: center; justify-content: center;
            background: rgba(30,41,59,0.7);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 12px;
            font-size: 20px; font-weight: 800;
            color: #e2e8f0;
            cursor: pointer;
            transition: background 0.15s, transform 0.1s;
            -webkit-tap-highlight-color: transparent;
        }
        .voip-tecla:active { background: rgba(99,102,241,0.3); transform: scale(0.93); }
        #voip-ctrls-chamada.hidden { display: none !important; }
        #voip-ctrls-chamada { display: flex; }

        /* ── Chat (aba do gestor) em tela cheia no celular — sem card ── */
        @media (max-width: 767.98px) {
            #tab-chat { margin: -1rem; }
            #tab-chat > div {
                gap: 0;
                min-height: 0;
                height: calc(100vh - 128px);
                height: calc(100dvh - 128px);
            }
            #tab-chat .glass-panel {
                background: transparent;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                border: 0;
                border-radius: 0;
                box-shadow: none;
            }
        }
        @media (min-width: 640px) and (max-width: 767.98px) {
            #tab-chat { margin: -1.5rem; }
        }
        
        .custom-scrollbar::-webkit-scrollbar { width: 4px; height: 4px; }
        .custom-scrollbar::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
        .custom-scrollbar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
        .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
        .custom-date-input::-webkit-calendar-picker-indicator { filter: invert(0.6) sepia(1) hue-rotate(180deg) saturate(2); cursor: pointer; opacity: 0.7; }
        .custom-date-input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

        /* Esconder setas (spin buttons) de inputs numéricos no Webkit/Firefox */
        input[type="number"]::-webkit-inner-spin-button,
        input[type="number"]::-webkit-outer-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        input[type="number"] {
            -moz-appearance: textfield;
        }

/* ═══════ ATLAS — aba Mapa (tab-mapa) ═══════ */
/* Cria um stacking context no container do Leaflet: os panes internos
   (z-index 200–700) ficam presos aqui dentro e não cobrem os painéis
   flutuantes (z-10+) da aba. Mesma técnica do #mapa-atribuicao. */
#ax-mapa { position: relative; z-index: 0; }
/* Pino em gota: círculo colorido com ícone, rotacionado para formar a ponta */
.ax-pin {
    width: 34px; height: 34px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: var(--ax-cor, #0EA5E9);
    border: 2.5px solid #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,.55);
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s ease;
}
.ax-pin i {
    transform: rotate(45deg);
    color: #fff; font-size: 13px;
    text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.ax-sel .ax-pin { transform: rotate(-45deg) scale(1.25); box-shadow: 0 0 0 4px rgba(14,165,233,.35), 0 3px 12px rgba(0,0,0,.6); }

/* Rótulo de texto livre no mapa */
.ax-text-label {
    font-weight: 800; white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.5);
    transform: translate(-50%, -50%);
    cursor: pointer;
}
.ax-sel .ax-text-label { outline: 2px dashed rgba(14,165,233,.8); outline-offset: 3px; border-radius: 4px; }

/* Tooltip escura padrão do módulo */
.ax-tip {
    background: rgba(11,17,32,.92) !important;
    border: 1px solid rgba(51,65,85,.8) !important;
    color: #f8fafc !important;
    font-size: 11px; font-weight: 700;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.5) !important;
}
.ax-tip::before { display: none; }

/* Ícone de evento EONET */
.ax-eonet-ico {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(11,17,32,.9);
    border: 2px solid var(--ax-cor, #f97316);
    color: var(--ax-cor, #f97316);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    box-shadow: 0 0 10px color-mix(in srgb, var(--ax-cor, #f97316) 60%, transparent);
}

/* Ponto pulsante do GPS */
.ax-gps-dot {
    width: 18px; height: 18px; border-radius: 50%;
    background: #0EA5E9; border: 3px solid #fff;
    box-shadow: 0 0 0 rgba(14,165,233,.6);
    animation: ax-gps-pulse 2s infinite;
}
@keyframes ax-gps-pulse {
    0% { box-shadow: 0 0 0 0 rgba(14,165,233,.55); }
    70% { box-shadow: 0 0 0 16px rgba(14,165,233,0); }
    100% { box-shadow: 0 0 0 0 rgba(14,165,233,0); }
}

/* Botões de ação do painel de detalhes */
.ax-det-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 8px 2px; border-radius: 12px;
    background: rgba(30,41,59,.6); color: #94a3b8;
    font-size: 12px; transition: all .15s;
}
.ax-det-btn span { font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.ax-det-btn:hover { background: rgba(51,65,85,.8); color: #fff; }

/* Itens do menu de contexto e da busca */
.ax-ctx-btn, .ax-busca-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%; text-align: left;
    padding: 9px 14px;
    font-size: 12px; font-weight: 600; color: #cbd5e1;
    transition: background .12s, color .12s;
}
.ax-ctx-btn:hover, .ax-busca-item:hover { background: rgba(51,65,85,.5); color: #fff; }

/* Popup Leaflet no tema escuro dentro da aba Mapa */
#tab-mapa .leaflet-popup-content-wrapper, #tab-mapa .leaflet-popup-tip {
    background: rgba(11,17,32,.95); color: #f8fafc;
    border: 1px solid rgba(51,65,85,.7);
}
#tab-mapa .leaflet-container { font-family: inherit; }

/* Marcadores A/B da análise de viabilidade de enlace */
.ax-viab-mk {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--ax-cor, #0EA5E9);
    border: 3px solid #fff;
    color: #fff; font-weight: 900; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--ax-cor, #0EA5E9) 30%, transparent), 0 3px 10px rgba(0,0,0,.55);
    cursor: grab;
}
