/* =============================================================================
   style.css — Aparência do sistema de gestão da Agius Engenharia.
   Paleta "alto padrão": azul-marinho (navy) + dourado, sobre fundo claro.
   ============================================================================= */

:root {
  --navy: #12294a;
  --navy-2: #0d1d34;   /* barra lateral */
  --gold: #c8a24c;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e6e9ee;
  --ok: #1a7f4b;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--navy); }

/* ---- Estrutura geral: barra lateral + conteúdo --------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy-2);
  color: #fff;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.marca { padding: 4px 6px 16px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 14px; }
.marca-logo { width: 100%; height: auto; display: block; }

.menu { display: flex; flex-direction: column; gap: 2px; }
.menu-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #d7dde8;
  text-decoration: none;
  font-size: 15px;
  transition: background .15s, color .15s;
}
.menu-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.menu-item.ativo { background: var(--navy); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.menu-item.desativado { color: #6b7a90; cursor: default; }
.menu-item.desativado:hover { background: transparent; }
.menu-item.desativado em { font-size: 11px; font-style: normal; color: #55637a; margin-left: 4px; }

/* ---- Conteúdo ------------------------------------------------------------ */
.conteudo { flex: 1; min-width: 0; }
.topo {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 18px 28px;
}
.topo h1 { margin: 0; font-size: 22px; color: var(--navy); }
.pagina { padding: 24px 28px 48px; max-width: 1100px; }

/* ---- Aviso de etapa ------------------------------------------------------ */
.aviso {
  background: #eef4ff;
  border: 1px solid #d3e2ff;
  border-left: 4px solid var(--navy);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 22px;
  font-size: 14px;
}

/* ---- Cartões de contagem ------------------------------------------------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin-bottom: 26px; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-num { font-size: 30px; font-weight: 700; color: var(--navy); }
.card-rot { font-size: 13px; color: var(--muted); }

/* ---- Blocos e tabelas ---------------------------------------------------- */
.bloco {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.bloco h2 { margin: 0 0 14px; font-size: 17px; color: var(--navy); }
.bloco-topo { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.bloco-topo h2 { margin: 0; }
.btn-mini { padding: 6px 12px; font-size: 13px; }

/* ---- Pastas de documentos ------------------------------------------------- */
.pasta-arvore { background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px;
  padding: 12px 16px; font-size: 13px; color: #33415c; margin: 12px 0; }
.nota code { background: #eef1f6; padding: 2px 7px; border-radius: 5px; font-size: 12.5px; word-break: break-all; }

/* ---- Tela de Integrações -------------------------------------------------- */
.aviso-integra { background: #f2f6fc; border-left: 4px solid var(--navy); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 20px; font-size: 14px; color: #33415c; line-height: 1.6; }
.linha-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.badge.sit-neutro { background: #eef1f6; color: #5b6880; }
@media (max-width: 760px) { .linha-3 { grid-template-columns: 1fr; } }

/* ---- Melhorias (rodada 7) ------------------------------------------------- */
/* Botão WhatsApp */
.btn.zap { background: #25d366; border-color: #25d366; color: #063d1e; }
.btn.zap:hover { filter: brightness(1.03); }

/* Link público de aceite (copiar) */
.link-copia { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-copia input { flex: 1; min-width: 240px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; color: #33415c; background: #f8fafc; }

/* Página de erro (código grande) */
.erro-codigo { font-size: 54px; font-weight: 800; color: var(--gold); line-height: 1; margin: 6px 0; }

/* Paginação */
.paginacao { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.paginacao-info { font-size: 13px; color: var(--muted); }

/* Seletor de mês do dashboard */
.dash-mes { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.dash-mes label { font-size: 13px; color: var(--muted); font-weight: 600; }
.dash-mes input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 14px; }

/* Delta nos KPIs */
.kpi-delta { font-size: 11.5px; font-weight: 700; }
.kpi-delta.sobe { color: #7fd8a4; }
.kpi-delta.desce { color: #f19aa2; }

/* Tabela de fluxo de caixa */
.fluxo-tabela .verde { color: var(--ok); }
.fluxo-tabela .vermelho { color: var(--danger); }

/* Busca global no topo */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.busca-global input { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-family: inherit; width: 220px; max-width: 100%; }
.busca-global input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(18,41,74,.1); }

/* Recorrência e confirmação de duplicado (formulários) */
.recorrencia { background: #fafbfc; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.recorrencia-meses { margin-top: 8px; font-size: 13px; color: var(--muted); }
.aviso-dup { background: #fff8e6; border: 1px solid #f0d98c; border-radius: 8px; padding: 12px 14px; }
.aviso-dup label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #7a5b00; }

.colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

.tabela-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: #fafbfc; }
.num { text-align: right; }

.tag {
  display: inline-block;
  background: #eef1f6;
  color: #3b4a63;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  text-transform: capitalize;
}

.nota { font-size: 13px; color: var(--muted); margin: 10px 2px 0; }
.rodape-nota { font-size: 13px; color: var(--muted); margin-top: 10px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---- Cartões: pé e cores ------------------------------------------------- */
.card-pe { font-size: 11px; color: var(--muted); }
.card-num.verde { color: var(--ok); }
.card-num.vermelho { color: var(--danger); }
.bloco.destaque { display: flex; flex-direction: column; gap: 5px; }

/* ---- Barra de ações (título + botões/filtros) ---------------------------- */
.barra-acoes { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.titulo-detalhe { margin: 0; font-size: 20px; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.acoes-topo { display: flex; gap: 8px; align-items: center; }
.acoes-topo form { margin: 0; }

/* ---- Botões -------------------------------------------------------------- */
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: var(--navy); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; font-family: inherit; }
.btn:hover { background: #f3f5f9; }
.btn.primario { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primario:hover { background: #0d1f38; }
.btn.perigo { color: var(--danger); border-color: #f0c9c9; }
.btn.perigo:hover { background: #fbeaea; }

/* ---- Filtros (pílulas) --------------------------------------------------- */
.filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: #3b4a63; font-size: 13px; text-decoration: none; }
.pill:hover { background: #f3f5f9; }
.pill.ativo { background: var(--navy); color: #fff; border-color: var(--navy); }
.pill em { font-style: normal; opacity: .7; margin-left: 3px; font-size: 12px; }

/* ---- Mensagens de sucesso/erro ------------------------------------------- */
.flash { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid; }
.flash.ok { background: #e4f4ea; border-color: #bfe3cc; color: #1a6b40; }
.flash.erro { background: #fce8e8; border-color: #f2c4c4; color: #a52a22; }

/* ---- Selos coloridos (estágio / status / situação) ----------------------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1f6; color: #3b4a63; white-space: nowrap; }
.badge-orcamento_enviado, .status-enviada { background: #e5eefb; color: #1b4f9c; }
.badge-fechado, .status-aceita, .sit-pago { background: #e4f4ea; color: #1a7f4b; }
.badge-em_execucao, .status-expirada, .sit-pendente { background: #fbf1dd; color: #8a6412; }
.badge-entregue { background: #ddf1f0; color: #0f6e6a; }
.badge-perdido, .status-recusada, .sit-atrasado { background: #fce8e8; color: #b3261e; }
/* status de Ordem de Serviço */
.os-agendada { background: #e5eefb; color: #1b4f9c; }
.os-em_execucao, .os-em_elaboracao { background: #fbf1dd; color: #8a6412; }
.os-concluida { background: #ddf1f0; color: #0f6e6a; }
.os-entregue { background: #e4f4ea; color: #1a7f4b; }
.os-cancelada { background: #fce8e8; color: #b3261e; }

/* ---- Ações dentro das tabelas -------------------------------------------- */
.acoes-linha { white-space: nowrap; }
.acoes-linha a, .link-btn { color: var(--navy); text-decoration: none; font-size: 13px; margin-right: 10px; }
.acoes-linha a:hover, .link-btn:hover { text-decoration: underline; }
.link-forte { font-weight: 600; color: var(--navy); text-decoration: none; }
.link-forte:hover { text-decoration: underline; }
.link-btn { background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; font-weight: 600; }
.perigo-txt { color: var(--danger); }
.inline { display: inline; margin: 0; }
tr.inativo { opacity: .55; }
.vazio { text-align: center; color: var(--muted); padding: 22px; }
.vazio-simples { color: var(--muted); font-size: 14px; }

/* ---- Formulários --------------------------------------------------------- */
.form-bloco { max-width: 720px; }
.campo { margin-bottom: 14px; display: flex; flex-direction: column; gap: 5px; }
.campo label { font-size: 13px; font-weight: 600; color: #374151; }
.campo input, .campo select, .campo textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text); width: 100%; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(18,41,74,.1); }
.linha-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.campo-check { justify-content: flex-end; }
.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
.check input { width: auto; }
.form-botoes { display: flex; gap: 10px; margin-top: 8px; }
.voltar { margin: 0 0 14px; font-size: 14px; }

/* ---- Gráfico de barras (faturamento) ------------------------------------- */
.grafico { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding-top: 10px; }
.g-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.g-valor { font-size: 11px; color: var(--muted); margin-bottom: 5px; height: 14px; white-space: nowrap; }
.g-barra { width: 100%; max-width: 54px; background: linear-gradient(180deg, #1c3a63, #12294a); border-radius: 6px 6px 0 0; min-height: 3px; }
.g-rot { font-size: 12px; color: var(--muted); margin-top: 7px; }

/* ---- Faixa de KPIs (dashboard) ------------------------------------------- */
.kpi-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px;
  background: linear-gradient(135deg, #163156, var(--navy-2)); border-radius: 14px; overflow: hidden;
  margin-bottom: 26px; box-shadow: 0 8px 26px rgba(13,29,52,.28); }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
  border-left: 1px solid rgba(255,255,255,.06); }
.kpi:first-child { border-left: none; }
.kpi-rot { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #9db0cc; }
.kpi-num { font-size: 24px; font-weight: 700; color: #fff; line-height: 1.15; }
.kpi-num.ok { color: #7fd8a4; }
.kpi-num.ruim { color: #f19aa2; }
.kpi-pe { font-size: 11px; color: #7f93b3; }

/* ---- Medidor circular (Real vs Meta / conversão) ------------------------- */
.medidor-bloco { text-align: center; }
.donut-wrap { display: flex; justify-content: center; margin: 6px 0 10px; }
.donut { width: 190px; height: 190px; max-width: 100%; }
.donut-fundo { fill: none; stroke: #e7ebf1; stroke-width: 12; }
.donut-frente { fill: none; stroke: var(--gold); stroke-width: 12; stroke-linecap: round;
  transition: stroke-dasharray .6s ease; }
.donut-txt { font-size: 26px; font-weight: 700; fill: var(--navy); font-family: inherit; }
.medidor-legenda { font-size: 15px; color: var(--navy); margin: 4px 0; }
.medidor-legenda strong { font-size: 18px; }

/* ---- Rankings horizontais (serviço / clientes) --------------------------- */
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.rank-item { display: grid; grid-template-columns: 34% 1fr auto; align-items: center; gap: 10px; }
.rank-nome { font-size: 13.5px; color: var(--text); text-decoration: none; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
a.rank-nome:hover { color: var(--navy); text-decoration: underline; }
.rank-barra { background: #eef1f6; border-radius: 999px; height: 16px; overflow: hidden; }
.rank-fill { display: block; height: 100%; border-radius: 999px; min-width: 3px;
  background: linear-gradient(90deg, #1c3a63, var(--navy)); }
.rank-fill.ouro { background: linear-gradient(90deg, #e0c079, var(--gold)); }
.rank-val { font-size: 13px; font-weight: 700; color: var(--navy); white-space: nowrap; }

/* ---- Mini-funil (clientes por estágio) ----------------------------------- */
.funil { list-style: none; margin: 0; padding: 0; }
.funil li a { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); font-size: 14px; }
.funil li a:hover { background: #fafbfc; }
.funil-num { font-weight: 700; color: var(--navy); background: #eef1f6; border-radius: 999px; min-width: 26px; text-align: center; padding: 1px 8px; font-size: 13px; }

/* ---- Ficha do cliente (detalhe) ------------------------------------------ */
.ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; }
.ficha > div { font-size: 14px; display: flex; flex-direction: column; }
.ficha > div span { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.obs { margin-top: 14px; font-size: 14px; background: #fafbfc; padding: 10px 12px; border-radius: 8px; }

/* Proporção 2:1 para dashboard e detalhe */
.colunas.col-2-1 { grid-template-columns: 2fr 1fr; }

/* ---- Formulário de itens da proposta ------------------------------------- */
h3.sub { font-size: 15px; color: var(--navy); margin: 22px 0 4px; }
.doc-total-form { text-align: right; font-size: 17px; color: var(--navy); margin: 16px 0 4px; }
.doc-total-form strong { font-size: 20px; }
.nota-numero { font-size: 14px; color: var(--muted); margin: -6px 0 14px; }
.tabela-itens-form { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 12px; }
.tabela-itens-form th, .tabela-itens-form td { padding: 7px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.tabela-itens-form th.num, .tabela-itens-form td.num { text-align: right; }
.tabela-itens-form input, .tabela-itens-form select { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px; font-family: inherit; background: #fff; }
.tabela-itens-form .in-qtd { max-width: 90px; text-align: right; margin-left: auto; }
.tabela-itens-form .in-valor { max-width: 130px; text-align: right; margin-left: auto; }
.tabela-itens-form tfoot td { border-top: 2px solid var(--border); border-bottom: none; font-size: 15px; padding-top: 10px; }
.form-proposta .form-botoes { margin-top: 18px; }
.opcional { font-weight: 400; color: var(--muted); font-size: 12px; }
.dica-os { display: block; margin-top: 5px; font-size: 12px; color: var(--gold); font-weight: 600; }
.form-bloco textarea { resize: vertical; }
.gerado-linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }

/* ---- Filtros do financeiro ----------------------------------------------- */
.filtros-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filtros-form .campo { margin: 0; flex: 1 1 150px; min-width: 130px; }
.filtros-form.compacto .campo { flex-basis: 120px; }
.filtros-botoes { display: flex; gap: 8px; }
.mini-link { font-size: 12px; color: var(--muted); text-decoration: none; }
.mini-link:hover { text-decoration: underline; }

/* ---- Grupos de filtro (CRM) ---------------------------------------------- */
.filtros-grupo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filtros-rot { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; min-width: 96px; }
.ponto-aberto { color: var(--gold); font-size: 11px; margin-left: 4px; vertical-align: middle; }

/* ---- Editor de templates ------------------------------------------------- */
.editor-html { font-family: "Consolas", "Courier New", monospace; font-size: 13px; line-height: 1.5;
  white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 2; }
.marcadores { display: flex; flex-wrap: wrap; gap: 6px; }
.marcador { font-family: "Consolas", monospace; font-size: 12px; background: #eef1f6; color: #33415c;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.marcador:hover { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---- Busca --------------------------------------------------------------- */
.busca-form { display: flex; gap: 6px; }
.busca-form input { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; min-width: 230px; }
.busca-form input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(18,41,74,.1); }

/* ---- Anexos -------------------------------------------------------------- */
.anexo-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.anexo-form input[type="file"] { font-size: 13px; max-width: 100%; }
.anexos-lista { list-style: none; margin: 0; padding: 0; }
.anexos-lista li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; flex-wrap: wrap; }
.anexos-lista li:last-child { border-bottom: none; }
.anexo-nome { text-decoration: none; color: var(--navy); font-weight: 600; }
.anexo-nome:hover { text-decoration: underline; }
.anexo-meta { color: var(--muted); font-size: 12px; margin-right: auto; }

/* ---- Login --------------------------------------------------------------- */
.tela-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy-2); padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 30px; width: 100%; max-width: 370px; box-shadow: 0 12px 40px rgba(0,0,0,.3); text-align: center; }
.login-card h1 { color: var(--navy); font-size: 20px; margin: 10px 0 18px; }
.login-logo { width: 170px; max-width: 72%; height: auto; display: block; margin: 0 auto 6px; }
.login-nota { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.login-card .campo { text-align: left; }
.btn-bloco { width: 100%; margin-top: 6px; }
.login-sep { border: none; border-top: 1px solid var(--border); margin: 18px 0 14px; }
.login-link { margin: 16px 0 0; font-size: 13px; }
.login-link a { color: var(--navy); font-weight: 600; text-decoration: none; }
.login-link a:hover { text-decoration: underline; }

/* ---- Usuário logado (barra lateral) -------------------------------------- */
.usuario-atual { display: flex; flex-direction: column; gap: 1px; margin-top: 16px; padding: 10px 12px;
  background: rgba(255,255,255,.05); border-radius: 8px; text-decoration: none; }
.usuario-atual:hover { background: rgba(255,255,255,.09); }
.usuario-nome { color: #fff; font-weight: 600; font-size: 14px; }
.usuario-papel { color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }

/* ---- Tela de usuários ----------------------------------------------------- */
tr.inativo { opacity: .55; }
.form-papel select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 13px; }
.form-reset-senha { display: inline-flex; gap: 6px; align-items: center; margin-top: 6px; }
.form-reset-senha input { padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; }
.escondido { display: none; }

/* ---- Botão Sair (barra lateral) ------------------------------------------ */
.sair-form { margin-top: 16px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.1); }
.menu-item.sair { width: 100%; text-align: left; background: none; border: none; cursor: pointer; font-family: inherit; font-size: 15px; }

/* ---- Painel de status da proposta ---------------------------------------- */
.painel-status { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.painel-rot { font-weight: 600; color: #374151; font-size: 14px; }
.status-botoes { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-status { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: #3b4a63; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-status:hover { background: #f3f5f9; }
.btn-status.atual, .btn-status:disabled { background: var(--navy); color: #fff; border-color: var(--navy); cursor: default; opacity: 1; }
.painel-status .nota { flex-basis: 100%; margin: 4px 0 0; }

/* ---- Botão do menu (só aparece no celular/tablet) ------------------------- */
.menu-botao { display: none; background: none; border: 0; cursor: pointer;
  padding: 10px; margin: -10px -6px -10px 0; border-radius: 8px; }
.menu-botao-traco { display: block; width: 24px; height: 2px; background: #fff;
  border-radius: 2px; margin: 5px 0; transition: transform .2s, opacity .2s; }
.menu-botao:hover { background: rgba(255,255,255,.08); }
/* Vira um "X" quando o menu está aberto */
.sidebar.aberto .menu-botao-traco:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar.aberto .menu-botao-traco:nth-child(2) { opacity: 0; }
.sidebar.aberto .menu-botao-traco:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---- Responsivo: celular e tablet ---------------------------------------- */
@media (max-width: 820px) {
  /* Nada pode empurrar a página para os lados */
  html, body { max-width: 100%; overflow-x: hidden; }

  /* A barra lateral vira um cabeçalho fixo no topo */
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; padding: 10px 14px;
    position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,.18); }

  /* Logo menor, ao lado do botão de menu */
  .marca { display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 0; margin: 0; border-bottom: 0; }
  .marca-logo { width: auto; height: 36px; }
  .menu-botao { display: block; }

  /* Menu escondido até tocar no botão */
  .menu, .usuario-atual, .sair-form { display: none; }
  .sidebar.aberto .menu { display: flex; flex-direction: column;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
  .sidebar.aberto .usuario-atual { display: flex; }
  .sidebar.aberto .sair-form { display: block; }
  /* Alvos grandes o suficiente para o dedo */
  .menu-item { padding: 13px 12px; font-size: 15.5px; }

  /* Conteúdo respira mais e o título não fica gigante */
  .pagina { padding: 16px 14px 40px; }
  .topo { padding: 14px; gap: 10px; }
  .topo h1 { font-size: 19px; }
  .busca-global { width: 100%; }
  .busca-global input { width: 100%; padding: 11px 16px; }

  .btn { padding: 12px 16px; }

  /* CAMPOS: 16px evita o zoom automático do iPhone ao tocar no campo */
  .campo input, .campo select, .campo textarea,
  .filtros-form input, .filtros-form select,
  .busca-form input, .dash-mes input,
  .busca-global input, .form-reset-senha input,
  input[type="text"], input[type="password"], input[type="email"],
  input[type="number"], input[type="date"], input[type="month"],
  input[type="search"], select, textarea { font-size: 16px; }

  /* Tabelas: rolam de lado, com toque suave */
  .tabela-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabela-wrap table { min-width: 560px; }
  table th, table td { padding: 9px 8px; font-size: 13.5px; }

  /* Ajustes pontuais que estouravam a largura */
  .link-copia input { min-width: 0; width: 100%; }
  .link-copia { flex-direction: column; align-items: stretch; }
  .grafico { gap: 6px; }
  .paginacao { flex-wrap: wrap; }
  .nota code { word-break: break-all; }
  .acoes-linha { display: flex; flex-wrap: wrap; gap: 8px; }
}

/* ---- Telas estreitas: empilha o que estava lado a lado -------------------- */
/* Fica ABAIXO de 700px para o tablet (768px) continuar aproveitando a largura */
@media (max-width: 700px) {
  .colunas, .colunas.col-2-1, .linha-2, .linha-3, .ficha { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-hero { grid-template-columns: 1fr 1fr; }

  /* Barras de ação viram botões largos, fáceis de acertar com o dedo */
  .barra-acoes, .acoes-topo { flex-direction: column; align-items: stretch; }
  .acoes-topo .btn, .acoes-topo form, .acoes-topo button { width: 100%; }
  .form-botoes { flex-direction: column; }
  .form-botoes .btn, .form-botoes button { width: 100%; }

  .filtros-form { grid-template-columns: 1fr; }
  .filtros-botoes { flex-direction: column; }
  .filtros-botoes .btn, .filtros-botoes button { width: 100%; }
}

/* ---- Celular pequeno ------------------------------------------------------ */
@media (max-width: 430px) {
  .cards, .kpi-hero { grid-template-columns: 1fr; }
  .pagina { padding: 14px 12px 40px; }
  .bloco { padding: 16px 14px; }
  .topo h1 { font-size: 18px; }
}
