@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;450;500;600&display=swap');

:root {
  --bg: #f6f4fc;
  --surface: #ffffff;
  --surface-2: #f1ecfa;
  --surface-3: #e9e2f7;
  --border: rgba(31, 19, 56, 0.09);
  --border-strong: rgba(31, 19, 56, 0.16);
  --text: #1e1433;
  --text-muted: #6b6188;
  --text-light: #9b91b5;
  --primary: #7c3aed;
  --primary-2: #9d4edd;
  --primary-soft: #f0e7fe;
  --primary-ink: #4c1d95;
  --duck: #f5a623;
  --duck-soft: #fdf0d8;
  --speed: #6da81a;
  --speed-soft: #e8f3d6;
  --warm: #f97316;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --brand-grad: linear-gradient(150deg, #7c3aed 0%, #b026c9 52%, #f97316 120%);
  --sidebar-grad: linear-gradient(180deg, #3b1d7a 0%, #2a1559 60%, #20114a 100%);
  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(31,19,56,.05), 0 2px 8px rgba(31,19,56,.04);
  --shadow: 0 2px 6px rgba(31,19,56,.06), 0 12px 28px rgba(76,29,149,.07);
  --shadow-lg: 0 18px 50px rgba(76,29,149,.18);
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #130a26;
  --surface: #1e1340;
  --surface-2: #271a4d;
  --surface-3: #322160;
  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.16);
  --text: #f1ecfb;
  --text-muted: #b1a6cf;
  --text-light: #8579a8;
  --primary: #a06bf0;
  --primary-2: #b985f5;
  --primary-soft: #2e1d54;
  --primary-ink: #d9c6fb;
  --duck-soft: #3a2c14;
  --speed-soft: #25341a;
  --danger-soft: #3a1d22;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 2px 6px rgba(0,0,0,.3), 0 12px 28px rgba(0,0,0,.25);
  --shadow-lg: 0 18px 50px rgba(0,0,0,.45);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}
.hidden { display: none !important; }
::selection { background: var(--primary); color: #fff; }

h1,h2,h3,.display { font-family: var(--font-display); letter-spacing: -.01em; }

/* ============ LOGIN ============ */
#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(165deg, #170a3d 0%, #261254 32%, #3b1d7a 62%, #8a5a1a 105%);
  overflow: hidden;
}
#login-overlay::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 82% 92%, rgba(245,166,35,.55), transparent 65%),
    radial-gradient(ellipse 50% 40% at 18% 12%, rgba(160,107,240,.30), transparent 70%);
}
#login-overlay::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(15,5,40,.35) 100%);
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 24px; padding: 44px 40px 38px;
  width: 380px; max-width: 90vw; text-align: center;
  box-shadow: 0 30px 80px rgba(20,8,40,.4);
  animation: pop .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.login-duck { width: 112px; height: 112px; margin: 0 auto 16px; display: flex; align-items: center; justify-content: center; }
.login-duck img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 22px rgba(0,0,0,.4)); }
.login-card h1 { font-size: 26px; font-weight: 700; color: #fff; }
.login-card .tag { color: rgba(255,255,255,.82); font-size: 14px; margin: 4px 0 26px; }
.login-card input {
  width: 100%; height: 48px; padding: 0 16px; font-size: 15px; font-family: var(--font);
  border: 1px solid rgba(255,255,255,.28); border-radius: 12px; margin-bottom: 12px;
  background: rgba(255,255,255,.14); color: #fff; outline: none; transition: .15s;
}
.login-card input::placeholder { color: rgba(255,255,255,.6); }
.login-card input:focus { border-color: #fff; background: rgba(255,255,255,.22); box-shadow: 0 0 0 4px rgba(255,255,255,.12); }
.login-card button {
  width: 100%; height: 48px; border: none; border-radius: 12px; cursor: pointer;
  background: #fff; color: var(--primary-ink); font-size: 15px; font-weight: 600; font-family: var(--font);
  transition: transform .12s, box-shadow .12s;
}
.login-card button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,.2); }
.login-card button:active { transform: translateY(0); }
.login-erro { color: #ffe1e1; font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ============ SHELL ============ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0; background: var(--sidebar-grad);
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.side-duck { width: 46px; height: 46px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.side-duck img { width: 100%; height: 100%; object-fit: contain; }
.side-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: #fff; line-height: 1; }
.side-brand .sub { font-size: 11px; color: rgba(255,255,255,.6); letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 11px;
  color: rgba(255,255,255,.72); font-size: 14px; font-weight: 500; cursor: pointer;
  border: none; background: transparent; width: 100%; text-align: left; font-family: var(--font);
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.ativo { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.nav-item .ic { font-size: 17px; width: 20px; text-align: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.theme-toggle {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 13px;
  border-radius: 11px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.85);
  font-size: 13px; cursor: pointer; border: none; width: 100%; font-family: var(--font);
}
.theme-toggle .sw { width: 38px; height: 22px; border-radius: 20px; background: rgba(255,255,255,.22); position: relative; transition: background .2s; }
.theme-toggle .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .22s; }
[data-theme="dark"] .theme-toggle .sw { background: var(--duck); }
[data-theme="dark"] .theme-toggle .sw::after { transform: translateX(16px); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; }
.side-user .ava { width: 32px; height: 32px; border-radius: 50%; background: var(--duck); color: #5a3a00; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.side-user .who { font-size: 13px; color: #fff; font-weight: 500; line-height: 1.2; }
.side-user .role { font-size: 11px; color: rgba(255,255,255,.55); }
.side-logout { margin-left: auto; background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 16px; padding: 4px; }
.side-logout:hover { color: #fff; }

/* ============ MAIN ============ */
.main { flex: 1; min-width: 0; overflow-x: hidden; }
.main-inner { max-width: 1080px; margin: 0 auto; padding: 30px 30px 60px; }
.page-head { margin-bottom: 26px; }
.greeting { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.greeting .wave { display: inline-block; }
.page-head .date { color: var(--text-light); font-size: 13px; margin-top: 2px; }

/* ============ METRICAS ============ */
.metricas { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 26px; }
.metrica {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s;
}
.metrica:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.metrica::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.metrica.m1::after { background: var(--primary); }
.metrica.m2::after { background: var(--speed); }
.metrica.m3::after { background: var(--danger); }
.metrica.m4::after { background: var(--duck); }
.metrica .label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 9px; font-weight: 500; }
.metrica .valor { font-family: var(--font-display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }

/* ============ FILTROS + LISTA ============ */
.filtros { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  font-size: 13px; padding: 7px 15px; border-radius: 22px; cursor: pointer; user-select: none;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); transition: .12s; font-weight: 500;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.ativo { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 4px 12px rgba(124,58,237,.3); }
.chip[data-canal="frota"].ativo { background: var(--speed); border-color: var(--speed); box-shadow: 0 4px 12px rgba(109,168,26,.3); }
.chip[data-canal="reclamacao"].ativo { background: var(--danger); border-color: var(--danger); box-shadow: 0 4px 12px rgba(220,38,38,.3); }
.chip[data-canal="franquia"].ativo { background: #b026c9; border-color: #b026c9; box-shadow: 0 4px 12px rgba(176,38,201,.3); }

.lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.lista-head, .lead-row { display: grid; grid-template-columns: 2.4fr 1fr 1.1fr 2.6fr .7fr; gap: 12px; align-items: center; padding: 13px 18px; }
.lista-head { background: var(--surface-2); font-size: 12px; color: var(--text-muted); font-weight: 600; }
.lead-row { border-top: 1px solid var(--border); cursor: pointer; transition: background .1s; }
.lead-row:hover { background: var(--surface-2); }
.cliente { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.cliente .nome { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cliente .tel { font-size: 11px; color: var(--text-light); }
.badge { font-size: 11px; padding: 3px 11px; border-radius: 20px; display: inline-block; white-space: nowrap; font-weight: 600; }
.resumo { color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hora { text-align: right; color: var(--text-light); font-size: 12px; }
.vazio { padding: 48px; text-align: center; color: var(--text-light); font-size: 14px; }

.c-atendimento { background: var(--primary-soft); color: var(--primary-ink); }
.c-franquia { background: #f7e4fb; color: #8a1e9e; }
.c-frota { background: var(--speed-soft); color: #3c5e0a; }
.c-reclamacao { background: var(--danger-soft); color: #991b1b; }
[data-theme="dark"] .c-franquia { background: #3a1840; color: #eab8f5; }
[data-theme="dark"] .c-frota { color: #b9e078; }
[data-theme="dark"] .c-reclamacao { color: #f4a8a8; }
.f-novo { background: var(--surface-3); color: var(--text-muted); }
.f-em_contato { background: var(--duck-soft); color: #8a5a08; }
.f-negociando { background: var(--primary-soft); color: var(--primary-ink); }
.f-fechado { background: var(--speed-soft); color: #3c5e0a; }
.f-perdido { background: var(--danger-soft); color: #991b1b; }
[data-theme="dark"] .f-em_contato { color: #f0bf6a; }
[data-theme="dark"] .f-fechado { color: #b9e078; }
[data-theme="dark"] .f-perdido { color: #f4a8a8; }

/* ============ REATIVAÇÃO (follow-up de quem baixou o app) ============ */
.reativacao-head, .reativacao-row { display: grid; grid-template-columns: 2.2fr 1.1fr 1.3fr 1.3fr; gap: 12px; align-items: center; padding: 13px 18px; }
.reativacao-head { background: var(--surface-2); font-size: 12px; color: var(--text-muted); font-weight: 600; }
.reativacao-row { border-top: 1px solid var(--border); }
.r-aguardando { background: var(--surface-3); color: var(--text-muted); }
.r-d1 { background: var(--duck-soft); color: #8a5a08; }
.r-d3 { background: var(--primary-soft); color: var(--primary-ink); }
.r-d7 { background: var(--danger-soft); color: #991b1b; }
[data-theme="dark"] .r-d1 { color: #f0bf6a; }
[data-theme="dark"] .r-d7 { color: #f4a8a8; }

/* ============ CRM (planilha editável) ============ */
.crm-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.crm-toolbar .hint { font-size: 12.5px; color: var(--text-light); margin-left: auto; }
.crm-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow-sm); }
table.crm { border-collapse: collapse; width: 100%; min-width: 980px; font-size: 13px; }
table.crm th {
  position: sticky; top: 0; background: var(--surface-2); color: var(--text-muted); font-weight: 600;
  text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 12px;
}
table.crm td { padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
table.crm tr:hover td { background: var(--surface-2); }
.cell { padding: 10px 13px; min-height: 38px; cursor: text; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.cell.ro { cursor: default; color: var(--text-light); }
.cell.editavel:hover { box-shadow: inset 0 0 0 1.5px var(--primary); border-radius: 4px; }
.cell-input, .cell-select {
  width: 100%; border: none; outline: 2px solid var(--primary); background: var(--surface);
  padding: 9px 12px; font-size: 13px; font-family: var(--font); color: var(--text); border-radius: 4px;
}
.cell-check { display: flex; align-items: center; justify-content: center; padding: 10px; }
.cell-check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }

/* ============ DRAWER ============ */
#drawer-bg { position: fixed; inset: 0; background: rgba(20,8,40,.5); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; backdrop-filter: blur(2px); }
#drawer-bg.aberto { opacity: 1; pointer-events: auto; }
#drawer { position: fixed; top: 0; right: 0; height: 100%; width: 470px; max-width: 93vw; background: var(--bg); z-index: 70; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; }
#drawer.aberto { transform: none; }
.drawer-head { padding: 20px; background: var(--brand-grad); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-head .nome { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.drawer-head .tel { font-size: 12px; color: rgba(255,255,255,.82); }
.drawer-close { width: 34px; height: 34px; border: none; background: rgba(255,255,255,.18); border-radius: 9px; cursor: pointer; font-size: 16px; color: #fff; }
.drawer-close:hover { background: rgba(255,255,255,.3); }
.drawer-controls { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 11px; }
.ctrl-row { display: flex; align-items: center; gap: 10px; }
.ctrl-row label { font-size: 12px; color: var(--text-muted); width: 66px; flex-shrink: 0; font-weight: 500; }
.ctrl-row select, .ctrl-row input { flex: 1; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; font-family: var(--font); outline: none; background: var(--surface); color: var(--text); }
.ctrl-row select:focus, .ctrl-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.conversa { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 13px; line-height: 1.46; }
.msg .quando { display: block; font-size: 10px; opacity: .6; margin-top: 4px; }
.msg.user { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.assistant { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }

/* ============ COMPOSER (responder pelo portal) ============ */
.composer { padding: 12px 16px 14px; background: var(--surface); border-top: 1px solid var(--border); display: flex; gap: 9px; align-items: flex-end; position: relative; }
.composer-aviso { position: absolute; top: -34px; left: 16px; right: 16px; background: var(--duck-soft); color: #8a5a08; padding: 7px 12px; border-radius: 9px; font-size: 12px; font-weight: 500; border: 1px solid var(--duck); }
[data-theme="dark"] .composer-aviso { color: #f0bf6a; }
.composer textarea { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: 11px; padding: 10px 13px; font-family: var(--font); font-size: 14px; line-height: 1.4; background: var(--surface); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s; max-height: 100px; }
.composer textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.composer textarea:disabled { background: var(--surface-2); cursor: not-allowed; opacity: .6; }
.composer-btn { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--primary); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: .15s; }
.composer-btn:hover:not(:disabled) { background: var(--primary-2); transform: scale(1.05); }
.composer-btn:disabled { background: var(--border-strong); cursor: not-allowed; opacity: .5; }
.composer-btn.enviando .composer-ico { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 11px; font-size: 13px; font-weight: 500; z-index: 90; opacity: 0; transition: .22s; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* side-user como botão */
.side-user { background: transparent; border: none; cursor: pointer; width: 100%; transition: background .15s; }
.side-user:hover { background: rgba(255,255,255,.08); }
.side-caret { margin-left: auto; color: rgba(255,255,255,.55); font-size: 18px; }

/* ============ PIPELINE (Kommo) ============ */
.pipe-toolbar { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.pipe-title { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.pipe-hint { font-size: 12.5px; color: var(--text-light); }
.pipeline { display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; }
.pipeline::-webkit-scrollbar { height: 10px; }
.pipeline::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 10px; }
.pipeline::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
.pipeline::-webkit-scrollbar-thumb:hover { background: var(--primary); }
.pipe-col { flex: 0 0 242px; width: 242px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); scroll-snap-align: start; }
.pcol-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius) var(--radius) 0 0; border-top: 3px solid transparent; }
.pcol-head.f-novo { border-top-color: #8b8198; }
.pcol-head.f-em_contato { border-top-color: var(--duck); }
.pcol-head.f-negociando { border-top-color: var(--primary); }
.pcol-head.f-fechado { border-top-color: var(--speed); }
.pcol-head.f-perdido { border-top-color: var(--danger); }
.pcol-title { font-family: var(--font-display); font-weight: 600; font-size: 14px; }
.pcol-meta { font-size: 11.5px; color: var(--text-muted); font-weight: 500; background: var(--surface); padding: 3px 9px; border-radius: 20px; }
.pipe-cards { padding: 10px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 80px; flex: 1; transition: background .15s; border-radius: 0 0 var(--radius) var(--radius); }
.pipe-cards.drag-over { background: var(--primary-soft); outline: 2px dashed var(--primary); outline-offset: -6px; }
.pipe-empty { text-align: center; color: var(--text-light); font-size: 18px; padding: 18px 0; opacity: .4; }
.pipe-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 12px; cursor: grab; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s; }
.pipe-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.pipe-card:active { cursor: grabbing; }
.pipe-card.arrastando { opacity: .4; transform: rotate(1.5deg); }
.pc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pc-val { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: var(--speed); }
.pc-nome { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.pc-resumo { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 8px; }
.pc-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-light); }

/* ============ BARRA DE ATENDIMENTO (assumir) ============ */
.atend-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); transition: background .2s, border-color .2s; }
.atend-bar.pausado { background: var(--duck-soft); border-color: var(--duck); }
.atend-status { display: flex; align-items: center; gap: 11px; min-width: 0; }
.atend-ic { font-size: 22px; line-height: 1; }
.atend-titulo { font-weight: 600; font-size: 13.5px; }
.atend-sub { font-size: 11.5px; color: var(--text-muted); }
.atend-btn { flex-shrink: 0; height: 34px; padding: 0 14px; border: none; border-radius: 8px; background: var(--primary); color: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: var(--font); transition: .12s; }
.atend-btn:hover { background: var(--primary-2); }
.atend-bar.pausado .atend-btn { background: var(--speed); }
.atend-bar.pausado .atend-btn:hover { filter: brightness(1.08); }
.pipe-card.pausado { border-color: var(--duck); box-shadow: inset 3px 0 0 var(--duck), var(--shadow-sm); }

/* ============ MEMBROS (admin) ============ */
.membros-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.form-titulo { font-family: var(--font-display); font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 1.5fr 1.2fr 0.9fr auto; gap: 10px; }
.form-row input, .form-row select { height: 40px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 14px; font-family: var(--font); outline: none; background: var(--surface); color: var(--text); }
.form-row input:focus, .form-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.form-row .modal-btn { height: 40px; padding: 0 18px; }
.form-erro { color: var(--danger); font-size: 13px; min-height: 16px; margin-top: 8px; }
.form-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.membros-lista { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.membro-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.membro-row:last-child { border-bottom: none; }
.membro-row .ava { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.membro-nome { font-weight: 600; font-size: 14px; }
.membro-email { font-size: 12px; color: var(--text-muted); }
.membro-tag { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: var(--surface-3); color: var(--text-muted); margin-left: 6px; font-weight: 500; }
.membro-del { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); width: 36px; height: 36px; border-radius: 9px; cursor: pointer; transition: .12s; font-size: 14px; }
.membro-del:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

@media (max-width: 720px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ============ NOTIF BADGES (sidebar) ============ */
.nav-item { position: relative; }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px;
  background: var(--duck); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--sidebar-grad, #2a1559);
  animation: badge-in .25s ease;
}
@keyframes badge-in { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.nav-item.ativo .nav-badge { background: #fff; color: var(--primary-ink); }

/* ============ BUSCA + FILTROS + CSV ============ */
.busca-bar { display: flex; gap: 10px; margin-bottom: 14px; align-items: stretch; flex-wrap: wrap; }
.busca-wrap { position: relative; flex: 1 1 280px; min-width: 220px; }
.busca-wrap .busca-ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .55; pointer-events: none; }
#busca-input {
  width: 100%; height: 40px; padding: 0 38px 0 38px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 14px; font-family: var(--font); background: var(--surface); color: var(--text); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
#busca-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.busca-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 6px; border: none; background: var(--surface-2);
  color: var(--text-muted); cursor: pointer; font-size: 12px;
}
.busca-clear:hover { background: var(--surface-3); color: var(--text); }
.filtro-select {
  height: 40px; padding: 0 32px 0 14px; border: 1px solid var(--border-strong); border-radius: 10px;
  font-size: 13px; font-family: var(--font); background: var(--surface); color: var(--text); outline: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; -webkit-appearance: none; appearance: none;
}
.filtro-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.csv-btn {
  height: 40px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
  font-family: var(--font); cursor: pointer; transition: .12s;
}
.csv-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.lista-rodape { padding: 10px 18px; font-size: 12px; color: var(--text-light); border-top: 1px solid var(--border); background: var(--surface-2); text-align: right; }
.lista-rodape:empty { display: none; }

@media (max-width: 720px) {
  .busca-bar { gap: 8px; }
  .filtro-select, .csv-btn { flex: 1 1 auto; }
}

/* ============ CRM: barra de ações (período + export + arquivados) ============ */
.crm-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.crm-periodo { display: flex; align-items: center; gap: 8px; }
.crm-periodo-lbl { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.crm-actions-btns { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.arq-btn { display: inline-flex; align-items: center; gap: 6px; }
.arq-count { background: var(--duck); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ações no card do pipeline (aparecem no hover) */
.pipe-card { position: relative; }
.pc-acoes { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .14s; }
.pipe-card:hover .pc-acoes { opacity: 1; }
.pc-acao { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; padding: 0; transition: .12s; }
.pc-acao:hover { background: var(--surface-2); transform: scale(1.08); }
.pc-acao.excluir:hover { background: var(--danger-soft); border-color: var(--danger); }

/* ações no drawer */
.drawer-acoes { display: flex; gap: 9px; margin-top: 4px; }
.dr-acao { flex: 1; height: 36px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: .12s; }
.dr-acao.arquivar:hover { background: var(--duck-soft); border-color: var(--duck); color: #8a5a08; }
.dr-acao.excluir:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
[data-theme="dark"] .dr-acao.arquivar:hover { color: #f0bf6a; }

/* modal grande (pasta de arquivados) */
.modal.modal-grande { width: 620px; max-width: 94vw; }
.arq-intro { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.arq-lista { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.arq-row { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.arq-row .avatar { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.arq-nome { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arq-sub { font-size: 11.5px; color: var(--text-light); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.arq-acao { flex-shrink: 0; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-muted); font-size: 12px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: .12s; }
.arq-acao.restaurar:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.arq-acao.excluir { width: 36px; padding: 0; }
.arq-acao.excluir:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

@media (max-width: 720px) {
  .crm-actions-btns { margin-left: 0; width: 100%; }
  .arq-row { flex-wrap: wrap; }
}

/* ============ MODAL (perfil / senha) ============ */
.modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(20,8,40,.55); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-bg.aberto { opacity: 1; pointer-events: auto; }
.modal { width: 380px; max-width: 92vw; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; transform: scale(.96); transition: transform .2s; }
.modal-bg.aberto .modal { transform: scale(1); }
.modal-head { padding: 16px 20px; background: var(--brand-grad); color: #fff; display: flex; align-items: center; justify-content: space-between; font-family: var(--font-display); font-weight: 600; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 11px; }
.perfil-info { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.ava.grande { width: 50px; height: 50px; border-radius: 14px; font-size: 19px; background: var(--duck); color: #5a3a00; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.perfil-nome { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.perfil-email { font-size: 13px; color: var(--text-muted); }
.modal-sep { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin: 8px 0 2px; border-top: 1px solid var(--border); padding-top: 14px; }
.modal-body input { height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 14px; font-family: var(--font); outline: none; background: var(--surface); color: var(--text); }
.modal-body input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.modal-erro { color: var(--danger); font-size: 13px; min-height: 16px; }
.modal-btn { height: 44px; border: none; border-radius: 10px; background: var(--primary); color: #fff; font-size: 14px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: .12s; }
.modal-btn:hover { background: var(--primary-2); }
.modal-btn.ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }
.modal-btn.ghost:hover { background: var(--surface-2); color: var(--danger); }

@media (max-width: 860px) {
  .sidebar { position: fixed; bottom: 0; top: auto; left: 0; right: 0; width: 100%; height: auto; flex-direction: row; padding: 8px; z-index: 50; }
  .side-brand, .side-foot .side-user, .side-foot .theme-toggle span { display: none; }
  .nav { flex-direction: row; margin: 0; flex: 1; justify-content: space-around; }
  .side-foot { margin: 0; flex-direction: row; }
  .main-inner { padding: 20px 16px 90px; }
  .metricas { grid-template-columns: repeat(2,1fr); }
}
