﻿/* =============================================================================
   Cardexa Captura · Customer Portal — camada específica do portal do lojista
   Handoff "Customer Portal v1 · ago 2026", seções 3 a 5.

   Carrega DEPOIS de cardexa.css e só acrescenta o que o portal tem e o painel
   interno não: barra horizontal no lugar da lateral, selo de alcance, cartão de
   decisão de crédito, jornada com inspeção embutida, panorama, visor de imagem,
   formulário em coluna e o bloco único de permissão.

   Regra de ouro herdada: use o token, nunca o hex solto.
   Nomes com prefixo cxp- para não colidir com os componentes da fase 1
   (.cx-step é o passo do assistente; .cx-rail e .cx-decision já têm outro dono).
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Casca — barra horizontal de 64px (handoff §3, "Cabeçalho")
   -------------------------------------------------------------------------- */
.cxp-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--cx-surface); }

.cxp-top {
    height: 64px; flex: none; background: var(--cx-deep);
    border-bottom: 1px solid var(--cx-deep-line); position: sticky; top: 0; z-index: 30;
}
.cxp-top__in {
    max-width: 1440px; margin-inline: auto; height: 100%; padding: 0 var(--cx-s4);
    display: flex; align-items: stretch; gap: var(--cx-s5);
}
.cxp-top__brand { display: flex; align-items: center; flex: none; }
.cxp-top__brand .cx-wordmark { font-size: 19px; }

/* Título da tela ocupa o lugar do menu quando há menos de 2 itens (papel Operador). */
.cxp-top__solo {
    display: flex; align-items: center; font-size: 14px; font-weight: 600;
    color: var(--cx-on-deep); min-width: 0;
}
.cxp-top__solo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cxp-topnav { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; }
.cxp-topnav::-webkit-scrollbar { height: 0; }

.cxp-navitem {
    display: flex; align-items: center; gap: var(--cx-s1); padding: 0 14px;
    text-decoration: none; font-size: 13.5px; font-weight: 500; white-space: nowrap;
    color: var(--cx-on-deep); box-shadow: inset 0 -3px 0 transparent;
}
.cxp-navitem:hover { color: #fff; text-decoration: none; }
.cxp-navitem.is-active { font-weight: 600; color: #fff; box-shadow: inset 0 -3px 0 var(--cx-neon); }
.cxp-navitem__count {
    font-family: var(--cx-mono); font-size: 11px; font-weight: 600;
    background: var(--cx-deep-3); color: var(--cx-neon);
    border-radius: var(--cx-r-pill); padding: 1px 7px;
}

.cxp-top__right { display: flex; align-items: center; gap: var(--cx-s2); flex: none; position: relative; }
.cxp-who { text-align: right; line-height: 1.25; min-width: 0; }
.cxp-who__name { display: block; font-size: 12.5px; font-weight: 600; color: #fff; }
.cxp-who__role { display: block; font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-on-deep-2); }

.cxp-avatar {
    width: 34px; height: 34px; border-radius: var(--cx-r-pill); flex: none; border: none; cursor: pointer;
    background: var(--cx-deep-3); color: var(--cx-neon);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--cx-sans); font-size: 12.5px; font-weight: 600;
}
.cxp-avatar:hover, .cxp-avatar.is-open { background: var(--cx-neon); color: var(--cx-deep); }

/* Menu do usuário — painel claro (handoff §3) */
.cxp-usermenu {
    position: absolute; right: 0; top: calc(100% + 8px); width: 268px; z-index: 40;
    background: var(--cx-card); border: 1px solid var(--cx-border);
    border-radius: var(--cx-r-card); box-shadow: 0 18px 44px rgba(11, 16, 32, .18);
    padding: var(--cx-s2);
}
.cxp-usermenu__head {
    display: flex; align-items: center; gap: var(--cx-s2);
    padding: var(--cx-s2); border-bottom: 1px solid var(--cx-divider); margin-bottom: var(--cx-s1);
}
.cxp-usermenu__id { min-width: 0; }
.cxp-usermenu__name { display: block; font-size: 13.5px; font-weight: 600; color: var(--cx-ink); }
.cxp-usermenu__meta { display: block; font-size: 11.5px; color: var(--cx-ink-3); }
.cxp-usermenu__avatar {
    width: 38px; height: 38px; border-radius: var(--cx-r-pill); flex: none;
    background: var(--cx-deep); color: var(--cx-neon);
    display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.cxp-usermenu__item {
    display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
    padding: 10px 11px; border: none; background: none; cursor: pointer;
    border-radius: 10px; font-family: var(--cx-sans); font-size: 13.5px; font-weight: 500;
    color: var(--cx-ink-2); text-decoration: none;
}
.cxp-usermenu__item:hover { background: var(--cx-row-hover); color: var(--cx-ink); text-decoration: none; }
.cxp-usermenu__item .cx-i { font-size: 19px; color: var(--cx-ink-3); }
/* Nunca esconder sem explicar: o item fora do alcance fica, com cadeado. */
.cxp-usermenu__item--danger { color: var(--cx-error-fg); }
.cxp-usermenu__item--danger .cx-i { color: var(--cx-error); }
.cxp-usermenu__sep { height: 1px; background: var(--cx-divider); margin: var(--cx-s1) 0; }

/* Submenu "Configurações" do menu principal. É IRMÃO da .cxp-topnav de propósito: a barra rola
   no eixo X (overflow-x:auto) e um painel absoluto dentro dela seria clipado pelo overflow.
   O painel reusa os estilos de item do .cxp-usermenu — mesma linguagem visual de dropdown. */
.cxp-navdrop { position: relative; display: flex; align-items: stretch; flex: none; }
.cxp-navdrop__btn {
    background: none; border: none; cursor: pointer;
    font-family: var(--cx-sans); /* button não herda a fonte da barra sozinho */
}
.cxp-navdrop__btn .cx-i { font-size: 17px; }
.cxp-navdrop__panel {
    position: absolute; right: 0; top: calc(100% + 8px); width: 232px; z-index: 40;
    background: var(--cx-card); border: 1px solid var(--cx-border);
    border-radius: var(--cx-r-card); box-shadow: 0 18px 44px rgba(11, 16, 32, .18);
    padding: var(--cx-s2);
}

.cxp-main { flex: 1; }
/* Flex-column com gap, igual ao .cx-content do Dashboard. Sem isto os filhos diretos — alertas,
   cartões, tabelas — encostam um no outro e a tela parece um bloco só. Era a causa dos cards
   "um em cima do outro" em /webhooks, /reports e /credit-policy. */
.cxp-page {
    max-width: 1440px;
    margin-inline: auto;
    padding: var(--cx-s5) var(--cx-s4) var(--cx-s7);
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.cxp-body { display: flex; gap: var(--cx-s4); align-items: flex-start; }
.cxp-body__main { flex: 1; min-width: 0; }

/* Cabeçalho de tela — no portal ele rola junto, não gruda. */
.cxp-head { margin-bottom: var(--cx-s4); }
.cxp-head__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cxp-head__row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cx-s4); flex-wrap: wrap; }
.cxp-head__text { min-width: 0; flex: 1; }
.cxp-head__actions { display: flex; align-items: center; gap: var(--cx-s1); flex: none; flex-wrap: wrap; }
.cxp-head h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
.cxp-head__desc { margin-top: 6px; font-size: 14px; line-height: 1.5; color: var(--cx-ink-3); max-width: 760px; text-wrap: pretty; }

/* Botão pequeno — a fase 1 tem --lg e --block, mas não o compacto que o portal usa
   dentro de cards e da jornada. */
.cx-btn--sm {
    padding: 6px var(--cx-s2); font-size: 12.5px; border-radius: var(--cx-r-field); gap: 5px;
}
.cx-btn--sm .cx-i { font-size: 16px; }

/* -----------------------------------------------------------------------------
   Panorama do dia (handoff §5, "Transações") — faixa escura no topo da lista
   -------------------------------------------------------------------------- */
.cxp-pulse { background: var(--cx-deep); border-radius: var(--cx-r-card); padding: 18px 20px; margin-bottom: var(--cx-s4); }
.cxp-pulse__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cx-s3); margin-bottom: 14px; }
.cxp-pulse__title { font-size: 13px; font-weight: 600; color: #fff; }
.cxp-pulse__cta { font-size: 12.5px; font-weight: 600; color: var(--cx-neon); text-decoration: none; }
.cxp-pulse__cta:hover { color: #fff; }
.cxp-pulse__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--cx-s2); }

.cxp-tile {
    display: flex; flex-direction: column; text-decoration: none; text-align: left;
    background: var(--cx-deep-2); border: 1px solid var(--cx-deep-line);
    border-radius: var(--cx-r-btn); padding: 15px 16px; min-width: 0;
    font-family: var(--cx-sans); cursor: default;
}
a.cxp-tile, button.cxp-tile { cursor: pointer; }
a.cxp-tile:hover, button.cxp-tile:hover { border-color: var(--cx-neon); text-decoration: none; }
.cxp-tile.is-warn { border-color: var(--cx-warning); }
.cxp-tile__value { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: #fff; }
.cxp-tile.is-ok .cxp-tile__value { color: #7EE6C4; }
.cxp-tile.is-warn .cxp-tile__value { color: #F5C972; }
.cxp-tile.is-bad .cxp-tile__value { color: #F0A0A0; }
.cxp-tile__label { font-size: 12.5px; color: var(--cx-on-deep); margin-top: 4px; }
.cxp-tile__meta { font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-on-deep-3); margin-top: 3px; }

/* -----------------------------------------------------------------------------
   Filtros (handoff §5) — busca única + selects + atalhos com contagem
   -------------------------------------------------------------------------- */
.cxp-filters { display: flex; flex-direction: column; gap: var(--cx-s2); margin-bottom: var(--cx-s3); }
.cxp-filters__row { display: flex; gap: var(--cx-s1); flex-wrap: wrap; align-items: center; }
.cxp-search { position: relative; flex: 1; min-width: 260px; }
.cxp-search .cx-i {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    font-size: 19px; color: var(--cx-ink-3); pointer-events: none;
}
.cxp-search .cx-input { padding-left: 38px; }

/* -----------------------------------------------------------------------------
   Selo de alcance — o padrão mais importante do handoff (§3)
   -------------------------------------------------------------------------- */
.cxp-seal {
    display: inline-flex; align-items: center; gap: 5px; border-radius: var(--cx-r-pill);
    padding: 3px 10px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
/* Decide tudo: preenchido. */
.cxp-seal--full { background: var(--cx-warning-fg); color: #fff; }
/* Decide uma etapa: contorno. A distinção é estrutural, não só textual. */
.cxp-seal--step { border: 1px solid var(--cx-info-fg); color: var(--cx-info-fg); background: transparent; }
.cxp-seal .cx-i { font-size: 13px; }

/* -----------------------------------------------------------------------------
   Decisão de crédito — cartão âmbar de largura cheia (handoff §4.1)
   -------------------------------------------------------------------------- */
.cxp-cred {
    border: 2px solid var(--cx-warning); border-radius: var(--cx-r-card);
    background: var(--cx-card); overflow: hidden; margin-bottom: var(--cx-s4);
    box-shadow: 0 1px 2px rgba(11, 16, 32, .05);
}
.cxp-cred__head {
    background: var(--cx-warning-bg); padding: 14px 20px;
    display: flex; align-items: center; gap: var(--cx-s2); flex-wrap: wrap;
}
.cxp-cred__title { font-size: 15px; font-weight: 700; color: var(--cx-warning-fg); }
.cxp-cred__body { padding: 18px 20px 20px; }
.cxp-cred__desc { font-size: 13px; line-height: 1.55; color: var(--cx-ink-3); margin-bottom: var(--cx-s3); max-width: 78ch; }
.cxp-cred__opts { display: flex; flex-direction: column; gap: var(--cx-s1); margin-bottom: var(--cx-s3); }
.cxp-cred__foot { display: flex; align-items: center; gap: var(--cx-s2); flex-wrap: wrap; }

/* Inspeção de etapa — bloco EMBUTIDO, menor, sem sombra (handoff §4.1) */
.cxp-inspect {
    border: 1px solid var(--cx-warning); border-radius: var(--cx-r-btn);
    background: #FEFCF7; padding: 12px 14px; margin-top: var(--cx-s2);
}
.cxp-inspect__head { display: flex; align-items: center; gap: var(--cx-s1); flex-wrap: wrap; margin-bottom: 6px; }
.cxp-inspect__title { font-size: 12.5px; font-weight: 700; color: var(--cx-warning-fg); }
.cxp-inspect__text { font-size: 12.5px; line-height: 1.55; color: var(--cx-ink-2); }
.cxp-inspect__foot { display: flex; align-items: center; gap: var(--cx-s1); flex-wrap: wrap; margin-top: var(--cx-s2); }
.cxp-inspect__after { font-size: 11.5px; color: var(--cx-ink-3); }

/* -----------------------------------------------------------------------------
   Jornada da decisão (handoff §4) — nome próprio para não colidir com .cx-step
   -------------------------------------------------------------------------- */
.cxp-journey { display: flex; flex-direction: column; gap: var(--cx-s4); }
.cxp-jphase__head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--cx-s2); }
.cxp-jphase__label {
    font-family: var(--cx-mono); font-size: 10px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--cx-primary); white-space: nowrap;
}
.cxp-jphase__line { flex: 1; height: 1px; background: var(--cx-border); }
.cxp-jphase__meta { font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-ink-3); }
.cxp-jphase__list { display: flex; flex-direction: column; gap: var(--cx-s2); }

.cxp-jstep {
    display: flex; gap: 14px; align-items: flex-start;
    border: 1px solid var(--cx-border); border-radius: var(--cx-r-btn);
    padding: 14px 16px; background: var(--cx-card);
}
.cxp-jstep.needs-inspection { border-color: var(--cx-warning); background: #FEFCF7; }
.cxp-jnode {
    width: 28px; height: 28px; border-radius: var(--cx-r-pill); flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--cx-surface); color: var(--cx-ink-3);
}
.cxp-jnode .cx-i { font-size: 17px; }
.cxp-jnode--ok { background: var(--cx-success-bg); color: var(--cx-success-fg); }
.cxp-jnode--warn { background: var(--cx-warning-bg); color: var(--cx-warning-fg); }
.cxp-jnode--bad { background: var(--cx-error-bg); color: var(--cx-error-fg); }
.cxp-jstep__body { flex: 1; min-width: 0; }
.cxp-jstep__top { display: flex; align-items: center; gap: var(--cx-s1); flex-wrap: wrap; }
.cxp-jstep__name { font-size: 13.5px; font-weight: 600; color: var(--cx-ink); }
.cxp-jstep__svc { font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-ink-3); }
.cxp-jstep__time { margin-left: auto; font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-ink-3); }
.cxp-jstep__detail { font-size: 12.5px; line-height: 1.55; color: var(--cx-ink-3); margin-top: 6px; }

/* -----------------------------------------------------------------------------
   Coluna de identidade fixa (handoff §4.2)
   -------------------------------------------------------------------------- */
.cxp-idrail { width: 336px; flex: none; position: sticky; top: calc(64px + var(--cx-s3)); }
.cxp-idrail__card { background: var(--cx-deep); border-radius: var(--cx-r-card); padding: 20px; color: #fff; }
.cxp-idrail__who { display: flex; align-items: center; gap: var(--cx-s2); margin-bottom: var(--cx-s3); }
.cxp-idrail__avatar {
    width: 44px; height: 44px; border-radius: var(--cx-r-btn); flex: none;
    background: var(--cx-deep-3); color: var(--cx-neon);
    display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
}
.cxp-idrail__name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.cxp-idrail__cpf { font-family: var(--cx-mono); font-size: 12px; color: var(--cx-on-deep-2); margin-top: 2px; }
.cxp-idrail__facts { display: flex; flex-direction: column; }
.cxp-idrail__fact {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--cx-s2);
    padding: 7px 0; border-top: 1px solid var(--cx-deep-line);
}
.cxp-idrail__fact:first-child { border-top: 0; }
.cxp-idrail__k { font-size: 11.5px; color: var(--cx-on-deep-3); white-space: nowrap; }
.cxp-idrail__v {
    font-size: 13px; font-weight: 600; color: #fff; text-align: right;
    min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.cxp-idrail__v--mono { font-family: var(--cx-mono); font-size: 12.5px; }

/* Onde está a proposta — 4 passos, o atual em ciano */
.cxp-flow { margin-top: var(--cx-s4); padding-top: var(--cx-s3); border-top: 1px solid var(--cx-deep-line); display: flex; flex-direction: column; gap: 14px; }
.cxp-flow__item { display: flex; gap: 11px; align-items: flex-start; }
.cxp-flow__dot { width: 11px; height: 11px; border-radius: var(--cx-r-pill); flex: none; margin-top: 4px; background: var(--cx-deep-line-2); }
.cxp-flow__item.is-done .cxp-flow__dot { background: var(--cx-primary); }
.cxp-flow__item.is-current .cxp-flow__dot { background: var(--cx-neon); box-shadow: 0 0 0 4px rgba(34, 224, 200, .2); }
.cxp-flow__label { display: block; font-size: 13.5px; font-weight: 600; color: var(--cx-on-deep-2); }
.cxp-flow__item.is-done .cxp-flow__label { color: #fff; }
.cxp-flow__item.is-current .cxp-flow__label { font-weight: 700; color: var(--cx-neon); }
.cxp-flow__detail { display: block; font-size: 11.5px; color: var(--cx-on-deep-3); margin-top: 2px; line-height: 1.45; }

/* -----------------------------------------------------------------------------
   Veredito (handoff §4.2) — filete lateral na cor do estado
   -------------------------------------------------------------------------- */
.cxp-verdict {
    background: var(--cx-card); border: 1px solid var(--cx-border);
    border-left: 6px solid var(--cx-ink-4); border-radius: var(--cx-r-card);
    padding: 20px 24px; margin-bottom: var(--cx-s4);
    box-shadow: 0 1px 2px rgba(11, 16, 32, .05);
}
.cxp-verdict--ok { border-left-color: var(--cx-success); }
.cxp-verdict--warn { border-left-color: var(--cx-warning); }
.cxp-verdict--bad { border-left-color: var(--cx-error); }
.cxp-verdict__grid { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cx-s3) var(--cx-s5); }
.cxp-verdict__lead { min-width: 190px; }
.cxp-verdict__row { display: flex; align-items: center; gap: 10px; margin-top: 3px; }
.cxp-verdict__dot { width: 12px; height: 12px; border-radius: var(--cx-r-pill); flex: none; background: var(--cx-ink-4); }
.cxp-verdict--ok .cxp-verdict__dot { background: var(--cx-success); }
.cxp-verdict--warn .cxp-verdict__dot { background: var(--cx-warning); }
.cxp-verdict--bad .cxp-verdict__dot { background: var(--cx-error); }
.cxp-verdict__word { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--cx-ink); }
.cxp-verdict--ok .cxp-verdict__word { color: var(--cx-success); }
.cxp-verdict--warn .cxp-verdict__word { color: var(--cx-warning); }
.cxp-verdict--bad .cxp-verdict__word { color: var(--cx-error); }
.cxp-verdict__reason { font-size: 13px; line-height: 1.55; color: var(--cx-ink-3); margin-top: 7px; max-width: 62ch; }
.cxp-verdict__sep { width: 1px; align-self: stretch; background: var(--cx-border); }
.cxp-verdict__metrics { display: flex; flex-wrap: wrap; gap: var(--cx-s3) var(--cx-s5); flex: 1; }
.cxp-verdict__metric { display: flex; flex-direction: column; gap: 3px; }
.cxp-verdict__mv { font-size: 18px; font-weight: 600; color: var(--cx-ink); }

/* -----------------------------------------------------------------------------
   Aba com cadeado (handoff §4.3) — nunca esconder sem explicar
   -------------------------------------------------------------------------- */
.cx-tab .cx-i { font-size: 15px; vertical-align: -2px; margin-left: 4px; }

/* -----------------------------------------------------------------------------
   Bloco de permissão (handoff §3) — um componente para os oito casos
   -------------------------------------------------------------------------- */
.cxp-perm {
    max-width: 620px; border: 1px solid var(--cx-warning); border-radius: var(--cx-r-card);
    background: var(--cx-warning-bg); padding: 24px 26px;
}
.cxp-perm--inline { margin: var(--cx-s3) 0; }
.cxp-perm__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: var(--cx-r-btn); margin-bottom: 14px;
    background: var(--cx-warning); color: #fff;
}
.cxp-perm__icon .cx-i { font-size: 23px; }
.cxp-perm__title { font-size: 19px; font-weight: 700; letter-spacing: -.015em; color: var(--cx-warning-fg); margin-bottom: 6px; text-wrap: balance; }
.cxp-perm__text { font-size: 13.5px; line-height: 1.6; color: var(--cx-ink-2); max-width: 62ch; }
.cxp-perm__rows { margin: var(--cx-s3) 0; border-top: 1px solid rgba(138, 92, 6, .22); }
.cxp-perm__row {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--cx-s3);
    padding: 9px 0; border-bottom: 1px solid rgba(138, 92, 6, .22);
}
.cxp-perm__k { font-size: 12px; color: var(--cx-warning-fg); white-space: nowrap; }
.cxp-perm__v { font-size: 13px; font-weight: 600; color: var(--cx-ink); text-align: right; }
.cxp-perm__foot { display: flex; gap: var(--cx-s1); flex-wrap: wrap; }

/* -----------------------------------------------------------------------------
   Régua de cobertura de score (handoff §5, "Política de crédito")
   -------------------------------------------------------------------------- */
.cxp-ruler { margin-bottom: var(--cx-s3); }
.cxp-ruler__head { display: flex; align-items: center; justify-content: space-between; gap: var(--cx-s2); margin-bottom: var(--cx-s1); flex-wrap: wrap; }
.cxp-ruler__track { display: flex; height: 30px; border-radius: var(--cx-r-field); overflow: hidden; border: 1px solid var(--cx-border); }
.cxp-ruler__band {
    display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden;
    font-family: var(--cx-mono); font-size: 10.5px; font-weight: 600; white-space: nowrap;
    border-right: 1px solid var(--cx-card);
}
.cxp-ruler__band:last-child { border-right: 0; }
.cxp-ruler__band--ok { background: var(--cx-success-bg); color: var(--cx-success-fg); }
.cxp-ruler__band--warn { background: var(--cx-warning-bg); color: var(--cx-warning-fg); }
.cxp-ruler__band--bad { background: var(--cx-error-bg); color: var(--cx-error-fg); }
/* Lacuna e sobreposição precisam LER como falha, antes de salvar. */
.cxp-ruler__band--gap {
    background: repeating-linear-gradient(45deg, var(--cx-hatch), var(--cx-hatch) 6px, var(--cx-card) 6px, var(--cx-card) 12px);
    color: var(--cx-ink-3);
}
.cxp-ruler__band--over { background: var(--cx-error); color: #fff; }
.cxp-ruler__ends { display: flex; justify-content: space-between; font-family: var(--cx-mono); font-size: 10.5px; color: var(--cx-ink-3); margin-top: 3px; }

/* -----------------------------------------------------------------------------
   Formulário em coluna ao lado da lista (handoff §5, "Lojas")
   -------------------------------------------------------------------------- */
.cxp-sideform { width: 392px; flex: none; position: sticky; top: calc(64px + var(--cx-s3)); }
.cxp-sideform__head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: var(--cx-s2);
    padding: var(--cx-s3) 20px; border-bottom: 1px solid var(--cx-divider);
}
.cxp-sideform__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 20px; }
.cxp-sideform__grid .cx-span-2 { grid-column: span 2; }
.cxp-sideform__foot { display: flex; gap: var(--cx-s1); padding: var(--cx-s3) 20px; border-top: 1px solid var(--cx-divider); }

/* Campo preenchido pelo CEP — a mudança invisível mais confusa do portal (handoff §3) */
.cxp-auto .cx-input { border-color: var(--cx-primary); background: #F4FCFA; }
.cxp-autotag {
    display: inline-flex; align-items: center; gap: 3px; margin-left: 6px;
    font-family: var(--cx-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
    background: var(--cx-container); color: var(--cx-primary);
    border-radius: var(--cx-r-pill); padding: 1px 6px; vertical-align: 1px;
}

/* -----------------------------------------------------------------------------
   Visor de imagem (handoff §3) — barra, setas, miniaturas, Esc
   -------------------------------------------------------------------------- */
.cxp-viewer {
    position: fixed; inset: 0; z-index: 80; background: rgba(11, 16, 32, .92);
    display: flex; flex-direction: column;
}
.cxp-viewer[hidden] { display: none; }
.cxp-viewer__bar {
    flex: none; display: flex; align-items: center; gap: var(--cx-s3);
    padding: var(--cx-s2) var(--cx-s4); border-bottom: 1px solid var(--cx-deep-line-2); color: #fff;
}
.cxp-viewer__name { font-size: 14px; font-weight: 600; }
.cxp-viewer__pos { font-family: var(--cx-mono); font-size: 11.5px; color: var(--cx-on-deep-2); }
.cxp-viewer__tools { margin-left: auto; display: flex; align-items: center; gap: var(--cx-s1); }
.cxp-viewer__btn {
    display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--cx-deep-line-2);
    background: transparent; color: var(--cx-on-deep); cursor: pointer;
    border-radius: var(--cx-r-field); padding: 7px 11px;
    font-family: var(--cx-sans); font-size: 12.5px; font-weight: 500;
}
.cxp-viewer__btn:hover { border-color: var(--cx-neon); color: #fff; }
.cxp-viewer__stage { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--cx-s3); padding: var(--cx-s4); min-height: 0; }
.cxp-viewer__stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--cx-r-btn); }
.cxp-viewer__nav {
    width: 44px; height: 44px; flex: none; border-radius: var(--cx-r-pill); cursor: pointer;
    border: 1px solid var(--cx-deep-line-2); background: var(--cx-deep-2); color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.cxp-viewer__nav:hover { border-color: var(--cx-neon); }
.cxp-viewer__thumbs { flex: none; display: flex; gap: var(--cx-s1); justify-content: center; padding: var(--cx-s2) var(--cx-s4) var(--cx-s4); flex-wrap: wrap; }
.cxp-viewer__thumb {
    width: 54px; height: 40px; border-radius: 7px; cursor: pointer; padding: 0; overflow: hidden;
    border: 2px solid transparent; opacity: .5; background: var(--cx-hatch);
}
.cxp-viewer__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cxp-viewer__thumb.is-active { border-color: var(--cx-neon); opacity: 1; }

/* Etiqueta de grupo na galeria (identidade / proposta) */
.cx-shot__group {
    font-family: var(--cx-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--cx-ink-3);
}

/* -----------------------------------------------------------------------------
   Barras dos relatórios — empilhadas por dia, com token (handoff §5)
   -------------------------------------------------------------------------- */
.cxp-chart { display: flex; align-items: flex-end; gap: 3px; height: 200px; }
.cxp-chart__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; border-radius: 4px; overflow: hidden; min-width: 0; }
.cxp-chart__seg { display: block; width: 100%; }
.cxp-chart__seg--ok { background: var(--cx-primary); }
.cxp-chart__seg--warn { background: var(--cx-warning); }
.cxp-chart__seg--bad { background: var(--cx-error); }

.cxp-rank { display: flex; flex-direction: column; gap: 14px; }
.cxp-rank__item { display: block; width: 100%; text-align: left; border: none; background: none; padding: 0; cursor: default; font-family: var(--cx-sans); }
button.cxp-rank__item { cursor: pointer; }
button.cxp-rank__item:hover { opacity: .72; }
.cxp-rank__top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--cx-s2); margin-bottom: 5px; }
.cxp-rank__label { font-size: 12.5px; color: var(--cx-ink-2); }
.cxp-rank__count { font-family: var(--cx-mono); font-size: 11.5px; font-weight: 600; color: var(--cx-ink-3); }
.cxp-rank__track { height: 8px; border-radius: var(--cx-r-pill); background: var(--cx-divider); overflow: hidden; }
.cxp-rank__bar { display: block; height: 100%; border-radius: var(--cx-r-pill); background: var(--cx-primary); }
.cxp-rank__bar--bad { background: var(--cx-error); }
.cxp-rank__bar--warn { background: var(--cx-warning); }
/* F2: barra empilhada (Por loja) — segmentos lado a lado no mesmo trilho */
.cxp-rank__track--stack { display: flex; }
.cxp-rank__track--stack .cxp-rank__bar { border-radius: 0; }

.cx-foot-note { font-size: 11.5px; color: var(--cx-ink-3); margin-top: 14px; }

/* ── Funil de conversão (cxp-fn) — redesenho do designer (design/entrega-funil, 31/08/2026).
   A trilha de cada etapa é uma régua do total capturado: teal = seguiram, tique vermelho =
   perdidas, hachura = ainda em jogo. Saídas laterais penduradas no degrau. Só este card usa;
   o cxp-rank continua servindo os rankings. ─────────────────────────────────────────── */
.cxp-fn {
    --cxp-fn-track: 12px;   /* altura da trilha do caminho felizado */
    /* "ainda em jogo": hachura montada com os dois tokens de linha do tema */
    --cxp-fn-open: repeating-linear-gradient(135deg,
        var(--cx-border) 0 3px, var(--cx-divider) 3px 7px);
}

/* ── Cabeçalho: o número que o card existe para dar ───────────────────────────────────── */
.cxp-fn__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px var(--cx-s1);
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cx-divider);
    margin-bottom: var(--cx-s2);
}
.cxp-fn__headline {
    font-family: var(--cx-mono);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--cx-primary);
    font-variant-numeric: tabular-nums;
}
.cxp-fn__headline-note {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--cx-ink-2);
    flex: 1 1 190px;
}
.cxp-fn__headline-note b { font-family: var(--cx-mono); font-weight: 600; color: var(--cx-ink); }

/* Legenda das três leituras da trilha. */
.cxp-fn__legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    margin-left: auto;
    font-size: 11.5px;
    color: var(--cx-ink-3);
}
.cxp-fn__legend > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.cxp-fn__key {
    width: 10px; height: 10px; border-radius: 3px; flex: none;
    background: var(--cx-divider);
}
.cxp-fn__key--go   { background: var(--cx-primary); }
.cxp-fn__key--lost { background: var(--cx-error-bg); box-shadow: inset 2px 0 0 var(--cx-error); }
.cxp-fn__key--open { background: var(--cxp-fn-open); }

/* ── Etapa do caminho felizado ────────────────────────────────────────────────────────── */
/* Reset do <button> junto: a etapa é a mesma caixa, clicável ou não. */
.cxp-fn__stage {
    display: block;
    width: 100%;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    background: none;
    padding: 0;
    font-family: var(--cx-sans);
    color: inherit;
}
.cxp-fn__stage-top {
    display: flex;
    align-items: baseline;
    gap: var(--cx-s1);
    margin-bottom: 6px;
}
.cxp-fn__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cx-ink);
    min-width: 0;
}
.cxp-fn__pct {
    font-family: var(--cx-mono);
    font-size: 11.5px;
    color: var(--cx-ink-3);
    font-variant-numeric: tabular-nums;
}
.cxp-fn__count {
    margin-left: auto;
    font-family: var(--cx-mono);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--cx-ink);
    font-variant-numeric: tabular-nums;
    flex: none;
}

/* A trilha é uma régua única: a soma dos segmentos pintados = a etapa ANTERIOR.
   O encolhimento do teal de cima para baixo É o funil. */
.cxp-fn__track {
    display: flex;
    height: var(--cxp-fn-track);
    border-radius: var(--cx-r-pill);
    background: var(--cx-divider);
    overflow: hidden;
}
.cxp-fn__seg { display: block; height: 100%; min-width: 0; }
.cxp-fn__seg--go   { background: var(--cx-primary); }
.cxp-fn__seg--lost { background: var(--cx-error-bg); box-shadow: inset 2px 0 0 var(--cx-error); }
.cxp-fn__seg--open { background: var(--cxp-fn-open); }

/* ── O degrau: a queda entre duas etapas, com as saídas laterais penduradas nele ───────── */
.cxp-fn__step {
    margin: var(--cx-s1) 0 var(--cx-s1) 14px;
    padding-left: 18px;
    border-left: 1.5px dashed var(--cx-border);
}
.cxp-fn__rate {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 3px 6px;
    padding: 6px 0 2px;
    font-size: 12px;
    color: var(--cx-ink-2);
}
.cxp-fn__rate b {
    font-family: var(--cx-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--cx-ink);
    font-variant-numeric: tabular-nums;
}
.cxp-fn__delta {
    font-family: var(--cx-mono);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--cx-error-fg);
    background: var(--cx-error-bg);
    border-radius: var(--cx-r-pill);
    padding: 1px 7px;
    font-variant-numeric: tabular-nums;
}
.cxp-fn__delta--none { color: var(--cx-ink-3); background: var(--cx-divider); }

/* Bloco das saídas: fundo próprio, tipo menor, recuado. É o "fora do caminho". */
.cxp-fn__exits {
    list-style: none;
    padding: 4px;
    margin: 4px 0 2px;
    display: grid;
    gap: 1px;
    background: var(--cx-subtle);
    border: 1px solid var(--cx-divider);
    border-radius: 10px;
}
.cxp-fn__exit { display: block; }
.cxp-fn__exit-in {
    display: flex;
    align-items: center;
    gap: var(--cx-s1);
    width: 100%;
    padding: 7px var(--cx-s1);
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: 7px;
    background: none;
    font-family: var(--cx-sans);
    font-size: 12.5px;
    color: var(--cx-ink-2);
    text-align: left;
    text-decoration: none;
}
.cxp-fn__exit-key {
    width: 8px; height: 8px; border-radius: 2px; flex: none;
    background: var(--cx-error-bg);
    box-shadow: inset 2px 0 0 var(--cx-error);
}
.cxp-fn__exit--open .cxp-fn__exit-key { background: var(--cxp-fn-open); box-shadow: none; }
.cxp-fn__exit-label { min-width: 0; }
/* O "ainda pode virar" é a informação que o card de hoje perde. */
.cxp-fn__exit-tail { font-size: 11.5px; color: var(--cx-ink-3); font-style: italic; }
.cxp-fn__exit-pct {
    margin-left: auto;
    font-family: var(--cx-mono);
    font-size: 11px;
    color: var(--cx-ink-3);
    font-variant-numeric: tabular-nums;
    flex: none;
}
.cxp-fn__exit-count {
    font-family: var(--cx-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--cx-ink);
    font-variant-numeric: tabular-nums;
    flex: none;
    min-width: 34px;
    text-align: right;
}

/* ── Clicável parece clicável ─────────────────────────────────────────────────────────── */
button.cxp-fn__exit-in, a.cxp-fn__exit-in, button.cxp-fn__stage {
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
/* Chevron em CSS: sem dependência de fonte de ícone. */
.cxp-fn__go {
    flex: none;
    width: 7px; height: 7px;
    margin-left: 2px;
    border-right: 1.5px solid var(--cx-border);
    border-bottom: 1.5px solid var(--cx-border);
    transform: rotate(-45deg);
    transition: border-color .12s ease, transform .12s ease;
}
button.cxp-fn__exit-in:hover, a.cxp-fn__exit-in:hover { background: var(--cx-card); color: var(--cx-primary); }
button.cxp-fn__exit-in:hover .cxp-fn__go, a.cxp-fn__exit-in:hover .cxp-fn__go {
    border-color: var(--cx-primary);
    transform: rotate(-45deg) translate(1px, 1px);
}
button.cxp-fn__exit-in:hover .cxp-fn__exit-count { color: var(--cx-primary); }
button.cxp-fn__stage:hover .cxp-fn__label { color: var(--cx-primary); text-decoration: underline; text-underline-offset: 3px; }
:where(button, a).cxp-fn__exit-in:focus-visible,
button.cxp-fn__stage:focus-visible {
    outline: 2px solid var(--cx-primary);
    outline-offset: 2px;
    border-radius: 7px;
}

/* ── Estados vazios ───────────────────────────────────────────────────────────────────── */
.cxp-fn__blank {
    padding: 34px 20px;
    text-align: center;
    border: 1px dashed var(--cx-border);
    border-radius: 10px;
    background: var(--cx-subtle);
}
.cxp-fn__blank strong { display: block; font-size: 13px; font-weight: 600; }
.cxp-fn__blank span { display: block; font-size: 12.5px; color: var(--cx-ink-3); margin-top: 4px; }
/* Etapa que não pode ser calculada (denominador zero): "—", nunca "0%" nem "NaN". */
.cxp-fn__stage--void .cxp-fn__count,
.cxp-fn__stage--void .cxp-fn__label { color: var(--cx-ink-3); }

/* ── Responsivo ───────────────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
    .cxp-fn { --cxp-fn-track: 10px; }
    .cxp-fn__legend { margin-left: 0; flex-basis: 100%; }
    .cxp-fn__headline { font-size: 22px; }
    .cxp-fn__step { margin-left: 6px; padding-left: 12px; }
    .cxp-fn__exit-pct { display: none; }          /* a % sai antes do número absoluto */
    .cxp-fn__exit-count { margin-left: auto; } /* sem a %, o número herda o empurrão à direita */
    .cxp-fn__exit-tail { display: none; }
}

/* ── Movimento reduzido ───────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .cxp-fn * { transition-duration: .001ms !important; }
}

/* -----------------------------------------------------------------------------
   Diálogo de confirmação (handoff §3) — o alcance é sempre a primeira linha
   -------------------------------------------------------------------------- */
.cxp-confirm__rows { margin: 18px 0; border-top: 1px solid var(--cx-divider); }
.cxp-confirm__row {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--cx-s3);
    padding: 9px 0; border-bottom: 1px solid var(--cx-divider);
}
.cxp-confirm__k { font-size: 12px; color: var(--cx-ink-3); white-space: nowrap; }
.cxp-confirm__v { font-size: 13px; font-weight: 600; color: var(--cx-ink); text-align: right; }
.cxp-confirm__v--scope {
    background: var(--cx-warning-bg); color: var(--cx-warning-fg);
    border-radius: 6px; padding: 2px 8px; display: inline-block;
}

/* Célula com campo editável embutido (código externo) */
.cxp-cellinput { max-width: 170px; }
.cxp-cellinput.is-empty { font-style: italic; color: var(--cx-ink-3); }

/* -----------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
    .cxp-body { flex-wrap: wrap; }
    .cxp-idrail, .cxp-sideform { position: static; width: 100%; }
}
@media (max-width: 720px) {
    .cxp-top__in { gap: var(--cx-s3); padding: 0 var(--cx-s3); }
    .cxp-who { display: none; }
    .cxp-page { padding: var(--cx-s4) var(--cx-s3) var(--cx-s6); }
    .cxp-head h1 { font-size: 23px; }
}
@media print {
    .cxp-top, .cxp-viewer, .cx-backdrop { display: none !important; }
}

/* -----------------------------------------------------------------------------
   Arranque e erro do host — antes viviam no app.css do Metronic
   -------------------------------------------------------------------------- */
.cx-splash {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--cx-surface);
}
.cx-splash .cx-spinner { width: 28px; height: 28px; border-width: 3px; }

/* Overlay de carregamento da casca: cobre a tela inteira, inclusive a barra de cima, para o
   operador não ver menu e conteúdo se montando por partes logo depois do login. */
.cxp-loading {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cx-surface);
}
.cxp-loading__box {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    font-weight: 600;
    color: var(--cx-ink-2);
}
.cxp-loading .cx-spinner { width: 22px; height: 22px; border-width: 3px; }

#blazor-error-ui {
    display: none; position: fixed; left: 0; bottom: 0; width: 100%; z-index: 1000;
    background: var(--cx-error-bg); color: var(--cx-error-fg);
    border-top: 1px solid var(--cx-error);
    padding: 12px 20px; font-size: 13.5px; font-weight: 500;
}
#blazor-error-ui a { color: var(--cx-error-fg); text-decoration: underline; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 9px; text-decoration: none; }

/* Estado de carga padrão (LoadingCard, 31/08/2026): centralizado e com respiro — o card fino
   com spinner de 14px parecia tela quebrada enquanto os dados chegavam. */
.cx-loadingcard {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 140px; color: var(--cx-ink-3); font-size: 13px;
}
.cx-loadingcard .cx-spinner { width: 18px; height: 18px; }
