/* Estilo compartilhado do Portal do Cliente - Base Contábil */

@font-face {
    font-family: 'Neo Sans Std';
    src: url('/assets/neo-sans-std.otf') format('opentype');
    font-weight: 400 700;
    font-display: swap;
}

:root {
    --brand: #0084c3;
    --brand-escuro: #006a9e;
    --bg: #eef2f5;
    --texto: #1f2937;
    --texto-suave: #6b7280;
    --borda: #d1d5db;
    --control-h: 40px;      /* altura padrão de inputs / selects / botões */
    --control-radius: 7px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Campos de formulário herdam a fonte da página (não a do navegador) */
input, select, textarea, button { font-family: inherit; }
input[type="date"] { font-variant-numeric: tabular-nums; }

body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--texto);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    line-height: 1.5;
}

/* ---------- Card central (login / recuperação) ---------- */
.card {
    background: #fff;
    padding: 2.5rem 2.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 380px;
}

/* Emissão de NFS-e por link + PIN: página solta, sem menu (não há login).
   O body já é flex centralizado; aqui só a caixa precisa caber um formulário
   inteiro, diferente do .card estreito do login. */
body.emissor-publico { display: block; padding: 1.5rem 1rem 2rem; }
.emissor-publico__topo {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 860px;
    margin: 0 auto 1rem;
    padding: 0 0.25rem;
}
.emissor-publico__topo img { height: 42px; width: auto; }
.emissor-publico__topo strong { display: block; font-size: 1rem; color: var(--texto); }
.emissor-publico__topo span { font-size: 0.82rem; color: var(--texto-suave); }
.emissor-publico__rodape {
    width: 100%;
    max-width: 860px;
    margin: 1.2rem auto 0;
    text-align: center;
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--texto-suave);
}
.emissor-publico__rodape a { color: var(--brand); }
@media (max-width: 520px) {
    .emissor-publico__topo { justify-content: center; text-align: center; }
}
/* Tela do PIN: cartão estreito e centralizado, como o login (o formulário
   de emissão, depois do PIN, continua largo). */
.emissor-publico--pin .emissor-publico__topo { max-width: 420px; justify-content: center; text-align: center; }
.emissor-publico--pin .emissor-publico__caixa { max-width: 420px; padding: 1.8rem 1.6rem; }
.emissor-publico--pin .emissor-publico__rodape { max-width: 420px; }
.emissor-publico__rodape .item { white-space: nowrap; }
.emissor-publico__rodape .sep { margin: 0 0.15rem; opacity: 0.6; }
.emissor-pin { text-align: center; }
.emissor-pin__icone {
    display: inline-flex; align-items: center; justify-content: center;
    width: 3rem; height: 3rem; margin-bottom: 0.8rem;
    border-radius: 50%; background: #e0f2fe; color: var(--brand);
}
.emissor-pin__titulo { margin: 0 0 0.35rem; font-size: 1.15rem; line-height: 1.3; color: var(--texto); }
.emissor-pin__sub { margin: 0 0 1.3rem; font-size: 0.86rem; color: var(--texto-suave); }
.emissor-pin__form { text-align: left; }
.emissor-pin__campo { text-align: center; font-size: 1.35rem; letter-spacing: 0.35em; font-variant-numeric: tabular-nums; }
.emissor-pin__form .g-recaptcha { display: flex; justify-content: center; }
.emissor-pin .emissor-pin__entrar { width: 100%; height: 2.9rem; background: var(--brand); color: #fff; font-weight: 600; }
.emissor-pin .emissor-pin__entrar:hover { background: var(--brand-escuro); }
.emissor-pin .alerta { text-align: left; }

.emissor-publico__caixa {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 1.6rem 1.5rem 2rem;
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.card__logo {
    display: block;
    width: 180px;
    max-width: 70%;
    margin: 0 auto 1.75rem;
}

h1 {
    font-family: "Neo Sans Std", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
    color: var(--texto);
    margin-bottom: 0.35rem;
}

.subtitulo,
.intro {
    text-align: center;
    font-size: 0.85rem;
    color: var(--texto-suave);
    margin-bottom: 1.75rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: #374151;
}

input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    margin-bottom: 1.1rem;
    border: 1px solid var(--borda);
    border-radius: 7px;
    font-size: 0.95rem;
    transition: border-color .15s, box-shadow .15s;
}

/* reCAPTCHA ("Não sou um robô") na tela de login — o widget do Google tem
   304px fixos; encolhe um pouco em telas estreitas pra não estourar o card. */
.g-recaptcha { margin-bottom: 1.1rem; }
@media (max-width: 400px) {
    .g-recaptcha { transform: scale(0.87); transform-origin: 0 0; margin-bottom: calc(1.1rem - 19px); }
}

input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 132, 195, 0.15);
}

button {
    width: 100%;
    padding: 0.8rem;
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

button:hover { background: var(--brand-escuro); }

.link-secundario {
    display: block;
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--brand);
    text-decoration: none;
}

.link-secundario:hover { text-decoration: underline; }
/* área de toque confortável no celular (o texto continua do mesmo tamanho) */
.link-secundario { width: fit-content; margin-left: auto; margin-right: auto; padding: 0.55rem 0.75rem; margin-top: 0.7rem; }

/* Mostrar/ocultar senha (portal-form.js põe o campo dentro de .campo-senha) */
.campo-senha { position: relative; display: block; }
.campo-senha > input { padding-right: 2.9rem; }
.campo-senha__olho {
    position: absolute; top: 50%; right: 0.3rem; transform: translateY(-50%);
    display: flex; align-items: center; justify-content: center;
    width: 2.3rem; height: 2.3rem; padding: 0; margin: 0;
    border: 0; border-radius: 6px; background: transparent; color: #6b7280; cursor: pointer;
}
.campo-senha__olho:hover { background: #f3f4f6; color: #111827; }
.campo-senha__olho:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.alerta {
    padding: 0.7rem 0.85rem;
    border-radius: 7px;
    font-size: 0.85rem;
    margin-bottom: 1.1rem;
}

.alerta--erro { background: #fee2e2; color: #991b1b; }
.alerta--ok   { background: #dcfce7; color: #166534; }
.alerta--aviso { background: #fef3c7; color: #92400e; }

.rodape {
    margin-top: 1.75rem;
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
}

/* ---------- Painel pós-login (sidebar fixa + topo + conteúdo) ---------- */
:root { --sidebar-w: 224px; --sidebar-w-min: 60px; }

body.painel {
    display: block;
    min-height: 100vh;
    padding: 0 0 0 var(--sidebar-w);
    background: var(--bg);
    transition: padding-left 0.18s ease;
}
body.painel.sidebar-colapsada { padding-left: var(--sidebar-w-min); }

/* Sidebar — fixa, altura total do monitor */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    z-index: 30;
    overflow: hidden;
    transition: width 0.18s ease;
}
body.painel.sidebar-colapsada .sidebar { width: var(--sidebar-w-min); }

.sidebar nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.8rem 0.55rem;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 7px;
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { background: #f1f5f9; }
.nav-item.ativo { background: #e0f2fe; color: var(--brand); font-weight: 600; }
/* Item de menu com submenu (ex.: "Notas fiscais" -> Consultar/Emitir NF-e/...) */
.nav-item--toggle {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-family: inherit;
    font-weight: 400;
    cursor: pointer;
}
.nav-item__chev { flex-shrink: 0; margin-left: auto; transition: transform 0.15s ease; color: #9ca3af; }
.nav-submenu-grupo.aberto > .nav-item--toggle .nav-item__chev { transform: rotate(90deg); }
.nav-submenu-grupo.aberto > .nav-item--toggle { color: var(--brand); font-weight: 600; }
.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 0.05rem;
    padding-left: 2.1rem;
    margin: 0.1rem 0 0.2rem;
}
.nav-submenu-grupo.aberto > .nav-submenu { display: flex; }
.nav-subitem {
    display: block;
    padding: 0.42rem 0.7rem;
    border-radius: 7px;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
}
.nav-subitem:hover { background: #f1f5f9; color: #374151; }
.nav-subitem.ativo { background: #e0f2fe; color: var(--brand); font-weight: 600; }
/* Recolhida (só ícones): não tem espaço pro submenu -- o clique no ícone já
   leva direto pra "Consultar" (ver JS), igual o link único que existia antes. */
body.painel.sidebar-colapsada .nav-submenu { display: none !important; }
body.painel.sidebar-colapsada .nav-item__chev { display: none; }
.nav-grupo { margin-top: 0.9rem; }
.nav-grupo--sem-titulo { margin-top: 0.15rem; } /* "Painel" colado no "Início" */
.nav-grupo__titulo {
    display: block;
    padding: 0 0.7rem 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9ca3af;
    white-space: nowrap;
}

.sidebar-colapsar {
    flex-shrink: 0;
    width: 100%;
    height: 42px;
    padding: 0;
    background: none;
    border: none;
    border-top: 1px solid #e5e7eb;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-colapsar:hover { background: #f1f5f9; color: #374151; }
.sidebar-colapsar svg { transition: transform 0.18s ease; }

/* Estado recolhido: só ícones */
body.painel.sidebar-colapsada .nav-item span,
body.painel.sidebar-colapsada .nav-grupo__titulo { display: none; }
body.painel.sidebar-colapsada .nav-item { justify-content: center; padding: 0.6rem; gap: 0; }
body.painel.sidebar-colapsada .nav-grupo {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}
body.painel.sidebar-colapsada .sidebar-colapsar svg { transform: rotate(180deg); }

/* Recolhido: o rótulo aparece como tooltip ao passar o mouse no ícone.
   Precisa liberar o overflow (some com o texto de qualquer forma). */
body.painel.sidebar-colapsada .sidebar,
body.painel.sidebar-colapsada .sidebar nav { overflow: visible; }
body.painel.sidebar-colapsada .nav-item { position: relative; }
body.painel.sidebar-colapsada .nav-item::after {
    content: attr(data-rotulo);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    background: #111827;
    color: #fff;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s ease, transform 0.12s ease;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22);
    z-index: 80;
}
body.painel.sidebar-colapsada .nav-item::before {
    content: "";
    position: absolute;
    left: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #111827;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
    z-index: 80;
}
body.painel.sidebar-colapsada .nav-item:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}
body.painel.sidebar-colapsada .nav-item:hover::before { opacity: 1; }

/* Topo */
.topo {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--brand);
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.topo__menu {
    display: none;
    width: auto;
    height: auto;
    padding: 0;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
}
.topo__menu:hover { background: none; opacity: 0.8; }
.topo__marca {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: "Neo Sans Std", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-weight: 600;
}
.topo__marca img { height: 30px; width: auto; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25)); }
.topo__user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-size: 0.85rem;
}
.topo__user-nome { opacity: 0.9; }
.topo a { color: #fff; text-decoration: none; opacity: 0.9; }
.topo a:hover { opacity: 1; text-decoration: underline; }

/* ---------- Sino de notificações ---------- */
.topo-notif { position: relative; }
/* aviso de tarefa: o pop-up abre por cima da página atual (quadro transparente com a tela de obrigações em modo embed) */
.tarefa-embed { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; z-index: 10000; background: transparent; }
.tarefa-embed-carregando { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 10001; padding: 8px 16px; border-radius: 8px;
    background: #1f2937; color: #fff; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.topo-notif__btn {
    position: relative;
    display: inline-flex;
    width: auto; height: auto;
    padding: 0.35rem;
    background: none; border: none; border-radius: 6px;
    color: #fff; cursor: pointer;
}
.topo-notif__btn:hover { background: rgba(255, 255, 255, 0.14); }
.topo-notif__badge {
    position: absolute; top: 0; right: 0;
    min-width: 16px; height: 16px; padding: 0 3px;
    border-radius: 999px;
    background: #dc2626; color: #fff;
    font-size: 0.65rem; font-weight: 700; line-height: 16px; text-align: center;
    box-shadow: 0 0 0 2px var(--brand);
}
.topo-notif__menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    width: 320px; max-width: calc(100vw - 2rem);
    background: #fff; color: var(--texto);
    border: 1px solid var(--borda); border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    z-index: 60;
    overflow: hidden;
}
.topo-notif__cab {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--borda);
    font-size: 0.85rem; font-weight: 600;
}
.topo-notif__cab .link-btn { font-size: 0.75rem; font-weight: 400; }
.topo-notif__lista { max-height: 360px; overflow-y: auto; }
.topo-notif__vazio { padding: 1.5rem 0.9rem; text-align: center; color: var(--texto-suave); font-size: 0.85rem; }
.topo-notif__item {
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.topo-notif__item:last-child { border-bottom: none; }
.topo-notif__item:hover { background: #f8fafc; }
.topo-notif__item--novo { background: #eff8ff; }
.topo-notif__item--novo:hover { background: #e3f2fd; }
.topo-notif__item-titulo { font-size: 0.85rem; font-weight: 600; }
.topo-notif__item-msg { font-size: 0.8rem; color: var(--texto-suave); margin-top: 0.15rem; }
.topo-notif__item-tempo { font-size: 0.72rem; color: var(--texto-suave); margin-top: 0.3rem; }
/* botões de ação dentro de uma notificação (ex.: certificado identificado) */
.topo-notif__acoes { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.topo-notif__acao {
    width: auto; padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.76rem; font-weight: 600;
    background: #fff; color: #374151; border: 1px solid var(--borda); cursor: pointer;
}
.topo-notif__acao:hover:not(:disabled) { background: #f3f4f6; }
.topo-notif__acao:disabled { opacity: 0.5; cursor: wait; }
/* menu do botão direito numa notificação */
.topo-notif__ctx {
    position: fixed; z-index: 70; min-width: 220px; padding: 4px;
    background: #fff; border: 1px solid var(--borda); border-radius: 8px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.topo-notif__ctx button {
    display: block; width: 100%; text-align: left; padding: 0.5rem 0.75rem;
    background: none; border: 0; border-radius: 6px; font-size: 0.85rem; color: #374151; cursor: pointer;
}
.topo-notif__ctx button:hover, .topo-notif__ctx button:focus-visible { background: #f3f4f6; }
.topo-notif__ctx button[data-ctx="excluir"] { color: #b91c1c; }
.topo-notif__acao--aprovar { background: #16a34a; border-color: #16a34a; color: #fff; }
.topo-notif__acao--aprovar:hover:not(:disabled) { background: #15803d; }
.topo-notif__acao--recusar { color: #b91c1c; border-color: #fecaca; }
.topo-notif__acao--recusar:hover:not(:disabled) { background: #fef2f2; }

/* ---------- Menu do usuário ---------- */
.topo-user { position: relative; }
.topo-user__btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    width: auto; height: auto;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    background: none; border: none; border-radius: 999px;
    color: #fff; cursor: pointer; font-size: 0.85rem;
}
.topo-user__btn:hover { background: rgba(255, 255, 255, 0.14); }
.topo-user__avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.02em;
    overflow: hidden; flex: none;
}
.topo-user__avatar img { width: 100%; height: 100%; object-fit: cover; }
.topo-user__nome { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topo-user__chev { flex: none; opacity: 0.8; }
.topo-user__menu {
    position: absolute; top: calc(100% + 8px); right: 0;
    min-width: 220px;
    background: #fff; color: var(--texto);
    border: 1px solid var(--borda); border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    z-index: 60;
    padding: 0.3rem;
}
.topo-user__menu a,
.topo-user__menu button {
    display: block; width: 100%; text-align: left;
    padding: 0.55rem 0.7rem;
    background: transparent; border: none; border-radius: 6px;
    color: var(--texto); text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}
.topo-user__menu a:hover,
.topo-user__menu button:hover { background: #f1f5f9; opacity: 1; text-decoration: none; }
.topo-user__menu button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 560px) {
    .topo-user__nome { display: none; }
    .topo-user__chev { display: none; }
}

.sidebar-overlay { display: none; }

main {
    padding: 1.75rem;
    max-width: 1200px;
    min-width: 0;
}

@media (max-width: 900px) {
    body.painel,
    body.painel.sidebar-colapsada { padding-left: 0; }
    .topo__menu { display: inline-flex; }
    .sidebar-colapsar { display: none; }
    .sidebar,
    body.painel.sidebar-colapsada .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        z-index: 60;
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
    }
    .sidebar.aberta { transform: none; }
    /* no mobile a gaveta é sempre expandida (ignora o estado recolhido) */
    body.painel.sidebar-colapsada .nav-item span { display: inline; }
    body.painel.sidebar-colapsada .nav-grupo__titulo { display: block; }
    body.painel.sidebar-colapsada .nav-item { justify-content: flex-start; padding: 0.55rem 0.7rem; gap: 0.65rem; }
    body.painel.sidebar-colapsada .nav-grupo { border-top: none; padding-top: 0; margin-top: 0.9rem; }
    body.painel.sidebar-colapsada .nav-item::after,
    body.painel.sidebar-colapsada .nav-item::before { display: none; }
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 50;
    }
    .sidebar-overlay[hidden] { display: none; }
    main { padding: 1.25rem; }
}

/* Dashboard */
.dash-sub { color: var(--texto-suave); font-size: 0.9rem; margin-bottom: 1.75rem; }
.dash-grupo {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 1.6rem 0 0.75rem;
}
.dash-grupo:first-of-type { margin-top: 0; }
.dash-alertas__lista { list-style: none; margin: 0 0 1.6rem; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.dash-alertas__lista li {
    display: flex; align-items: center; gap: 0.5rem; font-size: 0.87rem;
    padding: 0.5rem 0.7rem; border: 1px solid var(--borda); border-radius: 8px; background: #fff;
}
.dash-alerta--vencido { border-color: #fca5a5; background: #fef2f2; }
.dash-alerta__data { font-variant-numeric: tabular-nums; color: var(--texto-suave); font-weight: 600; }
.dash-alerta-concluir {
    margin-left: auto; background: none; border: 1px solid var(--borda); border-radius: 6px;
    padding: 0.2rem 0.6rem; font-size: 0.78rem; cursor: pointer; flex: none;
    width: auto; color: var(--texto); /* anula o button{width:100%;color:#fff} global */
}
.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}
.dash-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.2rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
a.dash-card:hover {
    border-color: var(--brand);
    box-shadow: 0 4px 16px rgba(0, 132, 195, 0.12);
    transform: translateY(-2px);
}
.dash-card__ic {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: var(--brand);
    border-radius: 9px;
    margin-bottom: 0.35rem;
}
.dash-card__nome { font-weight: 600; font-size: 0.98rem; }
.dash-card__desc { font-size: 0.83rem; color: var(--texto-suave); line-height: 1.45; }
.dash-card--soon { opacity: 0.6; cursor: default; }
.dash-card--soon .dash-card__ic { background: #f3f4f6; color: #9ca3af; }

.pagina-titulo {
    font-family: "Neo Sans Std", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}

/* ---------- Filtros ---------- */
.filtros {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.filtros__grade {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.9rem 1.1rem;
}

.filtros label { margin-bottom: 0.3rem; }
.filtros input,
.filtros select { margin-bottom: 0; }

.filtros label.check {
    display: block;
    font-weight: 400;
    margin: 0.15rem 0;
}
.filtros label.check input { width: auto; margin-right: 0.4rem; }

.filtros__acoes {
    margin-top: 1.1rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Botão primário (Pesquisar) — mesma caixa dos .btn */
.filtros__acoes button[type="submit"] {
    width: auto;
    height: var(--control-h);
    padding: 0 1.6rem;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: var(--control-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.filtros__acoes button[type="submit"]:hover {
    background: var(--brand-escuro);
    border-color: var(--brand-escuro);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: var(--control-h);
    padding: 0 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    background: #fff;
    color: var(--texto);
}
.btn-secundario {
    background: #fff;
    color: var(--brand);
    border-color: var(--brand);
}
.btn-secundario:hover { background: #f0f9ff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* .btn define display:inline-flex, que é regra de autor -- sempre ganha do
   display:none do [hidden] nativo do navegador (regra de user-agent, perde
   mesmo com especificidade igual). Reforça aqui, mesmo motivo do
   .cofre-form__grade[hidden] logo acima -- é por isso que o "×" de remover
   de uma linha (pagamento, item etc.) continuava visível mesmo com
   `hidden` setado via JS. */
.btn[hidden] { display: none; }

/* ---------- Resultado / tabela ---------- */
.resultado-info { font-size: 0.85rem; color: var(--texto-suave); margin-bottom: 0.6rem; }

.lote-acoes {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}
.lote-resumo {
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.8rem;
    line-height: 1.25;
    color: var(--texto-suave);
    min-width: 0;
}
.lote-resumo__linha { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lote-contador.tem-selecao { color: var(--brand); font-weight: 600; }
.lote-botoes {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.por-pagina {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: var(--texto-suave);
    margin-bottom: 0;
}
/* mesmo visual dos botões Lote (.btn-secundario) */
.por-pagina select {
    height: var(--control-h);
    padding: 0 2rem 0 0.9rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--brand);
    background-color: #fff;
    border: 1px solid var(--brand);
    border-radius: var(--control-radius);
    cursor: pointer;
}

.tabela-wrap {
    overflow-x: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

table.dados { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.dados th,
table.dados td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid #f0f0f0;
}
table.dados thead th { background: #f9fafb; font-weight: 600; color: #374151; }
table.dados tbody tr:hover { background: #f8fbfd; }

.th-ord { color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; display: inline-flex; align-items: center; gap: 0.25rem; }
.th-ord:hover { color: var(--brand); }
.ord-ind { font-size: 0.7rem; color: var(--brand); }

/* ordenação client-side (módulo portal-tabela.js) */
table.dados thead th.th-sort { cursor: pointer; user-select: none; }
table.dados thead th.th-sort:hover { color: var(--brand); }
.sort-ind { margin-left: 0.3rem; font-size: 0.7rem; color: var(--brand); }

/* Reordenar colunas (arrastar títulos) */
.tabela-legenda {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.dica-colunas { font-size: 0.78rem; color: var(--texto-suave); }
.link-btn {
    width: auto;
    height: auto;
    padding: 0;
    background: none;
    border: none;
    color: var(--brand);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
}
.link-btn:hover { background: none; text-decoration: underline; }
.link-btn.perigo { color: #b91c1c; }
.link-btn.perigo:hover { color: #991b1b; }
.acoes-sep { color: #d1d5db; margin: 0 0.15rem; font-size: 0.8rem; }

table.dados[data-tabela^="cofre-"] .acoes-col {
    width: auto;
    white-space: nowrap;
    text-align: right;
    padding-right: 1rem;
}

table.dados thead th[data-col] { cursor: grab; user-select: none; }
table.dados thead th[data-col].arrastando { opacity: 0.4; }
table.dados thead th[data-col].alvo-drop { box-shadow: inset 3px 0 0 var(--brand); }

/* Emitente / Destinatário podem quebrar linha */
table.dados td[data-col="emitente"],
table.dados td[data-col="destinatario"] { white-space: normal; min-width: 190px; max-width: 340px; }
/* Memorando: título/assunto podem ser bem longos -- sem isso, o texto
   ficava numa linha só e empurrava as colunas de status/responsável pra
   fora da tela (a rolagem horizontal existe, mas ninguém rola pra ver). */
table.dados[data-tabela="memorando"] td[data-col="titulo"] { white-space: normal; min-width: 220px; max-width: 340px; }
table.dados[data-tabela="memorando"] td[data-col="assunto"] { white-space: normal; min-width: 140px; max-width: 220px; }
table.dados .valor { text-align: right; font-variant-numeric: tabular-nums; }
table.dados .mut { color: #9ca3af; margin-left: 0.35rem; font-size: 0.8rem; }

.tag {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.tag--nfce { background: #e0f2fe; color: #075985; }
.tag--nfse { background: #ede9fe; color: #5b21b6; }
.tag--cancel { background: #fee2e2; color: #991b1b; }

.vazio { padding: 2rem; text-align: center; color: var(--texto-suave); white-space: normal; }

/* ---------- Sem resultado ---------- */
.sem-resultado {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--texto-suave);
}
.sem-resultado svg { color: #cbd5e1; margin-bottom: 0.75rem; }
.sem-resultado p { font-size: 0.95rem; }

#parametro-bloco-nfse h4, #parametro-bloco-nfe_nfce h4 { margin: 1rem 0 0.55rem; font-size: 0.95rem; color: #374151; }
#parametro-bloco-nfse h4:first-child, #parametro-bloco-nfe_nfce h4:first-child { margin-top: 0.25rem; }

/* ---------- Status (ícone) ---------- */
table.dados .marca-col { text-align: center; white-space: nowrap; }
table.dados td.marca-col input { width: auto; margin: 0; cursor: pointer; accent-color: var(--brand); }
table.dados thead th.marca-col { font-size: 0.78rem; }

table.dados .check-col { width: 34px; text-align: center; }
table.dados .check-col input {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    cursor: pointer;
    accent-color: var(--brand);
}
table.dados .status-col { text-align: center; width: 68px; }
.status-icone { display: inline-flex; line-height: 0; cursor: help; }
.status-icone--ok { color: #16a34a; }
.status-icone--cancel { color: #dc2626; }
.status-icone--pendente { color: #2563eb; }

/* botão de copiar a chave de acesso, na coluna Número */
.nf-chave-copiar {
    width: auto;
    padding: 2px;
    margin-left: 4px;
    border: 0;
    background: none;
    color: var(--texto-suave);
    opacity: 0.4;
    cursor: pointer;
    vertical-align: middle;
    line-height: 0;
    border-radius: 4px;
    transition: opacity .12s, background .12s, color .12s;
}
table.dados tr:hover .nf-chave-copiar { opacity: 0.8; }
.nf-chave-copiar:hover { opacity: 1; color: var(--brand); background: #eff6ff; }
.nf-chave-copiar:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; opacity: 1; }

/* ---------- Menu de ações ---------- */
table.dados .acoes-col { width: 44px; text-align: center; }

.acoes-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #6b7280;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}
.acoes-btn:hover { background: #f1f5f9; color: #111827; border-color: var(--borda); }

.acoes-menu {
    min-width: 190px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    padding: 0.3rem;
    z-index: 50;
}
.acoes-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.7rem;
    background: transparent;
    color: var(--texto);
    border: none;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 400;
    cursor: pointer;
}
.acoes-menu button:hover { background: #f1f5f9; }
.acoes-menu button.perigo { color: #b91c1c; }
.acoes-menu button.perigo:hover { background: #fee2e2; }
.acoes-menu button.acoes-menu__item--ajuda {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    color: var(--mut, #94a3b8);
    cursor: help;
}
.acoes-menu button.acoes-menu__item--ajuda:hover { background: transparent; }
.acoes-menu button.acoes-menu__item--ajuda svg { flex: none; opacity: 0.8; }
.acoes-menu button.acoes-menu__item--info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
}
.acoes-menu button.acoes-menu__item--info svg { flex: none; color: #d97706; }

.paginacao {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--texto-suave);
}
.paginacao a {
    color: var(--brand);
    text-decoration: none;
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--borda);
    border-radius: 6px;
}
.paginacao a:hover { background: #f0f9ff; }

/* ---------- Construtor de filtros (estilo SIEG) ---------- */
#linhas { display: flex; flex-direction: column; gap: 0.55rem; margin-bottom: 0.9rem; }

.linha {
    display: grid;
    grid-template-columns: 68px minmax(160px, 1.2fr) minmax(130px, 1fr) minmax(160px, 1.4fr) var(--control-h);
    gap: 0.5rem;
    align-items: center;
}
.linha select,
.linha input {
    width: 100%;
    height: var(--control-h);
    margin: 0;
    padding: 0 0.7rem;
    font-size: 0.9rem;
    color: var(--texto);
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
}
.linha select:focus,
.linha input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 132, 195, 0.15);
}
.linha .l-valor { display: block; }
.linha .l-valor > input,
.linha .l-valor > select { width: 100%; }

.valor-entre {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.valor-entre input,
.valor-entre select { flex: 1; min-width: 0; }
.valor-entre i { font-style: normal; font-size: 0.8rem; color: var(--texto-suave); }

.l-remover {
    width: var(--control-h);
    height: var(--control-h);
    padding: 0;
    background: #fff;
    color: #991b1b;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}
.l-remover:hover { background: #fee2e2; border-color: #fca5a5; }

#add-linha { margin-bottom: 0.4rem; }

.sql-preview { margin-top: 1rem; font-size: 0.8rem; color: var(--texto-suave); }
.sql-preview summary { cursor: pointer; }

/* Bloco de campos "avançados/secundários" nos formulários (ex.: regime
   tributário no emissor de NFS-e, transporte/pagamento no de NF-e). */
.form-avancado { margin-top: 1rem; font-size: 0.85rem; color: var(--texto-suave); }
.form-avancado > summary { cursor: pointer; font-weight: 500; margin-bottom: 0.4rem; }

.sql-preview pre {
    margin-top: 0.5rem;
    padding: 0.8rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

@media (max-width: 720px) {
    .linha {
        grid-template-columns: 1fr var(--control-h);
        grid-auto-flow: row;
    }
    .linha .l-conector { grid-column: 1 / -1; width: 68px; }
    .linha .l-remover { grid-row: 2 / 5; grid-column: 2; align-self: start; }
}

/* ==================== Cofre ==================== */
.cofre-barra {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}
.cofre-busca { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.cofre-busca input,
.cofre-busca select {
    height: var(--control-h);
    margin: 0;
    padding: 0 0.8rem;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    font-size: 0.9rem;
    background: #fff;
}
.cofre-busca input { width: 280px; max-width: 60vw; }
.cli-busca-campo { position: relative; display: inline-flex; }
.cli-busca-campo input { width: 280px; max-width: 60vw; padding-right: 2rem; }
.cli-busca-q-limpar {
    position: absolute; top: 50%; right: 0.5rem; transform: translateY(-50%);
    width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--texto-suave); font-size: 1.15rem; line-height: 1;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cli-busca-q-limpar:hover { background: #f1f5f9; color: var(--texto); }
.cli-filtro-tags-wrap { flex: 1 1 320px; min-width: 260px; max-width: 640px; }
.cofre-busca button[type="submit"] {
    height: var(--control-h);
    width: auto;
    padding: 0 1.2rem;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: var(--control-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.cofre-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}
.cofre-form h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}
/* subtítulo de etapa dentro de um formulário longo (ex.: cadastro de emissor) */
.cofre-form h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 1.4rem 0 0.7rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--borda);
    color: var(--texto);
}
.cofre-form h3 + h4 { margin-top: 0; padding-top: 0; border-top: none; }

/* "editar · excluir" na coluna de ações: o form do excluir não pode quebrar a linha */
.acoes-col .emissor-excluir-form { display: inline; }
.cofre-form__grade {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem 1.1rem;
}
/* o display:grid acima ganha do [hidden] do navegador — reforça aqui, mesmo motivo do .cofre-form label[hidden] logo abaixo */
.cofre-form__grade[hidden] { display: none; }
.cofre-form[hidden] { display: none; }
.arq-escolha .badge { margin-left: 4px; }

/* Linha/grupo de campos (Produtos, Pagamento, emissor NF-e/NFC-e): campos
   técnicos curtos (Código, NCM, CFOP, Qtd...) já têm largura máxima
   conhecida pelo tamanho do conteúdo -- não faz sentido ocupar a mesma
   largura de Descrição/Informações adicionais, que podem ser bem mais
   longos. Troca o grid uniforme por flex-wrap com largura por campo
   (.em-it-campo--*). Um item (produto) tem VÁRIOS `.em-item-grade` dentro
   do mesmo cartão `.em-item-linha` (dados básicos / descrição / ICMS /
   PIS-COFINS), cada um sua própria linha. */
.em-item-grade { display: flex; flex-wrap: wrap; gap: 0.9rem 1.1rem; margin-bottom: 0.9rem; }
.em-item-grade:last-child { margin-bottom: 0; }
.em-it-campo { flex: 0 1 200px; }
.em-it-campo--xs { flex: 0 1 90px; }
.em-it-campo--sm { flex: 0 1 140px; }
.em-it-campo--sm2 { flex: 0 1 175px; }
.em-it-campo--md { flex: 1 1 220px; }
.em-it-campo--lg { flex: 2 1 260px; }
/* + e × do pagamento moram na mesma coluna (só um aparece por vez, conforme
   a linha), senão a coluna de cada botão desalinha entre linhas -- o
   [hidden] tira o botão do fluxo, mas o <label> que o envolve continua
   ocupando a largura da coluna dele. */
.em-pg-acoes { display: flex; }

/* Cada produto vira um "cartão" com borda + rótulo numerado -- com 2+ itens
   os campos (todos iguais visualmente: caixinha branca, texto cinza) se
   confundiam sem uma fronteira clara entre um item e o próximo. */
#em-itens-lista .em-item-linha {
    border: 1px solid var(--borda);
    border-radius: 10px;
    background: #fafbfc;
    padding: 1.15rem 1rem 0.9rem;
    margin-bottom: 1rem;
    position: relative;
}
#em-itens-lista .em-item-linha::before {
    content: attr(data-item-rotulo);
    position: absolute;
    top: -0.65rem;
    left: 0.9rem;
    background: #fff;
    padding: 0 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--brand);
    border: 1px solid var(--borda);
    border-radius: 999px;
}
/* Sub-seção dentro do cartão do item (ICMS / PIS-COFINS) -- linha
   pontilhada + rótulo pra separar visualmente dos dados básicos/descrição,
   sem precisar de outro cartão dentro do cartão. */
.em-it-subtitulo {
    margin: 0 0 0.7rem;
    padding-top: 0.7rem;
    border-top: 1px dashed var(--borda);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--texto-suave);
}
.cofre-form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    /* min-width:auto (padrão de item de grid/flex) deixa o navegador não
       encolher o <label> além do tamanho "natural" do input/select lá
       dentro -- é isso que fazia os campos vazarem pra fora de boxes
       estreitos (ex.: dentro de .cli-dfe-box). */
    min-width: 0;
}
/* o seletor acima ganha do [hidden] do navegador — reforça aqui */
.cofre-form label[hidden] { display: none; }
/* Valor PIS/Valor COFINS do item: calculados automaticamente (base ×
   percentual), não editáveis -- fundo cinza claro deixa isso óbvio sem
   precisar de texto explicando. */
.cofre-form label input[readonly] { background: #f3f4f6; color: var(--texto-suave); cursor: default; }

/* grupo de radio (ex.: "Local da prestação") — foge do padrão empilhado
   de .cofre-form label (que é pra input/select de texto, não pra radio). */
.cofre-form__radios { border: none; padding: 0; margin: 0 0 0.9rem; }
.cofre-form__radios legend { font-size: 0.85rem; font-weight: 500; color: #374151; padding: 0; margin-bottom: 0.4rem; }
.cofre-form__radio {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.35rem;
    margin-right: 1.4rem;
    font-weight: 400 !important;
}
.cofre-form__radio input[type="radio"] { height: auto; width: auto; padding: 0; border: none; background: none; }
.cofre-form__radios .cofre-form__grade { margin-top: 0.7rem; }

.campo-aviso { font-size: 0.78rem; font-weight: 400; color: #b45309; }
.campo-dica { font-size: 0.78rem; font-weight: 400; color: var(--texto-suave); }

#cofre-resultado { transition: opacity 0.12s; }
#cofre-resultado[aria-busy="true"] { opacity: 0.45; pointer-events: none; }

.cofre-form label input,
.cofre-form label select {
    max-width: 100%;
    height: var(--control-h);
    margin: 0;
    padding: 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    background: #fff;
}
.cofre-form label textarea {
    width: 100%;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    font-family: inherit;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    background: #fff;
    resize: vertical;
    box-sizing: border-box;
}
/* Informações adicionais (Reservado ao Fisco / Informações complementares):
   texto normalmente mais denso/técnico -- fonte um pouco menor que o padrão
   dos outros campos do formulário, só nesses dois. */
.em-info-textarea { font-size: 0.8rem; }

.cofre-form__obs {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}
.cofre-form__obs textarea {
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    resize: vertical;
    min-height: 3rem;
}

.cofre-form__acoes {
    margin-top: 1.1rem;
    display: flex;
    gap: 0.6rem;
    align-items: center;
}
.cofre-form__acoes button[type="submit"] {
    height: var(--control-h);
    width: auto;
    padding: 0 1.5rem;
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    border-radius: var(--control-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

/* célula de senha */
.senha-cel { white-space: nowrap; }
.senha-cel code {
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
    font-size: 0.85rem;
    background: #f3f4f6;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    user-select: all;
}
.cofre-ic {
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    background: transparent;
    color: #6b7280;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}
.cofre-ic:hover { background: #f1f5f9; color: #111827; border-color: var(--borda); }
/* .cofre-ic define display:inline-flex, que por especificidade igual ganha
   do display:none padrão do navegador pro atributo [hidden] -- sem isso,
   qualquer .cofre-ic com "hidden" (ex.: os botões de editar tag) aparecia
   mesmo escondido. */
.cofre-ic[hidden] { display: none; }
.cofre-ic:disabled { opacity: 0.4; cursor: wait; }
.cofre-ic.ativo { color: var(--brand); }
.cofre-ic.copiado { color: #16a34a; border-color: #86efac; background: #dcfce7; }
/* ícones de ação na listagem (histórico / editar / excluir) */
.acoes-ic { display: inline-flex; gap: 0.15rem; justify-content: flex-end; }
.acoes-ic .cofre-ic { margin-left: 0; }

.acoes-ic .acao-hist { color: #b45309; }
.acoes-ic .acao-hist:hover { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.acoes-ic .acao-editar { color: #1d4ed8; }
.acoes-ic .acao-editar:hover { color: #1e40af; background: #dbeafe; border-color: #bfdbfe; }
.acoes-ic .perigo { color: #dc2626; }
.acoes-ic .perigo:hover { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

/* célula clicável para copiar (ex.: CPF) */
/* textos longos dentro de tabela (o padrão é nowrap): quebram em vez de alargar a página */
table.dados td.texto-longo { white-space: normal; min-width: 260px; }
/* Usuários: setores quebram linha e o texto suave (usuário, setores, e-mail) vai pra baixo, pra tabela caber sem rolagem */
table.usuarios-tabela td:is([data-col="nome"], [data-col="cargo"], [data-col="perfil"]) { white-space: normal; min-width: 150px; }
table.usuarios-tabela td .mut { display: block; margin-left: 0; }
table.dados td.texto-quebra { white-space: normal; word-break: break-all; min-width: 140px; max-width: 220px; }
/* filtros de uma linha só (De / Até / Filtrar) */
.filtros-linha { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.8rem; margin: 0.8rem 0 1rem; }
.filtros-linha label { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; }
.filtros-linha input, .filtros-linha select { width: auto; margin: 0; height: var(--control-h); }
/* nenhum campo do painel passa da largura da tela (ex.: select de modelos no celular) */
main input:not([type="checkbox"]):not([type="radio"]), main select, main textarea { max-width: 100%; }
/* celular: botão do menu e sino com área de toque de 40px */
@media (max-width: 900px) {
    .topo__menu, .topo-notif__btn { min-width: 40px; min-height: 40px; align-items: center; justify-content: center; }
}
table.dados td.obs-cel { white-space: normal; max-width: 300px; font-size: 0.82rem; color: var(--texto-suave); }

table.dados td.copiavel { cursor: pointer; }
table.dados td.copiavel:hover { color: var(--brand); }
table.dados td.copiavel.copiado { color: #16a34a; background: #dcfce7; }

/* ---------- Histórico do registro (modal) ---------- */
/* Envolve só o TEXTO do rótulo (não o botão) -- o span vira inline-block
   do tamanho exato do texto, então sua altura nunca muda (fica igual à
   dos rótulos sem botão ao lado, na mesma grade). O botão fica de fora
   do fluxo (position:absolute), por isso não empurra o <select> de baixo. */
/* align-self:flex-start -- sem isso, o <label>{display:flex;flex-direction:
   column} (ver .cofre-form label) estica este span pra largura toda da
   coluna (herda o align-items:stretch padrão), aí o "left:100%" do botão
   ficava na borda da coluna em vez de logo depois do texto. */
.campo-ajuda-rotulo { position: relative; display: inline-block; align-self: flex-start; }
.campo-ajuda {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 0.35rem;
    border: 1px solid var(--borda);
    border-radius: 50%;
    background: #f3f4f6;
    color: var(--mut);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    cursor: help;
}
.campo-ajuda:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.campo-ajuda-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(380px, 90vw);
    padding: 1rem 1.1rem;
    border: 1px solid var(--borda);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    color: var(--texto);
}
.campo-ajuda-modal::backdrop { background: rgba(0, 0, 0, 0.5); }
.campo-ajuda-modal p { margin: 0 0 0.8rem; font-size: 0.9rem; }
.campo-ajuda-modal button { width: auto; }

.hist-modal {
    position: fixed;
    inset: 0;
    margin: auto;   /* recentraliza o <dialog> — o `* { margin:0 }` global tira o padrão */
    width: min(820px, 94vw);
    max-height: 86vh;
    padding: 0;
    border: 1px solid var(--borda);
    border-radius: 10px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    color: var(--texto);
    overflow: hidden;
    white-space: normal; /* o modal mora dentro de tabelas (memorando): sem isso herdava nowrap e o conteúdo saía pela direita */
}
.hist-modal::backdrop { background: rgba(0, 0, 0, 0.5); }
.hist-modal__topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--borda);
    background: #f8fafc;
}
.hist-modal__topo h3 { font-size: 0.98rem; font-weight: 600; }
.hist-fechar {
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: -0.2rem -0.3rem -0.2rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1;
    color: var(--texto-suave);
    cursor: pointer;
    border-radius: 6px;
}
.hist-fechar:hover { background: #e5e7eb; color: var(--texto); }
.hist-fechar:focus { outline: none; }
.hist-fechar:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.hist-modal__corpo { padding: 0.9rem 1.1rem 1.1rem; overflow: auto; max-height: calc(86vh - 52px); }
.hist-modal__form { display: flex; flex-direction: column; max-height: 86vh; }
.hist-modal__form .hist-modal__corpo { flex: 1 1 auto; min-height: 0; max-height: none; }
.hist-modal__corpo > label { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; font-size: 0.85rem; font-weight: 500; color: #374151; }
.hist-modal__corpo > label[hidden] { display: none; }   /* o display:flex acima ganha do [hidden] do navegador */
.hist-modal__corpo > label input,
.hist-modal__corpo > label select { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-weight: 400; }
.hist-modal__corpo .cofre-form__grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.9rem 1.1rem; margin-bottom: 0.9rem; }
.hist-modal__corpo .cofre-form__grade label { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; font-size: 0.85rem; font-weight: 500; color: #374151; }
.hist-modal__corpo .cofre-form__grade input,
.hist-modal__corpo .cofre-form__grade select { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-weight: 400; }
/* `.cofre-form label` é flex-direction:column (pra rótulo em cima do campo).
   Checkbox é o oposto: marcador e texto na mesma linha. Precisa da mesma
   especificidade (0,2,0) pra ganhar daquela regra -- por isso o `.cofre-form`
   na frente, e não só `.cofre-form__check`. */
.cofre-form .cofre-form__check,
.hist-modal__corpo .cofre-form__check { display: flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0.75rem 0; font-weight: 400; }
.cofre-form .cofre-form__check input,
.hist-modal__corpo .cofre-form__check input { width: 16px; height: 16px; margin: 0; }

/* lista de liga/desliga em duas colunas (vira uma só em tela estreita) */
.check-grade { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.2rem; margin: 0.75rem 0; }
.cofre-form .check-grade .cofre-form__check { margin: 0.35rem 0; }
@media (max-width: 640px) { .check-grade { grid-template-columns: 1fr; } }

/* cadeado do memorando secreto, antes do assunto */
.cham-secreto-ic { vertical-align: -2px; margin-right: 3px; color: var(--texto-suave); flex: none; }

/* Botão-cadeado do "secreto": checkbox de verdade (funciona em formulário
   normal e no JS que lê .checked), só escondido -- o label estilizado como
   círculo é o que aparece, e "acende" via :checked no irmão.
   Os seletores levam .cham-secreto-campo na frente de propósito: dentro de um
   .cofre-form o `.cofre-form label` (flex em coluna, cor própria) tem mais
   peso que uma classe sozinha e desalinhava o ícone. */
.cham-secreto-campo { display: flex; align-items: center; margin: 0; }
.cham-secreto-campo .cham-secreto-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.cham-secreto-campo .cham-secreto-btn {
    display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 0;
    flex: none; width: var(--control-h); height: var(--control-h); margin: 0; padding: 0; border-radius: 50%;
    border: 1px solid var(--borda); background: #fff; color: var(--texto-suave);
    cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.cham-secreto-campo .cham-secreto-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.cham-secreto-campo .cham-secreto-input:checked + .cham-secreto-btn { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.cham-secreto-campo .cham-secreto-input:focus-visible + .cham-secreto-btn { outline: 2px solid var(--brand); outline-offset: 2px; }

/* formulário de criar: a data e o cadeado na mesma linha */
.cham-campo-data { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.cham-campo-data > label { font-size: 0.85rem; font-weight: 500; color: #374151; }
.cham-data-linha { display: flex; align-items: center; gap: 0.5rem; }
.cham-data-linha input[type="date"] {
    flex: 1 1 auto; min-width: 0; height: var(--control-h); margin: 0; padding: 0 0.75rem;
    border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-weight: 400;
}

/* e-mail de envio das notas, na seção Documentos Fiscais da ficha do cliente */
.cli-dfe-email { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.cli-dfe-email > span { font-size: 0.82rem; font-weight: 500; color: #374151; }
.cli-dfe-email input { flex: 1 1 260px; min-width: 0; height: var(--control-h); padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.cli-dfe-email .btn { flex: 0 0 auto; }

/* prévia do DANFSe logo depois de emitir */
.nfse-previa {
    width: 100%;
    height: 70vh;
    min-height: 420px;
    margin-top: 1rem;
    border: 1px solid var(--borda);
    border-radius: 8px;
    background: #fff;
}

/* campos + botão numa linha só, alinhados pela base (o rótulo fica acima do
   campo, então é `end` e não `center`) */
.linha-campos { display: flex; align-items: end; gap: 0.8rem; flex-wrap: wrap; margin: 0 0 0.9rem; }
.cofre-form .linha-campos > label { flex: 1 1 220px; min-width: 0; margin: 0; }
.cofre-form .linha-campos > label.campo-estreito { flex: 0 1 200px; }
.linha-campos > .btn { flex: 0 0 auto; }

/* liga/desliga e o campo que ele controla, lado a lado */
.campo-com-check { display: flex; align-items: end; gap: 1.2rem; flex-wrap: wrap; margin: 0.75rem 0; }
.campo-com-check .cofre-form__check { margin: 0; padding-bottom: 0.55rem; }
.campo-com-check label:not(.cofre-form__check) { flex: 1 1 220px; min-width: 0; margin: 0; }
.hist-modal__acoes { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 0.85rem 1.1rem; border-top: 1px solid var(--borda); background: #f8fafc; }
.parametro-campos { min-width: 0; }

/* cancelamento de documento fiscal */
.nf-cancelar { width: min(520px, 94vw); }
.nf-cancelar__doc {
    margin: 0 0 0.9rem;
    display: grid;
    gap: 0.25rem 0;
    font-size: 0.82rem;
}
.nf-historico-envio__doc-linha { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.nf-historico-envio__doc-linha > div { margin: 0; }
#nf-historico-ocultar-usuario { flex: 0 0 auto; width: auto; white-space: nowrap; }
.nf-historico-envio__lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.nf-historico-envio__item {
    border: 1px solid var(--borda); border-radius: 8px; padding: 0.55rem 0.7rem;
    font-size: 0.82rem; background: #fff;
}
.nf-historico-envio__item--erro { border-color: #fecaca; background: #fef2f2; }
.nf-historico-envio--sem-usuario .nf-historico-envio__usuario { display: none; }
.nf-cancelar__doc > div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 0.5rem;
}
.nf-cancelar__doc dt { color: var(--texto-suave); }
.nf-cancelar__doc dd { margin: 0; color: var(--texto); word-break: break-word; }
.nf-cancelar__doc dd[data-k="chave"] { word-break: break-all; font-variant-numeric: tabular-nums; }
.nf-cancelar__aviso {
    margin: 0 0 0.9rem;
    padding: 0.6rem 0.75rem;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 7px;
    font-size: 0.82rem;
    color: #92400e;
}
.nf-cancelar__label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: #374151;
}
.nf-cancelar__label textarea {
    margin: 0;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--borda);
    border-radius: 6px;
    font: inherit;
    font-weight: 400;
    resize: vertical;
}
.nf-cancelar__contador { align-self: flex-end; font-size: 0.75rem; color: var(--texto-suave); }

.nf-cce__historico-wrap { margin: 0 0 0.9rem; font-size: 0.82rem; }
.nf-cce__historico-wrap summary { cursor: pointer; color: var(--texto-suave); font-weight: 500; }
.nf-cce__historico { margin-top: 0.5rem; }
.nf-cce-historico { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.nf-cce-historico li { border: 1px solid var(--borda); border-radius: 8px; padding: 0.55rem 0.7rem; background: #fff; }
.nf-cce-historico__topo { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.nf-cce-historico__texto { margin: 0; word-break: break-word; }
.nf-cce-historico__motivo { margin: 0.3rem 0 0; color: #991b1b; }
/* .btn tem height fixa de campo de formulário -- alta demais pra um item de
   lista compacto, então aqui a altura vem do padding */
.nf-cce-historico__pdf { height: auto; margin-top: 0.5rem; padding: 0.32rem 0.8rem; font-size: 0.76rem; }
#nf-cce-ver-modal .nf-cce__historico { max-height: 55vh; overflow: auto; }

.nf-importar { width: min(480px, 94vw); }
.nf-importar-lista { list-style: none; margin: 0.7rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; max-height: 40vh; overflow: auto; }
.nf-importar-lista li { font-size: 0.85rem; padding: 0.4rem 0.6rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fafafa; word-break: break-word; }
.nf-importar-lista li.nf-importar-ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
.nf-importar-lista li.nf-importar-falha { border-color: #fca5a5; background: #fef2f2; color: #991b1b; }

.nf-enviar { width: min(560px, 94vw); }
.nf-enviar-linha { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.nf-enviar-linha .nf-enviar-canal { flex: 0 0 auto; width: 8.5rem; height: var(--control-h); padding: 0 0.6rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.nf-enviar-linha .nf-enviar-valor { flex: 1 1 auto; min-width: 0; height: var(--control-h); padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.nf-enviar-linha .nf-enviar-remover { flex: 0 0 auto; width: 1.8rem; height: 1.8rem; border: none; background: transparent; color: var(--texto-suave); font-size: 1.1rem; line-height: 1; cursor: pointer; border-radius: 50%; }
.nf-enviar-linha .nf-enviar-remover:hover { background: #f1f1f1; color: var(--texto); }
#nf-enviar-add { margin-bottom: 0.6rem; }

.hist-cabecalho {
    font-size: 0.88rem;
    color: var(--texto-suave);
    margin-bottom: 0.7rem;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.hist-cabecalho strong { color: var(--texto); }
.hist-total { margin-left: auto; font-size: 0.78rem; }
.hist-vazio { font-size: 0.88rem; color: var(--texto-suave); padding: 0.6rem 0; }

.hist-wrap { overflow-x: auto; }
.hist-tabela { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.hist-tabela th,
.hist-tabela td {
    text-align: left;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid #eef1f4;
    vertical-align: top;
}
.hist-tabela th {
    font-weight: 600;
    color: var(--texto-suave);
    border-bottom-color: var(--borda);
    white-space: nowrap;
}
.hist-quando { white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-ip { white-space: nowrap; color: var(--texto-suave); }
.hist-detalhe { color: var(--texto-suave); }

.hist-acao {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #334155;
    font-size: 0.76rem;
    white-space: nowrap;
}
.hist-acao--revelar,
.hist-acao--copiar { background: #fef3c7; color: #92400e; }
.hist-acao--inserir { background: #dcfce7; color: #166534; }
.hist-acao--editar { background: #dbeafe; color: #1e40af; }
.hist-acao--excluir { background: #fee2e2; color: #991b1b; }

/* ---------- Toast (aviso rápido, ex.: "copiado") ---------- */
.nf-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    max-width: min(90vw, 560px);
    background: #111827;
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: pre-line;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transition: opacity .18s, transform .18s;
    z-index: 9999;
    pointer-events: none;
    cursor: pointer;
}
.nf-toast.mostra { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }

/* ==================================================================== */
/*  Contas / 2FA / administração de usuários                             */
/* ==================================================================== */

.card--larga { max-width: 480px; }

.botao-bloco {
    display: block;
    text-align: center;
    text-decoration: none;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.8rem;
    border-radius: 7px;
    margin-top: 0.5rem;
}
.botao-bloco:hover { background: var(--brand-escuro); }

/* passos de configuração do 2FA */
.passos-2fa { margin: 0.5rem 0 1.25rem 1.1rem; padding: 0; font-size: 0.88rem; color: #374151; }
.passos-2fa > li { margin-bottom: 1rem; line-height: 1.5; }
.passos-2fa strong { color: var(--texto); }

.qr-box {
    margin: 0.7rem 0;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 10px;
    display: inline-block;
    line-height: 0;
}
.qr-box svg { width: 190px; height: 190px; display: block; }

.qr-manual { margin-top: 0.3rem; font-size: 0.82rem; }
.qr-manual summary { cursor: pointer; color: var(--brand); }
.qr-manual p { margin: 0.5rem 0 0.3rem; color: var(--texto-suave); }

.chave-2fa {
    display: block;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    background: #f3f4f6;
    padding: 0.55rem 0.7rem;
    border-radius: 6px;
    word-break: break-all;
    user-select: all;
}

.input-otp {
    text-align: center;
    letter-spacing: 0.4em;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}

/* checkbox em linha nas telas de card (login / 2FA) */
.check-linha {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    font-size: 0.85rem;
    color: #374151;
    margin: -0.2rem 0 1.1rem;
}
.check-linha input { width: auto; margin: 0; flex: none; }

/* checkbox em linha genérico dos formulários de emissão/cofre */
.cofre-form__check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    font-size: 0.85rem;
    color: #374151;
    margin: 0.4rem 0;
}
.cofre-form__check input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; margin: 0; flex: none; }

/* códigos de backup */
.cod-backup {
    list-style: none;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8fafc;
    border: 1px dashed var(--borda);
    border-radius: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem 1rem;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-align: center;
    user-select: all;
}

/* Minha conta */
.conta-grid { display: grid; gap: 1.25rem; max-width: 620px; }
.conta-bloco {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.2rem 1.3rem;
}
.conta-bloco h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 0.9rem; }
.conta-bloco form { margin-top: 0.3rem; }
.conta-bloco label { margin-top: 0.6rem; }
.conta-bloco button[type="submit"], .conta-bloco .btn { width: auto; margin-top: 0.4rem; }
.conta-dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; font-size: 0.9rem; margin-bottom: 0.6rem; }
.conta-dl dt { color: var(--texto-suave); }
.form-inline { border-top: 1px solid #f0f0f0; margin-top: 1rem; padding-top: 1rem; }
.conta-status { font-size: 0.88rem; margin-bottom: 0.7rem; }
.conta-status--ok { color: #166534; }
.conta-status--alerta { color: #b45309; }

/* badges de status (tabela de usuários) */
.badge {
    display: inline-block;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.25rem;
}
.badge--brand { background: #e0f2fe; color: var(--brand-escuro); }
.badge--ok { background: #dcfce7; color: #166534; }
.badge--off { background: #f3f4f6; color: #6b7280; }
.badge--alerta { background: #fef3c7; color: #92400e; }
.badge--erro { background: #fee2e2; color: #991b1b; }
.badge--wpp { background: #dcfce7; color: #15803d; }
/* Badge clicável: reseta só a "casca" de <button> nativo (aparência, borda,
   fundo padrão, herança de fonte, e o "width: 100%" que o seletor genérico
   `button` — pensado pra a tela de login — vaza pra qualquer <button> do
   portal sem essa correção, é o mesmo motivo pelo qual .btn/.ff-variavel-btn/
   etc. têm essa mesma linha) — nunca toca em tamanho/peso/cor/margem, que
   continuam 100% do .badge, pra ficar pixel a pixel igual ao badge (não
   clicável) usado no resto do portal (ex.: Status em clientes.php). */
.badge-clicavel {
    width: auto;
    appearance: none;
    -webkit-appearance: none;
    border: none;
    background-clip: padding-box;
    font-family: inherit;
    cursor: pointer;
}
.badge-clicavel:hover { filter: brightness(0.94); }
.badge-clicavel:disabled { cursor: wait; opacity: 0.6; }

table.dados tr.linha-inativa td { opacity: 0.55; }

/* form de usuário */
.usuario-form .uf-secao {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.6rem 1rem 1rem;
    margin-bottom: 1rem;
}
.usuario-form .uf-secao legend {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    padding: 0 0.4rem;
}
.usuario-form textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--borda);
    border-radius: 7px;
    font-size: 0.9rem;
    resize: vertical;
}
.uf-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    padding-bottom: 0.4rem;
}
.usuario-form .uf-check { align-self: end; }
.uf-check input { width: auto; margin: 0; flex: none; }
.uf-clientes { margin-top: 0.8rem; }
.uf-clientes select { width: 100%; padding: 0.4rem; border: 1px solid var(--borda); border-radius: 7px; }

.btn.perigo, .btn-secundario.perigo { color: #b91c1c; border-color: #fecaca; }
.btn.perigo:hover, .btn-secundario.perigo:hover { background: #fef2f2; }

/* ---------- seletor com busca + chips (tagpick) ---------- */
.tagpick { position: relative; }
/* busca do tagpick dentro de rótulo de formulário: sem a borda de campo comum (senão fica caixa dentro de caixa) */
.cofre-form label .tagpick__input,
.hist-modal__corpo label .tagpick__input { width: auto; height: 28px; padding: 0 0.25rem; border: none; border-radius: 0; background: transparent; box-shadow: none; }
.tagpick__hidden { display: none; }
.tagpick__box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: var(--control-h);
    padding: 0.28rem 0.4rem;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    background: #fff;
    cursor: text;
}
.tagpick__box:focus-within {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 132, 195, 0.15);
}
.tagpick__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.2rem 0.15rem 0.55rem;
    background: #e0f2fe;
    color: var(--brand-escuro);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    line-height: 1.4;
}
.tagpick__x {
    width: 18px;
    height: 18px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 106, 158, 0.15);
    color: var(--brand-escuro);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}
.tagpick__x:hover { background: var(--brand); color: #fff; }
.tagpick__input {
    flex: 1;
    min-width: 90px;
    height: 28px;
    margin: 0;
    padding: 0 0.25rem;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.9rem;
}
.tagpick__drop {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    max-height: 230px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14);
}
.tagpick__item {
    padding: 0.5rem 0.7rem;
    font-size: 0.88rem;
    cursor: pointer;
}
.tagpick__item:hover,
.tagpick__item.ativo { background: #f0f9ff; color: var(--brand-escuro); }
.tagpick__vazio { padding: 0.6rem 0.7rem; font-size: 0.85rem; color: var(--texto-suave); }

/* ---------- código 2FA em caixas ---------- */
.otp {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.2rem 0 1.1rem;
}
.otp__box {
    width: 46px;
    height: 54px;
    margin: 0;
    padding: 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--texto);
    border: 1px solid var(--borda);
    border-radius: 9px;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.otp__box:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(0, 132, 195, 0.18);
}
@media (max-width: 380px) {
    .otp { gap: 0.35rem; }
    .otp__box { width: 40px; height: 48px; font-size: 1.3rem; }
}
.otp-toggle {
    display: block;
    margin: -0.4rem auto 1rem;
    font-size: 0.82rem;
}

/* ==================================================================== */
/*  Área do cliente — listagem com expansão                              */
/* ==================================================================== */

.cli-tabela .cli-exp-col { width: 30px; text-align: center; }
.cli-linha { cursor: pointer; }
.cli-linha:hover td { background: #f8fafc; }
.cli-linha:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.cli-chevron {
    display: inline-block;
    color: var(--texto-suave);
    transition: transform .15s ease;
    font-size: 1.1rem;
    line-height: 1;
}
.cli-linha.aberta .cli-chevron { transform: rotate(90deg); color: var(--brand); }
.cli-linha.aberta td { background: #eff6ff; }

.cli-detalhe > td { padding: 0 !important; background: #f4f7fa; border-top: none; }
.cli-detalhe__box {
    padding: 1.1rem 1.3rem 1.3rem;
    display: grid;
    gap: 1.2rem;
    font-size: 0.88rem;
}
.cli-secao h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    margin-bottom: 0.6rem;
}
.cli-salvo-hint {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--texto-suave);
    margin-left: 0.5rem;
    font-size: 0.72rem;
}

/* seções recolhíveis */
.cli-secao--tog > .cli-secao__cab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
}
.cli-secao--tog > .cli-secao__cab:focus-visible {
    outline: 2px solid var(--primaria, #2563eb);
    outline-offset: 2px;
    border-radius: 3px;
}
.cli-secao__chev {
    flex: none;
    color: #9ca3af;
    transition: transform 0.15s ease;
}
.cli-secao--tog.recolhida > .cli-secao__cab .cli-secao__chev {
    transform: rotate(-90deg);
}
.cli-secao--tog.recolhida > .cli-secao__cab {
    margin-bottom: 0;
}
.cli-secao--tog.recolhida > .cli-secao__corpo {
    display: none;
}
.cli-secao__cab .cli-salvo-hint {
    margin-left: auto;
}

/* campos p/ copiar */
.cli-copia-grade {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.55rem;
}
.cli-copia {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.65rem;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 8px;
    transition: border-color .12s, background .12s;
}
.cli-novo-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cli-form-novo { max-width: 620px; }
.cli-form-dica { margin: 0.1rem 0 0.7rem; font-size: 0.8rem; color: var(--texto-suave); }
.cli-form-erro {
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 7px;
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    margin: 0.4rem 0 0.8rem;
}

.cli-copia--full { grid-column: 1 / -1; }
/* apelido (estreito) + razão social (o resto) na mesma linha */
.cli-copia-linha { grid-column: 1 / -1; display: flex; gap: 0.55rem; }
.cli-copia-linha > .cli-copia:first-child { flex: 0 0 20%; min-width: 150px; }
.cli-copia-linha > .cli-copia:last-child { flex: 1 1 0; min-width: 0; }
@media (max-width: 560px) { .cli-copia-linha { flex-wrap: wrap; } .cli-copia-linha > .cli-copia { flex: 1 1 100% !important; } }
.cli-copia:not(.vazio) { cursor: pointer; }
.cli-copia[data-copiar-fmt] { user-select: none; }
.cli-copia[data-copiar-fmt] .cli-copia__rot::after {
    content: " · 2 cliques = com pontuação";
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.65;
}
.cli-copia:not(.vazio):hover { border-color: var(--brand); background: #f0f9ff; }
.cli-copia.copiou { border-color: #86efac; background: #dcfce7; }
.cli-copia.copiou-erro { border-color: #fecaca; background: #fee2e2; }
.cli-copia__rot { font-size: 0.7rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.03em; }
.cli-copia__val { font-weight: 600; color: var(--texto); word-break: break-word; }

/* campos personalizados (ex.: CRC) e NIRE/IE/IM — mesmo card, com lápis pra
   editar (ou lápis desabilitado quando vem do Domínio). */
.cli-copia--custom { position: relative; padding-right: 2rem; }
.cli-copia__editar,
.cli-copia__editar-bloqueado,
.cli-dados-editar,
.cli-regime-editar,
.cli-contador-editar {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    width: 24px;
    height: 24px;
}
/* especificidade igual à .cofre-ic:disabled (cursor:wait) pra vencer por ordem no arquivo */
.cli-copia__editar-bloqueado:disabled { cursor: not-allowed; }
/* lupa (consultar IE na SEFAZ / regime na Receita) ao lado do lápis */
.cli-consultar-cad { position: absolute; top: 0.2rem; right: 1.75rem; width: 24px; height: 24px; }
.cli-copia--custom:has(.cli-consultar-cad) { padding-right: 3.6rem; }

/* form de editar NIRE/IE/IM/Regime tributário/Contador (cliente sem vínculo com o Domínio) — mesma cara do cli-campo-form */
.cli-dados-form-wrap,
.cli-regime-form-wrap,
.cli-contador-form-wrap { margin-top: 0.6rem; }
.cli-dados-form,
.cli-regime-form,
.cli-contador-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.cli-dados-form[hidden],
.cli-regime-form[hidden],
.cli-contador-form[hidden] { display: none; }
.cli-dados-form__rot { font-size: 0.85rem; font-weight: 600; color: var(--texto); }
.cli-dados-form input[type="text"],
.cli-regime-form select,
.cli-contador-form select {
    width: auto; flex: 1; min-width: 140px; margin-bottom: 0;
    height: var(--control-h);
    padding: 0 0.7rem;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    font-size: 0.85rem;
}
.cli-dados-form button[type="submit"],
.cli-regime-form button[type="submit"],
.cli-contador-form button[type="submit"] { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.85rem; }
.cli-dados-form .cli-form-erro,
.cli-regime-form .cli-form-erro,
.cli-contador-form .cli-form-erro { width: 100%; }

.cli-campo-add { margin-top: 0.6rem; }
.cli-campo-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.5rem;
}
.cli-campo-form[hidden] { display: none; }
.cli-campo-form input[type="text"] {
    width: auto; flex: 1; min-width: 140px; margin-bottom: 0;
    height: var(--control-h);
    padding: 0 0.7rem;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    font-size: 0.85rem;
}
.cli-campo-form button[type="submit"] { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.85rem; }
.cli-campo-form .cli-form-erro { width: 100%; }
.cli-copia.vazio .cli-copia__val { font-weight: 400; color: var(--texto-suave); }

/* senhas do cofre */
.cli-cofre-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.55rem; }
.cli-cofre-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.6rem;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border: 1px solid var(--borda);
    border-radius: 8px;
}
.cli-cofre__rot { font-size: 0.72rem; color: var(--texto-suave); text-transform: uppercase; letter-spacing: 0.03em; width: 100%; }
.cli-senha { display: inline-flex; align-items: center; gap: 0.2rem; white-space: nowrap; }
.cli-senha code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.85rem;
    background: #f3f4f6;
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
    cursor: pointer;
    user-select: all;
}
.cli-cofre-toggle { font-size: 0.78rem; }
.cli-cofre-form[hidden] { display: none; }   /* .cli-cofre-form {display:flex} ganha do [hidden] do navegador */
.cli-cofre-form {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eef1f4;
}
.cli-cofre-form input[type="text"] {
    flex: 1;
    min-width: 110px;
    height: 34px;
    margin: 0;
    padding: 0 0.6rem;
    border: 1px solid var(--borda);
    border-radius: 6px;
    font-size: 0.88rem;
}
.cli-cofre-form button {
    width: auto;
    height: 34px;
    padding: 0 0.9rem;
    font-size: 0.85rem;
}
.cli-cofre-form .link-btn { padding: 0; height: auto; }

/* form de funcionalidades */
.cli-config.salvando { opacity: 0.55; pointer-events: none; }
.cli-config-grade {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.7rem 1rem;
    align-items: end;
}
.cli-toggle {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.86rem;
    font-weight: 500;
    color: #374151;
    padding: 0.55rem 0;
}
.cli-toggle input { width: auto; margin: 0; flex: none; width: 16px; height: 16px; }

/* grade em modo "botões" (Documentos Fiscais Eletrônicos): cada bool vira um toggle-botão */
.cli-config-grade--botoes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.cli-config-grade--botoes .cli-toggle {
    padding: 0;
    gap: 0;
    cursor: pointer;
    user-select: none;
}
.cli-config-grade--botoes .cli-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}
.cli-config-grade--botoes .cli-toggle span {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 0.95rem;
    border: 1px solid #cbd2d8;
    border-radius: 8px;
    background: #eef1f3;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background .12s, border-color .12s, color .12s;
}
.cli-config-grade--botoes .cli-toggle:hover span {
    border-color: #b4bdc4;
    background: #e3e7ea;
}
.cli-config-grade--botoes .cli-toggle input:checked + span {
    border-color: #60a5fa;
    background: #dbeafe;
    color: #1d4ed8;
}
.cli-config-grade--botoes .cli-toggle:hover input:checked + span {
    background: #c3dafe;
    border-color: #3b82f6;
}

/* Comunicações — uma cor por tema (marcado) */
.cli-config-grade--botoes .cli-toggle input[name="confereFatorR"]:checked + span {
    border-color: #f59e0b; background: #fef3c7; color: #b45309;   /* Fator R — âmbar */
}
.cli-config-grade--botoes .cli-toggle:hover input[name="confereFatorR"]:checked + span {
    background: #fde9b0; border-color: #d97706;
}
.cli-config-grade--botoes .cli-toggle input[name="informaAliqSn"]:checked + span {
    border-color: #a78bfa; background: #ede9fe; color: #6d28d9;   /* Alíquota SN — violeta */
}
.cli-config-grade--botoes .cli-toggle:hover input[name="informaAliqSn"]:checked + span {
    background: #ddd6fe; border-color: #8b5cf6;
}
.cli-config-grade--botoes .cli-toggle input[name="notificarCaixaPostal"]:checked + span {
    border-color: #2dd4bf; background: #ccfbf1; color: #0f766e;   /* Caixa Postal — teal */
}
.cli-config-grade--botoes .cli-toggle:hover input[name="notificarCaixaPostal"]:checked + span {
    background: #99f6e4; border-color: #14b8a6;
}

.cli-config-grade--botoes .cli-toggle input:focus-visible + span {
    outline: 2px solid var(--brand, #2563eb);
    outline-offset: 2px;
}

/* Situação — verde quando ativo, vermelho quando inativo (os dois estados importam aqui) */
.cli-config-grade--botoes .cli-toggle input[name="status"] + span {
    border-color: #fca5a5; background: #fef2f2; color: #b91c1c;
}
.cli-config-grade--botoes .cli-toggle:hover input[name="status"] + span {
    background: #fee2e2; border-color: #f87171;
}
.cli-config-grade--botoes .cli-toggle input[name="status"]:checked + span {
    border-color: #4ade80; background: #dcfce7; color: #15803d;
}
.cli-config-grade--botoes .cli-toggle:hover input[name="status"]:checked + span {
    background: #bbf7d0; border-color: #22c55e;
}

/* Cobrança — verde quando "Cobrar? sim" */
.cli-config-grade--botoes .cli-toggle input[name="cobrar"]:checked + span {
    border-color: #4ade80; background: #dcfce7; color: #15803d;
}
.cli-config-grade--botoes .cli-toggle:hover input[name="cobrar"]:checked + span {
    background: #bbf7d0; border-color: #22c55e;
}

/* Documentos Fiscais Eletrônicos — um box por modelo (NF-e / NFS-e / NFC-e),
   cada um com seus toggles + o botão "Consultar ... agora". */
.cli-dfe-boxes {
    display: grid;
    /* auto-fit (não auto-fill) -- quando só tem 1-2 box aplicável (ex.: só
       NFS-e), eles esticam pra usar o espaço todo em vez de ficar
       espremidos numa faixa estreita com o resto da linha vazio. */
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 0.8rem;
    /* cada box com a própria altura: abrir a config da NFS-e não estica NF-e/NFC-e */
    align-items: start;
    grid-auto-flow: row dense;   /* os boxes fechados preenchem o espaço ao lado do aberto */
}
/* Config aberta (tela larga): a grade vira 2 colunas -- os boxes fechados
   empilham à esquerda e o aberto fica à direita, com a altura que precisar.
   A 3ª linha (1fr) absorve a altura extra do box aberto; sem ela a grade
   repartiria essa altura entre as linhas e abriria vãos entre os fechados.
   Não usar @container aqui: container-type tira a largura natural do bloco
   e, dentro da <td> da listagem, a seção inteira encolhe. */
@media (min-width: 900px) {
    .cli-dfe-boxes:has(.cli-dfe-config[open]) {
        grid-template-columns: minmax(215px, 1fr) minmax(0, 2fr);
        grid-template-rows: auto auto 1fr;
    }
    .cli-dfe-boxes:has(.cli-dfe-config[open]) > .cli-dfe-box { grid-column: 1; }
    .cli-dfe-boxes:has(.cli-dfe-config[open]) > .cli-dfe-box:has(.cli-dfe-config[open]) { grid-column: 2; grid-row: 1 / span 3; }
}
.cli-dfe-box {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.8rem;
    border: 1px solid var(--borda);
    border-radius: 10px;
    background: #fbfcfd;
    min-width: 0; /* idem .cofre-form label -- não deixa o conteúdo forçar o box a ficar mais largo que a coluna do grid */
    max-width: 100%;
    overflow-x: hidden;
}
.cli-dfe-box__tit {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--texto-suave);
}
.cli-dfe-box .cli-config-grade--botoes { gap: 0.4rem; }
.cli-dfe-box__acao {
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--borda);
}
/* config de numeração/emitente (série, endereço etc.) dentro do box de
   "Emitir X" -- o box é estreito (minmax 240px), então empilha 1 campo por
   linha em vez de tentar caber o grid largo usado no resto do sistema. */
.cli-dfe-config {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden; /* trava de segurança: nunca deixa nada aqui dentro empurrar a página pros lados */
    margin-top: 0.55rem;
    padding-top: 0.55rem;
    border-top: 1px dashed var(--borda);
}
/* Trava geral: NADA dentro dessa caixa pode ficar mais largo que o pai --
   cobre qualquer elemento (botão, label, parágrafo) que não esteja dentro
   de .cofre-form__grade e por isso escapa das regras de flex-wrap abaixo. */
.cli-dfe-config * {
    max-width: 100%;
    box-sizing: border-box;
}
.cli-dfe-config button,
.cli-dfe-config label,
.cli-dfe-config p,
.cli-dfe-config span {
    white-space: normal;
    word-break: break-word;
}
.cli-dfe-config summary {
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--texto-suave);
}
/* Botões diretos da caixa (ex.: "Buscar município pelo CNPJ da empresa")
   não ficam dentro de .cofre-form__grade -- sem largura definida, um botão
   com texto longo fica do tamanho do texto e estoura a caixa. */
.cli-dfe-config > button,
.cli-dfe-config .cli-dfe-config__cnpj-btn {
    display: block;
    width: 100%;
}
.cli-dfe-config .cli-toggle { width: 100%; }
/* Grid com 1fr ainda pode calcular largura pelo conteúdo em certos casos
   (e aqui dentro de <td> de tabela, que por padrão cresce pra caber o que
   tiver dentro) -- flexbox com wrap é bem mais previsível: nunca força o
   container a ficar mais largo, só quebra linha. */
.cli-dfe-config .cofre-form__grade {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.7rem;
    margin-top: 0.6rem;
}
.cli-dfe-config .cofre-form__grade label {
    flex: 1 1 110px;
    min-width: 0;
    max-width: 100%;
}
/* Município/Logradouro pedem mais espaço que UF/CEP/número. */
.cli-dfe-config .cofre-form__grade label.cli-dfe-config__largo { flex: 2 1 180px; }
.cli-dfe-config input:not([type="checkbox"]),
.cli-dfe-config select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}
/* Sem essa exceção, a regra acima (width:100%) também pega o checkbox de
   "Enviar Inscrição Municipal" e ele vira um quadradão gigante. */
.cli-dfe-config input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: none;
}
.cli-dfe-config h4,
.cli-dfe-config > p.campo-dica { margin-top: 0.7rem; }
.cli-dfe-config .cli-dfe-config__cnpj-btn { margin: 0.4rem 0 0.2rem; }
.cli-dfe-config details {
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--borda);
}
.cli-dfe-config details summary {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--texto-suave);
}
.cli-dfe-config__acoes {
    margin-top: 0.7rem;
    padding-top: 0.6rem;
    border-top: 1px dashed var(--borda);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.cli-dfe-config__status { font-size: 0.75rem; color: var(--texto-suave); }
.cli-dfe-consultar {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0 0.7rem;
    height: 2rem;
    border: 1px solid var(--borda);
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.cli-dfe-consultar:hover:not(:disabled) { background: #f3f4f6; border-color: #9ca3af; }
.cli-dfe-consultar svg { flex: none; }
.cli-dfe-consultar:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Documentos Fiscais (2026-10): box com cabeçalho + seções "Receber" / "Emitir" ---- */
.cli-dfe-acao {                       /* links "Emitir agora" / "Emissor do cliente" -- mesmo visual do Consultar */
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0 0.7rem; height: 2rem;
    border: 1px solid var(--borda); border-radius: 999px; background: #fff; color: #374151;
    font-size: 0.78rem; font-weight: 600; text-decoration: none;
}
.cli-dfe-acao:hover { background: #f3f4f6; border-color: #9ca3af; }
.cli-dfe-acao:hover, .cli-dfe-consultar:hover { text-decoration: none; }  /* .link-btn sublinha no hover */
.cli-dfe-acao svg { flex: none; }
.cli-dfe-box { gap: 0; padding: 0.85rem 0.9rem 0.9rem; background: #fff; }
.cli-dfe-box__cab {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    padding-bottom: 0.6rem;
}
.cli-dfe-box__cab .cli-dfe-box__tit { font-size: 0.8rem; color: #1f2937; }
.cli-dfe-selo {
    font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.55rem; border-radius: 999px;
    white-space: nowrap; cursor: default;
}
.cli-dfe-selo--ok { background: #dcfce7; color: #166534; }
.cli-dfe-selo--aviso { background: #fef3c7; color: #92400e; }
.cli-dfe-box__sec {
    display: flex; flex-direction: column; gap: 0.5rem;
    padding: 0.7rem 0; border-top: 1px solid #eef0f2;
}
.cli-dfe-box__sec:last-child { padding-bottom: 0; }
.cli-dfe-box__rot {
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #9ca3af;
}
.cli-dfe-box__acoes { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* "Configurar emissão de X": botão que abre o painel */
.cli-dfe-box__sec .cli-dfe-config { margin-top: 0.15rem; padding-top: 0; border-top: 0; }
.cli-dfe-config > summary {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.5rem 0.75rem; border: 1px solid var(--borda); border-radius: 8px;
    background: #f9fafb; color: #374151; font-size: 0.8rem; font-weight: 600; list-style: none;
}
.cli-dfe-config > summary::-webkit-details-marker { display: none; }
.cli-dfe-config > summary::before {
    content: ''; width: 0.4rem; height: 0.4rem; flex: none;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform .15s;
}
.cli-dfe-config[open] > summary { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.cli-dfe-config[open] > summary::before { transform: rotate(45deg); }
.cli-dfe-config > summary:hover { border-color: #9ca3af; }

/* blocos do painel (Como emitir, Numeração, Tributação...) */
.cli-dfe-grupo { border: 0; margin: 0; padding: 0.8rem 0 0; min-width: 0; }
.cli-dfe-grupo[hidden] { display: none; }
.cli-dfe-grupo + .cli-dfe-grupo { margin-top: 0.8rem; border-top: 1px dashed var(--borda); }
.cli-dfe-grupo > legend {
    float: left; width: 100%; padding: 0; margin: 0 0 0.5rem;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #4b5563;
}
.cli-dfe-grupo > legend + * { clear: both; }
.cli-dfe-grupo .campo-dica { margin: 0.35rem 0 0; }
.cli-dfe-grupo details { margin-top: 0.6rem; }

/* campos: 2 colunas; os longos ocupam a linha; UF fica estreita ao lado do município */
.cli-dfe-campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 0.6rem; }
.cli-dfe-campos > label {
    display: flex; flex-direction: column; gap: 0.25rem; min-width: 0;
    font-size: 0.78rem; font-weight: 500; color: #374151;
}
.cli-dfe-campos > .cli-dfe-campos__largo { grid-column: 1 / -1; }
.cli-dfe-campos--uf { grid-template-columns: 5.2rem minmax(0, 1fr); }
.cli-dfe-campos + .cli-dfe-campos { margin-top: 0.55rem; }
.cli-dfe-config .cli-dfe-campos input:not([type="checkbox"]),
.cli-dfe-config .cli-dfe-campos select {
    height: 2.35rem; padding: 0 0.6rem; margin: 0;
    border: 1px solid var(--borda); border-radius: 8px; background: #fff;
    font-size: 0.85rem; font-weight: 400; color: #111827;
}
.cli-dfe-config .cli-dfe-campos input:focus,
.cli-dfe-config .cli-dfe-campos select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 132, 195, .15); }
.cli-dfe-grupo .cli-toggle { padding: 0.25rem 0; font-size: 0.83rem; }
/* opções lado a lado (ex.: "Enviar no grupo de WhatsApp" + "Enviar o XML junto") */
.cli-dfe-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1.5rem; }
.cli-dfe-config .cli-dfe-linha .cli-toggle { width: auto; }
.cli-dfe-linha .cli-toggle:has(input:disabled) { opacity: 0.45; cursor: not-allowed; }
.cli-dfe-grupos-wpp { display: flex; flex-wrap: wrap; align-items: center; gap: 0 1rem; padding-left: 1.6rem; }
.cli-dfe-grupos-wpp .campo-dica { width: 100%; margin: 0; }
.cli-dfe-grupo .cli-dfe-config__cnpj-btn { margin: 0 0 0.6rem; }

/* "Como emitir": dois botões lado a lado, o escolhido em destaque */
.cli-seg {
    display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px;
    border: 1px solid var(--borda); border-radius: 10px; background: #eef1f3;
}
.cli-seg--3 { grid-template-columns: repeat(3, 1fr); }
.em-cfg-procurador { display: block; margin-top: 0.6rem; }
.em-cfg-procurador select { width: 100%; }
.cli-dfe-config .cli-seg__op {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
    min-height: 2.6rem; padding: 0.35rem 0.5rem; margin: 0; width: 100%;
    border: 0; border-radius: 8px; background: transparent; color: #4b5563;
    font: inherit; font-size: 0.82rem; font-weight: 600; text-align: center; line-height: 1.2;
    cursor: pointer; transition: background .12s, color .12s, box-shadow .12s;
}
.cli-dfe-config .cli-seg__op small { font-size: 0.66rem; font-weight: 500; opacity: 0.85; }
.cli-dfe-config .cli-seg__op:hover:not(:disabled):not([aria-checked="true"]) { background: #e2e6ea; color: #1f2937; }
.cli-dfe-config .cli-seg__op[aria-checked="true"] {
    background: var(--brand); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.cli-dfe-config .cli-seg__op:disabled { cursor: not-allowed; color: #9ca3af; }
.cli-dfe-config .cli-seg__op:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.cli-dfe-config__acoes { justify-content: space-between; }
.cli-dfe-config .cli-emissor-cfg-salvar { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cli-dfe-config .cli-emissor-cfg-salvar:hover:not(:disabled) { background: var(--brand-escuro); }


.cli-campo { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; font-weight: 500; color: #374151; }
.cli-campo select,
.cli-campo input {
    height: var(--control-h);
    margin: 0;
    padding: 0 0.7rem;
    border: 1px solid var(--borda);
    border-radius: var(--control-radius);
    background: #fff;
    font-size: 0.9rem;
    font-weight: 400;
}

/* seção WhatsApp — grupos + contato de cobrança numa linha só */
.cli-wpp {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
}
.cli-wpp-grupo,
.cli-wpp-contato,
.cli-wpp-pill {
    width: auto;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    height: 34px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

/* botões de GRUPO — verde mais forte (são grupos) */
.cli-wpp-grupo {
    gap: 0.45rem;
    padding: 0 0.9rem;
    border: 1px solid #3fae74;
    background: #d3efdf;
    color: #0b6b3b;
    cursor: pointer;
}
.cli-wpp-grupo:hover { background: #bde7cf; border-color: #2f9c63; }
.cli-wpp-grupo.carregando { opacity: 0.6; pointer-events: none; }

/* Administrativo ainda não solicitado — cinza; clicar marca (sem desmarcar) */
.cli-wpp-grupo.cli-wpp-grupo--off {
    border-color: #cbd2d8;
    background: #eef1f3;
    color: #6b7280;
}
.cli-wpp-grupo.cli-wpp-grupo--off:hover { background: #e3e7ea; border-color: #b4bdc4; }

/* Administrativo marcado, aguardando o grupo — verde, travado */
.cli-wpp-grupo.cli-wpp-adm-on,
.cli-wpp-grupo.cli-wpp-adm-on:hover,
.cli-wpp-grupo.cli-wpp-adm-on:disabled,
.cli-wpp-grupo.cli-wpp-info-on,
.cli-wpp-grupo.cli-wpp-info-on:hover,
.cli-wpp-grupo.cli-wpp-info-on:disabled {
    background: #d3efdf;
    border-color: #3fae74;
    color: #0b6b3b;
    opacity: 1;
    cursor: default;
}

/* contatos — verde mais claro, pill dividido (abrir | editar) */
.cli-wpp-pill {
    padding: 0;
    overflow: hidden;
    border: 1px solid #a7e0c0;
    background: #f0fbf5;
}
.cli-wpp-contato--cobr { border-color: #e0b355; }
.cli-wpp-contato--cobr .cli-wpp-pill__go,
.cli-wpp-contato--cobr .cli-wpp-pill__edit { color: #a06a12; }
.cli-wpp-contato--cobr .cli-wpp-pill__edit { border-left-color: #e0b355; }
.cli-wpp-pill__tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 4px;
    background: #f2d9a6;
    color: #7a4e08;
    font-size: 0.72rem;
    font-weight: 700;
}
.cli-wpp-pill__go {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 100%;
    padding: 0 0.75rem;
    color: #128c4b;
    font-weight: 500;
    text-decoration: none;
}
.cli-wpp-pill__go:hover { background: #dcf5e7; }
.cli-wpp-pill__edit {
    width: auto;
    height: 100%;
    margin: 0;
    padding: 0 0.5rem;
    border: 0;
    border-left: 1px solid #a7e0c0;
    background: transparent;
    color: #128c4b;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}
.cli-wpp-pill__edit:hover { background: #dcf5e7; }

/* botão "Contato" — adicionar mais um contato */
.cli-wpp-contato--add {
    gap: 0.45rem;
    padding: 0 0.9rem;
    border: 1px dashed #a7e0c0;
    background: #f7fdfa;
    color: #128c4b;
    cursor: pointer;
}
.cli-wpp-contato--add:hover { background: #e9f9f0; border-color: #6fd19c; }

.cli-wpp-ct-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    margin-top: 0.45rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eef1f4;
}
.cli-wpp-ct-form[hidden] { display: none; }
.cli-wpp-ct-form input[type="text"] {
    flex: 1;
    min-width: 120px;
    height: 34px;
    margin: 0;
    padding: 0 0.6rem;
    border: 1px solid var(--borda);
    border-radius: 6px;
    font-size: 0.88rem;
}
.cli-wpp-ct-chk {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    font-size: 0.84rem;
    color: #374151;
}
.cli-wpp-ct-chk input[type="checkbox"] { width: 16px; height: 16px; margin: 0; flex: none; }
.cli-wpp-ct-acoes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.cli-wpp-ct-form button[type="submit"] { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.85rem; }
.cli-wpp-ct-form .link-btn { padding: 0; height: auto; }
.cli-wpp-ct-excluir { color: #dc2626; margin-left: auto; }
.cli-wpp-ct-excluir[hidden] { display: none; }

/* select "Contato de cobrança" na seção Cobrança (fica na mesma grade dos outros campos) */
.cli-cobr-contato-nota {
    grid-column: 1 / -1;
    margin: 0;
    font-size: 0.82rem;
    color: var(--texto-suave);
}

/* certificado digital */
.cli-cert-lista { display: grid; gap: 0.5rem; }
.cli-cert {
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--borda);
    border-left: 3px solid #94a3b8;
    border-radius: 8px;
    background: #fff;
}
.cli-cert--vencido { border-left-color: #dc2626; }
.cli-cert--vence   { border-left-color: #f59e0b; }
.cli-cert--pendente { border-left-color: #94a3b8; }
.cli-cert__topo { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cli-cert__nome { font-weight: 600; font-size: 0.88rem; margin-right: auto; }
.cli-cert__sub { display: block; font-size: 0.76rem; color: var(--texto-suave); margin-top: 0.15rem; }
.cli-cert__venc { display: block; font-size: 0.8rem; color: var(--texto); margin-top: 0.1rem; }
.cli-cert--vencido .cli-cert__venc { color: #b91c1c; font-weight: 600; }
.cli-cert--vence .cli-cert__venc { color: #b45309; font-weight: 600; }
.cli-cert__msg { display: block; font-size: 0.76rem; color: var(--texto-suave); margin-top: 0.15rem; }
.cli-cert-senha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; margin-top: 0.25rem; }
.cli-cert-senha .cli-cert__rot { font-size: 0.76rem; color: var(--texto-suave); margin-right: 0.15rem; }
.cli-cert-senha code {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    background: #f3f4f6;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    color: var(--texto);
}
.cli-cert-senha .cofre-ic.ativo { color: var(--brand); }
.cli-cert-senha-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.35rem;
}
.cli-cert-senha-form[hidden] { display: none; }
.cli-cert-senha-form input[type="password"] {
    flex: 1; min-width: 130px; height: 32px; margin: 0; padding: 0 0.55rem;
    border: 1px solid var(--borda); border-radius: 6px; font-size: 0.85rem;
}
.cli-cert-senha-form button[type="submit"] { width: auto; height: 32px; padding: 0 0.8rem; font-size: 0.82rem; }

/* histórico do certificado */
.cli-cert-hist { margin-top: 0.8rem; font-size: 0.82rem; }
.cli-cert-hist > summary { cursor: pointer; color: var(--texto-suave); font-weight: 500; }
.cli-cert-hist ul { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.cli-cert-hist li {
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--borda);
    border-radius: 6px;
    background: #fff;
}
.cli-cert-hist__acao { font-weight: 600; }
.cli-cert-hist__id {
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    font-size: 0.76rem;
    background: #f1f5f9;
    padding: 0.05rem 0.35rem;
    border-radius: 4px;
    color: var(--texto-suave);
}
.cli-cert-hist__meta { display: block; font-size: 0.76rem; color: var(--texto-suave); margin-top: 0.1rem; }
.cli-cert-hist__det { display: block; font-size: 0.76rem; color: var(--texto); margin-top: 0.1rem; }
.cli-cert-baixar { color: var(--texto-suave); display: inline-flex; text-decoration: none; }
.cli-cert-baixar:hover { color: var(--brand); }
.cli-cert-excluir { color: #dc2626; }
.cli-cert-add { margin-top: 0.6rem; }
.cli-cert-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eef1f4;
}
.cli-cert-form[hidden] { display: none; }
.cli-cert-form input[type="password"] {
    height: 34px; margin: 0; padding: 0 0.6rem;
    border: 1px solid var(--borda); border-radius: 6px; font-size: 0.88rem;
}
.cli-cert-form input[type="file"] { font-size: 0.8rem; max-width: 100%; }
.cli-cert-form button[type="submit"] { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.85rem; }
.cli-cert-form .cli-form-erro { width: 100%; }

/* painel (painel.php) -- atenção, indicadores, gráficos e faixas */
.pn-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pn-cab__info { font-size: 0.82rem; color: var(--texto-suave); }
.pn-bloco {
    background: #fff; border: 1px solid var(--borda); border-radius: 10px;
    padding: 1rem 1.15rem 1.1rem; margin-bottom: 1rem; min-width: 0;
}
.pn-titulo { margin: 0 0 0.8rem; font-size: 0.95rem; font-weight: 700; color: var(--texto); }
.pn-subtitulo { margin: 1.1rem 0 0.4rem; font-size: 0.75rem; font-weight: 700; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .03em; }
.pn-ok { margin: 0; color: #15803d; font-weight: 600; font-size: 0.9rem; }
.pn-rodape { margin: 0.8rem 0 0; font-size: 0.78rem; color: var(--texto-suave); }
.pn-duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 0 1rem; }
/* Início → Visão do escritório: quadros vindos da TV (obrigações, agenda, cobrança por mês) */
.pn-kpis.pn-kpis--escritorio { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pn-obrig__venc, .pn-agenda__dia { width: 4.2rem; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.pn-agenda__dia { width: 5.6rem; }
.pn-agenda__hora { width: 3.4rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pn-obrig--passou td { color: #b91c1c; }
.pn-obrig--hoje td, .pn-agenda--hoje td { font-weight: 600; }
.pn-subtitulo--1 { margin-top: 0.2rem; }
.pn-subtitulo small { text-transform: none; font-weight: 400; letter-spacing: 0; }
.pn-cob { display: grid; gap: 0.35rem; margin-bottom: 0.4rem; }
.pn-cob__linha { display: grid; grid-template-columns: 3.4rem 1fr; align-items: center; gap: 0.6rem; font-size: 0.82rem; }
.pn-pilha { display: flex; height: 1.15rem; border-radius: 4px; overflow: hidden; background: #f1f5f9; }
.pn-pilha i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 0.7rem; font-weight: 600; color: #fff; }
.pn-pilha__pago { background: #16a34a; }
.pn-pilha__venc { background: #dc2626; }
.pn-pilha__avencer { background: #38bdf8; }
.pn-legenda i.pn-pilha__pago, .pn-legenda i.pn-pilha__venc, .pn-legenda i.pn-pilha__avencer { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 0.25rem 0 0.6rem; vertical-align: -1px; }

/* precisa de atenção */
.pn-atencao { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.pn-atencao__item > a, .pn-atencao__item > div {
    display: grid; grid-template-columns: 1fr auto; column-gap: 0.8rem; align-items: center;
    padding: 0.6rem 0.85rem; border-radius: 8px; border-left: 4px solid; text-decoration: none; color: inherit;
}
.pn-atencao__item > a:hover { filter: brightness(0.97); text-decoration: none; }
.pn-atencao__tit { font-weight: 700; font-size: 0.9rem; }
.pn-atencao__det { grid-column: 1; font-size: 0.8rem; color: #4b5563; margin-top: 0.1rem; }
.pn-atencao__seta { grid-column: 2; grid-row: 1 / span 2; font-size: 1.4rem; color: #9ca3af; }
.pn-atencao__item--critico > * { background: #fef2f2; border-color: #dc2626; }
.pn-atencao__item--critico .pn-atencao__tit { color: #991b1b; }
.pn-atencao__item--alerta > * { background: #fffbeb; border-color: #f59e0b; }
.pn-atencao__item--alerta .pn-atencao__tit { color: #92400e; }
.pn-atencao__item--info > * { background: #eff6ff; border-color: var(--brand); }
.pn-atencao__item--info .pn-atencao__tit { color: var(--brand-escuro); }

/* indicadores */
.pn-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.pn-kpi {
    display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem 1rem;
    background: #fff; border: 1px solid var(--borda); border-radius: 10px; text-decoration: none; color: inherit;
    transition: border-color .12s, box-shadow .12s;
}
a.pn-kpi:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07); text-decoration: none; }
.pn-kpi__rot { font-size: 0.78rem; color: var(--texto-suave); font-weight: 600; }
.pn-kpi__num { font-size: 1.55rem; font-weight: 700; color: var(--texto); line-height: 1.2; font-variant-numeric: tabular-nums; }
.pn-kpi__sub { font-size: 0.76rem; color: var(--texto-suave); }
.pn-var { font-weight: 700; }
.pn-var--alta { color: #15803d; }
.pn-var--baixa { color: #b91c1c; }

/* gráficos de 12 meses (barras empilhadas: saída embaixo, entrada em cima) */
.pn-graficos { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.4rem; }
.pn-graf { margin: 0; min-width: 0; }
.pn-graf figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.5rem; font-size: 0.88rem; }
.pn-graf figcaption span { font-size: 0.78rem; color: var(--texto-suave); }
.pn-graf__barras { display: flex; align-items: flex-end; gap: 4px; height: 120px; border-bottom: 1px solid var(--borda); }
.pn-graf__col { flex: 1; height: 100%; display: flex; flex-direction: column-reverse; border-radius: 3px 3px 0 0; }
.pn-graf__col:hover { background: #f1f5f9; }
.pn-graf__s { background: var(--brand); display: block; }
.pn-graf__e { background: #93c5fd; display: block; border-radius: 3px 3px 0 0; }
.pn-graf__col--parcial .pn-graf__s, .pn-graf__col--parcial .pn-graf__e { opacity: 0.45; }
.pn-graf__meses { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--texto-suave); margin-top: 0.25rem; }
.pn-legenda { display: flex; align-items: center; gap: 0.35rem; font-size: 0.72rem; color: var(--texto-suave); margin-top: 0.35rem; }
.pn-legenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.pn-legenda__s { background: var(--brand); }
.pn-legenda__e { background: #93c5fd; margin-left: 0.6rem; }

/* faixas (rótulo · barra · valor) */
.pn-faixas { display: flex; flex-direction: column; gap: 0.2rem; }
.pn-faixa {
    display: grid; grid-template-columns: minmax(120px, 210px) 1fr minmax(90px, auto); align-items: center; gap: 0.7rem;
    padding: 0.3rem 0.4rem; margin: 0 -0.4rem; border-radius: 6px; text-decoration: none; color: inherit;
}
a.pn-faixa:hover { background: #f1f5f9; text-decoration: none; }
.pn-faixa__rot { font-size: 0.84rem; }
.pn-faixa__rot small { display: block; font-size: 0.72rem; color: #b45309; }
.pn-faixa__val { font-size: 0.84rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pn-faixa__val small { font-weight: 400; color: var(--texto-suave); margin-left: 0.25rem; }
.pn-barra { height: 9px; border-radius: 5px; background: #e5e7eb; overflow: hidden; }
.pn-barra__fill { display: block; height: 100%; border-radius: 5px; background: var(--brand); min-width: 2px; }
.pn-barra__fill--ok { background: #16a34a; }
.pn-barra__fill--alerta { background: #f59e0b; }
.pn-barra__fill--critico { background: #dc2626; }

/* tabelas curtas */
.pn-tabela { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.pn-tabela td { padding: 0.42rem 0.3rem; border-top: 1px solid #f1f5f9; vertical-align: middle; }
.pn-tabela tr:first-child td { border-top: 0; }
.pn-tabela a { color: var(--texto); text-decoration: none; }
.pn-tabela a:hover { color: var(--brand); text-decoration: underline; }
.pn-tabela__num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pn-tabela small { margin-left: 0.35rem; }
.pn-cert-resumo { font-size: 0.85rem; margin-bottom: 0.6rem; color: var(--texto-suave); }
.pn-cert-resumo b { color: var(--texto); font-size: 1rem; }

/* memorando */
.pn-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pn-chip {
    display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.4rem 0.75rem;
    border: 1px solid var(--borda); border-radius: 999px; font-size: 0.84rem; color: inherit; text-decoration: none;
}
.pn-chip:hover { border-color: var(--brand); text-decoration: none; }
.pn-chip i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

@media (max-width: 560px) {
    .pn-duas { grid-template-columns: 1fr; }
    .pn-faixa { grid-template-columns: 1fr auto; }
    .pn-faixa .pn-barra { grid-column: 1 / -1; grid-row: 2; }
    .pn-bloco { padding: 0.85rem 0.9rem; }
}

/* grupos de permissão */
.gp-func-box { margin-top: 0.6rem; }
.gp-func-box__cab { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.5rem; }
.gp-func-filtro { height: 32px; padding: 0 0.6rem; border: 1px solid var(--borda); border-radius: 6px; font-size: 0.82rem; width: 200px; }
.gp-func-grupo { border: 1px solid var(--borda); border-radius: var(--control-radius); margin-bottom: 0.6rem; padding: 0.5rem 0.8rem 0.7rem; }
.gp-func-grupo legend { display: flex; align-items: center; gap: 0.8rem; padding: 0 0.3rem; font-weight: 600; font-size: 0.85rem; color: var(--texto); }
.gp-func-todos { font-weight: 400; font-size: 0.78rem; color: var(--texto-suave); display: flex; align-items: center; gap: 0.3rem; }
.gp-func-todos input { width: auto; margin: 0; }
.gp-func-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.4rem; margin-top: 0.4rem; }

/* tags do cliente */
.cli-tags__pills { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.5rem; }
.cli-tag-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.3rem 0.2rem 0.6rem; border-radius: 999px;
    background: #eef2ff; color: #3730a3; font-size: 0.78rem; font-weight: 600;
}
.cli-tag-pill__remover {
    display: flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%; border: none;
    background: transparent; color: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.cli-tag-pill__remover:hover { background: rgba(55, 48, 163, 0.15); }
.cli-tag-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.cli-tag-form input[type="text"] {
    width: auto; flex: 1; min-width: 160px; margin-bottom: 0;
    height: var(--control-h); padding: 0 0.7rem;
    border: 1px solid var(--borda); border-radius: var(--control-radius); font-size: 0.85rem;
}
.cli-tag-form button[type="submit"] { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.85rem; }
.cli-tag-form .cli-form-erro { width: 100%; }

/* cofre — certificado digital (abas de filtro) */
.cofre-filtros { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.6rem 0 1rem; }
.cofre-filtro {
    padding: 0.35rem 0.8rem; border-radius: 999px; border: 1px solid var(--borda);
    font-size: 0.82rem; color: var(--texto); text-decoration: none;
}
.cofre-filtro:hover { border-color: var(--brand); }
.cofre-filtro--ativo { background: var(--brand); border-color: var(--brand); color: #fff; }
table.dados tr.cli-cert--vencido { background: #fef2f2; }
table.dados tr.cli-cert--vence { background: #fffbeb; }

/* ---------- Chamados (memorando interno) ---------- */
table.dados tr.cham-linha { cursor: pointer; }
table.dados tr.cham-linha:hover { background: #f8fafc; }
table.dados tr.cham-linha--ativa { background: #eef2ff; }
table.dados tr.cham-linha-detalhe > td { padding: 0; background: #fbfcfe; border-top: none; }
/* O painel vive dentro de uma tabela que rola na horizontal, então sem isto
   ele herdaria a largura TOTAL da tabela e metade do conteúdo ficaria fora da
   área visível. `sticky` prende o box na borda esquerda do container e a
   largura é acertada por JS (ver memorando.php, ajustarLarguraDetalhe). */
.cham-detalhe__box { padding: 1rem 1.2rem; position: sticky; left: 0; box-sizing: border-box; }

/* Autor do trâmite: só o primeiro nome com o trâmite fechado (a linha é uma
   prévia, o espaço é do texto), nome completo quando abre. */
.cham-etapa__autor--completo { display: none; }
.cham-etapa[open] .cham-etapa__autor--curto { display: none; }
.cham-etapa[open] .cham-etapa__autor--completo { display: inline; }
.cham-detalhe__cabecalho { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.cham-detalhe__cabecalho .cofre-ic { vertical-align: middle; }
.cham-img-modal { width: min(90vw, 900px); }
/* ficha do cliente: copiar contatos pra outra empresa */
.cli-contatos-copiar-linha { margin: 0.6rem 0 0; font-size: 0.85rem; }
.cli-copiar { width: min(640px, 96vw); }
.cli-copiar .hist-modal__corpo { display: grid; gap: 0.8rem; }
.cli-copiar__destino { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.88rem; }
.cli-copiar__grupo { margin: 0; padding: 0.5rem 0.8rem 0.6rem; border: 1px solid var(--borda); border-radius: 8px; display: grid; gap: 0.3rem; }
.cli-copiar__grupo legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.85rem; }
.cli-copiar__grupo p { margin: 0; font-size: 0.85rem; }
.cli-copiar__item { display: flex; align-items: baseline; gap: 0.45rem; font-size: 0.88rem; overflow-wrap: anywhere; }
.cli-copiar__item input { width: auto; margin: 0; flex: none; }
.cli-copiar__nota { margin: 0; font-size: 0.8rem; }
/* cadastro PF: CPF + botão "Buscar pelo CPF" (CPF.CNPJ) na mesma linha */
.cli-cpf-busca { display: flex; gap: 0.4rem; align-items: stretch; }
.cli-cpf-busca input { flex: 1; min-width: 0; }
.cli-cpf-busca button { width: auto; flex: none; margin: 0; white-space: nowrap; }
table[data-tabela="cpfcnpj-consumo"] td[data-col="res"],
table[data-tabela="cpfcnpj-consumo"] td[data-col="nome"] { white-space: normal; min-width: 140px; max-width: 300px; }
/* admin: setas e lixeira no trâmite + log do memorando */
.cham-etapa-admin { display: inline-flex; gap: 2px; margin-left: 4px; }
.cham-etapa-admin button { width: 26px; height: 24px; padding: 0; margin: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #6b7280; font-size: 0.85rem; line-height: 1; cursor: pointer; }
.cham-etapa-admin button:hover:not(:disabled) { background: #f1f5f9; border-color: var(--borda); color: var(--brand); }
.cham-etapa-admin .cham-etapa-excluir:hover { color: #b91c1c !important; }
.cham-etapa-admin button:disabled { opacity: .3; cursor: default; }
.hist-modal.cham-log-modal { width: min(760px, 96vw); }
.cham-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cham-log__item { padding: 8px 10px; border-left: 3px solid #93c5fd; border-radius: 4px; background: #f8fafc; }
.cham-log__item--tramite_excluido, .cham-log__item--excluido, .cham-log__item--anexo_excluido, .cham-log__item--alerta_excluido { border-left-color: #f87171; }
.cham-log__item--criado { border-left-color: #22c55e; }
/* visualizações (abriu o memorando/trâmite/anexo, imprimiu): mais discretas, dá pra esconder */
.cham-log__item--visto { border-left-color: #cbd5e1; background: #fff; }
.cham-log__item--visto .cham-log__cab strong { font-weight: 600; color: #475569; }
.cham-log--sem-vistos .cham-log__item--visto { display: none; }
.hist-modal label.cham-log__filtro { display: inline-flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0 0 0.75rem; font-size: 0.85rem; font-weight: 500; color: #374151; cursor: pointer; }
.cham-log__filtro input[type="checkbox"] { width: 16px; height: 16px; min-width: 16px; margin: 0; flex: none; }
.cham-log__cab { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; font-size: 0.85rem; }
.cham-log__cab .mut { font-size: 0.78rem; }
.cham-log__det { margin-top: 4px; font-size: 0.82rem; white-space: pre-wrap; overflow-wrap: anywhere; color: #374151; }
/* popup de PDF do memorando: ocupa quase a tela toda, o iframe preenche o resto */
.cham-pdf-modal { width: min(96vw, 1100px); height: 92vh; max-height: 92vh; padding: 0; }
.cham-pdf-modal[open] { display: flex; flex-direction: column; }
.cham-pdf-modal .hist-modal__topo { gap: 0.9rem; }
.cham-pdf-modal .hist-modal__topo h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cham-pdf-modal iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: #525659; }
.cham-img-modal .hist-modal__topo { gap: 0.4rem; }
.cham-img-modal .hist-modal__topo h3 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cham-img-modal__zoom {
    display: inline-flex; align-items: center; justify-content: center;
    flex: 0 0 auto; width: 30px; height: 30px; padding: 0; border: 1px solid var(--borda); border-radius: 6px;
    background: #fff; color: var(--texto); font-size: 0.95rem; line-height: 1; cursor: pointer;
}
.cham-img-modal__zoom.ativo { background: var(--brand); border-color: var(--brand); color: #fff; }
#cham-img-modal-corpo { display: flex; align-items: center; justify-content: center; padding: 0.8rem; overflow: auto; max-height: 82vh; }
#cham-img-modal-corpo img { display: block; max-width: 100%; max-height: 78vh; border-radius: 6px; cursor: zoom-in; margin: auto; }
/* No zoom, troca flex por bloco comum: flex às vezes só deixa rolar na
   direção vertical quando o item cresce além do container nas duas
   direções ao mesmo tempo -- bloco com overflow:auto rola em ambas sem
   ambiguidade, em qualquer navegador. */
#cham-img-modal-corpo.cham-img-modal__corpo--zoom {
    display: block;
    /* Sem isso, o próprio container podia crescer pra caber a imagem em vez
       de ficar travado na largura do modal -- aí quem cortava a imagem era
       o overflow:hidden do <dialog> por fora, sem chance de rolar. */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: auto;
    text-align: left;
}
#cham-img-modal-corpo.cham-img-modal__corpo--zoom img { display: inline-block; max-width: none; max-height: none; margin: 0; cursor: zoom-out; }
.cham-detalhe__acoes { display: flex; align-items: center; gap: 0.6rem; }
.cham-detalhe__acoes .btn { width: auto; padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.cham-detalhe__meta { margin-top: 0.1rem; font-size: 0.82rem; }
/* Flutua com a página (fica sempre acessível mesmo depois de rolar pra ler
   um histórico longo de trâmites) -- fixo no canto, não sticky, porque o
   botão vive dentro de uma linha de tabela expandida (contexto ruim pra
   sticky funcionar direito entre navegadores). Só existe um por vez: some
   sozinho quando a linha do memorando é fechada (o próprio elemento é
   removido do DOM nesse momento). */
.cham-etapa-add-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 40;
    border-radius: 999px;
    padding: 0 1.3rem;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    font-weight: 600;
}
@media (max-width: 720px) {
    .cham-etapa-add-btn { right: 16px; bottom: 16px; }
}
.cham-etapas-barra { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 0.6rem; font-size: 0.85rem; }
.cham-timeline { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.7rem; }
.cham-etapa { border: 1px solid var(--borda); border-radius: 8px; padding: 0.6rem 0.8rem; background: #fff; }
.cham-etapa__resumo {
    /* Seta própria via ::before (não o marcador nativo do <summary>) -- é o
       jeito confiável de ter display:flex na linha inteira (seta + nome +
       data + editar, tudo na mesma linha) sem a seta cair pra uma linha
       separada, que é o que acontece tentando misturar list-item nativo
       com um filho flex de largura 100%. */
    cursor: pointer; font-size: 0.85rem; color: var(--texto);
    list-style: none;
    display: flex; align-items: center; gap: 0.5rem;
}
.cham-etapa__resumo::-webkit-details-marker { display: none; }
.cham-etapa__resumo-linha { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.cham-etapa__resumo-texto { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cham-etapa__resumo-dir { flex: 0 0 auto; display: flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; }
.cham-etapa[open] > .cham-etapa__resumo { margin-bottom: 0.5rem; padding-bottom: 0.45rem; border-bottom: 1px dashed var(--borda); }
/* Aberto: o texto inteiro já aparece embaixo -- some só o trechinho de
   resumo (senão duplicaria o começo do texto); nome, data e editar ficam
   sempre visíveis em cima, abertos ou fechados. */
.cham-etapa[open] > .cham-etapa__resumo .cham-etapa__resumo-excerto { display: none; }
.cham-etapa__cabecalho { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; font-size: 0.8rem; margin-bottom: 0.3rem; }
.cham-etapa__cabecalho-dir { display: flex; align-items: center; gap: 0.4rem; }
.cham-etapa-editar, .cham-etapa-transf {
    border: none; background: none; padding: 0.1rem 0.3rem; font-size: 0.85rem; line-height: 1;
    color: var(--texto-suave); cursor: pointer; border-radius: 4px;
}
.cham-etapa-editar:hover, .cham-etapa-transf:hover { background: #f1f1f1; color: var(--texto); }
.cham-etapa-transf { display: inline-flex; align-items: center; }
/* trâmite vinculado a transferência de contabilidade */
.cham-etapa__transf { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.cham-transf-chip { display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.15rem 0.2rem 0.15rem 0.6rem; border: 1px solid #c7d7ee; border-radius: 999px; background: #eef4fc; font-size: 0.78rem; }
.cham-transf-chip a { display: inline-flex; align-items: center; gap: 0.35rem; color: #1e3a5f; text-decoration: none; }
.cham-transf-chip a:hover span { text-decoration: underline; }
.cham-transf-chip em { font-style: normal; color: #64748b; }
.cham-transf-form select { width: 100%; }
/* transferencias.php: trâmites de memorando vinculados */
.transf-item__memo { margin-left: 0.4rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: #eef4fc; color: #1e3a5f; font-size: 0.72rem; text-decoration: none; white-space: nowrap; }
.transf-item__memo:hover { text-decoration: underline; }
.transf-memos { margin-top: 1.5rem; }
.transf-memos h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.transf-memos__lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.transf-memos__lista li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; padding: 0.55rem 0.75rem; border: 1px solid var(--borda); border-left: 3px solid #93c5fd; border-radius: 6px; background: #fff; }
.transf-memos__lista a { color: var(--brand); text-decoration: none; }
.transf-memos__lista a:hover { text-decoration: underline; }
.transf-memos__item { margin-left: 0; }
.transf-memos__texto { flex-basis: 100%; font-size: 0.85rem; color: #4b5563; overflow-wrap: anywhere; }
.cham-etapa__texto { white-space: pre-wrap; font-size: 0.9rem; overflow-wrap: anywhere; min-width: 0; }
.cham-link { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.cham-link:hover { opacity: 0.8; }
.cham-etapa__imagem {
    display: block; max-width: 100%; max-height: 420px; margin: 0.4rem 0;
    border-radius: 8px; border: 1px solid var(--borda);
}
.cham-etapa__anexos { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cham-anexo {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem;
    border: 1px solid var(--borda); border-radius: 999px; font-size: 0.78rem;
    text-decoration: none; color: var(--texto); background: #f8fafc;
}
.cham-anexo:hover { border-color: var(--brand); }
/* áudio anexado: tocador no próprio trâmite */
.cham-audio { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem 0.6rem; flex-basis: 100%; max-width: 640px; padding: 0.4rem 0.6rem; border: 1px solid var(--borda); border-radius: 10px; background: #f8fafc; }
.cham-audio__nome { font-size: 0.78rem; color: #374151; overflow-wrap: anywhere; flex: 1 1 100%; }
.cham-audio audio { flex: 1 1 260px; min-width: 0; height: 36px; }
.cham-audio__baixar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; color: #6b7280; }
.cham-audio__baixar:hover { background: #eef2f7; color: var(--brand); }
/* gravar áudio no popup do trâmite */
.cham-gravar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.cham-gravar__btn { display: inline-flex; align-items: center; gap: 0.4rem; width: auto; margin: 0; padding: 0.4rem 0.9rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; color: var(--texto); font: inherit; font-size: 0.85rem; cursor: pointer; }
.cham-gravar__btn:hover { background: #f1f5f9; border-color: var(--brand); color: var(--brand); }
.cham-gravar__btn--gravando, .cham-gravar__btn--gravando:hover { background: #fef2f2; border-color: #fca5a5; color: #b91c1c; }
.cham-gravar__ponto { width: 10px; height: 10px; border-radius: 50%; background: #dc2626; animation: cham-gravar-pisca 1s infinite; }
@keyframes cham-gravar-pisca { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .cham-gravar__ponto { animation: none; } }
.cham-gravar__tempo { font-size: 0.82rem; color: #b91c1c; font-variant-numeric: tabular-nums; }
.cham-gravar__lista { flex-basis: 100%; display: grid; gap: 0.4rem; }
.cham-gravar__lista:empty { display: none; }
.cham-gravar__item { display: flex; align-items: center; gap: 0.4rem; }
.cham-gravar__item audio { flex: 1; min-width: 0; height: 36px; }
.cham-nova-etapa { margin-top: 1rem; border-top: 1px solid var(--borda); padding-top: 0.8rem; }
.cham-nova-etapa textarea { width: 100%; resize: vertical; }
.cham-nova-etapa__linha { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 0.5rem; flex-wrap: wrap; }
.cham-nova-etapa__linha .btn { width: auto; padding: 0.35rem 1rem; }
.cham-novo { width: min(520px, 94vw); }
/* novo/editar trâmite: o form é o modal inteiro (zera o visual do form antigo, que ficava embaixo da lista) */
.hist-modal > .cham-nova-etapa { margin: 0; padding: 0; border: 0; }
.hist-modal > .cham-nova-etapa .hist-modal__corpo { display: flex; flex-direction: column; gap: 0.75rem; }
.hist-modal > .cham-nova-etapa textarea { min-height: 130px; margin: 0; padding: 0.6rem 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; }
.hist-modal > .cham-nova-etapa input[type="file"] { width: 100%; margin: 0; padding: 0.55rem; border: 1px dashed var(--borda); border-radius: var(--control-radius); background: #f8fafc; font-size: 0.85rem; cursor: pointer; }
/* ação principal do modal em destaque (o .btn base é branco) */
.hist-modal__acoes button[type="submit"].btn:not(.btn-secundario):not(.perigo) { background: var(--brand); border-color: var(--brand); color: #fff; }
.hist-modal__acoes button[type="submit"].btn:not(.btn-secundario):not(.perigo):hover { background: var(--brand-escuro); }
.cham-clientes-edicao,
.cham-alertas { position: relative; margin-top: 0.75rem; padding: 0.6rem 0.8rem; border: 1px solid var(--borda); border-radius: 8px; background: #f8fafc; }
.cham-clientes-edicao > summary,
.cham-alertas > summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--texto); list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.cham-clientes-edicao[open] > summary,
.cham-alertas[open] > summary { margin-bottom: 0.45rem; }
.cham-clientes-edicao > summary::-webkit-details-marker,
.cham-alertas > summary::-webkit-details-marker { display: none; }
.cham-clientes-edicao > summary::before,
.cham-alertas > summary::before,
.cham-etapa__resumo::before {
    content: '';
    flex: 0 0 auto;
    width: 0; height: 0;
    border-style: solid;
    border-width: 4.5px 0 4.5px 7px;
    border-color: transparent transparent transparent var(--texto);
    transition: transform 0.15s;
}
.cham-clientes-edicao[open] > summary::before,
.cham-alertas[open] > summary::before,
.cham-etapa[open] > .cham-etapa__resumo::before {
    transform: rotate(90deg);
}
.cham-clientes-edicao__linha { display: flex; align-items: flex-start; gap: 0.5rem; }
.cham-clientes-edicao__linha .tagpick { flex: 1; min-width: 0; }
.cham-clientes-edicao__salvar { flex: 0 0 auto; width: auto !important; margin: 0 !important; }
.cham-clientes-edicao__salvar { display: inline-flex; width: auto !important; margin-top: 0.55rem; padding: 0 1rem; }
.cham-novo__acoes { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.cham-novo__acoes .btn { width: auto; }
.cham-barra__acoes { display: flex; gap: 0.5rem; }
.cham-barra__acoes .btn { width: auto; }
/* admin com "Ver secretos de todos" ligado: secretos em que ele não está envolvido */
.cham-barra__acoes .cham-ver-secretos--on { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.cham-barra__acoes .cham-ver-todos--on { background: #e0f2fe; }
/* pop-up "Empresa nova — grupos de obrigações" (clientes.php?abrir=<id>&grupos=1) */
.cli-novo-grupos { width: min(560px, 96vw); }
.cli-novo-grupos__emp { margin: 0 0 6px; font-size: 1rem; font-weight: 600; color: var(--texto); }
.cli-novo-grupos__lista { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow-y: auto; }
.cli-novo-grupos__lista li { padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 8px; }
.cli-novo-grupos__lista li:has(input:checked:not(:disabled)) { border-color: var(--brand); background: #f0f9ff; }
.cli-novo-grupos__lista .cofre-form__check { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-weight: 400; cursor: pointer; }
.cli-novo-grupos__lista .cofre-form__check input { flex: none; width: 16px; height: 16px; margin: 3px 0 0; }
.cli-novo-grupos__lista .mut { display: block; font-size: 0.78rem; }
/* Configurações → Alertas → Empresa nova: tabela regime × origem */
.config-cn-filtro { display: grid; gap: 6px; margin: 10px 0 14px; }
table.dados.config-cn-matriz { width: auto; }
table.dados.config-cn-matriz th, table.dados.config-cn-matriz td { padding: 0.35rem 0.8rem; }
table.dados.config-cn-matriz td:not(:first-child), table.dados.config-cn-matriz th:not(:first-child) { text-align: center; }
.config-cn-matriz input[type=checkbox] { width: 16px; height: 16px; margin: 0; cursor: pointer; }
table.dados tr.cham-linha--alheio > td { background: #fffbeb; }
table.dados tr.cham-linha--alheio > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.cham-alheio { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 0.7rem; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: 1px; }
.cham-status-badge {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
    font-size: 0.76rem; font-weight: 600; color: #fff;
}
.cham-status-select { font-size: 0.8rem; padding: 0.2rem 0.4rem; border-radius: 6px; border: 1px solid var(--borda); }
.cham-status-lista { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin: 0 0 1rem; padding: 0; }
.cham-status-lista li { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.cham-status-item--inativo { opacity: 0.55; }
.cham-status-toggle {
    width: auto; flex: 0 0 auto; background: none; color: var(--texto);
    border: 1px solid var(--borda); border-radius: 6px; padding: 0.2rem 0.6rem;
    font-size: 0.78rem; font-weight: 400; cursor: pointer;
}
.cham-status-mover { width: auto; flex: 0 0 auto; background: none; color: var(--texto-suave); border: 1px solid var(--borda); border-radius: 6px; padding: 0.15rem 0.4rem; font-size: 0.75rem; font-weight: 400; line-height: 1; cursor: pointer; }
.cham-status-mover:disabled { opacity: 0.35; cursor: default; }
.cham-status-mover:not(:disabled):hover { background: #f1f1f1; }
.cham-status-item__acoes { display: flex; align-items: center; gap: 0.35rem; }
.cham-status-novo-form { display: flex; gap: 0.5rem; align-items: center; border-top: 1px solid var(--borda); padding-top: 0.8rem; }
.cham-status-novo-form input[type="text"] { flex: 1; margin-bottom: 0; height: var(--control-h); box-sizing: border-box; }
.cham-status-novo-form input[type="color"] { flex: 0 0 auto; width: 42px; height: var(--control-h); padding: 2px; border: 1px solid var(--borda); border-radius: 6px; margin-bottom: 0; box-sizing: border-box; }
.cham-status-novo-form .btn { width: auto; flex: 0 0 auto; margin-bottom: 0; }
.cham-alertas__lista { list-style: none; margin: 0 0 0.7rem; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.cham-alertas__lista li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.cham-alerta-status { margin-left: 0; flex: none; }
.cham-alerta-excluir {
    margin-left: auto; width: 20px; height: 20px; min-width: 20px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 5px; background: none; color: var(--texto);
    cursor: pointer; flex: none;
}
.cham-alerta-excluir:hover { background: var(--brand); color: #fff; }
.cham-alerta--concluido { opacity: 0.5; text-decoration: line-through; }
.cham-alerta__data { font-variant-numeric: tabular-nums; color: var(--texto-suave); }
.cham-alerta__comentario { color: var(--texto-suave); }
/* flex-wrap:wrap (não nowrap) -- esse formulário vive dentro de uma linha
   expandida da tabela do Memorando, que compartilha rolagem horizontal com
   a tabela inteira; com nowrap, a largura mínima das 3 colunas empurrava a
   tabela toda pra fora da tela (cortava Status/Responsável/Excluir). */
.cham-novo-alerta { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
/* .cham-novo-alerta > input pega o `input { padding/margin-bottom }` genérico
   (pensado pra tela de login) -- zera aqui pra alinhar com .tagpick__box/botão,
   que não herdam essa regra. */
.cham-novo-alerta input[type="date"],
.cham-novo-alerta input[name="comentario"] {
    margin-bottom: 0;
    padding: 0 0.7rem;
    height: var(--control-h);
    box-sizing: border-box;
}
.cham-novo-alerta input[type="date"] { flex: 0 0 150px; min-width: 0; }
.cham-novo-alerta .tagpick { flex: 1 1 140px; min-width: 110px; }
.cham-novo-alerta input[name="comentario"] { flex: 1 1 160px; min-width: 110px; }
.cham-novo-alerta .btn { width: auto; }
.cham-novo-alerta > button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem !important; height: var(--control-h); flex: 0 0 auto;
    padding: 0; font-size: 1.1rem; line-height: 1;
}

@media (max-width: 720px) {
    .cham-barra__acoes { width: 100%; flex-wrap: wrap; }
    .cham-barra__acoes .btn { flex: 1 1 150px; }
    .cham-novo-alerta { flex-wrap: wrap; }
    .cham-novo-alerta > * { flex: 1 1 100%; min-width: 0; }
    .cham-novo-alerta .tagpick { flex-basis: 100%; }
    .cham-novo-alerta .btn,
    .cham-novo-alerta > button[type="submit"] { width: 100% !important; }
}

/* Filtros fiscais — linhas de condição do formulário + chips de variável da mensagem */
.ff-voltar { display: inline-block; margin-bottom: 0.3rem; font-size: 0.85rem; text-decoration: none; }
.ff-estat { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: -0.3rem 0 1rem; font-size: 0.85rem; color: var(--texto-suave); }
.ff-form { max-width: 980px; }
.ff-form h3 { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.4rem; padding-top: 1.1rem; border-top: 1px solid var(--borda); }
.ff-form h3:first-of-type { margin-top: 0; padding-top: 0; border-top: none; }
.ff-passo { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.78rem; font-weight: 700; }
.ff-qtd { font-size: 0.82rem; font-weight: 400; color: var(--texto-suave); }
.ff-form .ff-nome { grid-column: 1 / -1; }
.ff-form > textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; resize: vertical; }
/* "todas / basta uma" como botão segmentado */
.ff-seg { display: inline-flex; flex-wrap: wrap; margin-bottom: 0.8rem; border: 1px solid var(--borda); border-radius: var(--control-radius); overflow: hidden; }
.cofre-form .ff-seg label { display: flex; flex-direction: row; align-items: center; gap: 0.4rem; margin: 0; padding: 0.45rem 0.85rem; font-size: 0.85rem; font-weight: 500; cursor: pointer; color: var(--texto); }
.cofre-form .ff-seg label + label { border-left: 1px solid var(--borda); }
.cofre-form .ff-seg label:has(input:checked) { background: #f0f7fc; color: var(--brand-escuro); box-shadow: inset 0 -2px 0 var(--brand); }
.cofre-form .ff-seg input { width: auto; height: auto; margin: 0; }
#ff-condicoes { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
.ff-condicao { display: grid; grid-template-columns: 2.2rem minmax(0, 1.3fr) minmax(0, 1.1fr) minmax(0, 1fr) 2rem; gap: 0.5rem; align-items: center; }
.ff-condicao select, .ff-condicao input {
    width: 100%; height: var(--control-h); margin: 0; padding: 0 0.6rem;
    border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit;
}
.ff-condicao .ff-valor--oculto { visibility: hidden; }
.ff-conector { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; color: var(--brand-escuro); text-align: center; }
.ff-remover {
    width: 2rem; height: 2rem; padding: 0; border: none; border-radius: 50%; background: none;
    font-size: 1.25rem; line-height: 1; color: #9ca3af; cursor: pointer;
}
.ff-remover:hover { background: #fee2e2; color: #b91c1c; }
#ff-add-condicao { width: auto; margin: 0 0 0.4rem 2.7rem; }
.ff-variaveis { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin: 0.5rem 0 0.7rem; }
.ff-variavel-btn {
    width: auto; border: 1px solid var(--borda); background: #f8fafc; border-radius: 999px;
    font-size: 0.75rem; padding: 0.15rem 0.6rem; cursor: pointer; color: #374151; font-family: ui-monospace, Consolas, monospace;
}
.ff-variavel-btn:hover { background: #eef2ff; border-color: #c7d2fe; }
.ff-previa { padding: 0.7rem 0.9rem; border-radius: 10px; background: #e7f6ee; border: 1px solid #c4e8d3; }
.ff-previa__rot { display: block; margin-bottom: 0.35rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: #15803d; }
#ff-previa-txt { white-space: pre-wrap; font-size: 0.9rem; color: #1f2937; overflow-wrap: anywhere; }
#ff-previa-txt mark { background: #fff; border: 1px dashed #86c9a1; border-radius: 4px; padding: 0 0.25rem; color: #166534; font-weight: 600; }

/* listagem */
.ff-tabela td { vertical-align: top; }
.ff-tabela td[data-col="nome"] { white-space: normal; min-width: 320px; }
.ff-linha { cursor: pointer; }
.ff-linha:hover td { background: #f8fafc; }
.ff-linha:hover .cert-nome { color: var(--brand); }
.ff-linha--inativa .cert-nome, .ff-linha--inativa .ff-resumo { opacity: 0.6; }
.ff-resumo { display: block; margin: 0.2rem 0; font-size: 0.8rem; color: #4b5563; line-height: 1.5; }
.ff-resumo b { font-weight: 600; }
.ff-resumo code { padding: 0 0.3rem; border-radius: 4px; background: #eef2f5; font-size: 0.78rem; }
.ff-resumo em { font-style: normal; font-weight: 700; font-size: 0.72rem; text-transform: uppercase; color: var(--brand-escuro); margin: 0 0.15rem; }
.ff-num { font-weight: 700; font-variant-numeric: tabular-nums; }
.ff-tabela td[data-col="ocorrencias"] .badge { margin-left: 0.3rem; text-decoration: none; }
.ff-nenhuma { font-size: 0.8rem; color: var(--texto-suave); }
.ff-sits .cert-sit--ativas { border-top-color: #16a34a; }
.ff-sits .cert-sit--inativas { border-top-color: #9ca3af; }
.ff-sits .cert-sit--pendencias { border-top-color: #f59e0b; }
.ff-sits .cert-sit--pendencias .cert-sit__num { color: #b45309; }

@media (max-width: 720px) {
    .ff-condicao { grid-template-columns: 1.8rem minmax(0, 1fr) 2rem; }
    .ff-condicao > :nth-child(3), .ff-condicao > :nth-child(4) { grid-column: 2; }
    .ff-condicao .ff-remover { grid-column: 3; grid-row: 1; }
    #ff-add-condicao { margin-left: 0; }
    .ff-tabela thead { display: none; }
    .ff-tabela, .ff-tabela tbody, .ff-tabela tr, .ff-tabela td { display: block; width: 100%; }
    .ff-tabela tr.ff-linha { padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--borda); }
    .ff-tabela tr[hidden] { display: none; }
    .ff-tabela td { padding: 0.15rem 0; border: none; }
    .ff-tabela td[data-col="clientes"]::before { content: "Clientes: "; font-weight: 400; color: var(--texto-suave); }
    .ff-tabela td[data-col="situacao"], .ff-tabela td.acoes-col { display: inline-block; width: auto; margin-right: 0.6rem; }
}

/* ---------- Configurações (abas) ---------- */
.config-tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--borda); margin: 0.8rem 0 1.2rem; overflow-x: auto; scrollbar-width: thin; }
.config-tabs .config-tab { flex: none; white-space: nowrap; }  /* celular: as abas rolam de lado em vez de quebrar "Envio / de / notas" */
.config-tab {
    width: auto; background: none; border: none; border-bottom: 2px solid transparent;
    padding: 0.6rem 0.9rem; font-size: 0.88rem; font-weight: 500; color: var(--texto-suave); cursor: pointer;
    margin-bottom: -1px;
}
.config-tab:hover { color: var(--texto); }
.config-tab.ativo { color: var(--brand); font-weight: 600; border-bottom-color: var(--brand); }
.config-msg-colunas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 2rem; align-items: start; }
.config-msg-coluna { min-width: 0; }
.config-msg-tipo-titulo { margin: 1.6rem 0 0.6rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--borda); }
.config-msg-coluna .config-msg-tipo-titulo:first-child { margin-top: 0; }
.config-msg-form { max-width: none; margin-bottom: 1.2rem; }
.config-msg-canal-titulo { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; font-size: 0.92rem; }
.config-msg-textarea { font-family: inherit; }
.config-msg-meta { margin: 0.2rem 0 0.6rem; font-size: 0.78rem; }
.config-msg-anexos { display: flex; align-items: center; gap: 0.9rem; margin: 0.6rem 0; }
.config-msg-anexos .cofre-form__check { display: flex; align-items: center; gap: 0.35rem; margin: 0; font-weight: 400; }
.config-alerta-tabela-wrap { overflow-x: auto; margin-top: 1rem; }
/* Alertas por setor (Configurações -> Alertas) e histórico de certificados identificados */
.config-alerta-setores { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem; padding: 0.3rem 0 0.5rem; }
.config-alerta-setores__rot { width: 100%; font-size: 0.8rem; font-weight: 600; color: #374151; }
.config-alerta-setores .cli-toggle { padding: 0.2rem 0; font-size: 0.82rem; }
.config-alerta-setores__hist { margin-left: auto; }
/* dentro do "Personalizar": separa o bloco de quem recebe das mensagens */
.config-alerta-personalizar .config-alerta-setores { margin: 0.6rem 0 0.8rem; padding: 0.6rem 0 0.8rem; border-bottom: 1px solid var(--borda); }
.config-alerta-minimo { width: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 600; color: #374151; margin-bottom: 0.4rem; }
.config-alerta-minimo input { width: 110px; height: 34px; }
.cert-hist summary { cursor: pointer; font-size: 0.8rem; color: var(--brand); }
.cert-hist ul { margin: 0.4rem 0 0; padding-left: 1.1rem; font-size: 0.8rem; white-space: normal; min-width: 280px; }
.cert-hist li { margin: 0.15rem 0; }
.badge--aviso { background: #fef3c7; color: #92400e; }

.config-alerta-tabela { border-collapse: collapse; min-width: 560px; width: 100%; }
.config-alerta-tabela th, .config-alerta-tabela td { padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--borda); text-align: center; }
.config-alerta-tabela th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.02em; color: var(--texto-suave); font-weight: 600; }
.config-alerta-tabela th:first-child, .config-alerta-tabela td:first-child { text-align: left; }
.config-alerta-celula input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }
.config-alerta-tabela tr[data-tipo] td { border-bottom: none; padding-bottom: 0.2rem; }
.config-alerta-tabela .config-alerta-personalizar-linha td { text-align: left; padding-top: 0.2rem; }
.config-alerta-personalizar > summary {
    list-style: none; display: flex; align-items: center; gap: 0.45rem;
    cursor: pointer; font-size: 0.82rem; font-weight: 600; color: var(--brand-escuro);
    padding: 0.25rem 0; width: fit-content;
}
.config-alerta-personalizar > summary::-webkit-details-marker { display: none; }
.config-alerta-personalizar > summary::before {
    content: ''; flex: none; width: 0; height: 0;
    border-style: solid; border-width: 4.5px 0 4.5px 7px;
    border-color: transparent transparent transparent var(--texto);
    transition: transform 0.15s ease;
}
.config-alerta-personalizar[open] > summary::before { transform: rotate(90deg); }
.config-alerta-msg-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.4rem 1.6rem; margin-top: 0.6rem; align-items: start; text-align: left; }
.config-alerta-msg-grade .config-msg-canal-titulo { margin-top: 0.6rem; }
/* ---------- Pessoal -> Relatórios ---------- */
.pes-form { max-width: 980px; }
.pes-campos { display: grid; gap: 0.2rem 1.2rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 0.4rem; }
.pes-campo { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 500; color: #374151; margin-bottom: 0.7rem; }
.pes-campo textarea { min-height: 5.5rem; font-family: inherit; }
.pes-campo input, .pes-campo textarea { margin: 0; }
.pes-checks { display: flex; gap: 1.4rem; flex-wrap: wrap; margin: 0.2rem 0 0.6rem; }
.pes-vars { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.6rem; }
.pes-vars__grupo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.pes-corpo { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 0.82rem; line-height: 1.45; min-height: 22rem; }
.pes-campo-linha { display: grid; grid-template-columns: 2fr 1.2fr 1fr auto auto; gap: 0.5rem; align-items: center; margin-bottom: 0.45rem; }
.pes-campo-linha input[type="text"], .pes-campo-linha select { margin: 0; width: 100%; }
.pes-campo-linha .cofre-form__check { margin: 0; white-space: nowrap; }
.pes-campo-remover {
    width: 24px; height: 24px; min-width: 24px; padding: 0; margin: 0;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 5px; background: none; color: var(--texto); font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.pes-campo-remover:hover { background: var(--brand); color: #fff; }
@media (max-width: 720px) { .pes-campo-linha { grid-template-columns: 1fr 1fr; } }
.pes-preview-wrap { margin-top: 1.4rem; }
.pes-barra { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.pes-barra__acoes { display: flex; gap: 0.6rem; }
.pes-barra__acoes .btn { width: auto; }

/* A "folha" do documento: aparece igual na tela, no preview e na impressão. */
.pes-folha {
    background: #fff; color: #111; max-width: 800px; margin: 0.6rem 0 1.5rem;
    padding: 2.4rem 2.6rem; border: 1px solid var(--borda); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
    font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.55; text-align: justify;
}
.pes-folha p { margin: 0 0 0.9em; }
.pes-titulo { text-align: center; font-size: 15pt; letter-spacing: 0.04em; margin: 0 0 1.4em; }
.pes-direita { text-align: right; }
.pes-recuo { margin-left: 1.2em; padding-left: 0.8em; border-left: 2px solid #999; }
.pes-assinaturas { display: flex; gap: 2.4rem; margin-top: 3.2em; page-break-inside: avoid; }
.pes-assinatura { flex: 1; text-align: center; font-size: 10.5pt; }
.pes-linha { border-top: 1px solid #111; margin-bottom: 0.35em; }

@media print {
    @page { size: A4; margin: 18mm 16mm; }
    body.painel { padding: 0 !important; background: #fff !important; }
    body.painel .topo, body.painel .sidebar, .pes-nao-imprimir, #cfg-toast { display: none !important; }
    body.painel main { padding: 0 !important; max-width: none !important; }
    .pes-folha { border: none; box-shadow: none; padding: 0; margin: 0; max-width: none; }
}
.btn.btn-perigo { color: #b91c1c; border-color: #fca5a5; }
.btn.btn-perigo:hover { background: #fee2e2; }
.pes-acoes { white-space: nowrap; }
.pes-acoes .btn { width: auto; margin-right: 0.35rem; }
.pes-campo-opcoes { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8rem; color: #374151; }
.pes-campo-opcoes[hidden] { display: none; }
.pes-campo-opcoes textarea { width: 100%; margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: 0.78rem; }

/* ---------- Cartas disciplinares (modelos da Base Contábil, papel timbrado) ---------- */
.pes-calibri { font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 12pt; line-height: 1.45; text-align: justify; }
.pes-calibri p { margin: 0 0 0.85em; }
.pes-timbre { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.1em; }
.pes-timbre__logo { width: 73px; height: auto; display: block; }
.pes-timbre__contato { text-align: right; font-size: 9.5pt; line-height: 1.4; color: #333; }
.pes-timbre--logo-dir { flex-direction: row-reverse; }
.pes-timbre--logo-dir .pes-timbre__contato { text-align: left; }
.pes-timbre--centralizado { flex-direction: column; align-items: center; gap: 0.5em; }
.pes-timbre--centralizado .pes-timbre__contato { text-align: center; }
.pes-titulo-carta { text-align: center; font-size: 14pt; font-weight: 700; margin: 0.5em 0 1.2em; }
.pes-ass { text-align: center; margin-top: 2.4em; page-break-inside: avoid; }
.pes-ass .pes-linha { width: 62%; margin: 0 auto 0.3em; }
.pes-ciente { margin: 1.8em 0 0; text-align: left; page-break-inside: avoid; }
table.pes-tabela { width: 100%; border-collapse: collapse; margin-bottom: 1.1em; page-break-inside: avoid; }
table.pes-tabela td { border: 1px solid #333; padding: 0.55em 0.8em; vertical-align: top; }
.pes-caixa-escrita { min-height: 5.5em; margin-bottom: 0.8em; }
.pes-art482 { font-size: 10.5pt; }
.pes-art482 ol { list-style: none; counter-reset: pesletra; margin: 0.3em 0 0.6em; padding: 0 0 0 1.4em; }
.pes-art482 li { counter-increment: pesletra; margin-bottom: 0.2em; }
.pes-art482 li::before { content: counter(pesletra, lower-alpha) ") "; }

/* Configurações -> Relatórios */
.config-rel-status { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; margin: 0.4rem 0 0.8rem; }
.config-rel-status__item { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 500; }
.config-rel-status__cor { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.config-tv-clientes-topo { display: flex; align-items: center; gap: 1rem; margin: 0.4rem 0 0.6rem; }
.config-tv-clientes-topo input { max-width: 320px; }
.config-tv-clientes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.3rem 1.2rem; max-height: 420px; overflow-y: auto; padding: 0.6rem 0.8rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; }
.config-tv-cliente { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 400; font-size: 0.88rem; }
.config-tv-cliente[hidden] { display: none; }
.config-tv-obrig { max-height: 300px; margin-bottom: 0.8rem; }
.config-tv-ordem { list-style: none; max-width: 420px; margin: 0.4rem 0 0; padding: 0.3rem 0.8rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; }
.config-tv-ordem li { display: flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0; font-size: 0.88rem; }
.config-tv-ordem li + li { border-top: 1px solid var(--borda); }
.config-tv-ordem li > label { flex: 1; }
.config-tv-ordem li:has(input:not(:checked)) > label { opacity: 0.55; } /* desmarcado = fora da TV */
.config-tv-ordem .btn { height: 1.8rem; width: 1.8rem; padding: 0; }
.config-tv-ordem li:first-child [data-mover="-1"], .config-tv-ordem li:last-child [data-mover="1"] { visibility: hidden; }
.config-tv-ordem-rodape { display: flex; align-items: center; gap: 1rem; margin: 0.5rem 0 0.8rem; }

/* ---------- Configurações → Imagens e cabeçalho ---------- */
.config-img-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.config-img-card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 1rem; background: #fff; }
.config-img-card h3 { margin: 0 0 0.7rem; font-size: 0.95rem; }
.config-img-previa { display: flex; align-items: center; justify-content: center; min-height: 120px; padding: 0.6rem; background: repeating-conic-gradient(#f3f4f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 0.5rem; }
.config-img-previa img { max-width: 100%; max-height: 140px; width: auto; height: auto; margin: 0; display: block; }
.config-img-acoes { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.config-img-acoes .config-img-arquivo { width: auto; max-width: 100%; margin: 0; flex: 1 1 100%; }
.config-img-acoes .btn { width: auto; margin: 0; }
.config-cab-form { display: flex; flex-direction: column; gap: 0.8rem; max-width: 640px; margin-bottom: 1rem; }
.config-cab-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: #374151; }
.config-cab-form textarea, .config-cab-form input, .config-cab-form select { width: 100%; margin: 0; }
.config-cab-form .btn { width: auto; }
.config-cab-linha { display: grid; grid-template-columns: 160px 1fr; gap: 0.8rem; }
.config-cab-previa { max-width: 640px; }

/* ---------- Memorando: título/assunto/referência/secreto (dentro do grupo com os clientes) ---------- */
.cham-titulo-edicao { padding-bottom: 0.7rem; margin-bottom: 0.7rem; border-bottom: 1px solid var(--borda); }
/* título 3 : assunto 2 do espaço que sobra; a data é curta, largura própria */
.cham-titulo-edicao__grade { display: grid; grid-template-columns: 3fr 2fr 10.5rem auto; gap: 0.7rem; align-items: end; margin-bottom: 0.2rem; }
.cham-titulo-edicao__grade--simples { grid-template-columns: 3fr 2fr; }
.cham-detalhe__acoes .cham-imprimir, .cham-detalhe__acoes .cham-log-abrir { width: var(--control-h); padding: 0; } /* quem não é admin: só título e assunto */
.cham-titulo-edicao__grade label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #374151; }
.cham-titulo-edicao__grade input { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.7rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.cham-dados-salvar { display: inline-flex; width: auto !important; margin: 0.8rem 0 0 !important; padding: 0 1.2rem; }
@media (max-width: 720px) {
    .cham-titulo-edicao__grade { grid-template-columns: 1fr; }
}

/* ---------- Memorando: responsável, participantes (dentro do grupo com os clientes) ---------- */
.cham-pessoas-edicao { padding-top: 0.7rem; margin-top: 0.7rem; border-top: 1px solid var(--borda); }
.cham-pessoas-edicao__grade { display: grid; grid-template-columns: minmax(230px, 320px) 1fr; gap: 0.8rem; align-items: start; }
.cham-pessoas-edicao__grade label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #374151; }
.cham-pessoas-edicao__grade > div > label { margin-bottom: 0.25rem; }
.cham-pessoas-edicao__grade select:not([multiple]) { width: 100%; margin: 0; }
.cham-pessoas-edicao__salvar { display: inline-flex; width: auto !important; margin: 0.55rem 0 0 !important; padding: 0 1rem; }
.cham-clientes-bloco__rotulo { display: block; margin-bottom: 0.25rem; font-size: 0.82rem; color: #374151; }
.cham-novo-pessoas { display: grid; grid-template-columns: minmax(230px, 320px) 1fr; gap: 0.8rem; align-items: start; margin-top: 0.6rem; }
.cham-novo-pessoas label { display: flex; flex-direction: column; gap: 0.25rem; }
.cham-novo-pessoas select:not([multiple]) { width: 100%; margin: 0; }
@media (max-width: 720px) {
    .cham-pessoas-edicao__grade, .cham-novo-pessoas { grid-template-columns: 1fr; }
}

/* ---------- Tags de clientes (tags.php) ---------- */
.tag-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.tag-filtros { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tag-filtros input,
.tag-filtros select {
    height: var(--control-h); margin: 0; padding: 0 0.8rem;
    border: 1px solid var(--borda); border-radius: var(--control-radius); font-size: 0.85rem; background: #fff;
}
.tag-filtros__busca { width: 240px; max-width: 60vw; }
.tag-toolbar > #tag-novo-abrir { width: auto; flex: 0 0 auto; }
.tag-novo-form__flags { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0.6rem 0 0.9rem; }
table.dados[data-tabela="tags"] td[data-col="nome"] { white-space: nowrap; display: flex; align-items: center; gap: 0.3rem; }
table.dados[data-tabela="tags"] .tag-nome-edit { width: 180px; margin: 0; padding: 0.2rem 0.5rem; height: auto; font-size: 0.85rem; }
table.dados[data-tabela="tags"] td[data-col="tem"],
table.dados[data-tabela="tags"] td[data-col="naotem"] { text-align: center; }
table.dados[data-tabela="tags"] td[data-col="tem"] input,
table.dados[data-tabela="tags"] td[data-col="naotem"] input { width: auto; margin: 0; cursor: pointer; accent-color: var(--brand); }
.tag-acoes { white-space: nowrap; display: flex; align-items: center; gap: 0.35rem; }
.tag-acoes .btn { width: auto; margin: 0; }
.tag-excluir-x:hover:not(:disabled) { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.tag-nome-cancelar-x { margin-left: 0.15rem; }
.tag-empresas summary { cursor: pointer; color: var(--brand); font-size: 0.85rem; list-style: none; }
.tag-empresas summary::-webkit-details-marker { display: none; }
.tag-empresas summary::before { content: '▸ '; }
.tag-empresas[open] summary::before { content: '▾ '; }
.tag-empresas__painel { margin-top: 0.4rem; padding: 0.6rem 0.7rem; border: 1px solid var(--borda); border-radius: 8px; background: #f8fafc; max-width: min(720px, 80vw); }
.tag-empresas__filtro { width: 100%; max-width: 280px; margin: 0 0 0.5rem; height: 30px; padding: 0 0.6rem; border: 1px solid var(--borda); border-radius: 6px; font-size: 0.82rem; background: #fff; }
.tag-empresas__lista {
    list-style: none; margin: 0; padding: 0.1rem 0.3rem 0.1rem 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0.15rem 1rem;
    max-height: 260px; overflow-y: auto;
}
.tag-empresas__lista li { display: flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; padding: 0.15rem 0; min-width: 0; }
.tag-empresas__lista li a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag-empresas__vazio { margin: 0.4rem 0 0; }
.tag-empresa-remover { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #9ca3af; cursor: pointer; }
.tag-empresa-remover:hover { background: #fee2e2; color: #b91c1c; }
@media (max-width: 720px) {
    .tag-empresas__lista { grid-template-columns: 1fr; }
}

/* consumo do 2captcha -- quadro de saldo */
.cap-saldo {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 2rem;
    background: #fff; border: 1px solid var(--borda); border-left: 4px solid #16a34a; border-radius: 10px;
    padding: 0.9rem 1.15rem; margin: 0.4rem 0 1.2rem;
}
.cap-saldo--baixo { border-left-color: #dc2626; background: #fef2f2; }
.cap-saldo__rot { display: block; font-size: 0.78rem; font-weight: 600; color: var(--texto-suave); }
.cap-saldo__valor { font-size: 1.8rem; font-weight: 700; color: var(--texto); font-variant-numeric: tabular-nums; }
.cap-saldo--baixo .cap-saldo__valor { color: #991b1b; }
.cap-saldo__info { list-style: none; margin: 0; padding: 0; font-size: 0.84rem; display: flex; flex-direction: column; gap: 0.15rem; }

/* certificados digitais (cofre-certificados.php) */
.cert-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0.6rem 0 1rem; }
.cert-barra__busca { flex: 1 1 280px; max-width: 420px; height: var(--control-h); }
/* campos da barra de filtros no padrão do portal (mesmo visual de .cofre-busca) */
.cert-barra input:not([type="checkbox"]):not([type="radio"]):not(.tagpick__input),
.cert-barra select:not([data-tags]) {
    width: auto; height: var(--control-h); margin: 0; padding: 0 0.8rem;
    border: 1px solid var(--borda); border-radius: var(--control-radius);
    font-size: 0.9rem; background: #fff;
}
.cert-barra input:not(.tagpick__input):focus, .cert-barra select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 132, 195, 0.15); }
.cert-barra button[type="submit"] { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.cert-barra button[type="submit"]:hover { background: var(--brand-escuro); }
.cert-barra__pp { width: auto; height: var(--control-h); margin-left: auto; }
.cert-extra { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; color: var(--texto); cursor: pointer; white-space: nowrap; }
.cert-extra input { width: auto; height: auto; margin: 0; }

.cert-sits { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.6rem; margin-bottom: 1rem; }
.cert-sit {
    display: flex; flex-direction: column; gap: 0.1rem; padding: 0.7rem 0.9rem;
    background: #fff; border: 1px solid var(--borda); border-top: 3px solid var(--borda); border-radius: 9px;
    color: inherit; text-decoration: none; transition: box-shadow .12s, border-color .12s;
}
.cert-sit:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07); text-decoration: none; }
.cert-sit__num { font-size: 1.45rem; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.cert-sit__rot { font-size: 0.78rem; color: var(--texto-suave); font-weight: 600; }
.cert-sit--ativos { border-top-color: var(--brand); }
.cert-sit--vencidos { border-top-color: #dc2626; }
.cert-sit--vencidos .cert-sit__num { color: #b91c1c; }
.cert-sit--vencendo { border-top-color: #f59e0b; }
.cert-sit--vencendo .cert-sit__num { color: #b45309; }
.cert-sit--validos { border-top-color: #16a34a; }
.cert-sit--substituidos { border-top-color: #9ca3af; }
.cert-sit.ativo { background: #f0f7fc; border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

.cert-tabela td { vertical-align: middle; }
.cert-linha { cursor: pointer; }
.cert-linha td:first-child { border-left: 4px solid transparent; }
.cert-linha--vencidos td:first-child { border-left-color: #dc2626; }
.cert-linha--vencendo td:first-child { border-left-color: #f59e0b; }
.cert-linha--validos td:first-child { border-left-color: #16a34a; }
.cert-linha--substituidos { opacity: 0.65; }
.cert-linha:hover td { background: #f8fafc; }
.cert-nome { display: block; font-weight: 600; color: var(--texto); text-decoration: none; }
.cert-linha:hover .cert-nome { color: var(--brand); }
.cert-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.15rem; font-size: 0.78rem; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.cert-tipo { font-size: 0.7rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 4px; background: #eef2f5; color: #475569; }
.cert-prazo { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; white-space: nowrap; }
.cert-prazo--vencidos { background: #fee2e2; color: #991b1b; }
.cert-prazo--vencendo { background: #fef3c7; color: #92400e; }
.cert-prazo--validos { background: #dcfce7; color: #166534; }
.cert-prazo--substituidos { background: #f3f4f6; color: #6b7280; }
.cert-data { display: block; margin-top: 0.2rem; font-size: 0.78rem; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.cert-ac { font-size: 0.84rem; color: var(--texto-suave); }
.cert-vazio { text-align: center; padding: 1.5rem; color: var(--texto-suave); }
#cert-resultado[aria-busy="true"] { opacity: 0.55; transition: opacity .15s; }

/* celular: cada certificado vira um cartão */
@media (max-width: 640px) {
    .cert-barra__pp { margin-left: 0; }
    .cert-tabela thead { display: none; }
    .cert-tabela, .cert-tabela tbody, .cert-tabela tr, .cert-tabela td { display: block; width: 100%; }
    .cert-tabela tr.cert-linha { border-left: 4px solid transparent; border-bottom: 1px solid var(--borda); padding: 0.6rem 0.75rem; }
    .cert-tabela tr.cert-linha--vencidos { border-left-color: #dc2626; }
    .cert-tabela tr.cert-linha--vencendo { border-left-color: #f59e0b; }
    .cert-tabela tr.cert-linha--validos { border-left-color: #16a34a; }
    .cert-tabela td { padding: 0.15rem 0; border: 0 !important; }
    .cert-tabela td[data-col="validade"] { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.3rem; }
    .cert-tabela .cert-data { display: inline; margin: 0; }
    .cert-tabela .cert-ac { font-size: 0.75rem; }
}

/* editar trâmite: anexos salvos com "×" pra excluir */
.cham-anexos-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.85rem; font-size: 0.84rem; }
.cham-anexos-edit__tit { width: 100%; font-weight: 500; color: #374151; }
.cham-anexos-edit__item { display: inline-flex; align-items: center; gap: 0.25rem; max-width: 100%; padding: 0.2rem 0.3rem 0.2rem 0.6rem; border: 1px solid var(--borda); border-radius: 999px; background: #f8fafc; }
.cham-anexos-edit__item a { color: var(--texto); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }
.cham-anexos-edit__item a:hover { color: var(--brand); text-decoration: underline; }
.cham-anexos-edit__x { width: 22px; height: 22px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: transparent; color: #9ca3af; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.cham-anexos-edit__x:hover:not(:disabled) { background: #fee2e2; color: #b91c1c; }
.cham-anexos-edit__x:disabled { opacity: 0.4; cursor: wait; }

/* trâmite do memorando: barra de formatação B / I / U / S */
.cham-formatos { display: flex; gap: 0.25rem; margin-bottom: 0.3rem; }
.cham-formatos__btn {
    width: 32px; height: 28px; padding: 0; margin: 0;
    border: 1px solid var(--borda); border-radius: 6px; background: #fff; color: #374151;
    font: 600 0.9rem/1 Georgia, 'Times New Roman', serif; cursor: pointer;
}
.cham-formatos__btn:hover { background: #f0f7fc; border-color: var(--brand); color: var(--brand); }
.cham-formatos__btn--b { font-weight: 800; }
.cham-formatos__btn--i { font-style: italic; }
.cham-formatos__btn--u { text-decoration: underline; }
.cham-formatos__btn--s { text-decoration: line-through; }
.cham-formatos { flex-wrap: wrap; align-items: center; }
.cham-formatos__sep { width: 1px; height: 20px; margin: 0 0.25rem; background: var(--borda); }
.cham-formatos__cor { width: 26px; height: 26px; padding: 0; margin: 0; border: 1px solid rgba(0, 0, 0, .15); border-radius: 6px; color: #1f2937;
    font-family: inherit; font-size: 0.8rem; font-weight: 700; line-height: 1; cursor: pointer; }
.cham-formatos__cor:hover { background: var(--fundo); outline: 2px solid var(--brand); outline-offset: 1px; } /* o button:hover geral pintava de azul */
.cham-formatos__cor.cham-fundo--preto { color: #fff; }
/* Trâmite: fundo colorido no texto ([verde]..[/verde] etc.); preto inverte a letra pra branco */
.cham-fundo { padding: 0 0.2em; border-radius: 3px; color: inherit; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cham-fundo--verde { --fundo: #86efac; background: var(--fundo); }
.cham-fundo--azul { --fundo: #93c5fd; background: var(--fundo); }
.cham-fundo--amarelo { --fundo: #fde047; background: var(--fundo); }
.cham-fundo--vermelho { --fundo: #fca5a5; background: var(--fundo); }
.cham-fundo--laranja { --fundo: #fdba74; background: var(--fundo); }
.cham-fundo--preto { --fundo: #111827; background: var(--fundo); color: #fff; }
.cham-fundo--cinza { --fundo: #d1d5db; background: var(--fundo); }
.cham-etapa__texto strong { font-weight: 700; }

/* lista do memorando (memorando.php) */
table.cham-lista td { vertical-align: middle; padding-top: 0.6rem; padding-bottom: 0.6rem; }
table.cham-lista td[data-col="titulo"] { min-width: 220px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
table.cham-lista td[data-col="assunto"] { white-space: normal; }
.cham-lista__titulo { display: flex; align-items: center; gap: 0.35rem; font-weight: 600; color: var(--texto); line-height: 1.3; }
.cham-lista__titulo .cham-secreto-ic { flex: 0 0 auto; color: #9ca3af; }
.cham-lista__clientes {
    display: block; margin-top: 0.15rem; font-size: 0.78rem; color: var(--texto-suave);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px;
}
table.cham-lista td[data-col="assunto"] { min-width: 140px; max-width: 240px; color: #374151; font-size: 0.86rem; }
table.cham-lista td[data-col="status"],
table.cham-lista td[data-col="responsavel"],
table.cham-lista td[data-col="atividade"],
table.cham-lista td[data-col="referencia"] { white-space: nowrap; }
.cham-resp { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.86rem; }
.cham-resp__av {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 26px;
    border-radius: 50%; background: #e0f2fe; color: var(--brand-escuro); font-size: 0.68rem; font-weight: 700; letter-spacing: .02em;
}
.cham-lista__ativ { display: block; font-size: 0.85rem; color: var(--texto); }
.cham-lista__etapas { display: block; font-size: 0.74rem; color: var(--texto-suave); }
.cham-lista__ref { font-size: 0.85rem; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.cham-lista__vazio { text-align: center; padding: 1.5rem !important; color: var(--texto-suave); }
table.cham-lista tr.cham-linha td:first-child { border-left: 3px solid transparent; }
table.cham-lista tr.cham-linha:hover td:first-child,
table.cham-lista tr.cham-linha--ativa td:first-child { border-left-color: var(--brand); }
@media (max-width: 640px) {
    table.cham-lista th[data-col="assunto"], table.cham-lista td[data-col="assunto"],
    table.cham-lista th[data-col="referencia"], table.cham-lista td[data-col="referencia"] { display: none; }
    table.cham-lista td[data-col="titulo"] { min-width: 0; width: 52vw; max-width: 52vw; }
    .cham-lista__clientes { max-width: 46vw; }
    .cham-resp { font-size: 0; gap: 0; }      /* só a bolinha com as iniciais */
    .cham-resp__av { font-size: 0.68rem; }
}

/* emitir NFS-e: exportação de serviço (tomador no exterior) */
.em-so-nacional[hidden], .em-ext[hidden] { display: none !important; }
.em-tomador-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cofre-form .em-tomador-cab label.em-exterior-check { display: inline-flex; flex-direction: row; align-items: center; gap: 0.3rem; margin: 0; font-size: 0.78rem; font-weight: 400; color: var(--texto-suave); cursor: pointer; white-space: nowrap; }
.cofre-form .em-exterior-check input { width: 13px; height: 13px; margin: 0; padding: 0; }
.cofre-form .em-tomador-cab label.em-exterior-check:hover { color: var(--brand); }
.em-ext { margin: 0.2rem 0 1rem; padding: 0.9rem 1rem 0.4rem; border: 1px dashed var(--brand); border-radius: 10px; background: #f6fbfe; }
.em-ext__tit { margin: 0.4rem 0 0.6rem; font-size: 0.9rem; font-weight: 700; color: var(--brand-escuro); }

/* emitir NF-e: situação da IE na SEFAZ (consulta cadastro) */
.em-ie-rot { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.cofre-form .em-ie-rot .em-ie-consultar { width: auto; height: auto; padding: 0; font-size: 0.74rem; font-weight: 400; }
.em-ie-status { display: block; margin-top: 0.2rem; font-size: 0.76rem; font-weight: 500; line-height: 1.3; }
.em-ie-status[hidden] { display: none; }
.em-ie-status--ok { color: #15803d; }
.em-ie-status--erro { color: #b91c1c; }
.em-ie-status--neutro { color: var(--texto-suave); }

/* obrigações (obrigacoes.php / obrigacoes-cadastro.php) */
.obr-barra { display: flex; justify-content: flex-end; margin-bottom: 0.8rem; }
.obr-barra__novo { margin-left: auto; }
/* grupos recolhíveis da tela de Documentos (Para revisar / Não identificados / Arquivos processados) */
.obr-grupo-cab { cursor: pointer; user-select: none; }
.obr-grupo-seta { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin: 0 4px 0 -4px; padding: 0;
    border: 0; border-radius: 6px; background: none; color: var(--texto-suave); vertical-align: middle; cursor: pointer; transition: transform .15s; }
.obr-grupo-seta:hover { background: #eef6fb; color: var(--brand); }
.obr-grupo-cab.fechado .obr-grupo-seta { transform: rotate(-90deg); }
.obr-sub { margin: 1.4rem 0 0.6rem; font-size: 0.95rem; }
/* Automações: empresas (lista de regimes) e destino quebram linha — sem isso a tabela passava de 1.600px */
table.dados.auto-tabela td[data-col="reg"], table.dados.auto-tabela td[data-col="dest"] { white-space: normal; min-width: 170px; }
table.dados.auto-tabela td[data-col="nome"] { white-space: normal; min-width: 180px; }
/* Empresas da rodada: meses em aberto e observação quebram linha */
table.dados.auto-itens td[data-col="obs"] { white-space: normal; min-width: 220px; }
table.dados.auto-itens td[data-col="pend"] { white-space: normal; min-width: 160px; }
.auto-pend__qtd { display: block; font-size: 0.8rem; font-weight: 600; color: #b91c1c; }
.auto-pend { display: flex; flex-wrap: wrap; gap: 3px; max-width: 250px; margin-top: 4px; }
.auto-pend > span { padding: 0 6px; border-radius: 4px; background: #fee2e2; color: #991b1b; font-size: 0.72rem; line-height: 1.7; font-variant-numeric: tabular-nums; }
.auto-obs--alerta { color: #92400e; font-weight: 500; }
.obr-acoes { white-space: nowrap; text-align: right; }
.obr-acoes .link-btn + .link-btn { margin-left: 0.6rem; }
.obr-inativa > td:not(.acoes-col) { opacity: 0.55; }   /* não na linha inteira: o menu ⋮ ficava desbotado e por baixo da linha seguinte */
/* chave ativa/inativa (Cadastro de obrigações) */
.obr-sw { position: relative; display: inline-block; vertical-align: -3px; flex: none; width: 30px; min-width: 30px; height: 17px; margin: 0 8px 0 0; padding: 0; border: 0; border-radius: 999px; background: #cbd5e1; cursor: pointer; transition: background .15s; }
.obr-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.obr-sw:hover { background: #94a3b8; }
.obr-sw[aria-checked="true"] { background: #16a34a; }
.obr-sw[aria-checked="true"]:hover { background: #15803d; }
.obr-sw[aria-checked="true"]::after { transform: translateX(13px); }
.obr-sw:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.obr-sw:disabled { opacity: .6; cursor: wait; }
.perigo-txt { color: #b91c1c !important; }
.obr-duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem 1.5rem; }
.obr-feriados-nac { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; columns: 2; }
.obr-feriados-nac li { padding: 0.2rem 0; break-inside: avoid; }
.obr-feriados-nac span { display: inline-block; width: 3rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.obr-filtros select, .obr-filtros input[type="month"] { width: auto; height: var(--control-h); }
.obr-filtro-cli { flex: 1 1 240px; min-width: 200px; }
.obr-tabela .obr-resp { width: auto; max-width: 180px; height: 32px; margin: 0; padding: 0 0.5rem; font-size: 0.82rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; }
.obr-deptos select { height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font-size: 0.9rem; }
/* tabelas das obrigações: texto longo quebra linha em vez de empurrar as ações pra fora da tela */
table.dados.obr-tabela td, table.dados#obr-lista td, table.dados#obr-vinc-tabela td, table.dados.obr-grupos td, table.dados.obr-docs td { white-space: normal; }
table.dados.obr-tabela td.obr-acoes { width: auto; min-width: 230px; text-align: left; }
table.dados.obr-tabela .cert-data { white-space: nowrap; }
.obr-tabela tbody tr[data-id] { cursor: pointer; }
.obr-lote[hidden] { display: none; }
.obr-envios[hidden], .obr-envio-resumo[hidden] { display: none; }
table.dados.obr-docs td.acoes-col, table.dados.obr-grupos td.acoes-col { white-space: nowrap; }
/* formulários das obrigações: dica "(…)" do rótulo vira legenda miúda e os campos da linha se alinham por baixo */
#obr-vincular-form .cofre-form__grade, #obr-form .cofre-form__grade, #obr-class-form .cofre-form__grade { align-items: end; }
#obr-vincular-form label > .mut, #obr-form label > .mut, #obr-class-form label > .mut, #obr-avulsa-form label > .mut, .obr-ensinar label > .mut, #obr-memo-form label > .mut, #nf-memo-form label > .mut { font-size: 0.75rem; font-weight: 400; margin-top: -0.2rem; }
#obr-memo-form textarea, #nf-memo-form textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; font-weight: 400; resize: vertical; }
.obr-tabela td.obr-acoes .link-btn { margin-left: 0.5rem; }
#obr-lista td[data-col="venc"] { min-width: 230px; font-size: 0.84rem; }
.obr-docs td[data-col="arq"] { min-width: 200px; overflow-wrap: anywhere; }
.obr-docs td[data-col="cli"], .obr-docs td[data-col="tipo"] { min-width: 150px; }
.obr-btn { height: 32px; padding: 0 0.8rem; font-size: 0.82rem; background: #16a34a; border-color: #16a34a; color: #fff; }
.obr-btn:hover { background: #15803d; }
.obr-quem { font-size: 0.78rem; margin-right: 0.4rem; }
@media (max-width: 640px) {
    .obr-tabela td.obr-acoes { text-align: left; margin-top: 0.4rem; }
}
#obr-form [hidden], #obr-feriado-form [hidden], #obr-conf [hidden] { display: none !important; }
.obr-multa { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 8px; font-size: 11px; line-height: 17px; background: #fee2e2; color: #b91c1c; vertical-align: middle; }
/* situação (andamento da pendente) e motivo da dispensa, ao lado do prazo */
.obr-situacao { display: inline-block; margin: 2px 0 0 4px; padding: 0 6px; border-radius: 8px; font-size: 11px; line-height: 17px; background: #ede9fe; color: #5b21b6; vertical-align: middle; }
.obr-situacao--motivo { background: #f1f5f9; color: #475569; }
.obr-sel { width: 28px; text-align: center; }
.obr-lote { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 8px 0; padding: 8px 12px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; }
.obr-vinc-filtros { flex-wrap: wrap; }
/* obrigações — banco de documentos */
.obr-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 16px; border: 2px dashed #93c5fd; border-radius: 10px; background: #f8fbff; cursor: pointer; text-align: center; }
.obr-drop.sobre { background: #e0efff; border-color: #2563eb; }
.obr-drop--mini { padding: 14px 10px; }
.obr-envios { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 4px; }
.obr-envios li { padding: 6px 10px; border-radius: 6px; background: #f3f4f6; font-size: 14px; }
.obr-envios li.obr-envio--vinculado { background: #dcfce7; }
.obr-envios li.obr-envio--nao_identificado, .obr-envios li.obr-envio--duplicado { background: #fef9c3; }
.obr-envios .obr-envio-link { margin-left: 8px; padding: 2px 10px; font-size: 13px; vertical-align: baseline; }
.obr-envios li.obr-envio--erro { background: #fee2e2; }
.obr-tipo-modal { width: min(1100px, 96vw); }
/* diálogo Novo/Editar tipo de documento: campos em seções à esquerda, exemplo fixo à direita */
.obr-ensinar { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.obr-ensinar__exemplo { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 800px) { .obr-ensinar { grid-template-columns: 1fr; } .obr-ensinar__exemplo { position: static; } }
.obr-sec { margin: 0 0 14px; padding: 10px 14px 4px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; min-width: 0; }
.obr-sec > legend { padding: 0 6px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brand-escuro); }
.obr-sec__dica { margin: 0 0 10px; }
.obr-sec .cofre-form__grade { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.6rem 1rem; }
.obr-ex-texto { width: 100%; height: max(180px, calc(86vh - 470px)); min-height: 0; resize: vertical; font: 12px/1.4 ui-monospace, Consolas, monospace; }
@media (max-width: 800px) { .obr-ex-texto { height: 220px; } }
.obr-usar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.obr-usar button { width: auto; font-weight: 500; padding: 2px 10px; border: 1px solid #bfdbfe; border-radius: 999px; background: #eff6ff; color: var(--brand-escuro); font: inherit; font-size: 12.5px; cursor: pointer; }
.obr-usar button:hover { background: #dbeafe; border-color: var(--brand); }
.obr-lido-tit { margin-top: 4px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--texto-suave); }
.obr-lido { padding: 10px 12px; border-radius: 8px; background: #f3f4f6; font-size: 14px; display: grid; gap: 2px; }
.obr-ensinar .obr-sec label:not(.cofre-form__check) { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.85rem; font-size: 0.85rem; font-weight: 500; color: #374151; }
.obr-ensinar .obr-sec label > input[type="text"], .obr-ensinar .obr-sec label > select:not([multiple]) { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-weight: 400; }
.obr-ensinar .obr-sec .cofre-form__grade label { margin-bottom: 0; }
.obr-ensinar .obr-sec .cofre-form__grade { margin-bottom: 0.85rem; }
.obr-ensinar .obr-sec .cofre-form__grade label > .mut { margin-top: -0.2rem; }
.hist-modal__acoes .obr-tipo-erro { margin: 0 auto 0 0; align-self: center; }
.obr-ensinar textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; font-weight: 400; }
.obr-ensinar .obr-ex-texto { font: 12px/1.4 ui-monospace, Consolas, monospace; }
.obr-pasta { max-width: 280px; word-break: break-word; font-size: 13px; }
/* documentos: linhas mais baixas — valor/datas sem quebra, links sem sublinhado, resultado com espaço */
.obr-docs td[data-col="arq"] > a, .obr-docs td[data-col="tipo"] a, .obr-docs td[data-col="cli"] a, .obr-docs td[data-col="arq"] .cert-sub a { text-decoration: none; }
.obr-docs td[data-col="arq"] > a:hover, .obr-docs td[data-col="tipo"] a:hover, .obr-docs td[data-col="cli"] a:hover { text-decoration: underline; }
.obr-docs td[data-col="tipo"] a, .obr-docs td[data-col="cli"] a { color: var(--texto); }
.obr-docs td[data-col="arq"] { max-width: 260px; }
table.dados.obr-docs td[data-col="valor"], table.dados.obr-docs th[data-col="valor"] { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
table.dados.obr-docs td[data-col="comp"], table.dados.obr-docs td[data-col="venc"], table.dados.obr-docs td[data-col="enviado"] { white-space: nowrap; }
.obr-docs td[data-col="res"] { min-width: 220px; }
.obr-docs td[data-col="nome"] { min-width: 210px; }
.obr-docs td[data-col="entrega"] { min-width: 170px; }
.obr-docs td[data-col="pasta"] { min-width: 220px; }
.obr-rec { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; overflow-wrap: anywhere; }
.obr-var { display: inline-block; padding: 0 0.3rem; margin: 0 1px; border-radius: 4px; background: #eef2f7; color: #475569; font-size: 0.75rem; line-height: 1.4; }
.obr-filtro-rot { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.8rem; color: var(--texto-suave); white-space: nowrap; }
.obr-msg-previa { margin: -4px 0 12px; padding: 10px 12px; border-radius: 8px; background: #e7f8ee; border: 1px solid #b7e4c7; font-size: 13px; }
.obr-msg-previa pre { margin: 4px 0 0; white-space: pre-wrap; font: 13px/1.45 inherit; font-family: inherit; }
#obr-tipo-form [hidden] { display: none !important; }
.obr-ensinar .cofre-form__check { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 12px; font-size: 14px; font-weight: 400; }
.obr-ensinar .cofre-form__check input { flex: none; margin-top: 2px; }
.obr-ensinar .cofre-form__check .mut { display: block; font-size: 0.75rem; }
.obr-envios { max-height: 320px; overflow-y: auto; padding: 6px; border: 1px solid var(--borda); border-radius: 8px; background: #fff; }
.obr-envio-resumo { margin: 10px 0 6px; padding: 8px 12px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; font-size: 14px; }
.obr-justif { display: block; max-width: 260px; font-style: italic; white-space: normal; }
#obr-conf textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; font-weight: 400; }
.obr-clicavel { cursor: pointer; }
.obr-clicavel:hover td { background: #f5f9ff; }
.obr-nome-link { color: inherit; text-decoration: none; }
.obr-nome-link:hover { text-decoration: underline; }
.obr-memo { display: block; max-width: 260px; white-space: normal; }
.obr-memo a { color: inherit; }
.obr-memo-lista { list-style: none; margin: 0 0 12px; padding: 6px 10px; max-height: 220px; overflow-y: auto; border: 1px solid var(--borda); border-radius: 8px; display: grid; gap: 6px; }
#auto-form [hidden] { display: none !important; }
.obr-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.obr-hist li { display: grid; gap: 2px; padding: 8px 10px; border-left: 3px solid #93c5fd; background: #f8fafc; border-radius: 4px; font-size: 14px; }
.obr-hist__cab { font-size: 12px; color: #64748b; }
/* tarefa rápida: documentos anexados + e-mail pro cliente (no pop-up da tarefa) */
.obr-anexos { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; display: grid; gap: 8px; }
.obr-anexos[hidden] { display: none; }
.obr-anexos h4 { margin: 0; font-size: 15px; }
.obr-anexos__lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.obr-anexos__lista li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.obr-anexos__lista li .link-btn { margin-left: auto; }
.obr-anexos__soltar { padding: 12px; border: 2px dashed var(--borda); border-radius: 8px; text-align: center; cursor: pointer; }
.obr-anexos__soltar:hover, .obr-anexos__soltar.ativo { border-color: #3b82f6; background: #eff6ff; }
.obr-anexos__envio { display: grid; gap: 6px; justify-items: start; }
.obr-anexos__envio[hidden] { display: none; }
.obr-anexos__contato { display: block; font-size: 14px; }
/* pop-up da tarefa: ações no topo (situação, concluir/dispensar/reabrir, responsável) */
.obr-pop-acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 14px; }
.obr-pop-acoes [hidden] { display: none !important; }
.obr-pop-acoes__sit { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #fef3c7; color: #92400e; }
.obr-pop-acoes__sit[data-st="entregue"] { background: #dcfce7; color: #166534; }
.obr-pop-acoes__sit[data-st="dispensada"] { background: #f1f5f9; color: #475569; }
.obr-pop-acoes .btn { padding: 6px 12px; }
.obr-pop-acoes__resp { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 0 auto; font-size: 0.85rem; font-weight: 500; color: #374151; }
/* responsável com a mesma cara dos botões (borda e texto azuis, mesma altura e canto) */
.obr-pop-acoes__resp select { width: auto; height: var(--control-h); margin: 0; padding: 0 2.1rem 0 1rem; border: 1px solid var(--brand); border-radius: var(--control-radius);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230084c3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 0.7rem center / 14px;
    color: var(--brand); font: inherit; font-size: 0.9rem; font-weight: 500; -webkit-appearance: none; appearance: none; cursor: pointer; }
.obr-pop-acoes__resp select:hover { background-color: #f0f9ff; }
.obr-pop-acoes__resp select:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* pop-up da tarefa (não rápida): datas à mão, documentos e documento subido à mão */
.obr-tacoes { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; display: grid; gap: 8px; }
.obr-tacoes[hidden] { display: none; }
.obr-tacoes h4 { margin: 4px 0 0; font-size: 15px; }
.obr-tacoes p:empty { display: none; }
.obr-tacoes__linha { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.obr-tacoes__linha label { display: grid; gap: 2px; font-size: 14px; white-space: nowrap; }
.obr-tacoes__opcoes { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; }
.obr-tacoes__opcoes label { display: inline-flex; align-items: center; gap: 6px; }
.obr-tacoes__opcoes input[type=checkbox], .obr-tacoes__opcoes input[type=radio] { width: auto; margin: 0; }
.obr-tacoes [hidden] { display: none !important; }
.obr-tdoc { display: grid; gap: 8px; }
.obr-tdoc > summary { cursor: pointer; font-weight: 600; }
.obr-tdoc[open] { padding-top: 4px; }
.obr-tdoc[open] > *:not(summary) { margin-top: 8px; }
/* pop-up da tarefa: mais largo, blocos separados (Datas · Documentos · Histórico), textos de apoio pequenos */
#obr-hist-modal { width: min(760px, 96vw); }
#obr-hist-tarefa { margin: 0 0 12px; font-size: 0.95rem; font-weight: 600; color: var(--texto); }
#obr-hist-modal .obr-tacoes { padding: 0; border: 0; gap: 12px; }
.obr-tbloco { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; }
#obr-hist-modal h4 { margin: 0; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--brand-escuro); }
#obr-hist-modal .obr-hist-tit { margin: 16px 0 8px; }
#obr-hist-modal .obr-hist { max-height: none; overflow: visible; }
#obr-t-datas-info, #obr-t-modos, #obr-t-lido, #obr-t-arq-nome { margin: 0; font-size: 0.8rem; line-height: 1.45; }
#obr-hist-modal .obr-tacoes__linha label { margin: 0; font-size: 0.85rem; font-weight: 500; color: #374151; }
#obr-hist-modal input:disabled { background: #f3f4f6; color: #6b7280; cursor: not-allowed; }
#obr-hist-modal .obr-anexos__lista li { display: grid; gap: 1px; }
#obr-hist-modal .obr-anexos__lista a { font-weight: 600; text-decoration: none; }
#obr-hist-modal .obr-anexos__lista a:hover { text-decoration: underline; }
#obr-hist-modal .obr-anexos__lista .mut { font-size: 0.78rem; }
#obr-hist-modal .obr-tdoc > summary { padding: 8px 12px; border: 1px dashed #93c5fd; border-radius: 8px; background: #f8fbff; color: var(--brand-escuro); font-size: 0.9rem; }
#obr-hist-modal .obr-tdoc[open] > summary { border-style: solid; }
#obr-hist-modal .obr-anexos__soltar { font-size: 0.85rem; }
#obr-t-subir { justify-self: start; width: auto; background: var(--brand); border-color: var(--brand); color: #fff; }
#obr-t-subir:disabled { background: #e5e7eb; border-color: #e5e7eb; color: #6b7280; opacity: 1; }
#obr-hist-modal .obr-tacoes__linha input { height: var(--control-h); margin: 0; }
#obr-hist-modal .obr-hist a { font-weight: 600; text-decoration: none; }
#obr-hist-modal .obr-hist a:hover { text-decoration: underline; }
/* "Para revisar": o que a entrega vai fazer (tarefa, pasta, cliente) */
/* prévia da baixa/transferência do cliente (cadastro → Clientes) */
.obr-enc-lista { margin: 4px 0 12px; padding-left: 1.2rem; font-size: 0.85rem; display: grid; gap: 2px; }
.obr-previa { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; font-size: 0.8rem; color: var(--texto-suave); overflow-wrap: anywhere; }
/* simulação detalhada (Configurações → Obrigações): o que foi/seria feito com o documento */
.obr-sim { margin-top: 6px; color: var(--texto, #1f2937); }
.obr-sim[open] { min-width: 460px; }
.obr-sim summary { cursor: pointer; font-size: 13px; color: #2563eb; }
.obr-sim__sec { margin: 6px 0 0; font-size: 13px; }
.obr-sim__sec ul { margin: 2px 0 0; padding-left: 18px; }
.obr-sim__sec li { margin: 1px 0; overflow-wrap: anywhere; }
.obr-mun { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid var(--borda); border-radius: 8px; background: #f8fafc; }
.obr-mun-tabela { margin-bottom: 8px; }
.obr-mun-novo { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.obr-mun-novo select, .obr-mun-novo input { height: var(--control-h); padding: 0 8px; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.obr-mun-novo input[type="number"] { width: 70px; }
#obr-mun-nome { min-width: 180px; }

/* Ficha do cliente → Atividades da empresa (CNAEs + enquadramento Simples/MEI) */
.cli-ativ__barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin-bottom: 0.7rem; font-size: 0.82rem; }
.cli-ativ__resumo { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.7rem; }
.cli-ativ__resumo .badge { font-size: 0.8rem; padding: 0.2rem 0.6rem; }
table.dados.cli-ativ-tabela td { white-space: normal; vertical-align: top; }
.cli-ativ-tabela td:first-child { min-width: 260px; }
.cli-ativ-tabela td:nth-child(2) { min-width: 160px; }
.cli-ativ-tabela td:nth-child(3) { min-width: 220px; }
.cli-ativ-tabela code { font-weight: 600; font-variant-numeric: tabular-nums; }
.cli-ativ__desc { display: block; margin-top: 0.15rem; font-size: 0.84rem; color: var(--texto-suave); }
.cli-ativ--principal td { background: #f0f7fc; }
.cli-ativ--principal td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.cli-ativ--principal .cli-ativ__desc { color: var(--texto); font-weight: 500; }
.cli-ativ__ocup { display: block; margin-top: 0.3rem; font-size: 0.82rem; }
.cli-ativ__imp { display: inline-block; padding: 0 0.35rem; border-radius: 4px; background: #eef2f5; color: #475569; font-size: 0.7rem; font-weight: 700; }
.obr-efeito { margin: 4px 0 12px; padding: 8px 12px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--borda); font-size: 14px; }
.obr-efeito__tit { display: block; margin-bottom: 4px; font-size: 0.85rem; font-weight: 500; color: #374151; }
.obr-efeito .cofre-form__check { margin: 4px 0; }

/* Consumo do Integra Contador */
.integra-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 12px 0 20px; }
.integra-card { display: grid; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid var(--borda); border-radius: 10px; font-size: 14px; }
.integra-card__rot { font-size: 12px; color: #64748b; text-transform: uppercase; letter-spacing: .03em; }
.integra-card__valor { font-size: 26px; font-weight: 600; }
.integra-card--total { border-color: #93c5fd; }
.integra-barra { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.integra-barra span { display: block; height: 100%; background: #0b7fc1; }
.integra-barra--alerta span { background: #d97706; }
.integra-precos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 12px; }
.integra-precos fieldset { border: 1px solid var(--borda); border-radius: 8px; padding: 8px 12px; }
.integra-faixa { display: flex; gap: 8px; margin-bottom: 6px; }
.integra-faixa label { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.integra-faixa input { width: 90px; }


/* popup do captcha da prefeitura (Betha) na ficha do cliente */
.cli-captcha { width: min(420px, 94vw); }
.cli-captcha [data-img] { display: block; margin: 0.4rem 0 0.9rem; border: 1px solid var(--borda); border-radius: 6px; background: #fff; }
.cli-captcha [data-resp] { text-transform: none; letter-spacing: 0.15em; font-weight: 600; }

/* Envio rápido de documentos no topo */
.topo-up { align-self: center; }
.topo-up--sobre { outline: 2px dashed #fff; outline-offset: 2px; background: rgba(255, 255, 255, 0.2); }
.topo-up--ocupado svg { animation: topo-up-pulsa 1s ease-in-out infinite; }
@keyframes topo-up-pulsa { 50% { opacity: .35; } }

/* dentro de janela (dialog) o corpo tem rolagem própria e cortava a lista de sugestões do
   campo de tags (só aparecia 1 item): lá ela abre no fluxo, empurrando o conteúdo */
.hist-modal__corpo .tagpick__drop { position: static; margin-top: 4px; max-height: 240px; }

/* Obrigações → Cadastro: janela "Clientes vinculados" (ver e desvincular) */
.obr-cli-modal { width: min(600px, 94vw); }
.obr-cli-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.obr-cli-barra input[type="search"] { flex: 1 1 240px; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.hist-modal__corpo .obr-cli-barra .cofre-form__check { margin: 0; }
.obr-cli-lista { list-style: none; margin: 0 0 0.6rem; padding: 0; max-height: 52vh; overflow-y: auto; border: 1px solid var(--borda); border-radius: 8px; background: #fff; }
.obr-cli-lista li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.75rem; border-bottom: 1px solid #f0f0f0; font-size: 0.9rem; }
.obr-cli-lista li:last-child { border-bottom: none; }
.obr-cli-lista li[hidden] { display: none; }
.obr-cli-lista li a { flex: 1; min-width: 0; color: var(--texto); text-decoration: none; }
.obr-cli-lista li a:hover { color: var(--brand); text-decoration: underline; }
.hist-modal__corpo .obr-cli-lista .cofre-form__check { margin: 0; }

/* ficha do cliente → seção Obrigações */
table.dados.cli-obr-tabela td { white-space: normal; vertical-align: top; }
.cli-obr-tabela td:first-child a { color: var(--texto); font-weight: 600; text-decoration: none; }
.cli-obr-tabela td:first-child a:hover { color: var(--brand); text-decoration: underline; }
.cli-obr-vincular { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem; margin-top: 0.8rem; }
.cli-obr-vincular .tagpick { flex: 1 1 260px; min-width: 0; }
.cli-obr-vincular .cli-form-erro { flex-basis: 100%; margin: 0; }


/* Início consolidado (inicio.php, prévia): minhas tarefas + alertas + visão do escritório */
.inicio-cab { margin-bottom: 0.6rem; }
.inicio-bloco__cab { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.inicio-bloco__cab a { font-size: 0.85rem; }
.inicio-sits { margin: 0.2rem 0 1rem; }
.inicio-linha { list-style: none; margin: 0; padding: 0 0 0 0.9rem; border-left: 3px solid #e5e7eb; }
.inicio-linha__dia { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; padding: 0.45rem 0; }
.inicio-linha__dia::before { content: ""; position: absolute; left: -1.33rem; top: 0.75rem; width: 11px; height: 11px; border-radius: 50%; background: #d97706; box-shadow: 0 0 0 3px #fff; }
.inicio-linha__dia--atrasada::before { background: #dc2626; }
.inicio-linha__dia--hoje::before { background: #ea580c; }
.inicio-linha__dia--futura::before { background: #0084c3; }
.inicio-linha__data { flex: 0 0 auto; min-width: 11.5rem; font-size: 0.8rem; font-weight: 700; color: var(--texto-suave); font-variant-numeric: tabular-nums; }
.inicio-linha__dia--atrasada .inicio-linha__data { color: #b91c1c; }
.inicio-linha__dia--hoje .inicio-linha__data { color: #c2410c; }
.inicio-linha__itens { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.inicio-linha__itens a { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.6rem; border: 1px solid var(--borda); border-radius: 999px; background: #fff; font-size: 0.82rem; color: var(--texto); text-decoration: none; }
.inicio-linha__itens a:hover { border-color: var(--brand); color: var(--brand); }
.inicio-linha__itens b { font-size: 0.75rem; color: var(--texto-suave); }
.pagina-titulo.inicio-secao { margin-top: 1.6rem; font-size: 1.15rem; }
.inicio-tarefas__ver { display: inline-flex; align-items: center; gap: 0.8rem; font-size: 0.85rem; }
.inicio-tarefas__ver select { height: 32px; margin: 0; padding: 0 0.5rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-size: 0.85rem; }

/* ===== Obrigações → Painel analítico: linha do tempo (estilo TaskDo) ===== */
.tl-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; margin: 0.4rem 0 0.8rem; }
.tl-barra .resultado-info { margin: 0; }
/* visão da linha do tempo: botões iguais ao "Limpar"; o selecionado fica aceso */
.tl-visao { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.tl-visao__rot { font-size: 0.85rem; color: var(--texto-suave); }
.tl-visao .btn.ativo { background: var(--brand); color: #fff; cursor: default; }
.tl { position: relative; padding-left: 1.1rem; border-left: 3px solid #e5e7eb; margin-left: 0.4rem; }
.tl-dia { position: relative; padding: 0.2rem 0 0.9rem; }
.tl-data { position: relative; display: inline-block; margin: 0 0 0.45rem -0.2rem; padding: 0.2rem 0.75rem; border-radius: 999px; background: #f59e0b; color: #fff; font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-data::before { content: ""; position: absolute; left: -1.33rem; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: inherit; box-shadow: 0 0 0 3px #fff; }
.tl-dia--passado .tl-data { background: #dc2626; }
.tl-dia--hoje .tl-data { background: #ea580c; }
.tl-obr { margin-bottom: 0.35rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.tl-obr.aberto { border-color: #cbd5e1; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tl-obr__cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; width: 100%; min-height: 42px; padding: 0.45rem 0.75rem; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; color: var(--texto); }
.tl-obr__cab:hover { background: #f8fafc; }
.tl-obr__cab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 8px; }
.tl-ic { display: inline-flex; color: #b91c1c; }
.tl-obr--prazo .tl-ic { color: #d97706; }
.tl-obr--entregue .tl-ic { color: #15803d; }
.tl-obr--dispensada .tl-ic { color: #9ca3af; }
.tl-nome { font-weight: 700; font-size: 0.86rem; letter-spacing: 0.01em; color: var(--brand-escuro); }
.tl-qtd { font-size: 0.78rem; color: var(--texto-suave); }
.tl-meta--passou { color: #c2410c; font-weight: 600; }
/* automação que obtém a guia: ok / agendado / alerta / falha; "sem automação" em destaque */
.tl-auto { display: inline-flex; align-items: center; gap: 2px; margin-left: 0.3rem; vertical-align: middle; }
.tl-auto--ok { color: #15803d; }
.tl-auto--agendado { color: #0284c7; }
.tl-auto--alerta { color: #d97706; }
.tl-auto--falha { color: #dc2626; }
.tl-auto--sem { color: #9ca3af; }
.tl-auto--grupo { padding: 2px 7px; border-radius: 999px; background: #f1f5f9; }
.tl-auto-sem { display: inline-block; margin-left: 0.35rem; padding: 1px 7px; border: 1px solid #fdba74; border-radius: 999px; background: #fff7ed; color: #c2410c; font-size: 0.72rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.tl-prazo { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; font-size: 0.82rem; color: #b91c1c; }
.tl-prazo svg { width: 13px; height: 13px; }
.tl-prazo--prazo { color: #c2410c; }
.tl-prazo--entregue { color: #15803d; }
.tl-prazo--dispensada { color: var(--texto-suave); }
.tl-chev { flex: none; color: var(--texto-suave); transition: transform .15s; }
.tl-obr.aberto .tl-chev { transform: rotate(180deg); }
.tl-obr__corpo { padding: 0 0.5rem 0.5rem; border-top: 1px solid #eef2f5; }
.tl-obr__corpo .tabela-wrap { margin: 0; }
.obr-tabela td.obr-cod { width: 1%; white-space: nowrap; color: var(--texto-suave); font-variant-numeric: tabular-nums; }   /* código na Domínio */
.tl-tabela [data-col="obr"] { display: none; }   /* a obrigação já está no cabeçalho do grupo */
@media (max-width: 640px) {
    .tl { padding-left: 0.8rem; margin-left: 0.2rem; }
    .tl-data::before { left: -1.03rem; }
    .tl-obr__cab { position: relative; padding-right: 2.2rem; }
    .tl-prazo { margin-left: 0; flex-basis: 100%; }
    .tl-chev { position: absolute; right: 0.75rem; top: 0.8rem; }
}

/* ===== Fiscal → Conferência DFe: cada nota é um bloco colorido ===== */
.cdf--verde { --cdf: #16a34a; --cdf-bg: #f0fdf4; --cdf-tx: #166534; }
.cdf--amarelo { --cdf: #ca8a04; --cdf-bg: #fefce8; --cdf-tx: #854d0e; }
.cdf--laranja { --cdf: #ea580c; --cdf-bg: #fff7ed; --cdf-tx: #9a3412; }
.cdf--vermelho { --cdf: #dc2626; --cdf-bg: #fef2f2; --cdf-tx: #991b1b; }
.cdf--cinza { --cdf: #9ca3af; --cdf-bg: #f9fafb; --cdf-tx: #4b5563; }
.cdf-form select, .cdf-form .tagpick { flex: 1 1 420px; min-width: min(420px, 100%); }
.cdf-carregando { display: flex; align-items: center; gap: 0.6rem; margin: 1rem 0; color: var(--texto-suave); }
.cdf-carregando[hidden] { display: none; }
.cdf-giro { width: 18px; height: 18px; border: 3px solid #cbd5e1; border-top-color: var(--brand); border-radius: 50%; animation: cdf-giro 0.8s linear infinite; }
@keyframes cdf-giro { to { transform: rotate(360deg); } }
.cdf-cab { margin: 0.6rem 0 0; font-size: 0.95rem; }
.cdf-grupos .cdf-qtd { font-weight: 400; color: var(--texto-suave); }
.cdf-grupos .cdf-qtd em { font-style: normal; margin-left: 0.25rem; padding: 0 0.4rem; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: 0.75rem; font-weight: 700; }
.cdf-cores { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.9rem; }
.cdf-cor { width: auto; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border: 1px solid var(--cdf); border-radius: 999px; background: #fff; color: var(--cdf-tx); font-size: 0.82rem; font-weight: 500; opacity: 0.55; }
.cdf-cor:hover { background: var(--cdf-bg); }
.cdf-cor.ativo { background: var(--cdf-bg); opacity: 1; box-shadow: inset 4px 0 0 var(--cdf); }
.cdf-cor b { font-variant-numeric: tabular-nums; }
.cdf-filtros { flex-wrap: wrap; }
.cdf-filtros input[type="search"] { flex: 1 1 260px; }
.cdf-check { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; white-space: nowrap; }
.cdf-check input[type="checkbox"] { flex: none; width: 16px; height: 16px; margin: 0; }
.cdf-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.6rem; }
.cdf-lista > .cert-vazio { grid-column: 1 / -1; }
.cdf-bloco { min-width: 0; padding: 0.55rem 0.75rem; border: 1px solid #e5e7eb; border-left: 4px solid var(--cdf); border-radius: 8px; background: var(--cdf-bg); cursor: pointer; font-size: 0.84rem; }
.cdf-bloco.cdf-tracejado { border-left-style: dashed; }
.cdf-bloco:hover { box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cdf-bloco:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.cdf-bloco.aberto { grid-column: 1 / -1; cursor: default; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.cdf-bloco.aberto > .cdf-b-topo, .cdf-bloco.aberto > .cdf-b-parte, .cdf-bloco.aberto > .cdf-b-rodape { cursor: pointer; }
.cdf-b-topo { display: flex; align-items: baseline; gap: 0.35rem; }
.cdf-b-topo .tag { font-size: 0.7rem; }
.cdf-b-data { margin-left: auto; color: var(--texto-suave); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.cdf-b-parte { margin: 0.2rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #374151; }
.cdf-b-rodape { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.8rem; }
.cdf-b-valor { font-weight: 600; font-variant-numeric: tabular-nums; }
.cdf-b-st { color: var(--cdf-tx); font-weight: 600; text-align: right; }
.cdf-det { margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px solid rgba(0,0,0,.08); cursor: default; }
.cdf-det-st { margin: 0 0 0.4rem; color: var(--cdf-tx); }
.cdf-det-av { margin: 0 0 0.6rem; padding-left: 1.1rem; color: #92400e; }
.cdf-det-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.cdf-det-col section { padding: 0.55rem 0.7rem; border-radius: 6px; background: #fff; border: 1px solid #eef2f5; display: grid; gap: 0.2rem; align-content: start; }
.cdf-det-col h4 { margin: 0 0 0.2rem; font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--texto-suave); }
.cdf-det-col p { margin: 0; }
.cdf-det-chave { margin: 0.6rem 0 0; overflow-wrap: anywhere; }
.cdf-det-chave code { font-size: 0.8rem; }
.cdf-det-acoes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.cdf-det-acoes .btn { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.82rem; }
.cdf-mais { display: flex; justify-content: center; margin: 1rem 0; }
.cdf-info-linha { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin: 0 0 0.6rem; }
.cdf-info-linha .resultado-info { margin: 0; }
.cdf-info-linha .btn { width: auto; height: 34px; padding: 0 0.9rem; font-size: 0.82rem; }
.cdf-gov-btn { width: auto; height: 32px; margin-top: 0.3rem; padding: 0 0.8rem; font-size: 0.8rem; }
.cdf-mais .btn { width: auto; }
.cdf-avisos-gerais { margin: 0.5rem 0 0; padding-left: 1.1rem; font-size: 0.82rem; color: var(--texto-suave); }
@media (max-width: 760px) { .cdf-det-col { grid-template-columns: 1fr; } }
.cdf-geral-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 1rem 0 0.6rem; }
.cdf-geral-cab .obr-sub { margin: 0; }
.cdf-geral-botoes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.cdf-geral-botoes .btn { width: auto; }
.cdf-num { display: inline-block; min-width: 1.8rem; padding: 0 0.45rem; border-radius: 999px; background: var(--cdf-bg, #f3f4f6); color: var(--cdf-tx, #374151); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.cdf-cab #cdf-voltar { margin-right: 0.6rem; }
.cdf-form #cdf-rotina { flex: 1 1 280px; min-width: min(280px, 100%); }
/* rotina da Domínio: um bloco por empresa; aberto, ocupa a linha e recebe o painel de conferência */
.cdf-emps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.6rem; }
.cdf-emp { min-width: 0; border: 1px solid #e5e7eb; border-left: 4px solid var(--cdf); border-radius: 8px; background: var(--cdf-bg); }
.cdf-emp.aberta { grid-column: 1 / -1; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.cdf-emp--fora { opacity: 0.6; }
.cdf-emp-cab { padding: 0.6rem 0.8rem; cursor: pointer; font-size: 0.85rem; }
.cdf-emp-cab:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; border-radius: 8px; }
.cdf-emp.aberta .cdf-emp-cab { background: var(--cdf-bg); border-radius: 4px 8px 0 0; }
.cdf-emp-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cdf-emp-linha { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.3rem; font-size: 0.8rem; color: #374151; }
.cdf-emp-st { color: var(--cdf-tx); font-weight: 600; text-align: right; }
.cdf-emp-corpo { padding: 0 0.8rem; }
.cdf-emp.aberta .cdf-emp-corpo { padding: 0.4rem 0.8rem 0.8rem; }
.cdf-emp #cdf-voltar { display: none; }

/* Faturamento → Últimos 12 meses (faturamento-12meses.php): 14 colunas cabendo em 1366 px */
table.fat12 th, table.fat12 td { padding: 0.5rem 0.3rem; font-size: 0.78rem; }
table.fat12 th:first-child, table.fat12 td:first-child { padding-left: 0.8rem; }
table.fat12 td a { color: inherit; text-decoration: none; }
table.fat12 td a:hover { color: var(--brand); text-decoration: underline; }
table.fat12:not(.fat12--zeradas) tr[data-zero] { display: none; }

/* ---------- Contratos (gerador, lista e visualização) ---------- */
.ctr-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem 1rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.ctr-botoes { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn.ctr-primario { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn.ctr-primario:hover { background: var(--brand-escuro); border-color: var(--brand-escuro); }
.ctr-gerador { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.ctr-form .cofre-form { margin-bottom: 1rem; }
.ctr-form .cofre-form[hidden], .ctr-form [data-so][hidden] { display: none; }
.ctr-dica { display: block; margin: -0.4rem 0 0.8rem; }
.ctr-col2 { grid-column: span 2; }
.ctr-inline { display: flex; gap: 0.4rem; }
.ctr-inline input { flex: 1; min-width: 0; }
.ctr-inline .btn { flex: none; height: var(--control-h); }
.ctr-cliente { margin-bottom: 1rem; }
.ctr-modelos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0.6rem; }
.cofre-form label.ctr-modelo { position: relative; display: flex; flex-direction: column; gap: 0.2rem; margin: 0; padding: 0.7rem 0.8rem; border: 1px solid var(--borda); border-radius: 9px; cursor: pointer; background: #fff; }
.cofre-form label.ctr-modelo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ctr-modelo strong { font-size: 0.88rem; color: var(--texto); }
.ctr-modelo small { font-size: 0.75rem; font-weight: 400; line-height: 1.35; color: var(--texto-suave); }
.ctr-modelo:hover { border-color: var(--brand); }
.ctr-modelo:has(input:checked) { border-color: var(--brand); background: #f0f7fc; box-shadow: inset 0 0 0 1px var(--brand); }
.ctr-modelo:has(input:checked) strong { color: var(--brand-escuro); }
.ctr-modelo:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.ctr-avalista { margin-bottom: 0.9rem; padding: 0.8rem 0.9rem 0.2rem; border: 1px dashed var(--borda); border-radius: 9px; }
.ctr-avalista__cab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; font-size: 0.88rem; }
button.ctr-remover { width: auto; padding: 0.2rem 0.5rem; background: none; color: #b91c1c; font-size: 0.8rem; font-weight: 500; }
button.ctr-remover:hover { background: #fef2f2; }
.ctr-mais { margin-top: 0.9rem; }
.ctr-mais summary { cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--brand-escuro); margin-bottom: 0.7rem; }
.ctr-grupo { margin: 0 0 1rem; padding: 0; border: none; }
.ctr-grupo legend { margin-bottom: 0.3rem; font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--brand-escuro); }
.ctr-op { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 0.8rem; padding: 0.45rem 0.2rem; border-bottom: 1px solid #f0f2f4; }
.ctr-op[hidden] { display: none; }
.cofre-form label.ctr-op__rot { display: flex; flex-direction: row; align-items: flex-start; gap: 0.55rem; margin: 0; flex: 1 1 260px; font-weight: 500; cursor: pointer; }
.cofre-form label.ctr-op__rot input { width: 16px; height: 16px; min-width: 16px; margin: 0.15rem 0 0; }
.ctr-op__rot small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--texto-suave); }
.ctr-op__params { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; font-size: 0.8rem; color: var(--texto-suave); }
.ctr-param { display: inline-flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.ctr-form input.ctr-num { width: 92px; height: 32px; margin: 0; padding: 0 0.5rem; font-size: 0.85rem; text-align: right; }
.ctr-form input.ctr-num--curto { width: 72px; }
.ctr-form .cofre-form__grade input.ctr-num { width: 100%; height: var(--control-h); text-align: left; font-size: 0.95rem; }
.ctr-op--off { opacity: 0.45; }
.ctr-op--off .ctr-op__rot { cursor: default; }
.ctr-extra { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.6rem; }
.ctr-extra textarea { flex: 1; min-height: 90px; padding: 0.5rem 0.7rem; border: 1px solid var(--borda); border-radius: 7px; font-size: 0.88rem; resize: vertical; }
.ctr-lado { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 0.6rem; max-height: calc(100vh - 92px); } /* 78px = barra azul fixa do portal + folga */
.ctr-g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem 0.9rem; margin-bottom: 0.9rem; }
.ctr-g4 .ctr-s2 { grid-column: span 2; }
.ctr-g4 .ctr-s3 { grid-column: span 3; }
.ctr-g4[hidden] { display: none; }
.ctr-lado__barra { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.ctr-pend { margin: 0; padding: 0.55rem 0.8rem 0.55rem 1.8rem; border: 1px solid #fcd34d; border-radius: 8px; background: #fffbeb; color: #92400e; font-size: 0.8rem; }
.ctr-pend[hidden] { display: none; }
.ctr-previa, .ctr-folha { overflow: auto; padding: 26px 30px; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); }
.ctr-folha { max-width: 860px; overflow: visible; }
@media (max-width: 1150px) {
    .ctr-gerador { grid-template-columns: 1fr; }
    .ctr-lado { position: static; max-height: none; }
}
@media (max-width: 640px) {
    .ctr-col2 { grid-column: auto; }
    .ctr-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ctr-g4 .ctr-s2, .ctr-g4 .ctr-s3 { grid-column: span 2; }
    .ctr-previa, .ctr-folha { padding: 16px; }
}

/* ---------- Contratos: cláusulas com trechos/variações no gerador ---------- */
.ctr-g4 .ctr-s4 { grid-column: 1 / -1; }
.ctr-cla { border-bottom: 1px solid #eef0f3; }
.ctr-cla[hidden], .ctr-cla__trechos[hidden], .ctr-param[hidden], [data-campo][hidden] { display: none !important; }
.ctr-cla > .ctr-op--cl { border-bottom: none; }
.ctr-cla__nome { padding-left: 0.2rem; font-size: 0.84rem; font-weight: 700; color: #374151; }
.ctr-cla__trechos { margin: -0.2rem 0 0.4rem 1.6rem; padding-left: 0.7rem; border-left: 2px solid #e5eef6; }
.ctr-cla__trechos .ctr-op { border-bottom: none; padding: 0.3rem 0.2rem; }
.ctr-op__rot--fixo { display: block; padding-left: 0.2rem; font-size: 0.85rem; font-weight: 500; color: #4b5563; }
.ctr-op--fora { opacity: 0.45; }
.ctr-op--fora .ctr-op__rot span::after { content: " — não entra (depende de outra opção)"; font-size: 0.75rem; font-weight: 400; color: #b45309; }
.ctr-form .ctr-op__params select, .ctr-form .ctr-op__params input:not(.ctr-num) { width: auto; max-width: 260px; height: 32px; margin: 0; padding: 0 0.5rem; border: 1px solid var(--borda); border-radius: 6px; font-size: 0.85rem; background: #fff; }

/* ---------- Contratos: biblioteca (Cláusulas e tipos) ---------- */
.ctrb-barra { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.6rem 1rem; margin-bottom: 0.8rem; }
.ctrb-barra .resultado-info { margin: 0; flex: 1 1 320px; }
.ctrb-filtro { display: flex; align-items: center; gap: 0.5rem; margin: 0; font-size: 0.85rem; }
.ctrb-filtro select { width: auto; height: 36px; margin: 0; padding: 0 0.6rem; border: 1px solid var(--borda); border-radius: 7px; background: #fff; }
.ctrb-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1rem; align-items: start; }
.ctrb-lista { list-style: none; margin: 0; padding: 0.3rem; border: 1px solid #e5e7eb; border-radius: 10px; background: #fff; position: sticky; top: 78px; max-height: calc(100vh - 92px); overflow: auto; }
.ctrb-li { display: flex; align-items: center; gap: 0.2rem; border-radius: 7px; }
.ctrb-li.ativo { background: #e8f3fb; }
.ctrb-li.inativa .ctrb-item__nome { color: #9ca3af; text-decoration: line-through; }
.ctrb-li.fora { opacity: 0.4; }
.ctrb-mover { display: inline-flex; gap: 1px; flex: none; }
.ctrb-mover button, .ctrb-x, .ctrb-vaba, .ctrb-cod, .ctrb-item { width: auto; padding: 0; margin: 0; border: none; background: none; color: inherit; font-weight: 500; cursor: pointer; }
.ctrb-mover button { width: 22px; height: 24px; border-radius: 5px; color: #6b7280; font-size: 0.8rem; }
.ctrb-mover button:hover:not(:disabled) { background: #eef2f6; color: var(--brand); }
.ctrb-mover button:disabled { opacity: 0.25; cursor: default; }
.ctrb-item { flex: 1; display: flex; gap: 0.4rem; min-width: 0; padding: 0.35rem 0.4rem; border-radius: 6px; text-align: left; font-size: 0.85rem; }
.ctrb-item:hover { background: #f3f6f9; }
.ctrb-item__num { flex: 0 0 1.6rem; color: var(--texto-suave); text-align: right; }
.ctrb-item__nome { min-width: 0; color: var(--texto); }
.ctrb-item__nome small { display: block; font-size: 0.72rem; font-weight: 400; color: var(--texto-suave); }
.ctrb-editor { min-width: 0; }
.ctrb-form h3 { margin-bottom: 0.8rem; }
.ctrb-chave { display: inline-block; padding: 0.15rem 0.4rem; border-radius: 5px; background: #f1f5f9; color: #475569; font-size: 0.78rem; }
.ctrb-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.2rem; margin: 0.4rem 0; }
.ctrb-linha select { width: auto; max-width: 100%; height: 36px; margin: 0; padding: 0 0.5rem; border: 1px solid var(--borda); border-radius: 7px; background: #fff; font-size: 0.85rem; }
.ctrb-campo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.7rem; margin: 0.5rem 0; font-size: 0.83rem; }
.ctrb-campo > span { flex: 0 0 auto; font-weight: 600; color: #374151; }
.ctrb-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cofre-form label.ctrb-chip, .hist-modal label.ctrb-chip { display: inline-flex; flex-direction: row; align-items: center; gap: 0.3rem; margin: 0; padding: 0.15rem 0.55rem; border: 1px solid var(--borda); border-radius: 999px; font-size: 0.78rem; font-weight: 500; cursor: pointer; background: #fff; }
.ctrb-chip input { width: 13px; height: 13px; margin: 0; }
.ctrb-chip:has(input:checked) { border-color: var(--brand); background: #eef7fd; color: var(--brand-escuro); }
.ctrb-chip--todos { font-weight: 700 !important; }
.cofre-form label.ctrb-cond { margin: 0.6rem 0; }
.ctrb-trecho { margin: 0 0 0.8rem; padding: 0.7rem 0.8rem; border: 1px solid #e5e7eb; border-left: 3px solid #cbd5e1; border-radius: 8px; background: #fcfdfe; }
.ctrb-trecho--caput { border-left-color: var(--brand); }
.ctrb-trecho--paragrafo { border-left-color: #a78bfa; }
.ctrb-trecho--item, .ctrb-trecho--incisos { border-left-color: #34d399; }
.ctrb-trecho__cab { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.ctrb-trecho__cab select { width: auto; max-width: min(300px, 100%); height: 32px; margin: 0; padding: 0 0.4rem; border: 1px solid var(--borda); border-radius: 6px; background: #fff; font-size: 0.82rem; }
.ctrb-trecho__cab .ctrb-mover { margin-left: auto; }
.ctrb-trecho__opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; }
.ctrb-trecho__opts input[type="text"] { flex: 1 1 220px; width: auto; height: 32px; margin: 0; padding: 0 0.55rem; font-size: 0.84rem; }
.cofre-form .ctrb-trecho__opts .cofre-form__check { margin: 0; font-size: 0.82rem; }
.ctrb-x { padding: 0.15rem 0.45rem; border-radius: 5px; color: #b91c1c; font-size: 0.78rem; }
.ctrb-x:hover { background: #fef2f2; }
.ctrb-mais { margin: 0.35rem 0; font-size: 0.8rem; }
.ctrb-mais summary { cursor: pointer; color: var(--texto-suave); }
.ctrb-mais .ctrb-chips { margin-top: 0.35rem; }
.ctrb-vars { margin-top: 0.5rem; }
.ctrb-vabas { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-bottom: -1px; }
.ctrb-vaba { padding: 0.3rem 0.7rem; border: 1px solid transparent; border-bottom: none; border-radius: 7px 7px 0 0; font-size: 0.78rem; color: var(--texto-suave); }
.ctrb-vaba.ativo { border-color: var(--borda); background: #fff; color: var(--brand-escuro); font-weight: 700; }
.ctrb-vaba--nova { color: var(--brand); }
.ctrb-vaba:hover:not(.ativo) { background: #f1f5f9; }
.ctrb-var-cab { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1rem; padding: 0.5rem 0.6rem 0; border: 1px solid var(--borda); border-bottom: none; background: #fff; }
.cofre-form .ctrb-var-cab label { flex: 1 1 200px; margin: 0; font-size: 0.8rem; }
.ctrb-var-cab + .ctrb-campo { margin: 0; padding: 0.4rem 0.6rem; border-left: 1px solid var(--borda); border-right: 1px solid var(--borda); background: #fff; }
textarea.ctrb-texto { display: block; width: 100%; margin: 0; padding: 0.55rem 0.7rem; border: 1px solid var(--borda); border-radius: 0 7px 7px 7px; font-family: inherit; font-size: 0.86rem; line-height: 1.5; resize: vertical; }
.ctrb-acoes { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid #eef0f3; }
.ctrb-ajuda { margin-top: 1rem; }
.ctrb-ajuda summary { cursor: pointer; font-weight: 700; font-size: 0.88rem; color: var(--brand-escuro); }
.ctrb-ajuda p { margin: 0.7rem 0 0.35rem; }
.ctrb-cods { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.ctrb-cod { padding: 0.15rem 0.45rem; border: 1px solid #dbe4ee; border-radius: 5px; background: #f8fafc; font: 0.76rem ui-monospace, Consolas, monospace; color: #334155; }
.ctrb-cod:hover { border-color: var(--brand); color: var(--brand-escuro); background: #eef7fd; }
.ctrb-vazio p { color: var(--texto-suave); }
.ctrb-logo { display: block; max-height: 48px; max-width: 120px; object-fit: contain; }
.ctrb-qual { max-width: 520px; white-space: normal; font-size: 0.78rem; }
.ctrb-logo-linha { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 0.5rem; }
.hist-modal.ctrb-dlg { width: min(860px, 96vw); }
.ctrb-dlg textarea { width: 100%; margin: 0; padding: 0.5rem 0.7rem; border: 1px solid var(--borda); border-radius: 7px; font-family: inherit; font-size: 0.88rem; font-weight: 400; resize: vertical; }
.ctrb-dlg .hist-modal__corpo > div > label:not(.cofre-form__check) { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; font-size: 0.85rem; font-weight: 500; color: #374151; }
.ctrb-dlg .hist-modal__corpo > div > label input:not([type="checkbox"]):not([type="file"]) { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); font: inherit; font-weight: 400; }
.ctrb-dlg .hist-modal__corpo > div > label select { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.6rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; }
.ctrb-dlg .hist-modal__corpo .cofre-form__check { display: flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0.6rem 0; font-weight: 400; }
.ctrb-dlg .hist-modal__corpo .cofre-form__check input { width: 16px; height: 16px; margin: 0; }
.ctrb-dlg h4 { margin: 1rem 0 0.6rem; font-size: 0.9rem; }
@media (max-width: 1100px) {
    .ctrb-grid { grid-template-columns: 1fr; }
    .ctrb-lista { position: static; max-height: 320px; }
}
.ctrb-ordem { width: 64px; white-space: nowrap; }

/* ---------- Cobranças recorrentes ---------- */
.cr-modal { width: min(940px, 96vw); }
.cr-modal .cofre-form__grade { margin-bottom: 0.85rem; }
.cr-modal .cofre-form__grade > label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 500; color: #374151; }
.cr-previa { margin: 0.4rem 0 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--borda); border-radius: 8px; background: #f8fafc; font-size: 0.85rem; }
.cr-previa table.dados { margin-top: 0.4rem; }
.cr-lista { display: flex; flex-direction: column; gap: 0.15rem; margin: 0.35rem 0 0.6rem; font-size: 0.85rem; }
.cob-erro { max-width: 260px; white-space: normal; }
/* transferência de contabilidade (transferencias.php) */
.transf-voltar { margin: 0 0 0.3rem; font-size: 0.85rem; }
.transf-voltar a { text-decoration: none; }
.transf-obs { margin-bottom: 0.8rem; }
.transf-prog { width: 160px; max-width: 100%; height: 7px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.transf-prog span { display: block; height: 100%; background: #22c55e; }
.transf-resumo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.9rem; margin: 0 0 0.8rem; }
.transf-resumo .transf-prog { width: 260px; }
.transf-resumo .cert-sub { margin: 0; font-size: 0.85rem; }
table.dados.transf-itens td { white-space: normal; vertical-align: middle; }
table.dados.transf-itens tr.transf-setor th { background: #f1f5f9; color: var(--brand-escuro); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.transf-itens .transf-item__nome { min-width: 260px; }
.transf-itens select, .transf-itens input { width: 100%; height: 32px; margin: 0; padding: 0 0.5rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; font-size: 0.85rem; }
.transf-itens select { min-width: 130px; }
.transf-itens input[type="date"] { min-width: 140px; }
.transf-itens input[type="text"] { min-width: 180px; }
.transf-itens select:disabled, .transf-itens input:disabled { background: #f9fafb; color: var(--texto-suave); }
.transf-item--recebido .transf-item__nome { color: #15803d; }
.transf-item--recebido select { border-color: #86efac; background: #f0fdf4; }
.transf-item--nao_aplica .transf-item__nome { color: var(--texto-suave); text-decoration: line-through; }
.transf-item--pendente select { border-color: #fcd34d; background: #fffbeb; }
.transf-add-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin: 0.8rem 0 0; font-size: 0.85rem; }
.transf-modal { width: min(720px, 96vw); }
.transf-grupo { margin: 0 0 0.7rem; padding: 0.4rem 0.8rem 0.5rem; border: 1px solid var(--borda); border-radius: 8px; }
.transf-grupo legend { padding: 0 0.3rem; font-weight: 600; font-size: 0.85rem; }
.transf-grupo legend .link-btn { margin-left: 0.4rem; font-weight: 400; font-size: 0.78rem; }
.hist-modal__corpo .transf-grupo .cofre-form__check { margin: 0.3rem 0; align-items: flex-start; font-size: 0.88rem; }
.transf-grupo .cofre-form__check input { margin-top: 0.2rem; }
.transf-outro { display: flex; gap: 0.5rem; }
.transf-outro select { width: 9rem; flex: none; }
.transf-outro input { flex: 1; }
table.dados.transf-lista td { white-space: normal; }
.transf-and { min-width: 170px; }
.transf-sec { margin: 0 0 1.1rem; }
.transf-sec__cab { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.7rem; margin: 0 0 0.45rem; }
.transf-sec__cab h3 { margin: 0; font-size: 1rem; color: var(--brand-escuro); }
.transf-sec__cab .mut { font-size: 0.82rem; }
.transf-sec__novo { margin-left: auto; font-size: 0.85rem; }
.transf-sec__excluir { font-size: 0.8rem; }
.transf-setas { display: inline-flex; gap: 2px; }
.transf-setas button { width: 26px; height: 24px; padding: 0; margin: 0; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #6b7280; font-size: 0.85rem; line-height: 1; cursor: pointer; }
.transf-setas button:hover:not(:disabled) { background: #f1f5f9; border-color: var(--borda); color: var(--brand); }
.transf-setas button:disabled { opacity: .3; cursor: default; }
.transf-sec__cab .transf-setas button { border-color: var(--borda); background: #fff; }
table.dados .transf-setas button { color: #6b7280; }
table.dados .transf-setas button:hover:not(:disabled) { color: var(--brand); }
table.dados.transf-modelos td { white-space: normal; vertical-align: middle; }
table.dados.transf-modelos td.transf-setas-col { width: 66px; padding-right: 0; }
table.dados.transf-modelos .badge { margin-left: 0.3rem; white-space: nowrap; }
/* capas de arquivo (capas-arquivo.php) */
.capas-form { max-width: 760px; }
/* notas do cliente: cliente/fornecedor ocupa 2 colunas da grade */
.cli-notas-filtros .cli-notas-parte { grid-column: span 2; }
/* tabela: nomes longos quebram linha (sem rolagem lateral); valor e arquivos numa linha só */
table.dados[data-tabela="cliente-notas"] td[data-col="emitente"],
table.dados[data-tabela="cliente-notas"] td[data-col="contraparte"] { white-space: normal; min-width: 160px; max-width: 320px; }
table.dados[data-tabela="cliente-notas"] td[data-col="valor"], table.dados[data-tabela="cliente-notas"] th[data-col="valor"] { text-align: right; font-variant-numeric: tabular-nums; }
.cli-notas-filtros select:not([data-tags]) { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
@media (max-width: 700px) { .cli-notas-filtros .cli-notas-parte { grid-column: auto; } }
.capas-setores { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: center; }
.capas-setores legend { width: 100%; }
.capas-setores .capas-outro { display: flex; flex-direction: row; align-items: center; gap: 0.5rem; margin: 0; }
.capas-setores .capas-outro input { width: 9rem; margin: 0; }
/* telas de cobrança: abas, indicadores, colunas de texto que quebram linha (a tabela cabe na tela) */
.cob-abas { margin-top: 0.4rem; }
.alerta--info { background: #e0f2fe; color: #075985; }
.cob-kpis { margin-bottom: 0.9rem; }
.pn-kpi.cob-kpi--alerta { border-color: #fca5a5; }
.pn-kpi.cob-kpi--alerta .pn-kpi__num { color: #b91c1c; }
.pn-kpi.cob-kpi--erro { border-color: #fca5a5; background: #fef2f2; }
.pn-kpi.cob-kpi--erro .pn-kpi__num { color: #b91c1c; }
.pn-kpi.cob-kpi--ativo { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: #f0f9ff; }
@media (max-width: 600px) {
    .cob-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
    .cob-kpis .pn-kpi { padding: 0.65rem 0.75rem; }
    .cob-kpis .pn-kpi__num { font-size: 1.1rem; }
}
.cr-modal label[hidden], .cr-modal p[hidden] { display: none; } /* "Modelo da nota" some com "Não emitir nota" */
a.config-tab { text-decoration: none; }
table.dados[data-tabela^="cobrancas"] td[data-col="cliente"] { white-space: normal; min-width: 160px; max-width: 260px; }
table.dados[data-tabela^="cobrancas"] td[data-col="descricao"] { white-space: normal; min-width: 140px; max-width: 260px; }
table.dados[data-tabela^="cobrancas"] td[data-col="envio"] { white-space: normal; min-width: 130px; max-width: 220px; }
table.dados[data-tabela^="cobrancas"] td[data-col="nota"],
table.dados[data-tabela^="cobrancas"] td[data-col="conta"] { white-space: normal; min-width: 110px; max-width: 160px; }
table.dados[data-tabela^="cobrancas"] .badge { white-space: nowrap; }
.cob-envio-form > h4:first-child { margin-top: 0; padding-top: 0; border-top: none; }
table.dados[data-tabela^="cobrancas"] td[data-col="envio"] .mut,
table.dados[data-tabela^="cobrancas"] td[data-col="cliente"] .mut,
table.dados[data-tabela^="cobrancas"] td[data-col="descricao"] .mut { margin-left: 0; }
.cob-secao-cab { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem 1rem; flex-wrap: wrap; margin: 1.4rem 0 0.6rem; }
.cob-secao-cab .obr-sub { margin: 0; }
.cob-nota { margin-top: 0.6rem; }
.cob-envio-form { max-width: 760px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.cob-filtros select:not([multiple]) { width: 100%; height: var(--control-h); margin: 0; padding: 0 0.75rem; border: 1px solid var(--borda); border-radius: var(--control-radius); background: #fff; font: inherit; }
.cr-lista label.cofre-form__check { display: flex; flex-direction: row; align-items: center; gap: 0.45rem; margin: 0; text-align: left; font-weight: 400; }
.cr-lista label.cofre-form__check input { width: auto; height: auto; margin: 0; flex: none; }
/* Boletos → Visão por cliente (boletos-visao.php): um valor por boleto, cor = situação do pagamento */
.bv { display: block; padding: 0.1rem 0.35rem; border-radius: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: default; }
.bv + .bv { margin-top: 2px; }
.bv--verde { background: #dcfce7; color: #166534; }
.bv--azul { background: #dbeafe; color: #1e40af; }
.bv--amarelo { background: #fef3c7; color: #92400e; }
.bv--vermelho { background: #fee2e2; color: #991b1b; }
.bv-legenda { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 0.75rem; font-size: 0.8rem; }
.bv-legenda .bv { display: inline-block; }
