/* =====================================================================
   Tema Pottschach One: menu azul-marinho, conteúdo claro, itens em destaque.
   Carregado por último: só sobrescreve aparência (cores, cantos, sombras).
   ===================================================================== */
:root {
  --bg: #f2f5fa; --panel: #ffffff; --ink: #000000; --muted: #1f2937; --line: #e1e7f0;
  --brand: #1f6feb; --brand-ink: #ffffff; --brand-soft: #e8f0fe; --brand-strong: #1856c4;
  --ok: #15803d; --ok-soft: #e6f6ec; --wait: #b45309; --wait-soft: #fff4dc;
  --danger: #dc2626; --danger-soft: #fdecec; --col: #ebf0f7;
  --navy: #0f2549; --navy-2: #0b1d3b; --navy-line: rgba(255, 255, 255, .1); --navy-ink: #e8eefb; --navy-muted: #9fb0cf;
  --radius-lg: 16px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 29, 54, .06), 0 2px 8px rgba(15, 29, 54, .05);
  --shadow-md: 0 2px 4px rgba(15, 29, 54, .06), 0 10px 24px rgba(15, 29, 54, .08);
}

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Menu lateral ---------- */
aside:not(.cp) { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); border-right: 0; color: var(--navy-ink); }
aside:not(.cp) .brand { display: flex; align-items: center; gap: 12px; padding: 22px 64px 14px 20px; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 17px;
  letter-spacing: .02em; color: #fff; background: rgba(255, 255, 255, .08); border: 1.5px solid rgba(255, 255, 255, .55); }
.brand-tx { min-width: 0; }
.brand strong { color: #fff; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--navy-muted); }
aside:not(.cp) .bell { top: 26px; right: 16px; background: rgba(255, 255, 255, .08); border-color: var(--navy-line); color: #fff; display: grid; place-items: center; }
aside:not(.cp) .bell:hover { background: rgba(255, 255, 255, .16); }
.nav-search input { background: rgba(255, 255, 255, .08); border-color: var(--navy-line); color: #fff; border-radius: 12px; padding: 10px 12px; }
.nav-search input::placeholder { color: var(--navy-muted); }
nav.menu { padding: 10px 12px; gap: 4px; }
nav.menu button { color: var(--navy-ink); padding: 11px 14px; border-radius: 12px; font-weight: 500; gap: 12px; }
nav.menu button .ic { width: 20px; height: 20px; opacity: .9; }
nav.menu button:hover { background: rgba(255, 255, 255, .08); color: #fff; }
nav.menu button[aria-current=true] { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(31, 111, 235, .35); font-weight: 600; }
.nav-badge { background: var(--danger) !important; color: #fff !important; }
.aside-foot { border-top: 1px solid var(--navy-line); color: var(--navy-muted); }
.aside-foot .muted { color: var(--navy-muted) !important; }
.aside-foot button { color: var(--navy-ink); display: inline-flex; align-items: center; gap: 8px; }
.aside-foot button:hover { color: #fff; }

/* ---------- Conteúdo ---------- */
main { max-width: 1240px; }
.page-head h2 { font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.card { border-color: var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.btn { border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow-sm); display: inline-flex; align-items: center; gap: 8px; justify-content: center; font-weight: 600; color: var(--ink); }
.btn:hover { border-color: #c5d0e0; background: #fbfcfe; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(31, 111, 235, .28); }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn .ic { width: 17px; height: 17px; }
input, select, textarea { border-radius: 12px; }
select { box-shadow: var(--shadow-sm); }

/* ---------- Barra do funil ---------- */
.crm-bar { gap: 12px; }
.crm-search { flex: 1 1 340px; position: relative; }
.crm-search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.crm-search input { padding: 11px 14px 11px 42px !important; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-sm); }
.crm-chips { background: none; border: 0; padding: 0; gap: 8px; }
.crm-chips > button, .more-btn { border: 1px solid var(--line) !important; background: var(--panel) !important; color: var(--ink) !important; padding: 9px 16px !important;
  border-radius: 12px !important; font-weight: 500; box-shadow: var(--shadow-sm); }
.crm-chips > button:hover, .more-btn:hover { border-color: #c5d0e0 !important; }
.crm-chips > button[aria-pressed=true], .more-btn[aria-pressed=true] { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; box-shadow: 0 4px 12px rgba(31, 111, 235, .28); }
.crm-bar select { padding: 10px 14px; border-radius: 12px; min-width: 170px; }
.more-wrap { position: relative; }
.more-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 230px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-md); padding: 6px; display: grid; }
.more-menu small { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.more-menu button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.more-menu button:hover { background: var(--bg); }
.more-menu button.on { background: var(--brand-soft); color: var(--brand-strong); font-weight: 600; }

/* Botão "Filtros" e seu painel */
.filters-wrap { position: relative; }
.filters-btn.on { border-color: var(--brand); color: var(--brand-strong); background: var(--brand-soft); }
.filters-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.filters-panel { position: absolute; top: calc(100% + 6px); right: 0; left: auto; z-index: 40; width: min(340px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-md); padding: 14px; display: grid; gap: 10px; }
.filters-panel .field { margin: 0; display: grid; gap: 4px; }
.filters-panel .field > span { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filters-panel select { width: 100%; min-width: 0; }
.crm-bar > .row { margin-left: auto; }

/* ---------- Colunas e cards ---------- */
.crm-board { gap: 16px; grid-auto-columns: minmax(290px, 1fr); }
.col { background: var(--col); border-radius: 18px; }
.col header { border-top-width: 5px; border-radius: 18px 18px 0 0; padding: 16px 16px 10px; }
.col header b { font-size: 17px; font-weight: 700; color: var(--ink); }
.col header .col-count { background: var(--panel); border-radius: 99px; padding: 1px 10px; font-weight: 700; font-size: 14px; color: var(--muted); box-shadow: var(--shadow-sm); }
.col-list { padding: 4px 10px 12px; gap: 10px; }
.lead-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px 12px; box-shadow: var(--shadow-sm); gap: 8px; transition: box-shadow .15s, transform .15s; }
.lead-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lead-card .av { width: 44px; height: 44px; font-size: 15px; }
.lead-id b { font-size: 15px; font-weight: 700; color: var(--ink); }
.lead-id span { font-size: 13px; }
.lead-msg { font-size: 14px; color: #34425a; }
.pin { color: var(--danger); }
.lead-foot { gap: 6px; }
.origin { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); }
.owner { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-strong); }
.owner .ic { width: 15px; height: 15px; }
.flag { font-size: 13px; padding: 4px 12px; border-radius: 10px; font-weight: 600; }
.flag.sale { background: var(--ok-soft); color: var(--ok); }
.tag { font-size: 13px; padding: 3px 10px; border-radius: 10px; }
.life { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 12px; border-radius: 10px; font-weight: 600; }
.life::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.life.optout::before { display: none; }
.life.alert { background: var(--danger-soft); color: var(--danger); }
.life.warn { background: var(--wait-soft); color: var(--wait); }
.life.wait { background: var(--brand-soft); color: var(--brand-strong); }

/* ---------- Telas internas ---------- */
.nav-search { padding: 0 20px 12px; }
.cp-head { border-bottom-color: var(--line); }
table.data th { color: var(--muted); font-weight: 600; }
.kpi { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }

/* Card: espaço da foto maior */
.lead-top { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.back-btn .ic { width: 18px; height: 18px; }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  aside:not(.cp), main { min-width: 0; max-width: 100vw; }        /* a fileira do menu não pode alargar a página */
  nav.menu { max-width: 100vw; overflow-x: auto; scrollbar-width: none; }
  aside:not(.cp) .bell { top: 16px; right: 14px; }
  .aside-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; font-size: 13px; }
  .aside-foot .muted { margin: 0 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  aside:not(.cp) { background: var(--navy); }
  aside:not(.cp) .brand { padding: 14px 60px 10px 16px; }
  .brand-logo { width: 38px; height: 38px; font-size: 14px; border-radius: 10px; }
  nav.menu { padding: 6px 10px 10px; }
  nav.menu button { padding: 9px 12px; white-space: nowrap; }
  .crm-search { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { .lead-card { transition: none; } .lead-card:hover { transform: none; } }
.crm-bar .filters-btn { margin-left: 0; }

/* Barra do funil numa linha só */
.crm-bar { flex-wrap: wrap; align-items: center; }
.crm-search { flex: 1 1 220px; min-width: 200px; }
.crm-bar > .row { margin-left: 0; }
@media (min-width: 1100px) { .crm-bar { flex-wrap: nowrap; } .crm-chips { flex-wrap: nowrap; } .crm-chips > button { white-space: nowrap; } }
.filters-btn, [data-el=newChat] { white-space: nowrap; }
.quick-f, .manage-list { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-f button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.quick-f button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.manage-list { display: grid; gap: 2px; }
.manage-list button { display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: none; padding: 8px 6px; border-radius: 10px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink); }
.manage-list button:hover { background: var(--bg); }
.manage-f { border-top: 1px solid var(--line); padding-top: 10px; }
/* Busca do menu: não deixar o navegador pintar de branco ao preencher sozinho */
.nav-search input:-webkit-autofill { -webkit-text-fill-color: #fff; -webkit-box-shadow: 0 0 0 40px var(--navy) inset; caret-color: #fff; }

/* Telas de notebook: a linha encolhe em vez de quebrar */
@media (max-width: 1500px) {
  .crm-chips .long, [data-el=newChat] .tx { display: none; }
  [data-el=newChat] { padding: 8px 12px; }
  .crm-chips > button, .filters-btn { padding: 8px 12px !important; }
  .crm-search { flex-basis: 160px; min-width: 150px; }
  .crm-bar, .crm-chips { gap: 8px; }
}

/* Textos sempre escuros nas áreas claras (pedido: preto, o mais escuro possível) */
main, .cp, .tm, .bell-panel, .search-pop, .filters-panel { color: var(--ink); }
.lead-msg { color: #111827; }
main .muted, .cp .muted, .tm .muted, main .hint, .cp .hint, .tm .hint, main small, .cp small, .tm small,
.bell-panel small, .search-pop small, .lead-id span, .cp label, .tm label, main label { color: #1f2937; }
input::placeholder, textarea::placeholder { color: #4b5563; opacity: 1; }
select:disabled, input:disabled, textarea:disabled { color: #1f2937; -webkit-text-fill-color: #1f2937; opacity: 1; }

.life.closed { background: #eef1f5; color: #1f2937; }
.life.closed::before { display: none; }

/* Responder mensagem (citação) */
.bub { position: relative; }
.reply-btn { position: absolute; top: 4px; right: -34px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel);
  color: #111827; font-size: 15px; cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .12s; box-shadow: var(--shadow-sm); }
.bub.me .reply-btn { right: auto; left: -34px; }
.bub:hover .reply-btn, .reply-btn:focus-visible { opacity: 1; }
@media (hover: none) { .reply-btn { opacity: .85; } }
.quote { display: grid; gap: 2px; width: 100%; text-align: left; border: 0; border-left: 4px solid #0ea5e9; background: rgba(0, 0, 0, .05); border-radius: 8px;
  padding: 6px 10px; margin: 2px 0 6px; font: inherit; color: #000; cursor: pointer; }
.quote.mine { border-left-color: var(--ok); }
.quote b { font-size: 13px; color: #0369a1; }
.quote.mine b { color: var(--ok); }
.quote span { font-size: 13px; color: #1f2937; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.reply-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 16px 0; background: var(--panel); border-top: 1px solid var(--line); }
.reply-bar .quote { margin: 0; cursor: default; }
.reply-bar .x { width: 32px; height: 32px; border: 0; background: none; font-size: 22px; cursor: pointer; color: #111827; border-radius: 8px; }
.reply-bar .x:hover { background: var(--bg); }
.bub.flash { animation: bubflash 1.6s ease; }
@keyframes bubflash { 0%, 60% { box-shadow: 0 0 0 3px #fde68a; } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .bub.flash { animation: none; outline: 3px solid #fde68a; } }
