/* =====================================================================
   LaçoHub — folha de estilo
   Sistema de temas: claro/escuro via [data-theme] no <html> (padrão: dark).
   --marca e --marca-forte podem ser sobrescritos por cliente (header.php).
   Paleta LibertySec: navy #151E36/#4C5E80, azuis #17539B/#2680C8/#4FB6E4,
   laranjas #9E2A15/#D04E1C/#EE7433, âmbar #F0AD27.
   ===================================================================== */

:root {
  /* ----- Marca (fixas nos dois temas) ----- */
  --navy: #151E36;
  --navy-2: #223152;
  --destaque: #F0AD27;
  --btn2-bg: #17539B;
  --vermelho: #DC3545;
  --azul: #0D6EFD;
  --branco: #FFFFFF;            /* branco real — texto sobre superfícies coloridas */

  /* ----- Métricas ----- */
  --raio: 14px;
  --raio-ctl: 10px;             /* botões, campos, itens de menu (eixo "cantos", ver temas.css) */
  --raio-md: 12px;              /* alertas, mini cartões */
  --sidebar: 270px;
  --fonte: Arial, Helvetica, sans-serif;
  --on-btn: #FFFFFF;            /* texto sobre botão primário (a cor da marca pode pedir texto escuro) */

  /* ----- Densidade (eixo "dens", ver temas.css) ----- */
  --pad-card: 18px;
  --pad-cell: 12px 10px;
  --pad-field: 11px 12px;
  --pad-content: 24px;
  --gap-grid: 18px;
}

/* Os seletores de tema valem em qualquer elemento (a prévia da tela de aparência usa um <div>). */
/* ===== Tema ESCURO = paleta LibertySec (padrão) ===== */
:root,
[data-theme="dark"] {
  --bg: #0F1720;
  --surface: #18222D;
  --surface-2: #1F2B37;
  --text: #E6EBF0;
  --text-muted: #9FB0BF;
  --border: #2D3B49;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --chip-bg: #263544;
  --input-bg: #1F2B37;
  --input-border: #3A4A5B;
  --table-head: #1B2631;
  --marca: #E97B5A;
  --marca-forte: #F09678;
  --marca-suave: rgba(233,123,90,.14);
  --marca-2: #4FB6E4;
  --marca-2-suave: rgba(79,182,228,.20);
  --ok: #4CC38A;
  --ok-suave: rgba(76,195,138,.20);
  --btn-bg: #C24A28;
  --btn-bg-hover: #A63A1C;
  --row-hover: rgba(233,123,90,.10);
  --link: var(--marca);
  --brand-strong: var(--marca-forte);   /* títulos/acentos legíveis no escuro */
  --hint-bg: rgba(233,123,90,.12);
}

/* ===== Tema CLARO ===== */
[data-theme="light"] {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --text: #1B2733;
  --text-muted: #5A6876;
  --border: #E3E6EA;
  --shadow: 0 10px 30px rgba(21,30,54,.10);
  --chip-bg: #E9ECEF;
  --input-bg: #FFFFFF;
  --input-border: #C5CCD3;
  --table-head: #F7F8FA;
  --marca: #C24A28;
  --marca-forte: #A63A1C;
  --marca-suave: #FBEFEA;
  --marca-2: #17539B;
  --marca-2-suave: rgba(23,83,155,.12);
  --ok: #1B7A4B;
  --ok-suave: rgba(27,122,75,.14);
  --btn-bg: #C24A28;
  --btn-bg-hover: #A63A1C;
  --row-hover: rgba(21,30,54,.04);
  --link: var(--marca-forte);
  --brand-strong: var(--marca-forte);
  --hint-bg: rgba(194,74,40,.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--fonte);
  background: var(--bg);
  color: var(--text);
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ----- Sidebar (gradiente navy nos dois temas) ----- */
.sidebar {
  width: var(--sidebar);
  background: linear-gradient(180deg, var(--navy), var(--navy-2));
  color: var(--branco);
  padding: 22px 18px;
  position: fixed;
  inset: 0 auto 0 0;
  overflow-y: auto;
  z-index: 60;
}

.sidebar .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.sidebar .brand-logo {
  width: auto; max-width: 150px; height: 46px; border-radius: var(--raio-md);
  object-fit: contain; background: var(--branco); padding: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.sidebar .brand h1 { margin: 0; font-size: 1.05rem; line-height: 1.2; }
.sidebar .brand small { display: block; opacity: .85; margin-top: 3px; }

.sidebar nav a { display: block; padding: 11px 12px; margin: 4px 0; border-radius: var(--raio-ctl); color: var(--branco); }
.sidebar nav a:hover,
.sidebar nav a.active { background: rgba(255,255,255,.14); text-decoration: none; }

.sidebar .sidebar-footer {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.15);
  font-size: .92rem; opacity: .95;
}

/* Botão de tema dentro da sidebar */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; width: 100%; justify-content: center;
  background: rgba(255,255,255,.12); color: var(--branco);
  border: 0; border-radius: var(--raio-ctl); padding: 10px 12px;
  cursor: pointer; font: inherit; font-weight: bold;
}
.theme-toggle:hover { background: rgba(255,255,255,.2); }

/* Ícone de tema no cabeçalho do menu (não ocupa linha da lista) */
.sidebar .brand { margin-top: 10px; }
.theme-mini {
  position: absolute; top: 7px; right: 8px;
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.12); color: var(--branco);
  font-size: .85rem; line-height: 1; cursor: pointer;
}
.theme-mini:hover, .theme-mini:focus-visible { background: rgba(255,255,255,.24); }

/* "Ver como" no rodapé do menu */
.viewas-form { margin-top: 6px; }
.sidebar .viewas-form label { display: block; font-size: .78rem; opacity: .8; margin: 0 0 3px; color: var(--branco); font-weight: normal; }
.sidebar .viewas-form select {
  width: 100%; padding: 6px 8px; border-radius: var(--raio-ctl);
  border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.1); color: var(--branco); font: inherit;
}
.viewas-form select option { color: #111; }

/* Faixa de aviso enquanto o "Ver como" está ativo (embaixo: os botões de ação das páginas ficam no topo) */
.viewas-banner ~ .content { padding-bottom: 76px; }
.viewas-banner {
  position: fixed; bottom: 16px; right: 16px; z-index: 70;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 7px 8px 7px 14px; border-radius: 999px;
  background: #b42318; color: #fff; font-size: .88rem;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}
.viewas-banner form { margin: 0; }
.viewas-banner button {
  border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer;
  background: #fff; color: #b42318; font: inherit; font-weight: bold;
}

/* ----- Barra de topo no mobile (hambúrguer + tema) ----- */
.appbar { display: none; }
.appbar-btn {
  background: rgba(255,255,255,.14); color: var(--branco);
  border: 0; border-radius: var(--raio-ctl); width: 42px; height: 42px;
  font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.appbar-title { flex: 1; font-weight: bold; }
.sidebar-backdrop { display: none; }

/* ----- Conteúdo ----- */
.content {
  margin-left: var(--sidebar);
  width: calc(100% - var(--sidebar));
  padding: var(--pad-content);
}

.topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  box-shadow: var(--shadow-on, var(--shadow));
  padding: 16px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.topbar h2, .topbar p { margin: 0; }
.topbar p { color: var(--text-muted); }

/* Versão publicada: texto pequeno e discreto (menu lateral e tela de login) */
.app-versao { font-size: .72rem; opacity: .6; margin-top: 8px; }
.app-versao-login { text-align: center; color: var(--text-muted); opacity: .8; margin: 14px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--raio);
  box-shadow: var(--shadow-on, var(--shadow));
  padding: var(--pad-card);
  margin-bottom: 18px;
}

/* Formulários não esticam em telas largas */
.form-card { max-width: 960px; }

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap-grid); }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.kpi { padding: 18px; border-radius: var(--raio); background: linear-gradient(135deg, var(--btn2-bg), var(--navy)); color: var(--branco); }
.kpi strong { display: block; font-size: 1.8rem; margin-top: 8px; }
.kpi span { font-size: .9rem; opacity: .9; }
.kpi.kpi-light { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.kpi.kpi-light span { color: var(--text-muted); }
.kpi.kpi-light strong { color: var(--brand-strong); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: var(--pad-cell); border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--table-head); font-size: .92rem; }

.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: .82rem; font-weight: bold; background: var(--chip-bg); color: var(--text); }
.badge.success { background: var(--ok-suave); color: var(--ok); }
.badge.warning { background: rgba(214,189,103,.24); color: #c79a17; }
.badge.danger { background: rgba(220,53,69,.18); color: #e2606c; }
.badge.primary { background: rgba(13,110,253,.18); color: #5b9bff; }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.field { grid-column: span 12; }
label { display: block; margin-bottom: 6px; font-weight: bold; font-size: .92rem; color: var(--text); }
input, select, textarea {
  width: 100%; padding: var(--pad-field);
  border: 1px solid var(--input-border); border-radius: var(--raio-ctl);
  font: inherit; background: var(--input-bg); color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { min-height: 110px; resize: vertical; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-block; border: 0; border-radius: var(--raio-ctl); padding: 11px 14px; cursor: pointer; font-weight: bold; text-align: center; }
.btn-primary { background: var(--btn-bg); color: var(--on-btn); }
.btn-primary:hover { background: var(--btn-bg-hover); }
.btn-secondary { background: var(--btn2-bg); color: var(--branco); }
.btn-light { background: var(--chip-bg); color: var(--text); }
.btn-danger { background: var(--vermelho); color: var(--branco); }
.btn-link { background: transparent; color: var(--link); padding: 0; }

.alert { padding: 14px 16px; border-radius: var(--raio-md); margin-bottom: 16px; border: 1px solid transparent; color: var(--text); }
.alert-info { background: rgba(13,110,253,.12); border-color: rgba(13,110,253,.30); }
.alert-success { background: var(--ok-suave); border-color: var(--ok); }
.alert-danger { background: rgba(220,53,69,.14); border-color: rgba(220,53,69,.30); }
.alert-warning { background: rgba(214,189,103,.18); border-color: rgba(214,189,103,.42); }

.footer { margin-top: 18px; color: var(--text-muted); font-size: .92rem; text-align: center; padding: 12px 0 4px; }

/* ===== Seções do menu lateral ===== */
.sidebar .nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; opacity: .6; margin: 16px 12px 4px; }

/* ===== Badges de estágio do funil ===== */
.badge.stage-lead { background: rgba(13,110,253,.18); color: #5b9bff; }
.badge.stage-contato { background: var(--marca-2-suave); color: var(--marca-2); }
.badge.stage-negociacao { background: rgba(214,189,103,.26); color: #c79a17; }
.badge.stage-cliente { background: var(--ok-suave); color: var(--ok); }
.badge.stage-perdido { background: rgba(220,53,69,.18); color: #e2606c; }

.badge.temp-quente { background: rgba(220,53,69,.18); color: #e2606c; }
.badge.temp-morno { background: rgba(214,189,103,.26); color: #c79a17; }
.badge.temp-frio { background: rgba(13,110,253,.18); color: #5b9bff; }

/* ===== Barra de filtros / abas ===== */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar a, .tabs a {
  padding: 8px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: .9rem;
}
.filterbar a.active, .tabs a.active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--on-btn); }
.filterbar a:hover, .tabs a:hover { text-decoration: none; }

/* ===== Timeline de followups ===== */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline:before { content: ""; position: absolute; left: 9px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding: 0 0 18px 34px; }
.timeline li:before { content: ""; position: absolute; left: 3px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--marca-2); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.timeline li.done:before { background: var(--ok); }
.timeline li.pending:before { background: var(--destaque); }
.timeline .tl-meta { font-size: .82rem; color: var(--text-muted); margin: 2px 0 4px; }
.timeline .tl-title { font-weight: bold; }

/* ===== Cartões de vendedor ===== */
.seller-card { display: block; color: inherit; }
.seller-card:hover { text-decoration: none; transform: translateY(-2px); transition: .15s; }
.seller-card .seller-name { font-size: 1.1rem; font-weight: bold; color: var(--brand-strong); }
.seller-card .seller-stats { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.seller-card .seller-stats div span { display: block; font-size: .78rem; color: var(--text-muted); }
.seller-card .seller-stats div strong { font-size: 1.2rem; }

/* ===== Tabela: linha clicável ===== */
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--row-hover); }

/* ===== Formulário: nome em caixa alta + combo de data ===== */
input.text-upper { text-transform: uppercase; }
.date-combo { position: relative; display: flex; gap: 6px; align-items: stretch; }
.date-combo input[type="text"] { flex: 1; }
.date-combo-btn {
  flex: 0 0 auto; width: auto; padding: 0 12px; cursor: pointer; font-size: 1.05rem;
  background: var(--chip-bg); color: var(--text);
  border: 1px solid var(--input-border); border-radius: var(--raio-ctl);
}
.date-combo-btn:hover { background: var(--surface-2); }
/* input date nativo fica invisível — só serve para abrir o calendário via showPicker() */
.date-combo-native { position: absolute; left: 12px; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }

/* ===== Telefone com seletor de país ===== */
.phone-field { display: flex; gap: 6px; align-items: stretch; }
.phone-field .phone-country { flex: 0 0 auto; width: 122px; min-width: 122px; padding-left: 8px; padding-right: 2px; }
.phone-field input { flex: 1 1 0%; width: 100%; min-width: 0; }
.phone-field .phone-ddi { flex: 0 0 auto; width: 92px; min-width: 92px; }
.phone-field [hidden] { display: none !important; }

/* ===== Ficha do contato: mini-painel de contadores + link WhatsApp ===== */
.mini-stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.mini-stats .ms {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--raio-md); padding: 10px 14px; min-width: 130px;
}
.mini-stats .ms span { display: block; font-size: .75rem; color: var(--text-muted); }
.mini-stats .ms strong { font-size: 1.15rem; color: var(--brand-strong); }
.datalist p { margin: 8px 0; }
/* <summary> usado como botão (edição inline de followup) — esconde o triângulo padrão */
summary.btn { cursor: pointer; }
summary.btn::-webkit-details-marker { display: none; }
summary.btn::marker { content: ""; }

/* ===== Mini editor de texto (rich text) ===== */
.rte { border: 1px solid var(--input-border); border-radius: var(--raio-ctl); overflow: hidden; background: var(--input-bg); }
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.rte-toolbar .btn { padding: 6px 10px; font-size: .9rem; }
.rte-color-btn { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.rte-color-btn input[type="color"] { width: 22px; height: 20px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.rte-emojis { display: inline-flex; gap: 2px; flex-wrap: wrap; }
.rte-emoji { background: transparent; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 1rem; line-height: 1; padding: 4px 6px; width: auto; }
.rte-emoji:hover { background: var(--chip-bg); }
.rte-editor { min-height: 130px; padding: 12px; color: var(--text); outline: none; }
.rte-editor:focus { box-shadow: inset 0 0 0 2px rgba(166,130,199,.35); }
.rte-editor h3 { margin: 8px 0 4px; color: var(--brand-strong); }
.rte-editor ul, .rte-editor ol { margin: 6px 0; padding-left: 22px; }
/* Descrição formatada exibida (somente leitura) */
.rte-content h3 { margin: 8px 0 4px; color: var(--brand-strong); font-size: 1rem; }
.rte-content ul, .rte-content ol { margin: 6px 0; padding-left: 22px; }
.rte-content p { margin: 6px 0; }
.wa-link { color: var(--ok); font-weight: bold; white-space: nowrap; }
.wa-link:hover { text-decoration: underline; }

/* ===== Vendas: divisão de pagamento (taxa × curso) ===== */
.pay-split { display: flex; flex-direction: column; gap: 10px; }
.pay-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--raio-ctl); padding: 10px 12px; }
.pay-row .pay-check { margin: 0; font-weight: bold; display: inline-flex; align-items: center; gap: 8px; }
.pay-row .pay-check input { width: auto; }
.pay-row .pay-amount { color: var(--text-muted); font-size: .9rem; }
.pay-row .pay-amount strong { color: var(--brand-strong); }
.pay-row select { width: auto; margin-left: auto; min-width: 160px; }

/* ===== Perfis de comissão: faixas ===== */
.tier-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--raio-ctl); padding: 10px 12px; margin-bottom: 8px; }
.tier-row label { margin: 0; font-weight: normal; display: inline-flex; align-items: center; gap: 6px; }
.tier-row input, .tier-row select { width: auto; }
.tier-row .tier-remove { margin-left: auto; padding: 8px 12px; }

/* ===== Campo de senha com "olho" ===== */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; width: 100%; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: auto; background: transparent; border: 0; cursor: pointer; font-size: 1.1rem; padding: 4px 8px; line-height: 1; }

/* ===== Configurações: toggles de módulo ===== */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .setting-label strong { display: block; }
.setting-row .setting-label span { color: var(--text-muted); font-size: .9rem; }

/* ===== Ajuda: caixas de exemplo/script ===== */
.quote-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin: 10px 0; font-style: italic; color: var(--text); }
.help-section code { background: var(--chip-bg); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* ===== Diversos ===== */
.section-title { margin: 6px 0 12px; font-size: 1rem; color: var(--brand-strong); }
.muted { color: var(--text-muted); font-size: .9rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ===== Mini dicas contextuais ===== */
.hint {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--hint-bg);
  border: 1px solid rgba(166,130,199,.35);
  border-radius: var(--raio-md); padding: 12px 14px; margin-bottom: 18px;
  font-size: .92rem; line-height: 1.5;
}
.hint .hint-ico { font-size: 1.15rem; line-height: 1.4; flex: 0 0 auto; }
.hint .hint-body { color: var(--text); }
.hint .hint-body strong { color: var(--brand-strong); }
.hint .hint-link { font-weight: bold; white-space: nowrap; }
.hint .hint-link:hover { text-decoration: underline; }

/* ===== Manuais e Ajuda ===== */
.help-nav { margin-bottom: 14px; }
.help-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.help-item:last-child { border-bottom: 0; }
.help-item h3 { margin: 0 0 4px; font-size: 1rem; color: var(--brand-strong); }
.help-item p { margin: 0; }
.help-steps { margin: 0; padding-left: 20px; }
.help-steps li { margin: 7px 0; }
.help-section { scroll-margin-top: 20px; }

/* ===== Filtro de data dos relatórios ===== */
.datefilter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.datefilter a {
  padding: 8px 14px; border-radius: 999px; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.datefilter a.active { background: var(--btn-bg); border-color: var(--btn-bg); color: var(--on-btn); }
.datefilter a:hover { text-decoration: none; }
.datefilter form { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.datefilter input[type="date"] { width: auto; padding: 7px 10px; }
.current-range { color: var(--text-muted); font-size: .9rem; margin: 0 0 16px; }
.report-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== Login ===== */
.auth-wrap { margin-left: 0; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { max-width: 420px; width: 100%; text-align: center; }
.auth-logo { width: auto; max-width: 220px; height: 64px; object-fit: contain; margin: 0 auto 14px; display: block; background: var(--branco); padding: 8px 14px; border-radius: var(--raio-md); box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.auth-card form { text-align: left; margin-top: 8px; }
.auth-toggle { margin-top: 16px; }

/* ===== Responsivo (drawer no mobile) ===== */
@media (max-width: 980px) {
  .appbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; height: 56px;
    padding: 0 14px; z-index: 50;
    background: linear-gradient(90deg, var(--navy), var(--navy-2));
    color: var(--branco); box-shadow: 0 2px 10px rgba(0,0,0,.25);
  }
  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease;
    width: min(82vw, 300px); box-shadow: 0 0 40px rgba(0,0,0,.5);
  }
  .sidebar.is-open { transform: none; }
  .sidebar.is-open ~ .sidebar-backdrop,
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .content { margin-left: 0; width: 100%; padding: 70px 16px 16px; }
  .viewas-banner { bottom: 12px; left: 12px; right: 12px; justify-content: space-between; border-radius: var(--raio-md); }
  .viewas-banner ~ .content { padding-bottom: 90px; }
  .col-2, .col-3, .col-4, .col-6, .col-8 { grid-column: span 12; }
}

/* ===== Impressão (PDF via navegador) ===== */
@media print {
  .sidebar, .appbar, .sidebar-backdrop, .report-tools, .datefilter, .no-print, .viewas-banner { display: none !important; }
  .content { margin: 0; width: 100%; padding: 0; }
  body { background: #fff; color: #000; }
  .card, .topbar { box-shadow: none; border-color: #ccc; }
  .print-header { display: flex !important; }
  @page { size: A4 portrait; margin: 10mm; }
  table { font-size: 10px; width: 100%; }
  thead { display: table-header-group; }
  tr { page-break-inside: avoid; }
  .table-wrap { overflow: visible !important; max-height: none !important; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.print-filters { font-size: .75rem; color: #333; margin: 0 0 10px; }
.print-header { display: none; align-items: center; gap: 14px; margin-bottom: 16px; }
.print-header img { width: 60px; height: 60px; object-fit: contain; }
.print-header h1 { margin: 0; font-size: 1.2rem; }
.print-header .ph-sub { color: #555; font-size: .9rem; }

/* ---------- Suporte: chips de anexo e passo a passo "Como funciona" ---------- */
.suporte-anexos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suporte-anexo-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--chip-bg); color: var(--text); font-size: .85rem; word-break: break-all;
}
.suporte-anexo-x {
  background: none; border: 0; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0 2px; width: auto;
}
.suporte-anexo-x:hover { color: var(--vermelho); }
.como-funciona { margin: 0; padding-left: 20px; }
.como-funciona li { margin-bottom: 12px; line-height: 1.5; }
.como-funciona li:last-child { margin-bottom: 0; }

/* Mensagens pré-definidas (v3.22) */
.msg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.msg-card { display: flex; flex-direction: column; }
.msg-card .wa-preview { flex: 1; max-height: 260px; overflow: auto; }
.wa-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--raio-ctl); padding: 12px 14px; line-height: 1.5; word-break: break-word; }
.bday-sent { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: normal; white-space: nowrap; }
.bday-sent input { width: auto; }

/* Fase 2: itens de proposta/contrato (includes/doc_items.php) */
.doc-item-row { border: 1px solid var(--border); border-radius: var(--raio-md); padding: 12px; margin-bottom: 12px; }
table.doc-itens td.num, table.doc-itens th.num, table.doc-totais td.num { text-align: right; white-space: nowrap; }
.doc-detalhe { font-size: .9em; margin-top: 4px; }
table.doc-totais { width: auto; margin: 12px 0 0 auto; background: transparent; }
table.doc-totais th { text-align: right; padding: 4px 12px; font-weight: normal; color: var(--text-muted); }
table.doc-totais td { padding: 4px 0 4px 12px; }
