﻿/* VoxOps — estilos base */
:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e4e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-50: #eef2ff;
    --success-50: #ecfdf5;
    --danger: #dc2626;
    --danger-50: #fef2f2;
    --sidebar: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-muted: #64748b;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
    --sidebar-w: 248px;
    --topbar-h: 64px;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(79, 70, 229, .35); outline-offset: 2px; }

/* ---------- Estrutura ---------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
    display: flex; flex-direction: column; padding: 20px 14px;
    background: var(--sidebar); color: var(--sidebar-text);
    transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 24px; color: #fff; text-decoration: none !important; }
.brand-mark {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
    background: linear-gradient(135deg, #6366f1, #22d3ee); color: #fff; font-weight: 800; font-size: 16px;
}
.brand-name { font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.brand-name strong { font-weight: 800; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 8px 10px 6px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--sidebar-text); font-weight: 500; text-decoration: none !important;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: #1e293b; color: #fff; box-shadow: inset 3px 0 0 #818cf8; }
.sidebar-footer { margin-top: auto; padding: 8px 10px; font-size: 12px; color: var(--sidebar-muted); }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
    display: flex; align-items: center; gap: 12px; padding: 0 28px;
    background: rgba(244, 246, 251, .85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border);
}
.page-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.content { width: 100%; padding: 28px; }

.icon-btn {
    width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
.icon-btn svg { width: 20px; height: 20px; }
.menu-btn { display: none; }

.user-menu { position: relative; margin-left: auto; }
.user-btn {
    display: flex; align-items: center; gap: 10px; padding: 4px 10px 4px 4px; cursor: pointer;
    border: 1px solid transparent; border-radius: 999px; background: none; color: var(--text);
}
.user-btn:hover { background: var(--surface); border-color: var(--border); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--primary-50); color: var(--primary-600); font-size: 13px; font-weight: 700;
}
.user-name { font-size: 14px; font-weight: 600; }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
}
.dropdown-header { padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.dropdown-header small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.dropdown form { margin: 0; }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; cursor: pointer;
    border: 0; border-radius: 8px; background: none; color: var(--text); font-size: 14px; text-align: left; text-decoration: none;
}
.dropdown svg { width: 16px; height: 16px; color: var(--muted); }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); }

/* ---------- Componentes ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
    border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
    text-decoration: none !important; transition: background .15s, border-color .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: #cbd5e1; }
.btn-block { width: 100%; height: 44px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.girando svg { animation: girar 1s linear infinite; }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); cursor: pointer; }

.alert { margin-bottom: 16px; padding: 12px 14px; border: 1px solid; border-radius: 10px; font-size: 14px; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { background: var(--success-50); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-50); border-color: #fecaca; color: #991b1b; }
.validation-summary-valid { display: none; }

/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.field input {
    height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field input.input-validation-error { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; }
.field-validation-valid { display: none; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.link-sm { font-size: 13px; font-weight: 500; }

/* ---------- Telas de autenticação ---------- */
.auth {
    min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background:
        radial-gradient(1200px 600px at 10% -10%, #e0e7ff 0, transparent 60%),
        radial-gradient(900px 500px at 110% 110%, #cffafe 0, transparent 55%),
        var(--bg);
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.auth-brand .brand-name { color: var(--text); font-size: 22px; }
.auth-card { padding: 32px 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.auth-title { margin: 0 0 4px; font-size: 22px; letter-spacing: -.02em; }
.auth-subtitle { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.auth-back { display: inline-block; margin-top: 18px; font-size: 14px; }
.auth-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- Painéis e indicadores ---------- */
.panel { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.panel-narrow { max-width: 480px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.panel-sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.panel-narrow .panel-sub { margin-bottom: 16px; }

.kpi-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 16px; }
.kpi {
    min-width: 0; padding: 18px; display: flex; flex-direction: column; gap: 6px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-blue { background: #3b82f6; }
.dot-amber { background: #f59e0b; }
.dot-violet { background: #8b5cf6; }

.kpi-hero { padding: 22px; border: 0; color: #fff; background: linear-gradient(135deg, #4338ca, #6366f1 55%, #0ea5e9); }
.kpi-hero .kpi-label { color: rgba(255, 255, 255, .85); }
.kpi-hero .kpi-value { font-size: 56px; }
.kpi-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.kpi-sub { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .14); }
.kpi-sub span { color: rgba(255, 255, 255, .85); font-size: 12px; font-weight: 600; }
.kpi-sub strong { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
/* Destaque quando há cartões sem dono */
.kpi-sub.alerta { background: #fff; color: #b45309; box-shadow: 0 0 0 2px #fbbf24; }
.kpi-sub.alerta span { color: #b45309; }

.list-block { margin-top: 24px; }
.list-block h3 { margin: 0 0 10px; font-size: 14px; }
.card-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-list li + li { border-top: 1px solid var(--border); }
.card-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); text-decoration: none; }
.card-list a:hover { background: var(--surface-2); }
.card-id { flex: none; color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.card-meta { flex: none; color: var(--muted); font-size: 12px; }

.kpi-foot { margin-top: auto; color: var(--muted); font-size: 12px; }
.kpi-foot strong { color: var(--text); }

/* Rankings por responsável */
.rankings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 0 24px; }
.tabela-ranking .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela-ranking .rank-pos { width: 1%; color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.tabela-ranking .rank-total { font-weight: 800; }
.rank-cartao { display: block; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.rank-cartao:hover { text-decoration: underline; }
.idade-atencao { color: #b45309; font-weight: 700; }
.idade-critica { color: #b91c1c; font-weight: 700; }

/* Esqueleto no primeiro carregamento */
.is-first-load .kpi-value, .is-first-load .kpi-sub strong {
    width: 2.5ch; color: transparent !important; border-radius: 8px;
    background: linear-gradient(90deg, rgba(148, 163, 184, .25), rgba(148, 163, 184, .5), rgba(148, 163, 184, .25));
    background-size: 200% 100%; animation: brilho 1.2s infinite;
}

@keyframes brilho { to { background-position: -200% 0; } }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .kpi-hero { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .45); }
    .main { margin-left: 0; }
    .menu-btn { display: grid; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px; }
}

@media (max-width: 640px) {
    .user-name { display: none; }
    .panel { padding: 16px; border-radius: 16px; }
    .panel-head { margin-bottom: 14px; }
    .btn-label { display: none; }
    .panel-head .btn { width: 40px; padding: 0; }
    .kpi-grid { gap: 10px; }
    .kpi { padding: 12px; }
    .kpi-label { font-size: 12px; align-items: flex-start; }
    .kpi-dot { margin-top: 5px; }
    .kpi-value { font-size: 28px; }
    .kpi-hero { padding: 18px; }
    .kpi-hero .kpi-value { font-size: 48px; }
    .card-meta { display: none; }
    .auth-card { padding: 26px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Listas, tabelas e cadastros ---------- */
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 16px; font-size: 13px; }
.link-voltar { font-weight: 600; font-size: 14px; }
.hint { color: var(--muted); font-size: 12px; }
.contador { display: inline-block; min-width: 22px; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; vertical-align: middle; }
.sub { display: block; color: var(--muted); font-size: 12px; }

.input, .field select, .field textarea {
    height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text); font: inherit; font-size: 14px; transition: border-color .15s, box-shadow .15s;
}
.field select, .field textarea { height: 44px; padding: 0 14px; font-size: 15px; }
.field textarea { height: auto; padding: 10px 14px; resize: vertical; }
.input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.field select.input-validation-error, .field textarea.input-validation-error { border-color: var(--danger); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.busca { display: flex; flex: 1; flex-wrap: wrap; gap: 8px; min-width: 260px; margin: 0; }
.busca input[type="search"] { flex: 1; min-width: 200px; }
.toolbar-acoes { display: flex; gap: 8px; margin-left: auto; }
.toolbar-acoes form { margin: 0; }
/* Botões alinhados com a primeira linha de filtros quando eles quebram em mais de uma linha */
.toolbar-topo { align-items: flex-start; }
.resumo-lista { margin: 0 0 12px; font-size: 14px; }

.lista-clientes { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.lista-clientes li + li { border-top: 1px solid var(--border); }
.linha-cliente { display: grid; grid-template-columns: auto 1fr auto minmax(110px, auto); align-items: center; gap: 14px; padding: 12px 14px; color: var(--text); text-decoration: none !important; }
.linha-cliente:hover { background: var(--surface-2); }
.avatar-empresa { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary-600); font-size: 13px; font-weight: 800; }
.lc-principal { min-width: 0; }
.lc-nome { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.lc-principal small { color: var(--muted); font-size: 12px; }
.lc-contatos { color: var(--muted); font-size: 13px; white-space: nowrap; }
.lc-sistemas { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: #334155; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-inativo { background: #f1f5f9; color: var(--muted); }
.badge-interno { background: #fef3c7; border-color: #fde68a; color: #92400e; }
.badge-via { background: #ecfeff; border-color: #a5f3fc; color: #0e7490; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em; background: #f1f5f9; color: #475569; }
.chip-jumpjump { background: #ede9fe; color: #5b21b6; }
.chip-zendesk { background: #dcfce7; color: #166534; }
.chip-pipedrive { background: #e0f2fe; color: #075985; }

.paginacao { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.vazio { padding: 28px 16px; text-align: center; color: var(--muted); }
.vazio .btn { margin-top: 8px; }
.vazio-inline { margin: 0; color: var(--muted); font-size: 14px; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: 1 / -1; }
.field-dupla { display: grid; grid-template-columns: 1fr 72px; gap: 10px; }
.field-uf input { text-transform: uppercase; }
.field-check { justify-content: flex-end; padding-bottom: 10px; }
.field-check .check { color: var(--text); }
.grupo-checks { margin: 0; padding: 0; border: 0; }
.grupo-checks legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.checks .check { color: var(--text); }
.form-acoes { display: flex; flex-wrap: wrap; gap: 8px; }

.tabela-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { padding: 10px 12px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; white-space: nowrap; }
.tabela td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.tabela td .badge + .badge, .tabela td .chip + .chip { margin-left: 4px; }
.tabela tr.inativo td { color: var(--muted); }
.tabela code { font-size: 12px; color: var(--muted); }
.col-acoes { width: 1%; white-space: nowrap; text-align: right; }
.col-acoes form { display: inline-block; margin: 0; }
.col-acoes .icon-btn { display: inline-grid; vertical-align: middle; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.perigo:hover { color: var(--danger); border-color: #fecaca; }
.link-button.perigo { color: var(--danger); font-size: 13px; }

.rel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.rel-grid h3 { margin: 0 0 8px; font-size: 14px; }
.lista-simples { margin: 0; padding: 0; list-style: none; }
.lista-simples li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.lista-simples form { margin: 0; }
.form-linha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 0 0; padding-top: 16px; border-top: 1px dashed var(--border); }
.form-linha select { max-width: 100%; }
.form-linha input.input { flex: 1; min-width: 180px; }
.rotulo-inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

.panel-perigo { border-color: #fecaca; }
.acoes-perigo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.acoes-perigo .form-linha { margin: 0; padding: 0; border: 0; }
.btn-perigo { background: var(--surface); border-color: #fecaca; color: var(--danger); }
.btn-perigo:hover { background: var(--danger-50); }

.dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 24px; border: 0; border-radius: 18px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); color: var(--text); }
.dialog::backdrop { background: rgba(15, 23, 42, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-acoes { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
    .rel-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .col-2 { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
    .toolbar-acoes { margin-left: 0; width: 100%; }
    .toolbar-acoes form, .toolbar-acoes a { flex: 1; }
    .toolbar-acoes .btn { width: 100%; }
    .linha-cliente { grid-template-columns: auto 1fr; }
    .lc-contatos, .lc-sistemas { grid-column: 2; justify-content: flex-start; }
    .form-grid { grid-template-columns: 1fr; }
    .field-check { padding-bottom: 0; }
    .dialog { padding: 18px; }
    .tabela-wrap { border: 0; }
    .tabela thead { display: none; }
    .tabela, .tabela tbody, .tabela tr, .tabela td { display: block; width: 100%; }
    .tabela tr { margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; }
    .tabela td { padding: 4px 0; border: 0; }
    .tabela td[data-rotulo]:empty { display: none; }
    .tabela td[data-rotulo]:not(:first-child)::before { content: attr(data-rotulo); display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
    .col-acoes { width: 100%; text-align: left; padding-top: 8px !important; }
}

/* ---------- Pesquisa: contatos encontrados ---------- */
.contatos-encontrados { margin: -4px 0 0; padding: 0 14px 10px 66px; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.contatos-encontrados a { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 13px; text-decoration: none !important; }
.contatos-encontrados a:hover { background: var(--primary-50); }
.contatos-encontrados a.inativo { color: var(--muted); }
.contatos-encontrados svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.ce-nome { font-weight: 600; }
.ce-dado { color: var(--muted); }
.ce-dado + .ce-dado::before, .ce-nome + .ce-dado::before { content: "·"; margin-right: 10px; color: #cbd5e1; }
.ce-mais a { background: none; color: var(--primary); padding: 2px 10px; }
mark { background: #fef08a; color: inherit; border-radius: 3px; padding: 0 1px; }
@media (max-width: 640px) {
    .contatos-encontrados { padding-left: 14px; }
    .ce-dado + .ce-dado::before, .ce-nome + .ce-dado::before { content: none; }
}
/* ---------- Estágio da empresa ---------- */
.badge-lead { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.badge-empoc { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.badge-excliente { background: #f1f5f9; color: var(--muted); }
.badge-leadperdido { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
/* ---------- Produtos e serviços ---------- */
.linha-produto.inativo { opacity: .6; }
.lp-modalidades { display: block; margin-top: 2px; }
.badge-adicional { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-status-ativo { background: var(--success-50); border-color: #a7f3d0; color: #047857; }
.badge-status-empoc { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.badge-status-cancelado { background: #f1f5f9; color: var(--muted); }
.totais { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.total { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.total > span { color: var(--muted); font-size: 12px; font-weight: 600; }
.total strong { font-size: 20px; }
.total strong small { font-size: 13px; font-weight: 500; color: var(--muted); }
.total > small { color: var(--muted); font-size: 12px; }
.dialog-sm { width: min(520px, calc(100vw - 24px)); }
.dialog-sub { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.campos-produto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; margin-bottom: 8px; }
.campos-produto .grupo-checks, .campos-produto > .check { grid-column: 1 / -1; }
.campos-produto > .check { color: var(--text); }
.input-unidade { display: flex; gap: 6px; }
.input-unidade input { flex: 1; min-width: 0; }
.input-unidade select { width: auto; }
.col-detalhes .detalhe { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: #334155; }
.lc-produtos { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.chip-produto { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--primary-50); color: var(--primary-600); font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip-produto.poc { background: #f5f3ff; color: #6d28d9; border: 1px dashed #c4b5fd; }

/* ---------- Usuários e perfis de acesso ---------- */
.fieldset-limpo { min-width: 0; margin: 0; padding: 0; border: 0; }
.fieldset-limpo:disabled input:not([type="checkbox"]), .fieldset-limpo:disabled select, .fieldset-limpo:disabled textarea { background: var(--surface-2); color: var(--text); cursor: default; }
.alert-aviso { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.senha-temporaria { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 6px; background: #fff; border: 1px solid #fde68a; font-size: 15px; font-weight: 700; letter-spacing: .04em; user-select: all; }
.linha-usuario.inativo, .linha-cliente.inativo { opacity: .6; }
.opcoes-perfil, .opcoes-usuarios { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.opcoes-usuarios { max-height: 420px; overflow-y: auto; padding-right: 4px; }
.opcao-perfil { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.opcao-perfil:hover { background: var(--surface-2); }
.opcao-perfil:has(input:checked) { border-color: #c7d2fe; background: var(--primary-50); }
.opcao-perfil input { margin-top: 3px; }
.opcao-perfil span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opcao-perfil small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.opcao-perfil.inativo strong { color: var(--muted); }
.grupos-funcionalidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px 20px; }
.grupos-funcionalidades .grupo-checks { display: flex; flex-direction: column; gap: 8px; }
.grupos-funcionalidades h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.lista-check { margin: 0; padding-left: 18px; font-size: 14px; }
.filtro-usuarios { max-width: 280px; }

/* ---------- Controle de propostas ---------- */
.codigo-proposta { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabela-propostas td { vertical-align: top; }
.tabela-propostas .chip-produto { margin: 0 4px 4px 0; }
.detalhe-proposta { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.badge-pendente { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.badge-tipo-contrato, .badge-tipo-renovacao { background: var(--success-50); border-color: #a7f3d0; color: #047857; }
.badge-tipo-aditivo { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-tipo-propostatecnica { background: var(--primary-50); border-color: #c7d2fe; color: var(--primary-600); }
.badge-tipo-nda { background: #f1f5f9; color: #334155; }
.codigo-box { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.codigo-box > div:not(.acoes-proposta) { display: flex; flex-direction: column; gap: 2px; }
.codigo-rotulo { color: var(--muted); font-size: 13px; font-weight: 600; }
.codigo-valor { font-size: 32px; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; user-select: all; }
.codigo-novo { border-color: #a7f3d0; background: var(--success-50); }
.codigo-novo .codigo-rotulo { color: #047857; }
.opcoes-produtos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px 16px; }
.opcoes-produtos .check { color: var(--text); }
.acoes-proposta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acoes-proposta form { margin: 0; }
.badge-cancelada { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.tabela tr.cancelada td { color: var(--muted); }
.tabela tr.cancelada .codigo-proposta { text-decoration: line-through; color: var(--muted); }
.tabela tr.cancelada .chip-produto { opacity: .6; }
.tabela-propostas .col-acoes { white-space: nowrap; }
.tabela-propostas .col-acoes form { display: inline; }
.codigo-cancelado .codigo-valor { text-decoration: line-through; color: var(--muted); }
.aviso-cancelada { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }
.aviso-cancelada form { margin: 0; }

/* ---------- Painel do cliente ---------- */
.painel-cliente-titulo { display: flex; align-items: center; gap: 14px; min-width: 0; }
.painel-cliente-titulo .avatar-empresa { flex: none; width: 46px; height: 46px; font-size: 15px; }
.resumo-cliente { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px 24px; margin: 0; }
.resumo-cliente dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.resumo-cliente dd { margin: 4px 0 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.secao-titulo { margin: 24px 0 10px; font-size: 14px; }
.produtos-cliente { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.produtos-cliente li { display: flex; flex-direction: column; gap: 2px; min-width: 160px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.produtos-cliente li.poc { border-style: dashed; border-color: #c4b5fd; background: #faf5ff; }
.produtos-cliente small { color: var(--muted); font-size: 12px; }
.pc-nome { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; }
.pc-cancelados { margin: 8px 0 0; font-size: 12px; }
.kpi-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-clicavel { font: inherit; color: inherit; text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi-clicavel:hover, .kpi-clicavel:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.dot-green { background: #10b981; }
.dialog-lg { width: min(1180px, calc(100vw - 24px)); }
.abas { display: flex; gap: 4px; margin: 12px 0 14px; border-bottom: 1px solid var(--border); }
.aba { margin-bottom: -1px; padding: 8px 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.aba:hover { color: var(--text); }
.aba[aria-selected="true"] { color: var(--primary-600); border-bottom-color: var(--primary); }
.tabela-cartoes td { vertical-align: top; }
.tabela-cartoes .col-data, .tabela-cartoes .col-numero { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela-cartoes .col-numero { color: var(--muted); }
.tabela-cartoes .col-titulo a { color: var(--text); font-weight: 600; }
.tabela-cartoes .col-titulo a:hover { color: var(--primary); text-decoration: underline; }

/* ---------- Incidentes ---------- */
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
a.kpi { color: inherit; text-decoration: none; }
.kpi-alerta { border-color: #c4b5fd; box-shadow: 0 0 0 3px rgba(139, 92, 246, .14); }
.dot-roxo { background: #8b5cf6; }
.dot-vermelho { background: #dc2626; }
.dot-laranja { background: #f59e0b; }
.badge-sev-s1 { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.badge-sev-s2 { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.badge-sev-s3 { background: #fefce8; border-color: #fde68a; color: #a16207; }
.badge-sit-aconfirmar { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
.badge-sit-aberto { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.badge-sit-mitigado { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.badge-sit-resolvido { background: var(--success-50); border-color: #a7f3d0; color: #047857; }
.badge-sit-descartado { background: #f1f5f9; color: var(--muted); }
.tag-incidente { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: #334155; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tag-incidente i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tags-incidente { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.titulo-incidente { font-weight: 600; color: var(--text); }
.titulo-incidente:hover { color: var(--primary); }
.tabela tr.descartado td, .tabela tr.descartado .titulo-incidente { color: var(--muted); }
.aviso-incidente { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.aviso-incidente > div:first-child { flex: 1 1 420px; }
.aviso-incidente .acoes { display: flex; gap: 8px; }
.cabecalho-incidente { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; }
.opcoes-tags { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.field input[type="color"] { width: 72px; height: 44px; padding: 4px; cursor: pointer; }
.form-cartao { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.form-cartao .input { width: auto; }
.form-cartao input[type="number"] { width: 150px; }
.titulo-cartao { font: inherit; font-weight: 600; color: var(--text); text-align: left; }
.titulo-cartao:hover, .titulo-cartao[aria-expanded="true"] { color: var(--primary); text-decoration: underline; }
.tabela tr.conteudo-cartao > td { background: var(--surface-2); border-top: 0; }
.cc { display: grid; gap: 14px; padding: 4px 2px 8px; }
.cc-bloco h4 { margin: 0 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.cc-texto { margin: 0; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.cc-bloco > .cc-texto { max-height: 420px; overflow: auto; }
.cc-comentarios { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.cc-comentarios li { padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.cc-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.lista-tags { max-height: 320px; margin: 8px 0 16px; overflow: auto; }
.lista-tags li.inativa .tag-incidente { opacity: .6; }
.lt-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lt-acoes { display: flex; gap: 4px; }
.form-tag { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.form-tag .input { flex: 1 1 180px; width: auto; }
.form-tag input[type="color"] { width: 48px; height: 40px; padding: 3px; cursor: pointer; }
.form-tag .field-error { flex-basis: 100%; margin: 0; }
@media (max-width: 1100px) { .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Incidentes: painel gerencial ---------- */
.abas-pagina { margin: 0; }
a.aba { display: inline-block; text-decoration: none !important; }
.aba[aria-current="page"] { color: var(--primary-600); border-bottom-color: var(--primary); }
.painel-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13px; }
.segmentado { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.seg-opcao { padding: 5px 12px; border-radius: 7px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none !important; }
.seg-opcao:hover { color: var(--text); }
.seg-opcao[aria-current="true"] { background: var(--primary-50); color: var(--primary-600); }
.delta-pior { color: #b42318; }
.delta-melhor { color: #047857; }
.kpi-foot.delta-pior, .kpi-foot.delta-melhor { font-weight: 600; }
.painel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 16px; }
.painel-grid > .panel { min-width: 0; }
/* Severidade nos gráficos: um só tom (ordem S1 > S2 > S3), validado para daltonismo */
.sev-s1 { background: #9f1d1d; }
.sev-s2 { background: #dc4a3a; }
.sev-s3 { background: #f08a6e; }
.legenda { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; font-weight: 600; }
.legenda li { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
/* Colunas empilhadas (incidentes por mês) */
.gc { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.gc-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.gc-area { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 100%; height: 200px; padding-top: 22px; border-bottom: 1px solid var(--border); }
.gc-valor { flex: none; margin-bottom: 4px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gc-pilha { flex: none; display: flex; flex-direction: column-reverse; gap: 2px; width: 100%; max-width: 24px; height: var(--h); min-height: 4px; border-radius: 4px 4px 0 0; overflow: hidden; }
.gc-pilha i { display: block; flex-basis: 0; min-height: 2px; }
.gc-col:hover .gc-pilha { filter: brightness(.9); }
.gc-rotulo { margin-top: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.tabela-grafico { margin-top: 14px; }
.tabela-grafico summary { color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; }
.tabela-grafico .tabela-wrap { margin-top: 10px; }
/* Colunas simples (simultâneos por dia/semana) */
.gs-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 8px; }
.gs-eixo-y { display: flex; flex-direction: column; justify-content: space-between; height: 140px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; }
.gs { display: flex; align-items: flex-end; gap: 2px; height: 140px; border-bottom: 1px solid var(--border); background: linear-gradient(var(--border), var(--border)) top / 100% 1px no-repeat; }
.gs-col { flex: 1 1 0; display: flex; align-items: flex-end; justify-content: center; height: 100%; min-width: 0; }
.gs-col i { display: block; width: 100%; max-width: 24px; background: var(--primary); border-radius: 3px 3px 0 0; }
.gs-col:hover i { background: var(--primary-600); }
.gs-eixo-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
/* Barras horizontais (tags e ranking) */
.barras-h { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.barras-h li { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr) 32px; align-items: center; gap: 10px; padding: 4px 0; }
.bh-rotulo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.bh-trilho { display: block; height: 10px; }
.bh-trilho i { display: block; height: 100%; min-width: 3px; background: var(--primary); border-radius: 0 4px 4px 0; }
.bh-sem-tag .bh-trilho i { background: #94a3b8; }
.bh-valor { text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.celula-barra { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.celula-barra .bh-trilho { flex: 1; }
.linha-total td { font-weight: 700; }

/* ---------- Incidentes: em andamento agora (tempo em aberto) ---------- */
.abertos-resumo { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 32px; margin-bottom: 14px; }
.abertos-numeros { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 0; }
.abertos-numeros dt { color: var(--muted); font-size: 12px; }
.abertos-numeros dd { margin: 2px 0 0; font-size: 22px; font-weight: 700; }
.abertos-numeros small { color: var(--muted); font-size: 12px; font-weight: 400; }
.abertos-idade { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.abertos-idade li { display: flex; flex-direction: column; align-items: center; min-width: 88px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.abertos-idade strong { font-size: 18px; }
.abertos-idade span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.abertos-idade .zerada { opacity: .55; }

/* ---------- Incidentes: faixa da tela inicial ---------- */
.faixa-incidentes { margin-bottom: 20px; padding: 18px 24px; }
.fi-ok { box-shadow: inset 4px 0 0 #0ca30c, var(--shadow); }
.fi-ativo { box-shadow: inset 4px 0 0 #dc4a3a, var(--shadow); }
.fi-critico { border-color: #fecaca; box-shadow: inset 4px 0 0 #9f1d1d, var(--shadow); }
.fi-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.fi-cab h2 { margin: 0; font-size: 16px; }
.fi-links { display: flex; gap: 16px; font-size: 14px; font-weight: 600; }
.fi-corpo { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.fi-tudo-ok { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; }
.fi-tudo-ok svg { flex: none; width: 24px; height: 24px; color: #0ca30c; }
.fi-ativos { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.fi-ativos a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; }
.fi-ativos a:hover { background: var(--surface-2); }
.fi-titulo-inc { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.fi-meta { flex: none; color: var(--muted); font-size: 12px; }
.fi-mais { display: inline-block; margin-top: 6px; font-size: 13px; }
.fi-numeros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0; }
.fi-numeros > div { min-width: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; }
.fi-numeros dt { color: var(--muted); font-size: 12px; font-weight: 600; }
.fi-numeros dd { margin: 2px 0 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
.fi-numeros small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; line-height: 1.3; }
.fi-numeros small.delta-pior { color: #b42318; }
.fi-numeros small.delta-melhor { color: #047857; }
@media (max-width: 1100px) {
    .fi-corpo { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .faixa-incidentes { padding: 16px; }
    .fi-numeros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fi-ativos a { flex-wrap: wrap; }
    .fi-meta { flex-basis: 100%; }
    .gc-rotulo { font-size: 10px; }
}
