/* Layout: sidebar à esquerda (altura total) | topbar + conteúdo à direita */

.app-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Loader (usado em ações como envio de e-mail) */
.loader  {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
  border: 3px solid;
  border-color: #FFF #FFF transparent transparent;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
}
.loader::after,
.loader::before {
  content: '';
  box-sizing: border-box;
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  margin: auto;
  border: 3px solid;
  border-color: transparent transparent #FF3D00 #FF3D00;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-sizing: border-box;
  animation: rotationBack 0.5s linear infinite;
  transform-origin: center center;
}
.loader::before {
  width: 32px;
  height: 32px;
  border-color: #FFF #FFF transparent transparent;
  animation: rotation 1.5s linear infinite;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes rotationBack {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 20, 16, 0.55);
    backdrop-filter: blur(2px);
}

.app-loading-overlay__card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 18px;
    border-radius: 16px;
    background: rgba(20, 36, 30, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.app-loading-overlay__text {
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Grid: [ sidebar | topbar ]  /  [ sidebar | main ] */
.app-layout {
    display: grid;
    grid-template-columns: 16rem 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    min-width: 0;
    width: 100%;
    padding: 0.75rem;
    gap: 0.75rem;
    box-sizing: border-box;
}

/* Telas bem pequenas: mais espaço útil para conteúdo */
@media (max-width: 575.98px) {
    .app-layout {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

/* Sidebar colapsável (desktop) */
@media (min-width: 992px) {
    body.sidebar-collapsed .app-layout {
        grid-template-columns: 4.75rem 1fr;
    }

    body.sidebar-collapsed .sidebar.app-sidebar {
        border-radius: 0 1.25rem 1.25rem 0;
    }

    body.sidebar-collapsed .sidebar__brand {
        padding: 0.9rem 0.6rem;
    }

    body.sidebar-collapsed .sidebar__label {
        display: none;
    }

    body.sidebar-collapsed .sidebar__sub {
        display: none !important;
    }

    body.sidebar-collapsed .sidebar__link,
    body.sidebar-collapsed .sidebar__sublink {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    body.sidebar-collapsed .sidebar__text {
        display: none;
    }

    body.sidebar-collapsed .sidebar__ico {
        font-size: 1.25rem;
    }
}

.topbar__sidebar-toggle {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar.app-sidebar {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: 0 8px 28px var(--shadow);
    overflow: hidden;
    position: relative;
    z-index: 1;
    visibility: visible;
    opacity: 1;
}

/* Desktop: sidebar encostada na esquerda, do topo ao rodapé da tela */
@media (min-width: 992px) {
    .app-body {
        padding-left: 0;
    }

    .app-layout {
        padding: 0 0.75rem 0 0;
        gap: 0.75rem;
    }

    .sidebar.app-sidebar {
        border-radius: 0 1.25rem 1.25rem 0;
        border-left: none;
        padding-left: env(safe-area-inset-left);
        box-shadow: 4px 0 28px var(--shadow);
        align-self: stretch;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .sidebar__brand .app-logo--sidebar {
        align-items: flex-start;
        text-align: left;
    }

    .sidebar__brand .app-logo--sidebar .app-logo__text {
        align-items: flex-start;
    }
}

.sidebar__brand {
    padding: 1rem 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar__brand .app-logo--sidebar {
    align-items: center;
    text-align: center;
}

.sidebar__brand .app-logo--sidebar .app-logo__text {
    align-items: center;
}

/* Logo sidebar: sem width/height no HTML — imagem e SVG maiores */
.sidebar__brand .app-logo--sidebar .app-logo__img,
.app-logo--sidebar .app-logo__img--sidebar {
    max-height: 5.75rem !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    object-fit: contain;
    display: block;
}

.sidebar__brand .app-logo--sidebar .app-logo__svg {
    width: clamp(64px, 22vw, 96px) !important;
    height: auto !important;
    max-height: 96px !important;
    display: block;
}

.sidebar__brand .app-logo__name {
    font-size: clamp(1.05rem, 3.5vw, 1.2rem);
}

.sidebar__brand .app-logo__tag {
    font-size: 0.85rem;
}

.topbar {
    grid-column: 2;
    grid-row: 1;
    z-index: 2;
    flex-shrink: 0;
    align-self: stretch;
    padding-top: max(0.5rem, env(safe-area-inset-top));
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    box-shadow: 0 8px 28px var(--shadow);
    overflow: hidden;
}

.app-content {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg);
    -webkit-overflow-scrolling: touch;
}

/* Evita "vazamento" horizontal por textos longos em flex/grid */
.app-content * {
    min-width: 0;
}

.topbar__brand {
    min-width: 0;
}

.topbar__logo-img {
    object-fit: contain;
    flex-shrink: 0;
}

.topbar__logo-badge {
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(145deg, #22c55e, #15803d);
    font-size: 0.65rem;
    letter-spacing: 0.05em;
}

.sidebar__inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 0.75rem 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    box-sizing: border-box;
    min-height: 0;
}

/* Mobile: empilha — topbar, sidebar, conteúdo */
@media (max-width: 991.98px) {
    .app-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    .topbar {
        grid-column: 1;
        grid-row: 1;
    }

    .sidebar.app-sidebar {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
    }

    .app-content {
        grid-column: 1;
        grid-row: 3;
    }

    .sidebar__inner {
        padding: 0 0.75rem 0.75rem;
        min-height: auto;
    }

    .sidebar__brand {
        padding: 0.85rem 0.65rem;
    }

    .sidebar__nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .sidebar__link {
        flex: 1 1 auto;
        justify-content: center;
        min-width: 8rem;
    }
}

.sidebar__label {
    letter-spacing: 0.06em;
    font-size: 0.65rem;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem 0.85rem;
    min-height: 44px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: clamp(0.9rem, 2.8vw, 0.95rem);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar__link:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.sidebar__link.is-active {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.2);
}

.sidebar__ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    opacity: 0.95;
}

/* Logo (login) */
.app-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.5rem;
}

.app-logo--sidebar {
    align-items: flex-start;
    text-align: left;
}

.app-logo--sidebar .app-logo__text {
    align-items: flex-start;
}

.app-logo__mark {
    display: flex;
    justify-content: center;
}

.app-logo--sidebar .app-logo__mark {
    justify-content: flex-start;
}

.app-logo__svg {
    width: clamp(44px, 12vw, 52px);
    height: auto;
    max-height: 52px;
    display: block;
}

.app-logo__img {
    max-height: 48px;
    width: auto;
    max-width: min(100%, 200px);
    object-fit: contain;
    border-radius: 10px;
}

/* Login: tamanhos estáveis (evita escala fracionada em vw = logo embaçada) */
.app-logo--login .app-logo__mark {
    transform: translateZ(0);
}

.app-logo--login .app-logo__svg {
    width: 80px;
    height: 80px;
    max-width: 100%;
    max-height: none;
    flex-shrink: 0;
}

.app-logo--login .app-logo__img {
    max-height: 80px;
    max-width: min(100%, 280px);
    width: auto;
    height: auto;
    flex-shrink: 0;
    object-fit: contain;
    vertical-align: middle;
}

.app-logo__text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.app-logo__name {
    font-weight: 700;
    font-size: clamp(1rem, 4vw, 1.05rem);
    color: var(--text);
    line-height: 1.2;
}

.app-logo__tag {
    font-size: 0.8rem;
    color: var(--muted);
}

.login-brand--with-logo {
    margin-bottom: 1.5rem;
}

.login-brand--with-logo .app-logo--login {
    margin-top: -0.4rem;
}

.login-brand .login-brand__title {
    margin: 1.65rem 0 0;
    font-size: clamp(1.2rem, 4.5vw, 1.35rem);
    font-weight: 600;
    color: var(--text);
}

.login-brand__hint {
    margin: 0.35rem 0 0;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Páginas internas: alinhadas à esquerda da área de conteúdo (junto à sidebar), como Configurações */
.page-card {
    width: 100%;
    max-width: min(72rem, 100%);
    margin-left: 0;
    margin-right: auto;
    padding: clamp(1.1rem, 4vw, 1.75rem) clamp(1rem, 4vw, 1.5rem);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: clamp(12px, 2vw, 16px);
    box-shadow: 0 8px 28px var(--shadow);
}

/* Telas largas (listagens / formulários longos): mais largura útil */
.page-card.page-card--wide {
    max-width: min(112rem, 100%);
}

/* Portal público (/portal/documentos): mais largura para checklist + lista de arquivos */
.portal-doc-upload__card.page-card.page-card--wide {
    max-width: min(96rem, calc(100vw - 1.25rem));
}

.portal-doc-upload__filename {
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.portal-doc-upload__meta {
    min-width: 7.5rem;
}

@media (max-width: 575.98px) {
    .portal-doc-upload__file-row .d-flex {
        flex-direction: column;
    }

    .portal-doc-upload__meta {
        align-self: flex-end;
    }
}

/* Sidebar: submenu sob Cadastro — só visível em Cadastro ou Clientes */
.sidebar__sub:not(.sidebar__sub--open) {
    display: none;
}

.sidebar__sub {
    margin: -0.15rem 0 0.35rem 0.35rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border);
}

.sidebar__sublink {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    min-height: 40px;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: clamp(0.85rem, 2.6vw, 0.92rem);
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar__sublink:hover {
    color: var(--text);
    background: var(--accent-soft);
}

.sidebar__sublink.is-active {
    color: var(--accent);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.2);
}

.cadastro-hub-card {
    transition: box-shadow 0.15s, border-color 0.15s;
    border-color: var(--border) !important;
}

.cadastro-hub-card:hover {
    border-color: rgba(21, 128, 61, 0.35) !important;
    box-shadow: 0 10px 28px var(--shadow) !important;
}

.cliente-form__accordion .accordion-button {
    font-size: 0.95rem;
    font-weight: 600;
}

.cliente-table__actions {
    min-width: 8.5rem;
}

.cliente-grupo-row td {
    background: rgba(21, 128, 61, 0.06);
}

.cliente-grupo-row__label {
    letter-spacing: 0.02em;
}

.cliente-dados-api-th--geral {
    background: rgba(13, 110, 253, 0.12);
}

.cliente-dados-api-th--loc {
    background: rgba(255, 193, 7, 0.2);
}

.cliente-dados-api-th--cont {
    background: rgba(214, 51, 132, 0.12);
}

.cliente-dados-api-th--out {
    background: rgba(25, 135, 84, 0.12);
}

.cliente-dados-api-toggle {
    background: var(--card, #fff);
}

.cliente-dados-api-toggle:hover {
    background: var(--accent-soft, rgba(21, 128, 61, 0.06));
}

@media (max-width: 575.98px) {
    .page-card--settings .nav-tabs .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.65rem;
    }
}

.settings-thumb {
    min-height: 100px;
}

.settings-thumb--login {
    min-height: 120px;
}

.settings-thumb__img {
    max-height: 72px;
    width: auto;
    object-fit: contain;
}

.settings-thumb--login .settings-thumb__img {
    max-height: 88px;
}

.settings-timbrado-preview {
    aspect-ratio: 210 / 297;
    max-height: 360px;
    background: var(--bs-light, #f8f9fa);
}

.settings-timbrado-preview__img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center center;
}

/* CRM: Funil */
.crm-stage {
    border-radius: 14px;
}

.crm-pipeline {
    /* Puxa um pouco para a esquerda para dar folga visual */
    margin-left: -0.25rem;
    margin-right: 0.25rem;
}

.crm-pipeline__track {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.25rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    /* Esconde a barra horizontal sem remover o scroll */
    scrollbar-width: none; /* Firefox */
}

.crm-pipeline__track::-webkit-scrollbar {
    height: 0; /* Chrome/Safari/Edge */
}

.crm-pipeline__col {
    flex: 1 1 15.5rem; /* cresce para ocupar espaço livre */
    min-width: 15.5rem;
    max-width: 20rem;  /* evita colunas gigantes em telas muito largas */
    scroll-snap-align: start;
}

@media (min-width: 1200px) {
    .crm-pipeline__col {
        flex-basis: 16rem;
        min-width: 16rem;
    }
}

/* Funil responsivo: no mobile empilha colunas (sem rolagem horizontal) */
@media (max-width: 991.98px) {
    .crm-pipeline__track {
        flex-wrap: wrap;
        overflow-x: hidden;
        overflow-y: visible;
        padding-bottom: 0;
        scroll-snap-type: none;
    }

    .crm-pipeline__col {
        flex: 1 1 100%;
        min-width: 0;
        max-width: none;
    }
}

.crm-dropzone {
    min-height: 120px;
}

.crm-lead {
    border-radius: 12px;
    cursor: grab;
    user-select: none;
    overflow: visible;
    position: relative;
}

.crm-lead:active {
    cursor: grabbing;
}

.crm-lead__actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity .15s ease, transform .15s ease;
}

.crm-lead__action {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: rgba(31, 45, 46, 0.75);
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.crm-lead__action--success {
    color: rgba(20, 108, 67, 0.9);
    border-color: rgba(25, 135, 84, 0.22);
}

.crm-lead:hover .crm-lead__actions,
.crm-lead:focus-within .crm-lead__actions {
    opacity: 1;
    transform: translateY(0);
}

/* Evita texto estourando em flex dentro do card */
.crm-lead .card-body,
.crm-lead .d-flex {
    min-width: 0;
}

.crm-lead .text-truncate {
    max-width: 100%;
}

.crm-lead .crm-lead__meta {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Título do lead: 2 linhas para não “cortar” */
.crm-lead__title {
    font-weight: 700;
    line-height: 1.15;
    font-size: 0.95rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* CRM: Card moderno do funil */
.crm-lead2 {
    padding: 0.35rem 0.35rem 0.2rem;
}

.crm-lead2__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.crm-lead2__avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--stage-fg, #0f5132);
    background: var(--stage-bg, rgba(25,135,84,0.16));
    border: 1px solid var(--stage-border, rgba(25,135,84,0.28));
    flex: 0 0 auto;
}

.crm-lead2.is-stage-visita {
    --stage-bg: rgba(13,110,253,0.14);
    --stage-border: rgba(13,110,253,0.30);
    --stage-fg: #0b3d91;
}
.crm-lead2.is-stage-diagnostico {
    --stage-bg: rgba(13,202,240,0.16);
    --stage-border: rgba(13,202,240,0.32);
    --stage-fg: #055160;
}
.crm-lead2.is-stage-proposta {
    --stage-bg: rgba(255,193,7,0.18);
    --stage-border: rgba(255,193,7,0.35);
    --stage-fg: #664d03;
}
.crm-lead2.is-stage-negociacao {
    --stage-bg: rgba(108,117,125,0.18);
    --stage-border: rgba(108,117,125,0.33);
    --stage-fg: #343a40;
}
.crm-lead2.is-stage-contratado {
    --stage-bg: rgba(25,135,84,0.16);
    --stage-border: rgba(25,135,84,0.30);
    --stage-fg: #0f5132;
}
.crm-lead2.is-stage-documentos {
    --stage-bg: rgba(33,37,41,0.10);
    --stage-border: rgba(33,37,41,0.22);
    --stage-fg: #212529;
}

.crm-lead2__amount {
    font-weight: 800;
    font-size: 0.98rem;
    color: #1f2d2e;
    text-align: right;
    min-width: 0;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-lead2__amount.is-high {
    color: #146c43;
}

.crm-lead2__mid {
    margin-top: 0.45rem;
    min-width: 0;
}

.crm-lead2__name {
    font-weight: 700;
    font-size: 0.98rem;
    line-height: 1.15;
    color: #1f2d2e;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crm-lead2__contact {
    margin-top: 0.15rem;
    font-size: 0.82rem;
    color: #51646b;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.crm-lead2__id {
    margin-top: 0.2rem;
    font-size: 0.78rem;
    color: #6c7a80;
    overflow-wrap: anywhere;
}

.crm-lead2__divider {
    height: 1px;
    background: rgba(0,0,0,0.06);
    margin: 0.45rem 0 0.35rem;
}

.crm-lead2__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.crm-lead2__tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.10);
    border: 1px solid rgba(13, 110, 253, 0.16);
    color: #1b4d9b;
    font-weight: 600;
    font-size: 0.78rem;
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-lead2__right {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.crm-lead2__days {
    font-size: 0.78rem;
    color: #6c7a80;
    padding: 0.16rem 0.45rem;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.55);
    white-space: nowrap;
}

.crm-lead2__days.is-stale {
    color: #b02a37;
    border-color: rgba(220,53,69,0.25);
    background: rgba(220,53,69,0.06);
}

.crm-lead2__score {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.crm-lead2__ring {
    --p: 0;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background:
        conic-gradient(var(--ring) calc(var(--p) * 1%), rgba(0,0,0,0.10) 0);
    display: grid;
    place-items: center;
    position: relative;
}

.crm-lead2__ring::after {
    content: '';
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: rgba(255,255,255,0.88);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}

.crm-lead2__scoreText {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
    text-align: right;
}

.crm-lead2__scoreLabel {
    font-size: 0.68rem;
    color: #6c7a80;
}

.crm-lead2__scoreVal {
    font-weight: 800;
    font-size: 0.82rem;
    color: #1f2d2e;
}

.crm-lead2__score.is-good { --ring: rgba(25,135,84,0.95); }
.crm-lead2__score.is-warn { --ring: rgba(255,193,7,0.95); }
.crm-lead2__score.is-bad  { --ring: rgba(220,53,69,0.95); }

/* Lixeira do funil (dropzone) */
.crm-trash {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 50;
}

.crm-trash__zone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 0.85rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    border: 1px dashed rgba(220,53,69,0.45);
    box-shadow: 0 10px 26px rgba(0,0,0,0.10);
    color: #b02a37;
    font-weight: 800;
    min-height: 44px;
    min-width: 120px;
    cursor: pointer;
    user-select: none;
}

.crm-trash__zone.is-active {
    background: rgba(220,53,69,0.08);
    border-style: solid;
    transform: translateY(-1px);
}

.crm-lead__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    min-width: 0;
}

.crm-lead__main {
    min-width: 0;
    flex: 1 1 auto;
}

.crm-lead__side {
    flex: 0 0 auto;
    text-align: right;
    min-width: 6.4rem;
}

.crm-lead__sub {
    font-size: 0.78rem;
    line-height: 1.25;
    margin-top: 0.15rem;
    overflow-wrap: anywhere;
}

.crm-lead__money {
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1.15;
    margin-top: 0.05rem;
}

.crm-lead__pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.06);
    border: 1px solid rgba(13, 110, 253, 0.12);
}

.crm-ghost {
    opacity: 0.5;
}

.crm-drag {
    box-shadow: 0 16px 40px rgba(0,0,0,0.15);
}

@media (max-width: 575.98px) {
    .crm-stage .card-header {
        position: sticky;
        top: 0;
        z-index: 1;
    }
    .crm-dropzone {
        max-height: 60vh;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* CRM: gráficos (evita loop de resize/infinite height) */
.crm-chart-box {
    position: relative;
    height: 220px;
}

.crm-chart-box--lg {
    height: 260px;
}

/* CRM: animação de "encher" barras de score */
.crm-progress-animate {
    width: 0;
    transition: width 900ms cubic-bezier(.2,.8,.2,1);
    will-change: width;
}

/* Se score > 0, ainda aparece um "mínimo" visual */
.crm-progress-animate[aria-valuenow]:not([aria-valuenow="0"]) {
    min-width: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .crm-progress-animate {
        transition: none;
    }
}

.page-card__title {
    margin: 0 0 0.5rem;
    font-size: clamp(1.15rem, 4vw, 1.35rem);
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
}

.page-card__text,
.page-card__lead {
    margin: 0 0 1.25rem;
    color: var(--muted);
    line-height: 1.5;
    font-size: clamp(0.9rem, 2.8vw, 1rem);
}

.field__hint {
    margin: 0.4rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

.app-content img,
.app-content video {
    max-width: 100%;
    height: auto;
}

@media (max-width: 576px) {
    .page-card .form-control {
        min-height: 2.75rem;
    }

    /* Botões em formulários: fáceis de tocar, sem estourar toolbars */
    .page-card form .btn:not(.btn-link) {
        min-height: 2.75rem;
    }

    .page-card form .d-grid .btn,
    .page-card form .d-md-flex .btn,
    .page-card form .d-flex .btn {
        width: 100%;
    }
}

/* Tabelas: melhora leitura e evita colunas "inúteis" no xs */
@media (max-width: 575.98px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    .cliente-table th:nth-child(4),
    .cliente-table td:nth-child(4),
    .cliente-table th:nth-child(5),
    .cliente-table td:nth-child(5),
    .cliente-table th:nth-child(6),
    .cliente-table td:nth-child(6) {
        display: none;
    }

    .cliente-table__actions {
        min-width: 6.5rem;
    }
}

/* =========================
   Impressão de contratos (A4 / ABNT)
   ========================= */
.crm-contract-print-toolbar__title {
    font-weight: 700;
    font-size: 1rem;
}

.crm-contract-print-toolbar__meta {
    color: var(--bs-secondary-color, #6c757d);
}

.crm-contract-print-toolbar__strong {
    font-weight: 700;
    color: var(--bs-body-color, #212529);
}

/* Folha A4 centralizada na tela e na impressão */
.crm-print-root {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.crm-print-sheet {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 210mm;
    margin-left: auto;
    margin-right: auto;
}

.crm-print-sheet__stack {
    display: grid;
    gap: 18px;
}

.crm-print-sheet__page {
    width: 210mm;
    height: 297mm;
    background: #fff;
    position: relative;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
    /* Sem cantos arredondados: border-radius + overflow:hidden recortava o logo do timbrado no canto superior esquerdo. */
    border-radius: 0;
    overflow: hidden;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/*
 * Timbrado na folha inteira sem recorte:
 * - "cover" cortava bordas da imagem (logo sumindo no topo). Use 100% 100% para mapear o arquivo inteiro na A4.
 */
.crm-print-sheet__page::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: #fff;
    background-image: var(--crm-timbrado-url);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: 100% 100%;
    opacity: 1;
    pointer-events: none;
    z-index: 0;
}

.crm-print-sheet__content {
    position: relative;
    z-index: 1;
    /* Laterais; topo/rodapé um pouco menores para caber assinaturas na mesma folha */
    padding: 32mm 18mm 18mm 18mm;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Aptos Narrow: família do Microsoft 365; fallback estreito similar */
    font-family: "Aptos Narrow", "Aptos", "Segoe UI", "Arial Narrow", Arial, sans-serif !important;
    /* Corpo e títulos: 12 pt (equivalente ao “12” do Word em documento impresso) */
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #111 !important;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.crm-print-sheet__content img,
.crm-print-sheet__content table {
    max-width: 100% !important;
}

.crm-print-sheet__content table {
    width: 100% !important;
}

.crm-print-sheet__content *,
.crm-print-sheet__content small,
.crm-print-sheet__content .small {
    font-family: "Aptos Narrow", "Aptos", "Segoe UI", "Arial Narrow", Arial, sans-serif !important;
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #111 !important;
}

.crm-print-sheet__content h1,
.crm-print-sheet__content h2,
.crm-print-sheet__content h3,
.crm-print-sheet__content h4,
.crm-print-sheet__content h5,
.crm-print-sheet__content h6 {
    font-size: 12pt !important;
    font-weight: 700 !important;
}

.crm-print-sheet__content h1 {
    margin: 0 0 10pt !important;
}

.crm-print-sheet__content h2 {
    margin: 11pt 0 5pt !important;
}

.crm-print-sheet__content h3 {
    margin: 12pt 0 5pt !important;
}

.crm-print-sheet__content th,
.crm-print-sheet__content thead td {
    font-weight: 700 !important;
}

.crm-print-sheet__content p {
    margin: 0 0 8pt !important;
    text-align: justify !important;
}

/* Assinaturas: lado a lado e sem quebra entre CONTRATANTE / CONTRATADA na impressão */
.crm-contract-assinaturas {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    margin-top: 1.1rem;
    break-inside: avoid;
    page-break-inside: avoid;
}

.crm-contract-assinaturas__col {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
}

.crm-contract-assinaturas__sign {
    border-top: 1px solid #333;
    padding-top: 8px;
    color: #111 !important;
}

.crm-contract-assinaturas__role {
    margin-top: 4px;
    font-size: 12pt !important;
    line-height: 1.5 !important;
    color: #555 !important;
}

/* Agrupamento só para paginação (DOCX / vários <p>) — fluxo vertical, largura total */
.crm-contract-rodape-grupo {
    display: block;
    width: 100%;
    box-sizing: border-box;
    break-inside: avoid;
    page-break-inside: avoid;
}

.crm-contract-rodape-grupo p:last-child {
    margin-bottom: 0 !important;
}

@media print {
    /* Folha física = A4 exata; margens 0 para o navegador não “encolher” a arte */
    @page {
        size: 210mm 297mm;
        margin: 0;
    }

    html {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background: #fff !important;
    }

    /* Evita deslocar a folha por padding/margem do .container / utilitários Bootstrap */
    .crm-print-root.container,
    .crm-print-root.container-fluid {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .crm-print-sheet {
        display: block !important;
        max-width: none !important;
        width: 210mm !important;
        min-width: 210mm !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .crm-print-sheet.mt-3,
    .crm-print-sheet.mt-md-4 {
        margin-top: 0 !important;
    }

    .crm-print-sheet__stack {
        display: block !important;
        width: 210mm !important;
        margin: 0 auto !important;
        gap: 0 !important;
    }

    .crm-print-sheet__page {
        box-shadow: none !important;
        border-radius: 0 !important;
        width: 210mm !important;
        min-width: 210mm !important;
        height: 297mm !important;
        min-height: 297mm !important;
        max-width: 210mm !important;
        margin: 0 auto !important;
        page-break-after: always;
        break-after: page;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .crm-print-sheet__page:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    .crm-print-sheet__page::before {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .crm-print-sheet__content {
        overflow: visible !important;
    }

    .crm-print-sheet__content,
    .crm-print-sheet__content *,
    .crm-print-sheet__content small,
    .crm-print-sheet__content .small {
        font-size: 12pt !important;
    }

    /* Duas colunas só no bloco manual de assinaturas (dois filhos __col) */
    .crm-contract-assinaturas {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .crm-contract-rodape-grupo {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        flex: none !important;
        flex-direction: unset !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }
}
