/* CRM de Campanhas — Perin Group
   Marca: navy #263A44 / tinta #131A1D / dourado #CE8F41 · Montserrat (títulos) + Inter (texto) */

:root {
  color-scheme: light;
  --navy: #263A44;
  --ink: #131A1D;
  --gold: #CE8F41;
  --gold-2: #E2AE6C;
  --gold-soft: rgba(206, 143, 65, .12);
  --gold-line: rgba(206, 143, 65, .35);

  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --surface-2: #F8FAFB;
  --surface-3: #EEF2F4;
  --border: #E2E7EB;
  --border-2: #D3DADF;
  --text: #15232A;
  --text-2: #4E5D66;
  --muted: #84939C;
  --shadow-sm: 0 1px 2px rgba(19, 26, 29, .06), 0 1px 1px rgba(19, 26, 29, .04);
  --shadow: 0 4px 16px rgba(19, 26, 29, .07), 0 1px 3px rgba(19, 26, 29, .05);
  --shadow-lg: 0 24px 60px rgba(19, 26, 29, .18), 0 6px 18px rgba(19, 26, 29, .08);
  --overlay: rgba(12, 19, 22, .45);

  /* séries (paleta validada — dataviz) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --meta: var(--s1); --google: var(--s2); --outra: var(--s3);
  /* status (fixos) */
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #0b7a0b; --critical-ink: #b42f2f; --warning-ink: #9a6a00;
  --good-bg: rgba(12, 163, 12, .1); --critical-bg: rgba(208, 59, 59, .1); --warning-bg: rgba(250, 178, 25, .14);

  --side: #131A1D;
  --side-2: #1A262C;
  --side-text: #C9D3D8;
  --side-muted: #7F8F97;

  --r-sm: 8px; --r: 12px; --r-lg: 16px; --r-xl: 22px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Montserrat", "Inter", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1417; --surface: #151E22; --surface-2: #19242A; --surface-3: #1F2C33;
    --border: #243239; --border-2: #2F3F47; --text: #ECF1F3; --text-2: #A7B4BB; --muted: #73838B;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 30px 70px rgba(0,0,0,.55);
    --overlay: rgba(0, 0, 0, .6); --gold-soft: rgba(206, 143, 65, .16);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --good-ink: #3fcf3f; --critical-ink: #f07575; --warning-ink: #f5c04a;
    --side: #0A0F11; --side-2: #121B1F;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1417; --surface: #151E22; --surface-2: #19242A; --surface-3: #1F2C33;
  --border: #243239; --border-2: #2F3F47; --text: #ECF1F3; --text-2: #A7B4BB; --muted: #73838B;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4); --shadow: 0 6px 20px rgba(0,0,0,.35); --shadow-lg: 0 30px 70px rgba(0,0,0,.55);
  --overlay: rgba(0, 0, 0, .6); --gold-soft: rgba(206, 143, 65, .16);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --good-ink: #3fcf3f; --critical-ink: #f07575; --warning-ink: #f5c04a;
  --side: #0A0F11; --side-2: #121B1F;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--gold-line); }
.hidden { display: none !important; }
.num { font-family: var(--font-head); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.t2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.sp { justify-content: space-between; }
.mt { margin-top: 18px; } .mt-s { margin-top: 10px; } .mb { margin-bottom: 18px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- ícones ---------- */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 15px; height: 15px; } .ic.lg { width: 22px; height: 22px; } .ic.xl { width: 34px; height: 34px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art {
  position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% 10%, #213640 0%, var(--ink) 55%), var(--ink);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-art::before, .login-art::after {
  content: ""; position: absolute; inset: auto; width: 560px; height: 140px; transform: skewX(-24deg);
  background: linear-gradient(90deg, rgba(206,143,65,.0), rgba(206,143,65,.22), rgba(206,143,65,0));
  right: -120px; top: 34%; filter: blur(.3px);
}
.login-art::after { top: 58%; right: -220px; width: 700px; opacity: .55; background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); }
.login-art img { width: 260px; position: relative; z-index: 1; }
.login-art h1 { font-size: 40px; line-height: 1.12; font-weight: 700; max-width: 520px; position: relative; z-index: 1; }
.login-art h1 em { font-style: normal; color: var(--gold); }
.login-art p { color: #A9B8BF; max-width: 460px; font-size: 15px; position: relative; z-index: 1; }
.login-chips { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.login-chips span { border: 1px solid rgba(255,255,255,.14); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; color: #D5DEE2; background: rgba(255,255,255,.04); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.login-box { width: 100%; max-width: 380px; }
.login-box h2 { font-size: 26px; margin-bottom: 6px; }
.login-box .muted { margin-bottom: 28px; }
.login-box .btn { width: 100%; justify-content: center; height: 46px; margin-top: 8px; }
.login-erro { color: var(--critical-ink); background: var(--critical-bg); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 14px; font-size: 13px; }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

/* ---------- casca ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.app.mini { grid-template-columns: 76px 1fr; }
.side {
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); color: var(--side-text);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30;
}
.side-logo { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 22px; }
.side-logo img { height: 22px; }
.side-logo .marca-mini { display: none; width: 34px; height: 34px; border-radius: 9px; background: var(--gold); color: var(--ink); font: 800 15px var(--font-head); align-items: center; justify-content: center; }
.side-sub { font: 600 10.5px var(--font-head); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); padding: 0 10px 14px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
  color: var(--side-text); font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.on { background: linear-gradient(90deg, rgba(206,143,65,.2), rgba(206,143,65,.05)); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav a.on .ic { color: var(--gold); }
.nav .badge { margin-left: auto; }
.nav-sec { font: 600 10.5px var(--font-head); letter-spacing: .14em; text-transform: uppercase; color: var(--side-muted); padding: 18px 12px 6px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; }
.side-user:hover { background: rgba(255,255,255,.05); }
.side-user .nm { color: #fff; font-weight: 600; font-size: 13px; }
.side-user .pf { color: var(--side-muted); font-size: 11.5px; text-transform: capitalize; }
.side-acts { display: flex; gap: 6px; }
.side-acts button { flex: 1; background: rgba(255,255,255,.05); border: 0; color: var(--side-text); border-radius: 9px; height: 34px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.side-acts button:hover { background: rgba(255,255,255,.1); color: #fff; }
.app.mini .side-logo img, .app.mini .side-sub, .app.mini .nav span, .app.mini .nav-sec, .app.mini .side-user .grow, .app.mini .nav .badge { display: none; }
.app.mini .side-logo .marca-mini { display: flex; }
.app.mini .nav a { justify-content: center; }
.app.mini .side-acts { flex-direction: column; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 12px 28px; display: flex; align-items: center; gap: 14px;
}
.top h1 { font-size: 19px; font-weight: 700; }
.top .crumb { font-size: 12px; color: var(--muted); }
.view { padding: 24px 28px 60px; flex: 1; min-width: 0; }
.burger { display: none; }

/* seletor de empresa */
.emp-sel { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 12px; overflow-x: auto; max-width: 52vw; }
.emp-sel button { border: 0; background: transparent; padding: 6px 11px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 7px; white-space: nowrap; font-weight: 500; font-size: 13px; color: var(--text-2); }
.emp-sel button:hover { background: var(--surface-3); color: var(--text); }
.emp-sel button.on { background: var(--navy); color: #fff; box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .emp-sel button.on { background: var(--gold); color: var(--ink); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }

/* ---------- componentes ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: transform .06s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--muted); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.pri:hover { background: #1d2f38; }
.btn.gold { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: #b97b31; color: #1b1206; }
.btn.gold:hover { filter: brightness(1.04); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); box-shadow: none; }
.btn.danger { color: var(--critical-ink); }
.btn.danger:hover { background: var(--critical-bg); border-color: var(--critical); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.ico { width: 38px; padding: 0; justify-content: center; }
.btn.sm.ico { width: 31px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
:root[data-theme="dark"] .btn.pri, :root:not([data-theme="light"]) .btn.pri { }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.pri { background: #2E4955; border-color: #3B5A68; } }
:root[data-theme="dark"] .btn.pri { background: #2E4955; border-color: #3B5A68; }

.inp, select.inp, textarea.inp {
  width: 100%; height: 38px; border: 1px solid var(--border-2); background: var(--surface); border-radius: 10px; padding: 0 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.inp { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.inp:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.inp.sm { height: 32px; font-size: 13px; border-radius: 8px; padding: 0 10px; }
select.inp { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2384939C' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.lbl small { font-weight: 400; color: var(--muted); }
.fld { margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 16px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.search { position: relative; }
.search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .inp { padding-left: 36px; }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.chk input { width: 16px; height: 16px; accent-color: var(--gold); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.card-h h3 { font-size: 14.5px; font-weight: 700; }
.card-h .sub { color: var(--muted); font-size: 12px; }
.card-b { padding: 12px 18px 18px; }
.card.pad { padding: 18px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.pill.good { background: var(--good-bg); color: var(--good-ink); }
.pill.bad { background: var(--critical-bg); color: var(--critical-ink); }
.pill.warn { background: var(--warning-bg); color: var(--warning-ink); }
.pill.gold { background: var(--gold-soft); color: #9c6420; }
:root[data-theme="dark"] .pill.gold { color: var(--gold-2); }
.pill.navy { background: var(--navy); color: #fff; }
.pill.sm { height: 20px; font-size: 11px; padding: 0 8px; }
.badge { min-width: 20px; height: 20px; border-radius: 99px; background: var(--critical); color: #fff; font: 700 11px/20px var(--font-head); text-align: center; padding: 0 6px; }
.badge.gold { background: var(--gold); color: var(--ink); }
.plat { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px 0 6px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.plat i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.plat.meta { background: color-mix(in srgb, var(--meta) 12%, transparent); color: var(--meta); }
.plat.meta i { background: var(--meta); }
.plat.google { background: color-mix(in srgb, var(--google) 12%, transparent); color: var(--google); }
.plat.google i { background: var(--google); }
.plat.outra, .plat.webhook, .plat.manual, .plat.ambas { background: var(--surface-3); color: var(--text-2); }
.plat.outra i, .plat.webhook i, .plat.manual i { background: var(--muted); }
.plat.ambas i { background: linear-gradient(90deg, var(--meta) 50%, var(--google) 50%); }

.av { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font: 700 11.5px var(--font-head); flex: none; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface); }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.vazio { background: var(--surface-3); color: var(--muted); border: 1px dashed var(--border-2); box-shadow: none; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg button .badge { height: 18px; min-width: 18px; line-height: 18px; font-size: 10.5px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }

/* filtros */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filtros .inp { width: auto; min-width: 140px; }
.filtros .search .inp { min-width: 220px; }
.filtro-ativo { border-color: var(--gold) !important; background-color: var(--gold-soft) !important; }

/* tabelas */
.tbl-wrap { overflow: auto; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th { text-align: left; font: 600 11.5px var(--font-head); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); white-space: nowrap; cursor: default; z-index: 1; }
.tbl th.ord { cursor: pointer; } .tbl th.ord:hover { color: var(--text); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl .r { text-align: right; } .tbl .c { text-align: center; }
.tbl tfoot td { font-weight: 700; border-top: 2px solid var(--border); background: var(--surface-2); }
.bar-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.bar-cell .b { height: 8px; border-radius: 4px; background: var(--s1); min-width: 2px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 18px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.kpi .k-lbl { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi .k-lbl .ic { color: var(--gold); width: 16px; height: 16px; }
.kpi .k-val { font: 700 25px/1.2 var(--font-head); margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi.hero { background: linear-gradient(135deg, #1B2B33 0%, var(--ink) 100%); color: #fff; border-color: transparent; }
.kpi.hero .k-lbl { color: #B8C6CC; } .kpi.hero .k-sub { color: #93A4AC; }
.kpi.hero::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(206,143,65,.35), transparent 70%); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; }
.delta.up { color: var(--good-ink); background: var(--good-bg); }
.delta.down { color: var(--critical-ink); background: var(--critical-bg); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.kpi.hero .delta.up { color: #7fe07f; background: rgba(12,163,12,.18); }
.kpi.hero .delta.down { color: #ff9a9a; background: rgba(208,59,59,.22); }

/* alertas */
.alertas { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.alerta { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); cursor: pointer; text-decoration: none; transition: border-color .15s, transform .1s; }
.alerta:hover { border-color: var(--gold); transform: translateY(-1px); }
.alerta .ai { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; }
.alerta .av-n { font: 700 20px var(--font-head); line-height: 1; }
.alerta .av-t { font-size: 12px; color: var(--text-2); }
.alerta.bad .ai { background: var(--critical-bg); color: var(--critical-ink); }
.alerta.warn .ai { background: var(--warning-bg); color: var(--warning-ink); }
.alerta.ok .ai { background: var(--good-bg); color: var(--good-ink); }
.alerta.info .ai { background: var(--gold-soft); color: var(--gold); }

/* grids de layout */
.g { display: grid; gap: 16px; }
.g-2 { grid-template-columns: 1fr 1fr; }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-21 { grid-template-columns: 2fr 1fr; }
.g-12 { grid-template-columns: 1fr 2fr; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; } .chart-box.lg { height: 320px; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* medidores */
.gauges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.gauge { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 14px 12px; text-align: center; box-shadow: var(--shadow-sm); }
.gauge svg { width: 100%; max-width: 170px; display: block; margin: 0 auto; }
.gauge .g-lbl { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.gauge .g-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; min-height: 17px; }
.gauge .g-status { margin-top: 8px; }

/* barra de progresso */
.prog { height: 7px; background: var(--surface-3); border-radius: 99px; overflow: hidden; position: relative; }
.prog > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--gold); }
.prog .marca { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; border-radius: 2px; }

/* ---------- kanban ---------- */
.kb-wrap { overflow-x: auto; padding-bottom: 12px; margin: 0 -28px; padding-left: 28px; padding-right: 28px; }
.kb { display: flex; gap: 14px; align-items: flex-start; min-height: calc(100vh - 230px); }
.kb-col { width: 296px; flex: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kb-col.ganho { background: color-mix(in srgb, var(--good) 5%, var(--surface-2)); }
.kb-col.perdido { background: color-mix(in srgb, var(--critical) 4%, var(--surface-2)); }
.kb-h { padding: 12px 14px 10px; border-bottom: 1px solid var(--border); position: relative; }
.kb-h::before { content: ""; position: absolute; left: 14px; right: 14px; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--c); }
.kb-h .t { font: 700 13.5px var(--font-head); display: flex; align-items: center; gap: 8px; }
.kb-h .n { background: var(--surface-3); color: var(--text-2); border-radius: 99px; font-size: 11.5px; padding: 1px 8px; font-weight: 700; }
.kb-h .v { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; justify-content: space-between; }
.kb-list { padding: 10px; overflow-y: auto; flex: 1; min-height: 80px; display: flex; flex-direction: column; gap: 9px; }
.kb-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 12px; cursor: grab; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s, transform .1s; position: relative;
}
.kb-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.kb-card.sel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft); }
.kb-card .nm { font-weight: 650; font-size: 13.5px; line-height: 1.3; padding-right: 18px; }
.kb-card .sb { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kb-card .meta-l { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; align-items: center; }
.kb-card .ft { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--border); font-size: 11.5px; color: var(--muted); }
.kb-card .vl { font: 700 12.5px var(--font-head); color: var(--text); }
.kb-card .emp-tag { position: absolute; top: 12px; right: 12px; width: 8px; height: 8px; border-radius: 50%; }
.kb-card .alert-i { color: var(--critical-ink); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kb-card .warn-i { color: var(--warning-ink); display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.kb-ghost { opacity: .35; border: 2px dashed var(--gold) !important; box-shadow: none !important; }
.kb-drag { transform: rotate(2deg); box-shadow: var(--shadow-lg) !important; cursor: grabbing; }
.kb-vazio { text-align: center; color: var(--muted); font-size: 12px; padding: 18px 6px; border: 1px dashed var(--border-2); border-radius: 10px; }
.kb-mais { text-align: center; font-size: 12px; }
.tag { display: inline-flex; height: 20px; align-items: center; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-2); }

/* ---------- campanhas ---------- */
.camp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.camp {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow .2s, transform .15s, border-color .2s; box-shadow: var(--shadow-sm);
}
.camp:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-2); }
.camp::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.camp .c-top { display: flex; align-items: flex-start; gap: 12px; }
.camp h3 { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.camp .c-emp { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.camp .c-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 14px; }
.camp .c-kpis div { background: var(--surface-2); border-radius: 10px; padding: 8px 9px; }
.camp .c-kpis b { display: block; font: 700 15px var(--font-head); font-variant-numeric: tabular-nums; }
.camp .c-kpis span { font-size: 11px; color: var(--muted); }
.camp .c-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.ring { position: relative; width: 52px; height: 52px; flex: none; }
.ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 13px var(--font-head); }

.det-head { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 20px; }
.det-head h2 { font-size: 24px; font-weight: 700; }
.det-head .det-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 13px; }
.mini-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.mini-kpis div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; }
.mini-kpis span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.mini-kpis b { font: 700 18px var(--font-head); font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; background: var(--surface-3); border-radius: 8px; padding: 9px 12px; word-break: break-all; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.code span { flex: 1; }

/* linha do tempo */
.tl { display: flex; flex-direction: column; }
.tl-i { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-i::before { content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--border); }
.tl-i:last-child::before { display: none; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: var(--surface-3); color: var(--text-2); z-index: 1; }
.tl-ic.ligacao { background: color-mix(in srgb, var(--s1) 14%, transparent); color: var(--s1); }
.tl-ic.whatsapp { background: color-mix(in srgb, var(--s3) 15%, transparent); color: var(--s3); }
.tl-ic.email { background: color-mix(in srgb, var(--s7) 14%, transparent); color: var(--s7); }
.tl-ic.reuniao { background: var(--gold-soft); color: var(--gold); }
.tl-ic.etapa { background: color-mix(in srgb, var(--s2) 14%, transparent); color: var(--s2); }
.tl-ic.criado, .tl-ic.reentrada { background: var(--good-bg); color: var(--good-ink); }
.tl-b { flex: 1; min-width: 0; }
.tl-b .tl-t { font-size: 13px; }
.tl-b .tl-t b { font-weight: 650; }
.tl-b .tl-d { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.tl-b .tl-x { margin-top: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }

/* ---------- drawer / modal ---------- */
.ovl { position: fixed; inset: 0; background: var(--overlay); z-index: 60; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.ovl.on { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--bg); z-index: 61; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .25s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.dr-h { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px 22px 0; }
.dr-b { overflow-y: auto; padding: 18px 22px 40px; flex: 1; }
.dr-h h2 { font-size: 20px; font-weight: 700; }
.stepper { display: flex; gap: 3px; margin: 16px 0 0; overflow-x: auto; padding-bottom: 14px; }
.stepper button { flex: 1; min-width: 80px; border: 0; height: 30px; font-size: 11.5px; font-weight: 600; color: var(--text-2); background: var(--surface-3); cursor: pointer; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%); padding: 0 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: filter .15s; }
.stepper button:first-child { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); border-radius: 7px 0 0 7px; }
.stepper button:hover { filter: brightness(.95); }
.stepper button.feito { background: color-mix(in srgb, var(--c) 30%, var(--surface-3)); color: var(--text); }
.stepper button.atual { background: var(--c); color: #fff; }
.contato-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.contato-acts a { text-decoration: none; }

.modal-w { position: fixed; inset: 0; z-index: 70; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 100%; max-width: 520px; transform: translateY(14px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
.modal.lg { max-width: 860px; } .modal.md { max-width: 660px; }
.modal-w.on .modal { transform: none; opacity: 1; }
.modal-h { padding: 20px 24px 6px; display: flex; align-items: center; gap: 10px; }
.modal-h h3 { font-size: 18px; font-weight: 700; }
.modal-b { padding: 14px 24px; }
.modal-f { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border); }
.sec-t { font: 700 11.5px var(--font-head); text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin: 10px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-t::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.dica { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.box-info { background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: var(--r); padding: 12px 14px; font-size: 13px; color: var(--text-2); }
.box-info b { color: var(--text); }

.menu { position: absolute; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500; }
.menu button:hover { background: var(--surface-3); }

.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; min-width: 260px; max-width: 420px; font-size: 13.5px; animation: tin .25s ease; border-left: 4px solid var(--gold); }
.toast.erro { border-left-color: var(--critical); }
.toast.ok { border-left-color: var(--good); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

.vazio { text-align: center; padding: 50px 20px; color: var(--muted); }
.vazio .ic { width: 42px; height: 42px; color: var(--border-2); margin-bottom: 10px; }
.vazio h4 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.carregando { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); gap: 12px; }
.spin { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* tarefas */
.tf-list { display: flex; flex-direction: column; }
.tf { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); transition: background .1s; }
.tf:last-child { border-bottom: 0; }
.tf:hover { background: var(--surface-2); }
.tf .ck { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border-2); display: flex; align-items: center; justify-content: center; cursor: pointer; flex: none; background: var(--surface); transition: all .15s; }
.tf .ck:hover { border-color: var(--good); }
.tf.feita .ck { background: var(--good); border-color: var(--good); color: #fff; }
.tf.feita .tf-t { text-decoration: line-through; color: var(--muted); }
.tf .tf-t { font-weight: 600; font-size: 13.5px; }
.tf .tf-s { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 2px; align-items: center; }
.tf .tf-s a { color: var(--text-2); text-decoration: none; border-bottom: 1px dotted; cursor: pointer; }
.prio { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.prio.urgente { background: var(--critical); } .prio.alta { background: var(--serious); } .prio.normal { background: var(--s1); } .prio.baixa { background: var(--border-2); }
.grupo-t { font: 700 12px var(--font-head); text-transform: uppercase; letter-spacing: .08em; padding: 14px 16px 8px; color: var(--text-2); display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-bottom: 1px solid var(--border); }

/* funil (relatório) */
.funil-v { display: flex; flex-direction: column; gap: 6px; }
.funil-r { display: grid; grid-template-columns: 170px 1fr 120px; align-items: center; gap: 12px; }
.funil-r .fb { height: 34px; border-radius: 4px; display: flex; align-items: center; padding: 0 10px; color: #fff; font: 700 12.5px var(--font-head); min-width: 34px; transition: width .4s; margin: 0 auto; }
.funil-r .fn { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.funil-r .fp { font-size: 12px; color: var(--muted); text-align: right; }

/* configurações */
.etapa-ed { display: grid; grid-template-columns: 22px 34px 1.6fr 1fr 90px 90px 36px; gap: 8px; align-items: center; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; }
.etapa-ed .hand { cursor: grab; color: var(--muted); display: flex; }
.etapa-ed input[type=color] { width: 32px; height: 32px; border: 0; border-radius: 8px; padding: 0; background: none; cursor: pointer; }
input[type=color] { inline-size: 38px; block-size: 38px; border: 1px solid var(--border-2); border-radius: 10px; padding: 3px; background: var(--surface); cursor: pointer; }
.integ { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 18px; }
.integ-logo { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; font: 800 17px var(--font-head); flex: none; }

/* impressão */
@media print {
  .side, .top, .filtros, .tabs, .btn, .no-print { display: none !important; }
  .app { display: block; } .view { padding: 0; } body { background: #fff; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
}

/* responsivo */
@media (max-width: 1200px) { .g-3 { grid-template-columns: 1fr 1fr; } .g-21, .g-12 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app, .app.mini { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-on .side { transform: none; box-shadow: var(--shadow-lg); }
  .burger { display: inline-flex; }
  .top { padding: 10px 16px; flex-wrap: wrap; }
  .emp-sel { max-width: 100%; order: 5; width: 100%; }
  .view { padding: 16px 16px 50px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .kb-wrap { margin: 0 -16px; padding: 0 16px 12px; }
  .camp-grid { grid-template-columns: 1fr; }
  .funil-r { grid-template-columns: 110px 1fr 70px; }
  .etapa-ed { grid-template-columns: 22px 34px 1fr 36px; }
  .etapa-ed .opt { display: none; }
}
.modal-w .ovl { z-index: 0; }
.modal { position: relative; z-index: 1; }

/* ajustes pós-teste visual */
.side { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; }
.app.mini .side { width: 76px; }
.main { grid-column: 2; }
.g > *, .grid2 > *, .grid3 > *, .grid4 > *, .kpis > *, .alertas > * { min-width: 0; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.alertas { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.card-b, .card { min-width: 0; }
@media (max-width: 860px) {
  .main { grid-column: 1; }
  .side { width: 260px; }
  .filtros > * { max-width: 100%; }
  .filtros .search .inp, .filtros .inp { min-width: 0; }
  .filtros .search { flex: 1 1 100%; }
  .seg { flex-wrap: wrap; }
  .det-head .row.wrap { width: 100%; }
  .kpi .k-val { font-size: 21px; }
  .gauges { grid-template-columns: repeat(2, 1fr); }
  .mini-kpis { grid-template-columns: repeat(2, 1fr); }
  .camp .c-kpis { grid-template-columns: repeat(2, 1fr); }
  .tbl-wrap, .card > table.tbl { display: block; overflow-x: auto; }
  .top h1 { font-size: 16px; }
  .top .btn.gold span { display: none; }
}
.camp .c-kpis span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp .c-kpis { grid-template-columns: 1.25fr .9fr 1.15fr .9fr; }
