/* CRM Silva — tema DARK total, sóbrio. Cor só na flag do cliente (verde/amarelo/vermelho). */
:root {
  --bg: #0a0b0e;
  --bg-1: #101116;
  --bg-2: #14161d;      /* cards */
  --bg-3: #1c1f28;      /* inputs, hover */
  --border: #23262f;
  --border-soft: #1b1e26;
  --text: #eef1f6;
  --text-dim: #8b93a7;
  --accent: #e6e8ee;          /* branco suave — cor secundária neutra */
  --accent-2: #b9bdc9;
  --accent-soft: rgba(255,255,255,.07);
  --val: #e6e8ee;             /* valores de dinheiro/dado */
  --blue: #8b93a7;            /* neutralizado (só a flag tem cor) */
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow: 0 4px 16px rgba(0,0,0,.28);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
#app { display: flex; min-height: 100vh; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2d38; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Sidebar ---------- */
.sidebar { width: 250px; background: var(--bg-1); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
/* Recolher / abrir o menu (mais espaço pro dashboard) */
.side-toggle { position: absolute; top: 14px; right: 12px; width: 26px; height: 26px; border-radius: 8px; background: var(--bg-3); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.side-toggle:hover { color: var(--text); border-color: var(--text-dim); }
.side-open { position: fixed; top: 14px; left: 14px; z-index: 60; width: 38px; height: 38px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); color: var(--text); cursor: pointer; font-size: 17px; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow); }
.side-open:hover { border-color: var(--text-dim); }
body.sidebar-collapsed .sidebar { display: none; }
body.sidebar-collapsed .side-open { display: flex; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; padding: 0 6px; }
.logo { width: 40px; height: 40px; border-radius: 11px; background: var(--accent); border: 1px solid transparent; display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--bg); font-size: 15px; }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--text-dim); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { text-align: left; background: none; border: none; color: var(--text-dim); padding: 11px 13px; border-radius: 12px; cursor: pointer; font-size: 14px; font-family: inherit; transition: .15s; }
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--bg-3); color: var(--text); font-weight: 700; }
.side-select { margin-top: 18px; }
.side-select label { display: block; color: var(--text-dim); font-size: 10px; font-weight: 700; letter-spacing: .7px; margin: 0 4px 7px; text-transform: uppercase; }
.side-select select { width: 100%; background: var(--bg-3); border: 1px solid var(--border); color: var(--text); padding: 11px 12px; border-radius: 11px; font-size: 13px; font-family: inherit; cursor: pointer; }
.side-select select:focus { outline: none; border-color: var(--accent); }
.side-spacer { flex: 1; }
.sidebar-footer { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 14px; margin-top: 10px; }
.btn-ghost { background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 8px; border-radius: 10px; cursor: pointer; font-size: 12px; font-family: inherit; }
.btn-ghost:hover { color: var(--text); border-color: var(--text-dim); }

/* ---------- Main ---------- */
.main { flex: 1; padding: 16px 20px; overflow-x: hidden; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; gap: 14px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.page-sub { color: var(--text-dim); font-size: 12px; margin-top: 3px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); font-weight: 700; padding: 9px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; font-family: inherit; }
.btn:hover { border-color: var(--text-dim); filter: brightness(1.06); }
.btn-sec { background: var(--bg-3); color: var(--text); border: 1px solid var(--border); padding: 10px 15px; border-radius: 12px; cursor: pointer; font-size: 13px; font-family: inherit; }
.btn-sec:hover { border-color: var(--text-dim); }
.btn.small, .btn-sec.small { padding: 7px 12px; font-size: 12px; border-radius: 10px; }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 9px; margin-bottom: 10px; }
.kpi { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 12px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; }
.kpi-accent::before, .kpi-green::before, .kpi-yellow::before, .kpi-red::before, .kpi-blue::before { background: var(--border); }
.kpi-label { color: var(--text-dim); font-size: 10px; margin-bottom: 3px; }
.kpi-value { font-size: 18px; font-weight: 800; display: flex; align-items: baseline; gap: 6px; letter-spacing: -.5px; }
.kpi-sub { color: var(--text-dim); font-size: 10px; margin-top: 3px; }

/* ---------- Generic card ---------- */
.card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.card.pad { padding: 9px 11px; }
.card.block { margin-bottom: 4px; }
.mini-title { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.muted { color: var(--text-dim); }
.skel { color: var(--text-dim); opacity: .5; font-size: 12px; }
.note { color: var(--text-dim); font-size: 12px; line-height: 1.6; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-3); }
td.acts { text-align: right; width: 44px; }
.row-total td { background: var(--bg-3); }
.row-total { font-weight: 700; }
.abast-soon { color: var(--yellow); font-weight: 700; }
.abast-hoje { color: var(--red); font-weight: 800; }
.icon-btn { cursor: pointer; opacity: .5; padding: 3px; border-radius: 6px; font-size: 11px; }
.icon-btn:hover { opacity: 1; background: var(--bg-3); }
/* lápis bem pequeno dentro dos cards (Comparativo/Mensal/Semanal) */
.cc-mv .icon-btn, .cc-lbl .icon-btn { font-size: 6px; padding: 0; opacity: .35; vertical-align: middle; }

/* ---------- Badges / dots ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-green { background: rgba(52,211,153,.15); color: var(--green); }
.badge-yellow { background: rgba(251,191,36,.15); color: var(--yellow); }
.badge-red { background: rgba(248,113,113,.15); color: var(--red); }
.badge-blue { background: rgba(255,255,255,.06); color: var(--text-dim); }
.badge-gray { background: rgba(139,147,167,.15); color: var(--text-dim); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot-green { background: var(--green); } .dot-yellow { background: var(--yellow); } .dot-red { background: var(--red); }

/* ---------- Portfolio: client cards ---------- */
.client-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 8px; align-items: start; }
.comp-grid { grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 7px; }
.comp-grid .client-card { padding: 5px 7px; }
.comp-grid .cc-metrics > div { padding-left: 5px; padding-right: 5px; }
.comp-grid .cc-name { font-size: 11px; }
.comp-grid .cc-mv { font-size: 11px; }
/* Portfólio — barra de ferramentas (período segmentado · busca · sort · GC · atualizar) */
.pf-toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 10px; }
.pf-bar-spacer { flex: 1 1 12px; }
.seg-ctrl { display: inline-flex; background: var(--bg-3); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg-item { padding: 6px 14px; border: none; background: transparent; color: var(--text-dim); font-family: inherit; font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: .12s; }
.seg-item:hover { color: var(--text); }
.seg-item.active { background: var(--bg-1); color: var(--text); box-shadow: var(--shadow); }
.pf-search-wrap { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 11px; padding: 0 11px; }
.pf-search { background: transparent; border: none; color: var(--text); font-family: inherit; font-size: 13px; padding: 9px 0; min-width: 190px; }
.pf-search:focus { outline: none; }
.pf-search-wrap:focus-within { border-color: var(--accent); }
.icon-btn2 { background: var(--bg-3); border: 1px solid var(--border); color: var(--text); border-radius: 11px; padding: 8px 11px; cursor: pointer; font-size: 14px; line-height: 1; }
.icon-btn2:hover { border-color: var(--accent); }
/* Portfólio — cards com badges + métricas + botão 360 */
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 9px; }
.pf-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 10px; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: .15s; }
.pf-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.pf-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-name { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.pf-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pf-dot-lg { width: 13px; height: 13px; box-shadow: 0 0 0 3px rgba(255,255,255,.05); }
.cc-top .pf-dot { width: 11px; height: 11px; margin-top: 3px; }
/* Bloquinho do flag com o motivo (amarelo/vermelho) — pequeno, discreto */
.flag-chip { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 20px; line-height: 1.5; white-space: nowrap; flex-shrink: 0; }
.chip-yellow { background: rgba(251,191,36,.15); color: var(--yellow); border: 1px solid rgba(251,191,36,.35); }
.chip-red { background: rgba(248,113,113,.15); color: var(--red); border: 1px solid rgba(248,113,113,.4); }
.flag-chip-lg { font-size: 11px; padding: 3px 10px; }
.dot-verde { background: var(--green); } .dot-amarelo { background: var(--yellow); } .dot-vermelho { background: var(--red); }
.pf-badges { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 1px; }
.pf-badges .badge { font-size: 9px; padding: 2px 6px; }
.pf-metrics { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.pf-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pf-row span { color: var(--text-dim); font-size: 11px; }
.pf-row b { font-size: 12px; font-weight: 700; }
.client-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; cursor: pointer; transition: .15s; box-shadow: var(--shadow); }
.client-card:hover { border-color: var(--text-dim); }
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 3px; }
.cc-name { font-weight: 700; font-size: 12px; }
.cc-nicho { color: var(--text-dim); font-size: 9px; margin-top: 1px; }
.cc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 4px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cc-metrics > div { padding: 0 7px; }
.cc-metrics > div:first-child { padding-left: 0; }
.cc-metrics > div:last-child { padding-right: 0; }
.cc-metrics > div + div { border-left: 1px solid var(--border); }
.cc-ml { color: var(--text-dim); font-size: 8px; text-transform: uppercase; letter-spacing: .2px; margin-bottom: 1px; }
.cc-mv { font-size: 12px; font-weight: 700; }
/* Comparativo — cards planos, mesmo padrão do Portfólio */
.cc-cap { color: var(--text-dim); font-size: 8px; margin-top: 1px; }
/* Coluna única (Comparativo / Mensal / Semanal) */
.cc-list { display: flex; flex-direction: column; margin-top: 2px; }
.cc-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border); }
.cc-lbl { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.cc-val { font-size: 13px; font-weight: 700; text-align: right; }
.cc-mut { color: var(--text-dim); font-weight: 400; font-size: 11px; }
/* Análise IA */
.an-actions { display: flex; align-items: center; gap: 14px; margin: 14px 0 4px; flex-wrap: wrap; }
.an-meta { color: var(--text-dim); font-size: 12px; }
.analysis-wrap { margin-top: 14px; }
.note-err { border-color: var(--red); color: var(--red); }
.analysis-md { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 17px; line-height: 1.55; font-size: 14px; }
.analysis-md .an-h3 { font-size: 15px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .4px; margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.analysis-md .an-h3:first-child { margin-top: 0; }
.analysis-md .an-h4 { font-size: 14px; font-weight: 700; margin: 14px 0 4px; }
.analysis-md p { margin: 8px 0; }
.analysis-md ul, .analysis-md ol { margin: 8px 0 8px 20px; display: flex; flex-direction: column; gap: 6px; }
.analysis-md li { padding-left: 2px; }
.analysis-md strong { color: var(--text); font-weight: 700; }
.analysis-md code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; font-size: 12px; }
/* Alertas de performance */
.rem-badge.crit { background: var(--red); }
.alert-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.alert-row { display: flex; align-items: stretch; gap: 8px; border: 1px solid var(--border); border-left: 3px solid var(--yellow); border-radius: 10px; overflow: hidden; transition: .15s; }
.alert-row.crit { border-left-color: var(--red); }
.alert-body { flex: 1; padding: 10px 12px; cursor: pointer; }
.alert-body:hover { background: var(--bg-3); }
.alert-cli { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-txt { color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.alert-when { color: var(--text-dim); font-size: 11px; margin-top: 4px; opacity: .8; }
.alert-row.resolved { border-left-color: var(--border); opacity: .72; }
.alert-row.resolved .alert-body { cursor: pointer; }
.alert-x { border: none; background: transparent; color: var(--text-dim); cursor: pointer; padding: 0 14px; font-size: 15px; border-left: 1px solid var(--border); flex-shrink: 0; }
.alert-x:hover { background: var(--red); color: #fff; }
/* Briefing / estratégia do cliente */
.briefing-area { width: 100%; min-height: 220px; resize: vertical; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: var(--text); font-family: inherit; font-size: 14px; line-height: 1.6; }
.briefing-area:focus { outline: none; border-color: var(--accent); }
.briefing-view { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; white-space: pre-wrap; line-height: 1.6; font-size: 14px; min-height: 60px; }
/* Links de referência do briefing */
.brlinks { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.mini-sub { font-size: 12px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 12px; }
.brlinks-list { display: flex; flex-direction: column; gap: 8px; }
.brlink-row { display: flex; align-items: stretch; gap: 10px; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.brlink { flex: 1; padding: 12px 14px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 3px; }
.brlink:hover { background: var(--bg-3); }
.brlink b { font-size: 13px; }
.brlink-url { color: var(--accent-2); font-size: 11px; word-break: break-all; }
.brlink-x { border: none; border-left: 1px solid var(--border); background: transparent; color: var(--text-dim); cursor: pointer; padding: 0 16px; font-size: 13px; }
.brlink-x:hover { background: var(--red); color: #fff; }
.brlink-form { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 12px; margin-top: 16px; align-items: center; }
.brlink-form input { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 12px 14px; border-radius: 11px; font-size: 14px; font-family: inherit; }
.brlink-form input::placeholder { color: var(--text-dim); }
.brlink-form input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 640px) { .brlink-form { grid-template-columns: 1fr; } }
/* Verba por plataforma */
.budget-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.budget-box { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.budget-plat { font-weight: 800; margin-bottom: 8px; }
.budget-tax { color: var(--val); font-size: 12px; font-weight: 700; margin-top: 4px; min-height: 16px; }
.budget-view { color: var(--text-dim); font-size: 13px; }
.th-budget { font-weight: 600; color: var(--accent); font-size: 12px; text-transform: none; letter-spacing: 0; }
@media (max-width: 620px) { .budget-grid { grid-template-columns: 1fr; } }
/* Investimento por plataforma dentro do card */
.cc-inv { color: var(--val); font-weight: 800; font-size: 12px; margin-left: 8px; white-space: nowrap; }
.cc-inv-line { color: var(--val); font-weight: 800; font-size: 12px; margin-top: 1px; }
.cc-invrow { padding: 4px 0; border-top: 1px solid var(--border); }
.inv-split { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px 18px; margin-top: 3px; }
.inv-split div { display: flex; align-items: baseline; gap: 5px; }
.inv-split span { color: var(--text-dim); font-size: 10px; }
.inv-split b { font-size: 11px; font-weight: 700; }
/* Pares resultado | custo */
.cc-pairs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.cc-pairs > div { padding: 11px 14px; border-top: 1px solid var(--border); }
.cc-pairs > div:nth-child(-n+2) { border-top: none; }
.cc-pairs > div:nth-child(even) { border-left: 1px solid var(--border); }
.cc-pairs > div:first-child, .cc-pairs > div:nth-child(odd) { padding-left: 0; }
.cc-pairs > div:nth-child(even) { padding-right: 0; }
/* Tarefas resumidas na Visão Geral */
.mini-tasks { margin: 12px 0 4px; display: flex; flex-direction: column; }
.mini-task { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.mt-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; background: var(--text-dim); }
.mt-dot.prio-alta { background: var(--red); } .mt-dot.prio-media { background: var(--yellow); } .mt-dot.prio-baixa { background: var(--green); }
.mt-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-due { color: var(--text-dim); font-size: 11px; flex-shrink: 0; }
.mt-due.late { color: var(--red); font-weight: 700; }
.cc-metrics-sub { border-top: none; padding-top: 0; margin-top: 1px; }
.cc-metrics-sub .cc-mv { font-size: 11px; font-weight: 600; color: var(--text-dim); }
.delta { font-size: 11px; font-weight: 700; }
.delta.up { color: var(--text-dim); }
.delta.down { color: var(--text-dim); }
.cc-foot { display: flex; flex-direction: column; gap: 3px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.cc-owner { font-size: 12px; }
.cc-owner b { color: var(--text); font-weight: 700; }
.cc-gc { color: var(--text-dim); font-size: 12px; }
.cc-flagslot { flex-shrink: 0; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.kanban-col { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-height: 200px; transition: .15s; }
.kanban-col.drop { border-color: var(--accent); background: var(--accent-soft); }
.kanban-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 700; margin-bottom: 14px; padding: 0 4px; }
.col-count { background: var(--bg-3); border-radius: 20px; padding: 2px 9px; font-size: 11px; color: var(--text-dim); }
.kanban-body { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.kb-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px; cursor: pointer; transition: .15s; }
.kb-card:hover { border-color: var(--accent); }
.kb-card:active { cursor: grabbing; }
.kb-name { font-weight: 700; font-size: 14px; }
.kb-nicho { color: var(--text-dim); font-size: 11px; margin: 3px 0 10px; }
.kb-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.kb-l { color: var(--text-dim); }
.kb-foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-dim); font-size: 11px; margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.kb-resumo { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-dim); font-size: 11px; padding: 4px 9px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.kb-resumo:hover { color: var(--accent); border-color: var(--accent); }
.summary-wrap { display: flex; flex-direction: column; gap: 14px; }
.sum-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.sum-tasks { display: flex; flex-direction: column; gap: 6px; }
.sum-task { font-size: 13px; color: var(--text); }

/* ---------- Client header ---------- */
.client-header { background: linear-gradient(135deg, var(--bg-2), var(--bg-1)); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: var(--shadow); }
.ch-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.ch-name { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.ch-sub { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.ch-right { display: flex; align-items: center; gap: 14px; }
.ch-invest { font-size: 20px; font-weight: 800; }
.ch-invest small { font-size: 12px; color: var(--text-dim); font-weight: 400; margin-left: 4px; }
.ch-acts { display: flex; gap: 10px; margin-top: 16px; }

/* ---------- Period / sub-bar ---------- */
.sub-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sub-bar-label { color: var(--text-dim); font-size: 13px; }
.period-ctrl { display: inline-flex; align-items: center; gap: 8px; }
.month-select, .month-input { background: var(--bg-3); border: 1px solid var(--border); color: var(--text); padding: 9px 13px; border-radius: 11px; font-family: inherit; font-size: 13px; cursor: pointer; }
.month-select:focus, .month-input:focus { outline: none; border-color: var(--accent); }
.period-dash { color: var(--text-dim); }

/* ---------- Tabs ---------- */
.tab-bar { display: flex; gap: 6px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 11px; padding: 4px; margin-bottom: 14px; overflow-x: auto; }
.tab { background: none; border: none; color: var(--text-dim); padding: 10px 16px; cursor: pointer; font-size: 13px; font-family: inherit; white-space: nowrap; border-radius: 10px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.tab-body { display: flex; flex-direction: column; gap: 16px; }

/* ---------- Flag picker ---------- */
.flag-picker { display: inline-flex; gap: 5px; }
.flag-btn { background: var(--bg-3); border: 1px solid var(--border); border-radius: 9px; padding: 3px 6px; cursor: pointer; font-size: 14px; filter: grayscale(.7) opacity(.5); transition: .15s; }
.flag-btn:hover { filter: none; }
.flag-btn.active { filter: none; border-color: var(--accent); background: var(--bg); transform: scale(1.1); }

/* ---------- Visão geral ---------- */
.geral-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; }
.geral-side { display: flex; flex-direction: column; gap: 16px; }
.chart-wrap { height: 270px; position: relative; }
.big-num { font-size: 34px; font-weight: 800; margin: 8px 0; letter-spacing: -.5px; }
.big-num small { font-size: 12px; color: var(--text-dim); font-weight: 400; margin-left: 6px; }
.card.pad .btn-sec.small, .card.pad .btn.small { margin-top: 14px; }

/* ---------- Progress ---------- */
.progress { height: 9px; background: var(--bg); border-radius: 20px; overflow: hidden; margin-bottom: 8px; }
.progress-bar { height: 100%; background: var(--text-dim); border-radius: 20px; transition: width .3s; }
.progress-txt { color: var(--text-dim); font-size: 12px; }

/* ---------- Metric grid ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.metric-cell { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; }
.mc-label { color: var(--text-dim); font-size: 11px; margin-bottom: 6px; }
.mc-val { font-size: 19px; font-weight: 700; }

/* ---------- Tasks ---------- */
.task-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--bg-3); }
.task-check { width: 19px; height: 19px; border-radius: 6px; border: 2px solid var(--text-dim); cursor: pointer; flex-shrink: 0; }
.task-check.done { background: var(--green); border-color: var(--green); position: relative; }
.task-check.done::after { content: "✓"; color: #05210b; font-size: 12px; font-weight: 800; position: absolute; top: -3px; left: 2px; }
.task-title { flex: 1; }
.task-title.done { text-decoration: line-through; color: var(--text-dim); }
.task-meta { display: flex; gap: 8px; align-items: center; }
.inline-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { background: var(--bg-3); border: 1px solid var(--border); color: var(--text-dim); padding: 8px 14px; border-radius: 20px; cursor: pointer; font-size: 12px; font-family: inherit; }
.chip.active { background: var(--bg-3); color: var(--text); border-color: var(--text-dim); font-weight: 700; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 64px 20px; color: var(--text-dim); }
.empty-icon { font-size: 44px; margin-bottom: 14px; }

/* ---------- Modal ---------- */
#modal-root:empty { display: none; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.66); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 56px 20px; z-index: 100; overflow-y: auto; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 540px; padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal h3 { margin-bottom: 20px; font-size: 19px; }
.field { margin-bottom: 15px; }
.field label { display: block; color: var(--text-dim); font-size: 12px; margin-bottom: 7px; }
.field input, .field select, .field textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 11px 13px; border-radius: 11px; font-size: 14px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field textarea { min-height: 72px; resize: vertical; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.modal-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; align-items: center; }
.modal-actions .right { display: flex; gap: 10px; }
.link-del { color: var(--red); background: none; border: none; cursor: pointer; font-size: 13px; font-family: inherit; }
.report-wrap { display: flex; flex-direction: column; gap: 12px; }
.report-text { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 13px; border-radius: 12px; font-size: 13px; font-family: ui-monospace, monospace; line-height: 1.5; resize: vertical; }
.import-wrap { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; }
.import-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: center; background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.imp-name { font-size: 13px; font-weight: 600; }
.imp-google select { width: 100%; }
.gc-multi { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; }
.gc-opt { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.gc-opt input { width: 16px; height: 16px; }
.link-list { display: flex; flex-direction: column; gap: 6px; }
.attach-chip { display: inline-block; background: var(--bg); border: 1px solid var(--border); color: var(--accent-2); padding: 7px 11px; border-radius: 9px; font-size: 12px; text-decoration: none; word-break: break-all; }
.attach-chip:hover { border-color: var(--accent-2); }

/* ---------- Segmented toggle (Lista/Kanban) ---------- */
.seg { display: inline-flex; background: var(--bg-1); border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.seg-btn { background: none; border: none; color: var(--text-dim); padding: 7px 15px; border-radius: 9px; cursor: pointer; font-size: 13px; font-family: inherit; }
.seg-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.kb-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.kanban-tasks .kb-card { cursor: grab; }

/* ---------- Lembretes ---------- */
.reminders-btn { display: flex; align-items: center; gap: 8px; text-align: left; width: 100%; margin-top: 8px; background: none; border: 1px solid var(--border); color: var(--text-dim); padding: 10px 13px; border-radius: 12px; cursor: pointer; font-size: 14px; font-family: inherit; }
.reminders-btn:hover { color: var(--text); border-color: var(--text-dim); }
.reminders-btn.has { color: var(--text); border-color: var(--red); }
.rem-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 8px; }

/* ---------- Champions (criativos) ---------- */
.champ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.champ-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; display: flex; flex-direction: column; }
.champ-thumb { aspect-ratio: 1/1; background: var(--bg-3); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.champ-thumb img { width: 100%; height: 100%; object-fit: cover; }
.champ-noimg { color: var(--text-dim); font-size: 12px; }
.champ-body { padding: 12px 13px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.champ-name { font-size: 13px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.champ-score { color: var(--text-dim); font-size: 12px; }
.champ-link { display: block; text-align: center; padding: 9px; background: var(--bg-3); color: var(--accent); font-size: 12px; text-decoration: none; border-top: 1px solid var(--border); }
.champ-link:hover { background: var(--accent-soft); }

/* ---------- Login ---------- */
#login-root { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 50% -10%, #16181f, var(--bg)); padding: 20px; }
.login-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: 20px; padding: 34px 30px; width: 100%; max-width: 380px; box-shadow: 0 24px 70px rgba(0,0,0,.5); text-align: center; }
.login-logo { width: 54px; height: 54px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text); font-size: 20px; margin: 0 auto 16px; }
.login-box h2 { font-size: 22px; margin-bottom: 4px; }
.login-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-box .field { text-align: left; }
.login-msg { color: var(--red); font-size: 12px; min-height: 18px; margin-bottom: 10px; }

/* User chip */
#user-chip { display: flex; align-items: center; gap: 10px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 11px; padding: 9px 11px; margin-bottom: 8px; }
.uc-txt { min-width: 0; }
.uc-avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; background-size: cover; background-position: center; background-color: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: var(--accent); }
.uc-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uc-role { color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.login-logo { background-size: cover; background-position: center; }

.settings-wrap { display: flex; flex-direction: column; gap: 14px; }
.token-guide { margin: 10px 0; border: 1px solid var(--border); border-radius: 11px; background: var(--bg); overflow: hidden; }
.token-guide summary { cursor: pointer; padding: 11px 14px; font-size: 13px; color: var(--accent); list-style: none; }
.token-guide summary::-webkit-details-marker { display: none; }
.token-guide[open] summary { border-bottom: 1px solid var(--border); }
.token-guide-body { padding: 12px 16px; font-size: 13px; color: var(--text-dim); }
.token-guide-body .tg-h { color: var(--text); font-weight: 700; margin: 10px 0 4px; }
.token-guide-body .tg-h:first-child { margin-top: 0; }
.token-guide-body ol { margin: 0 0 6px 18px; display: flex; flex-direction: column; gap: 3px; }
.token-guide-body b { color: var(--text); }
.token-guide-body p { margin: 0 0 8px; }
.tg-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.tg-link { display: inline-block; background: var(--bg-3); border: 1px solid var(--border); color: var(--accent); padding: 8px 12px; border-radius: 9px; font-size: 12px; text-decoration: none; }
.tg-link:hover { border-color: var(--accent); }
.pass-row { display: flex; gap: 8px; }
.pass-row input { flex: 1; }
.pass-row .btn-sec { white-space: nowrap; }
.cred-box { display: flex; flex-direction: column; gap: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.cred-item .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.cred-v { font-size: 15px; font-weight: 700; font-family: ui-monospace, monospace; margin-top: 3px; word-break: break-all; }
.settings-wrap .card.pad .btn, .settings-wrap .card.pad .btn-sec { margin-top: 10px; margin-right: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) { .kanban { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .geral-grid { grid-template-columns: 1fr; } }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 60; flex-direction: column; padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--border); gap: 10px; }
  .brand { margin-bottom: 0; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; -webkit-overflow-scrolling: touch; }
  .nav-item { white-space: nowrap; padding: 9px 14px; }
  .side-select { margin-top: 0; display: flex; align-items: center; gap: 8px; }
  .side-select label { margin: 0; }
  .side-select select { flex: 1; }
  .side-spacer { display: none; }
  .sidebar-footer { flex-direction: row; align-items: center; margin-top: 0; padding-top: 0; border-top: none; flex-wrap: wrap; }
  #user-chip { flex: 1; margin-bottom: 0; min-width: 160px; }
  .btn-ghost { flex: 1; }

  .main { padding: 16px 12px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-title { font-size: 20px; }
  .head-actions { flex-wrap: wrap; }
  .head-actions .btn, .head-actions .btn-sec, .period-ctrl, .month-select { flex: 1; }

  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-value { font-size: 22px; }
  .client-cards { grid-template-columns: 1fr; }

  /* tabelas rolam horizontalmente dentro do card */
  .card { overflow-x: auto; }
  table { min-width: 560px; }

  .client-header { padding: 16px; }
  .ch-top { flex-direction: column; }
  .ch-right { align-items: flex-start; width: 100%; justify-content: space-between; }
  .ch-name { font-size: 21px; }
  .ch-acts { flex-wrap: wrap; }
  .ch-acts .btn-sec { flex: 1; }

  .modal-overlay { padding: 12px; }
  .modal { padding: 18px; }
  .field-row { flex-direction: column; gap: 0; }
  .import-row { grid-template-columns: 1fr; }

  .champ-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr; }
  .champ-grid { grid-template-columns: 1fr; }
}
