/* ===== CRM · tema claro/escuro automático ===== */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --border: #e2e7ef;
  --text: #1b2333;
  --muted: #667085;
  --primary: #1f5eff;
  --primary-hover: #1749cc;
  --primary-soft: #e6eeff;
  --on-primary: #ffffff;
  --success: #12805c;
  --success-soft: #e3f6ee;
  --danger: #c4321f;
  --danger-soft: #fdecea;
  --warning: #a15c00;
  --warning-soft: #fff4e0;
  --sidebar: #0f1b33;
  --sidebar-text: #c7d0e0;
  --sidebar-active: #1f5eff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 12px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 28px rgba(16, 24, 40, .14);
  --sidebar-w: 240px;
  --sidebar-w-collapsed: 68px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1220;
    --surface: #151c2c;
    --surface-2: #1b2438;
    --border: #273148;
    --text: #e6eaf2;
    --muted: #94a0b8;
    --primary: #5b8cff;
    --primary-hover: #7aa2ff;
    --primary-soft: #1d2b4f;
    --on-primary: #0d1220;
    --success: #3ccf91;
    --success-soft: #133326;
    --danger: #ff7a66;
    --danger-soft: #3a1b17;
    --warning: #f5b453;
    --warning-soft: #362811;
    --sidebar: #0a0f1b;
    --sidebar-text: #aeb9cf;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.hidden { display: none !important; }

/* ===== Estrutura ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  transition: width .2s ease; overflow: hidden; z-index: 40; flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; color: #fff; font-weight: 700; white-space: nowrap; }
.brand-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--sidebar-active); color: #fff; font-weight: 800; flex: none; }
.brand-mark.lg { width: 56px; height: 56px; font-size: 1.3rem; border-radius: 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; flex: 1; overflow-y: auto; }
.nav a, .nav-btn {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); white-space: nowrap; font: inherit; background: none; border: 0; width: 100%; cursor: pointer; text-align: left;
}
.nav a:hover, .nav-btn:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.sidebar-foot { padding: 8px; border-top: 1px solid rgba(255, 255, 255, .08); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 12px; white-space: nowrap; }
.me-info { display: flex; flex-direction: column; line-height: 1.2; }
.me-info strong { color: #fff; font-size: .9rem; }
.me-info small { font-size: .78rem; }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .8rem; flex: none; }
.sidebar .avatar { background: rgba(255, 255, 255, .12); color: #fff; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .nav span,
body.sidebar-collapsed .sidebar .brand-name,
body.sidebar-collapsed .sidebar .me-info,
body.sidebar-collapsed .sidebar .nav-btn span { display: none; }
body.sidebar-collapsed .nav a, body.sidebar-collapsed .nav-btn { justify-content: center; }
body.sidebar-collapsed .me { justify-content: center; padding: 8px 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 14px; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 9px 0; width: 100%; color: var(--text); font: inherit; outline: none; }
.search:focus-within { border-color: var(--primary); }
.topbar .btn { margin-left: auto; }
.content { padding: 24px; width: 100%; max-width: 1400px; }
.page-title { font-size: 1.45rem; margin-bottom: 18px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head .page-title { margin: 0; }
.sidebar-backdrop { display: none; }

/* ===== Botões ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.3;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-success:hover, .btn-danger:hover { filter: brightness(1.08); background-color: inherit; }
.btn-success:hover { background: var(--success); }
.btn-danger:hover { background: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }
.link-btn.danger { color: var(--danger); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline { display: inline; }

/* ===== Cartões ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-value { font-size: 1.6rem; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.stat-sub { color: var(--muted); font-size: .85rem; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > progress { display: block; width: 100%; height: 8px; border: 0; appearance: none; -webkit-appearance: none; background: transparent; }
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--success); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--success); border-radius: 99px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }

/* ===== Formulários ===== */
.form { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .88rem; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; min-width: 0;
}
input[type=checkbox], input[type=radio] { width: auto; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 12px; }
legend { font-weight: 700; padding: 0 6px; }
.hint { color: var(--muted); font-size: .82rem; margin: 0; font-weight: 400; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 14px; }
.filters label { font-size: .8rem; }
.filters input, .filters select { padding: 7px 10px; }
.filters .grow { flex: 1; min-width: 180px; }

/* ===== Tabelas ===== */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
th a { color: inherit; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
.card table th { background: transparent; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 2px; }
.pager-links { display: flex; align-items: center; gap: 10px; }

/* ===== Selos ===== */
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge-aberto { background: var(--primary-soft); color: var(--primary); }
.badge-ganho { background: var(--success-soft); color: var(--success); }
.badge-perdido { background: var(--danger-soft); color: var(--danger); }
.badge-atrasada { background: var(--danger-soft); color: var(--danger); }
.badge-hoje { background: var(--warning-soft); color: var(--warning); }
.badge-admin { background: var(--primary-soft); color: var(--primary); }

/* ===== Alertas ===== */
.alert { position: relative; padding: 12px 40px 12px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 1px solid transparent; }
.alert-sucesso { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.alert-erro { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--primary-soft); color: var(--primary); }
.alert-aviso { background: var(--warning-soft); color: var(--warning); }
.alert-close { position: absolute; top: 6px; right: 8px; background: none; border: 0; font-size: 1.3rem; color: inherit; cursor: pointer; line-height: 1; padding: 4px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ===== Abas ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-size: .75rem; background: var(--surface-2); padding: 1px 7px; border-radius: 99px; margin-left: 4px; }

/* ===== Kanban ===== */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { flex: 0 0 280px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kcol-head { padding: 12px 14px 8px; border-bottom: 1px solid var(--border); }
.kcol-head h2 { font-size: .95rem; margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.kcol-total { font-weight: 800; font-size: 1.05rem; margin-top: 2px; }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 80px; flex: 1; }
.kcol.drag-over { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard-title { font-weight: 700; display: block; color: var(--text); }
.kcard-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.kcard-value { font-weight: 700; color: var(--text); }
.kcard-move { margin-top: 8px; display: none; gap: 6px; }
.kcard-move select { padding: 4px 6px; font-size: .82rem; }
.kcard .avatar { width: 26px; height: 26px; font-size: .7rem; }
.overdue { color: var(--danger); font-weight: 600; }

/* ===== Linha do tempo ===== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.t-note::before { border-color: var(--primary); background: var(--primary); }
.timeline li.t-status::before { border-color: var(--success); }
.timeline .t-meta { font-size: .8rem; color: var(--muted); }
.timeline .t-body { white-space: pre-wrap; word-wrap: break-word; }
.timeline li.t-note .t-body { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 10px; margin-top: 4px; }

.dl { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.dl dt { color: var(--muted); font-size: .88rem; }
.dl dd { margin: 0; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.done-title { text-decoration: line-through; color: var(--muted); }

/* ===== Login / instalador ===== */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.bare-box { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 30px; }
.login-head { text-align: center; margin-bottom: 18px; }
.login-head h1 { margin: 12px 0 4px; font-size: 1.35rem; }

/* ===== Responsivo ===== */
@media (max-width: 1000px) {
  .grid-side, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 35; }
  body.sidebar-collapsed .sidebar .nav span, body.sidebar-collapsed .sidebar .brand-name,
  body.sidebar-collapsed .sidebar .me-info, body.sidebar-collapsed .sidebar .nav-btn span { display: initial; }
  body.sidebar-collapsed .nav a, body.sidebar-collapsed .nav-btn { justify-content: flex-start; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .content { padding: 16px 12px; }
  .hide-sm { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { margin-top: 6px; }
  .kcol { flex-basis: 85vw; max-height: none; }
  .kcard-move { display: flex; }
  th, td { padding: 9px 10px; }
  .hide-mobile { display: none; }
}
@media (hover: none) { .kcard-move { display: flex; } }
@media print { .sidebar, .topbar, .filters, .actions { display: none !important; } }

/* Cartões clicáveis do painel */
a.stat { display: block; color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--primary); }
.card > .table-wrap { box-shadow: none; }
.card .filters { margin: 12px 0 0; }
.card-head .filters { margin: 0; }

/* Logo e subtítulo no menu */
.brand-logo { height: 34px; width: auto; flex: none; object-fit: contain; }
.brand-logo.lg { height: 60px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name { font-weight: 800; }
.brand-sub { color: #8fa3c7; font-weight: 500; font-size: .8rem; }
body.sidebar-collapsed .sidebar .brand-text { display: none; }
body.sidebar-collapsed .sidebar .brand { justify-content: center; padding: 18px 8px; }
body.sidebar-collapsed .sidebar .brand-logo { max-width: 48px; height: auto; }
@media (max-width: 760px) { body.sidebar-collapsed .sidebar .brand-text { display: flex; } }

/* Net2phone */
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; font-size: .85rem; white-space: pre-wrap; word-break: break-all; }
.mt { margin-top: 18px; }
.badge-n2p { background: #e8f1ff; color: #1557d6; }
@media (prefers-color-scheme: dark) { .badge-n2p { background: #1d2b4f; color: #8db3ff; } }
.quote-items { margin: 6px 0 0; padding-left: 18px; font-size: .85rem; color: var(--muted); }

/* Cartão: dados da cotação Net2phone */
.kcard-quote { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: .8rem; color: var(--muted); }
.kcard-quote strong { color: var(--text); }
.kcard-accepted { color: var(--success); font-weight: 600; }
.kcol.kcol-closed { background: var(--success-soft); }
.filters-inline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.kcard-status { margin-top: 6px; font-size: .78rem; padding: 4px 8px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* ===== Painel (visão geral) ===== */
.sec { display: flex; align-items: baseline; gap: 10px; font-size: 1.05rem; margin: 26px 0 12px; }
.sec a { font-size: .85rem; font-weight: 500; }
.sec .muted { font-size: .82rem; font-weight: 500; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.kpi h3 { font-size: .88rem; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.kpi .big { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.15; }
.kpi .sub { color: var(--muted); font-size: .82rem; }
.kpi .split { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 10px; }
.kpi .split + .split { margin-top: 8px; }
.kpi .split-label { color: var(--primary); font-size: .78rem; font-weight: 700; }
.kpi .mid { font-size: 1.3rem; font-weight: 800; }
.kpi a.more { font-size: .82rem; font-weight: 600; display: inline-block; margin-top: 6px; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.chart-card h3 { font-size: .92rem; margin: 0 0 10px; }
.chart-card.wide { grid-column: 1 / -1; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: var(--border); stroke-width: 1; }
svg.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
svg.chart .bar { fill: var(--primary); }
svg.chart a:hover .bar { fill: var(--primary-hover); }
svg.donut { max-width: 230px; margin: 6px auto 0; }
svg.donut .seg { fill: none; stroke-width: 30; }
.c1 { stroke: #3b82f6; background: #3b82f6; } .c2 { stroke: #e2602d; background: #e2602d; } .c3 { stroke: #16a36b; background: #16a36b; }
.c4 { stroke: #a855f7; background: #a855f7; } .c5 { stroke: #eab308; background: #eab308; } .c6 { stroke: #64748b; background: #64748b; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; font-size: .82rem; color: var(--muted); }
.legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.hbars { display: grid; gap: 6px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 1fr) 2fr 40px 120px; gap: 10px; align-items: center; color: var(--text); padding: 4px 6px; border-radius: 6px; font-size: .9rem; }
.hbar:hover { background: var(--surface-2); text-decoration: none; }
.hbar-track progress { width: 100%; height: 12px; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); appearance: none; -webkit-appearance: none; }
.hbar-track progress::-webkit-progress-bar { background: var(--surface-2); }
.hbar-track progress::-webkit-progress-value { background: var(--primary); border-radius: 99px; }
.hbar-track progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }
.hbar-num { text-align: right; font-weight: 700; }
.hbar-val { text-align: right; color: var(--muted); }
.hbar.won .hbar-track progress::-webkit-progress-value { background: var(--success); }
.hbar.won .hbar-track progress::-moz-progress-bar { background: var(--success); }
.scroll-table { max-height: 360px; overflow-y: auto; }
@media (max-width: 1000px) { .charts { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .hbar { grid-template-columns: 1fr 60px; } .hbar-track, .hbar-val { display: none; } }

/* Janela "Ver empresas" do painel */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 12, 24, .55); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(1000px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-h h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-body .table-wrap { box-shadow: none; }
.legend a { color: inherit; }
.legend a:hover { color: var(--primary); text-decoration: none; }
svg.chart a { cursor: pointer; }
svg.donut a:hover .seg { stroke-width: 34; }

/* Cotação Net2phone no negócio */
fieldset.n2p-quote { margin-top: 6px; }
fieldset.n2p-quote legend { font-weight: 700; }
fieldset.n2p-quote h3 { margin: 12px 0 4px; font-size: .92rem; color: var(--primary); }
.n2p-body { display: grid; gap: 10px; }
.n2p-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.n2p-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.n2p-item:last-child { border-bottom: 0; }
.n2p-item:hover { background: var(--surface-2); }
table.n2p-selected input { padding: 5px 7px; text-align: right; }
table.n2p-selected .n2p-qty { width: 80px; }
table.n2p-selected .n2p-price { width: 110px; }
.n2p-links { display: grid; gap: 8px; margin-top: 8px; }
.n2p-link input { flex: 1; min-width: 180px; font-size: .82rem; padding: 6px 8px; }
.n2p-link .actions { flex-wrap: nowrap; }

/* ---------- Marketing & Outbound ---------- */
.kpis-sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpis-sm .kpi { padding: 10px 14px; color: var(--text); }
.kpis-sm .kpi:hover { text-decoration: none; border-color: var(--primary); }
.kpis-sm .big { font-size: 1.35rem; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); position: sticky; top: 0; z-index: 5; }
.bulkbar select { padding: 4px 8px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; flex-direction: row; font-weight: 500; margin-right: 12px; }
label.inline input[type=number] { width: 90px; }
.checks { border: 0; padding: 0; margin: 0; }
.checks legend { font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
th.chk, td.chk { width: 34px; text-align: center; }
.badge-role { background: #f1ebff; color: #6b3fd4; }
.badge-lead-novo { background: var(--surface-2); color: var(--muted); }
.badge-lead-enriquecido { background: var(--primary-soft); color: var(--primary); }
.badge-lead-aprovado { background: var(--warning-soft); color: var(--warning); }
.badge-lead-convertido { background: var(--success-soft); color: var(--success); }
.badge-lead-descartado { background: var(--danger-soft); color: var(--danger); }
.badge-mail-valid, .badge-mail-verified { background: var(--success-soft); color: var(--success); }
.badge-mail-invalid, .badge-mail-generico, .badge-mail-descadastrado, .badge-mail-webmail { background: var(--danger-soft); color: var(--danger); }
.email-generico, .email-descadastrado, .email-invalid { text-decoration: line-through; color: var(--muted); }
.connectors { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin: 12px 0 18px; }
.connector { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.connector h3 { margin: 0; font-size: 1rem; }
.checklist { padding-left: 18px; display: grid; gap: 8px; }
.cnpj-preview { background: var(--surface-2); border-radius: var(--radius); padding: 10px 12px; font-size: .85rem; display: grid; gap: 4px; }
.hint.ok { color: var(--success); }
.hint.warn { color: var(--danger); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
