/* ═══════════════════════════════════════════════════════
   COREPV — Design System v2
   Tema claro premium: fundo off-white, sidebar grafite,
   ícones SVG em traço, cartões limpos com sombra suave.
   ═══════════════════════════════════════════════════════ */

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

:root {
  --sidebar-bg:      #0e1320;
  --sidebar-bg2:     #131a2b;
  --sidebar-w:       232px;
  --accent:          #00b489;
  --accent-strong:   #009f79;
  --accent-soft:     rgba(0, 180, 137, 0.10);
  --accent2:         #4f46e5;
  --accent2-soft:    rgba(79, 70, 229, 0.10);
  --danger:          #dc2626;
  --warning:         #d97706;
  --bg:              #f6f7f9;
  --card:            #ffffff;
  --border:          #e6e9ef;
  --border-strong:   #d8dde6;
  --text:            #101828;
  --muted:           #667085;
  --radius:          12px;
  --radius-sm:       8px;
  --shadow:          0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-hover:    0 4px 12px rgba(16, 24, 40, 0.08), 0 2px 4px rgba(16, 24, 40, 0.04);
  --ring:            0 0 0 3px rgba(0, 180, 137, 0.15);
}

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  display: flex;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); min-height: 100vh;
}

::selection { background: rgba(0, 180, 137, 0.2); }

/* ícones SVG inline (macro _icons.html) */
.ic { vertical-align: -3px; flex-shrink: 0; }
.btn .ic, .tab .ic { vertical-align: -2px; }

/* ─── SIDEBAR ─────────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-w); min-height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  display: flex; flex-direction: column; position: fixed; left: 0; top: 0;
  z-index: 100; padding: 0;
}

.sidebar-logo { padding: 20px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-logo h1 { color: #fff; font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.sidebar-logo small { color: rgba(255,255,255,0.4); font-size: 11px; }

/* marca tipográfica — substitui o PNG antigo (fundo chapado fora do padrão) */
.brand, .brand:hover, .brand:visited { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(135deg, #00d69e 0%, #009f79 100%);
  display: flex; align-items: center; justify-content: center; color: #04231a;
  box-shadow: 0 0 0 1px rgba(0, 214, 158, 0.25), 0 4px 14px rgba(0, 180, 137, 0.35);
}
.brand-mark .ic { vertical-align: 0; }
.brand-text { display: block; color: #fff; font-size: 16px; font-weight: 700;
  letter-spacing: .10em; line-height: 1.15; text-transform: uppercase; }
.brand-tag { display: block; color: rgba(255,255,255,0.38); font-size: 9px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .18em; margin-top: 2px; }
.sb-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #555; margin-right: 4px; }
.sb-dot.ok { background: var(--accent); box-shadow: 0 0 6px rgba(0,180,137,0.8); }

.sidebar-tenant { padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.sidebar-tenant label { color: rgba(255,255,255,0.45); font-size: 10px; text-transform: uppercase;
  letter-spacing: .9px; display: block; margin-bottom: 6px; font-weight: 600; }
.sidebar-tenant select {
  width: 100%; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: #fff; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13px; cursor: pointer;
  transition: border-color .15s;
}
.sidebar-tenant select:hover { border-color: rgba(255,255,255,0.25); }
.sidebar-tenant select option { background: var(--sidebar-bg); }

.sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px;
  color: rgba(255,255,255,0.60); text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all .15s; border-radius: var(--radius-sm); margin-bottom: 2px;
}
.sidebar-nav a .ic { opacity: .75; transition: opacity .15s; }
.sidebar-nav a:hover { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-nav a:hover .ic { opacity: 1; }
.sidebar-nav a.active {
  color: #fff; background: linear-gradient(90deg, rgba(0,180,137,0.18), rgba(0,180,137,0.06));
  box-shadow: inset 2px 0 0 var(--accent);
}
.sidebar-nav a.active .ic { opacity: 1; color: var(--accent); }

.sidebar-bottom { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-bottom a { color: rgba(255,255,255,0.45); font-size: 12px; text-decoration: none;
  display: flex; align-items: center; gap: 7px; transition: color .15s; }
.sidebar-bottom-btn { appearance: none; -webkit-appearance: none; background: none;
  border: none; padding: 0; margin: 0; cursor: pointer; display: flex; align-items: center; gap: 7px;
  width: 100%; color: rgba(255,255,255,0.45); font-size: 12px; font-family: inherit; text-align: left; }
.sidebar-bottom a:hover, .sidebar-bottom-btn:hover { color: rgba(255,255,255,0.85); }

/* ─── MAIN CONTENT ────────────────────────────────────── */

.main { margin-left: var(--sidebar-w); flex: 1; padding: 28px 36px 48px; min-height: 100vh;
  max-width: calc(100vw); }

.page-header { margin-bottom: 24px; }
.page-header h2 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 10px; }
.page-header h2 .ic { color: var(--accent); }
.page-header p { color: var(--muted); margin-top: 4px; font-size: 13px; max-width: 860px; }
.page-header a { color: var(--accent-strong); text-decoration: none; font-weight: 500; }
.page-header a:hover { text-decoration: underline; }

/* ─── CARDS ────────────────────────────────────────────── */

.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 20px;
}

.card-grid { display: grid; gap: 16px; }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card .stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; }
.stat-card .stat-label { color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 500; }
.stat-card .stat-icon { margin-bottom: 10px; display: inline-flex; align-items: center;
  justify-content: center; width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent-strong); }

/* ─── PIPELINE KANBAN ─────────────────────────────────── */

.pipeline-board { display: grid; gap: 12px;
  grid-template-columns: repeat(6, minmax(180px, 1fr)); overflow-x: auto; padding-bottom: 8px; }

.kanban-col {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); min-height: 300px; padding: 14px;
  box-shadow: var(--shadow);
}

.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--border);
}
.kanban-col-header .col-title { font-weight: 700; font-size: 13px; }
.kanban-col-header .col-count {
  background: var(--bg); color: var(--muted); font-size: 11px;
  padding: 2px 8px; border-radius: 20px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.col-descoberto .kanban-col-header { border-bottom-color: #94a3b8; }
.col-engajado   .kanban-col-header { border-bottom-color: #6366f1; }
.col-conversa   .kanban-col-header { border-bottom-color: var(--accent); }
.col-proposta   .kanban-col-header { border-bottom-color: #f59e0b; }
.col-fechado    .kanban-col-header { border-bottom-color: #16a34a; }
.col-perdido    .kanban-col-header { border-bottom-color: #ef4444; }

.lead-card {
  background: #fafbfc; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px; cursor: grab; transition: all .15s;
  text-decoration: none; color: inherit; display: block; user-select: none;
}
.lead-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px);
  border-color: var(--border-strong); background: #fff; }
.lead-card:active { cursor: grabbing; }
.lead-card .lc-name { font-weight: 600; font-size: 12px; margin-bottom: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.lead-card .lc-sub { font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.lead-card .lc-channels { margin-top: 6px; font-size: 13px; display: flex; gap: 4px; }

/* ─── TIMELINE ────────────────────────────────────────── */

.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 20px; }
.tl-dot { position: absolute; left: -24px; top: 4px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--accent); }
.tl-dot.canal-maps     { background: #6366f1; box-shadow: 0 0 0 2px #6366f1; }
.tl-dot.canal-linkedin { background: #0a66c2; box-shadow: 0 0 0 2px #0a66c2; }
.tl-dot.canal-whatsapp { background: #25d366; box-shadow: 0 0 0 2px #25d366; }
.tl-date { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.tl-text { font-size: 13px; }
.tl-badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 20px;
  background: #ecfdf5; color: #047857; font-weight: 600; margin-left: 6px; }

/* ─── TOGGLES ─────────────────────────────────────────── */

.toggle-row { display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-row .tl { font-size: 13px; font-weight: 500; }
.toggle-row .ts { font-size: 12px; color: var(--muted); }

.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: #d8dde6;
  border-radius: 24px; transition: .2s; }
.slider::before { content: ""; position: absolute; height: 18px; width: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
input:checked + .slider { background: var(--accent); }
input:checked + .slider::before { transform: translateX(18px); }

/* ─── MODOS (radio buttons visuais) ──────────────────── */

.mode-selector { display: flex; gap: 8px; margin-bottom: 20px; }
.mode-btn { flex: 1; padding: 12px 10px; border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--muted); transition: all .15s; background: var(--card); }
.mode-btn:hover { border-color: var(--accent); color: var(--text); }
.mode-btn.active { border-color: var(--accent); color: var(--accent-strong);
  background: var(--accent-soft); }
.mode-btn .mb-icon { display: block; margin-bottom: 6px; color: inherit; }

/* ─── SEÇÕES / PANELS ─────────────────────────────────── */

.panel { background: var(--card); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--shadow); }
.panel-header { padding: 14px 20px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 13px; display: flex; align-items: center;
  justify-content: space-between; background: #fcfcfd; }
.panel-header .ic { color: var(--accent-strong); margin-right: 2px; }
.panel-body { padding: 20px; }

.section-tag { font-size: 10px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: block; }

/* ─── BOTÕES ──────────────────────────────────────────── */

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; text-decoration: none; transition: all .15s; font-family: inherit; }
.btn-primary { background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(0, 159, 121, 0.35); }
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0, 159, 121, 0.30); }
.btn-secondary { background: var(--card); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg); border-color: var(--muted); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-running { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
  animation: pulse 2s infinite; cursor: default; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }

/* ─── CAMPOS / INPUTS ─────────────────────────────────── */

input[type="text"], input[type="number"], input[type="password"], input[type="file"],
textarea, select {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: 13px; font-family: inherit;
  background: var(--card); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent);
  box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 80px; }
label { font-size: 12px; font-weight: 600; color: var(--text);
  display: block; margin-bottom: 5px; }
.form-row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.form-group { margin-bottom: 14px; }
.form-group small { line-height: 1.45; display: block; margin-top: 4px; }

/* ─── TABELAS ─────────────────────────────────────────── */

.table, .sessions-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td,
.sessions-table th, .sessions-table td { padding: 10px 12px; text-align: left;
  border-bottom: 1px solid var(--border); }
.table th, .sessions-table th { font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.table tbody tr, .sessions-table tbody tr { transition: background .1s; }
.table tbody tr:hover, .sessions-table tbody tr:hover { background: #fafbfc; }
.table tr:last-child td, .sessions-table tr:last-child td { border-bottom: none; }
.table td { font-variant-numeric: tabular-nums; }
.table a { color: var(--accent-strong); text-decoration: none; font-weight: 500; }
.table a:hover { text-decoration: underline; }

/* ─── SIMULADOR WHATSAPP ──────────────────────────────── */

.wa-chat {
  background: #ece5dd; border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; height: 500px;
  border: 1px solid var(--border);
}
.wa-header {
  background: #128c7e; color: #fff; padding: 12px 16px;
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.wa-header .wa-avatar { width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.2); display: flex; align-items: center;
  justify-content: center; font-size: 15px; font-weight: 700; }
.wa-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex;
  flex-direction: column; gap: 8px; }
.wa-msg { max-width: 75%; padding: 8px 12px; border-radius: 10px; font-size: 13px;
  line-height: 1.5; position: relative; }
.wa-msg-in { background: #fff; align-self: flex-start; border-top-left-radius: 2px; }
.wa-msg-out { background: #dcf8c6; align-self: flex-end; border-top-right-radius: 2px; }
.wa-msg-time { font-size: 10px; color: rgba(0,0,0,0.4); margin-top: 3px; text-align: right; }
.wa-input { display: flex; gap: 8px; padding: 12px; background: #f0f0f0;
  border-top: 1px solid var(--border); }
.wa-input input { flex: 1; border-radius: 24px; padding: 9px 16px; }
.wa-input button { background: #128c7e; color: #fff; border: none; border-radius: 50%;
  width: 40px; height: 40px; cursor: pointer; font-size: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; }

/* ─── RELATÓRIOS ─────────────────────────────────────── */

.stats-row { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stats-row .stat-card { flex: 1; min-width: 120px; text-align: center; padding: 16px; }
.stat-card .stat-delta { font-size: 12px; font-weight: 700; }
.stat-card .stat-delta.up { color: #16a34a; }
.stat-card .stat-delta.down { color: var(--danger); }

/* ─── TAGS / BADGES ───────────────────────────────────── */

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px;
  border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-descoberto { background: #f1f5f9; color: #64748b; }
.badge-engajado   { background: #eef2ff; color: #4f46e5; }
.badge-conversa   { background: #ecfdf5; color: #059669; }
.badge-proposta   { background: #fef3c7; color: #b45309; }
.badge-fechado    { background: #dcfce7; color: #166534; }
.badge-perdido    { background: #fee2e2; color: #991b1b; }
.badge-maps       { background: #ede9fe; color: #6d28d9; }
.badge-instagram  { background: #fce7f3; color: #be185d; }
.badge-linkedin   { background: #dbeafe; color: #1d4ed8; }
.badge-whatsapp   { background: #dcfce7; color: #15803d; }

/* ─── CANAL ICON ──────────────────────────────────────── */
.ci { font-size: 14px; }

/* ─── TABS ────────────────────────────────────────────── */

.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 4px; }
.tab { padding: 9px 16px; font-size: 13px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  text-decoration: none; transition: all .15s; display: inline-flex; align-items: center; gap: 7px;
  background: none; border-top: none; border-left: none; border-right: none; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-strong); border-bottom-color: var(--accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── AQUECEDOR ───────────────────────────────────────── */

.chip-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  font-weight: 600; }
.chip-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip-status.on  { color: #047857; }
.chip-status.on .dot { background: var(--accent); box-shadow: 0 0 5px rgba(0,180,137,.6); }
.chip-status.off { color: var(--muted); }
.chip-status.off .dot { background: #cbd5e1; }

/* ─── UTILS ────────────────────────────────────────────── */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }

/* Botões que são <a> herdariam a cor de link de regras como .page-header a
   e .table a (mesma especificidade) — estas regras ficam no FIM do arquivo
   de propósito, pra vencer o empate e manter todo botão legível. */
a.btn, a.btn:hover, a.btn:visited { text-decoration: none; }
a.btn-primary, a.btn-primary:visited, a.btn-primary:hover { color: #fff; }
a.btn-danger, a.btn-danger:visited, a.btn-danger:hover { color: #fff; }
a.btn-secondary, a.btn-secondary:visited { color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d9e2; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b9c2cf; }
::-webkit-scrollbar-track { background: transparent; }
