/* ===========================================================
   Identidade Visual — Grupo MHM (claro + escuro)
   Tokens, brilho vermelho e componentes conforme o guia da marca.
   =========================================================== */
:root {
  --mhm-red: #ef2c19;
  --mhm-red-hover: #d8260f;
  --mhm-red-tint: #fdecea;
  --mhm-dark: #2c2e35;

  --ident-bg: #f4f4f6;   /* fundo claro */
  --surface: #ffffff;    /* cards / superfícies */
  --field-bg: #fafafb;
  --border: #e4e4e8;
  --muted: #6b6e76;
  --glow: 0.10;          /* intensidade do brilho */

  --r-card: 14px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-theme="dark"] {
  --mhm-dark: #e8e8ec;
  --mhm-red-tint: #3a201d;
  --ident-bg: #0a0a0c;   /* preto da marca */
  --surface: #15161d;    /* card charcoal */
  --field-bg: #0f1c26;
  --border: #20303b;
  --muted: #a8aab2;
  --glow: 0.20;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--mhm-dark);
  background:
    radial-gradient(115% 60% at 50% -8%, rgba(239,44,25,var(--glow)), rgba(239,44,25,0.03) 34%, transparent 58%),
    var(--ident-bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px 56px; }
/* página larga; formulários/resultados ficam numa coluna legível */
.card, .faixa, table.detalhe, ul.checks, .erro, .sucesso { max-width: 720px; }
.top-acoes { display: flex; align-items: center; gap: 8px; }
a.toggle { text-decoration: none; }

/* topo: logo (troca por tema) + toggle */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0 8px; }
.marca { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.marca .logo { height: 34px; width: auto; }
.marca .logo.neg { display: none; }
[data-theme="dark"] .marca .logo.norm { display: none; }
[data-theme="dark"] .marca .logo.neg { display: inline; }
.marca .produto { color: var(--muted); font-size: 16px; font-weight: 700; }
.toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px;
  font: 600 13px/1 var(--font); color: var(--muted); cursor: pointer;
  background: var(--field-bg); border: 1px solid var(--border); border-radius: 9px;
}
.toggle:hover { border-color: var(--mhm-red); color: var(--mhm-red); }

main { padding-top: 18px; }
h1 { font-size: 27px; font-weight: 800; margin: 8px 0 6px; }
h2 { font-size: 18px; font-weight: 800; margin: 28px 0 10px; }
.card h2 { margin-top: 0; }
.sub { color: var(--muted); margin: 0 0 22px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 -4px; }
.op { font-weight: 400; color: var(--muted); font-size: 12px; }

/* cards */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s, box-shadow .15s;
}

/* campos */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; }
select, input, textarea {
  font: inherit; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 11px; background: #fff; color: #2c2e35;  /* branco mesmo no escuro (regra do guia) */
}
textarea { resize: vertical; }
select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--mhm-red);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--mhm-red);
}
input[type="file"] { padding: 9px; background: var(--field-bg); color: var(--mhm-dark); }

/* botões */
button {
  margin-top: 4px; align-self: stretch; background: var(--mhm-red); color: #fff; border: 0;
  padding: 13px 22px; border-radius: 11px; font: 700 15px var(--font); cursor: pointer;
  box-shadow: 0 8px 30px rgba(239,44,25,0.35); transition: background .15s, box-shadow .15s;
}
button:hover { background: var(--mhm-red-hover); box-shadow: 0 10px 38px rgba(239,44,25,0.5); }
.btn-sugerir {
  align-self: flex-start; margin: 0; background: transparent; color: var(--muted);
  border: 1px solid var(--border); padding: 8px 14px; border-radius: 9px;
  font: 600 13px var(--font); box-shadow: none;
}
.btn-sugerir:hover:not(:disabled) { background: transparent; border-color: var(--mhm-red); color: var(--mhm-red); box-shadow: none; }
.btn-sugerir:disabled { opacity: .6; cursor: default; }

/* divisória "ou" */
.ou { text-align: center; margin: 22px 0; position: relative; }
.ou::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.ou span { position: relative; background: var(--ident-bg); padding: 0 14px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }

/* bloco IA sugere setor */
.ia-setor { background: var(--field-bg); border: 1px dashed var(--border); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sugestoes-setor { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sug-titulo { width: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; font: 600 13px var(--font); cursor: pointer; color: var(--mhm-dark); box-shadow: none; margin: 0; }
.chip:hover { border-color: var(--mhm-red); background: var(--surface); box-shadow: none; }
.chip-sel { background: var(--mhm-red); color: #fff; border-color: var(--mhm-red); }
.aviso-setor { font-size: 13px; color: var(--muted); }
.fator { display: flex; flex-direction: column; gap: 5px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.fator:last-child { border-bottom: 0; }
.fator-label { margin: 0; font-weight: 700; font-size: 14px; }
.desc-fator { margin: 0 0 2px; font-size: 12px; color: var(--muted); }
.opcoes { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { cursor: pointer; }
.pill input { position: absolute; opacity: 0; width: 0; height: 0; }
.pill span {
  display: inline-block; padding: 6px 13px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--mhm-dark); background: var(--surface);
}
.pill span:hover { border-color: var(--mhm-red); }
.pill input:checked + span { background: var(--mhm-red); color: #fff; border-color: var(--mhm-red); }
.pill input:focus-visible + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--mhm-red); }

/* resultado: faixa */
.faixa {
  font-size: 30px; font-weight: 800; color: var(--mhm-red);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 24px; text-align: center; margin: 8px 0;
}
.faixa span { color: var(--muted); font-size: 18px; font-weight: 600; margin: 0 8px; }
.central { color: var(--muted); margin: 0 0 22px; }

/* tabela de detalhe */
table.detalhe { width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
table.detalhe td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
table.detalhe tr:last-child td { border-bottom: 0; }
table.detalhe td:first-child { color: var(--muted); width: 48%; }
table.detalhe em { color: var(--muted); font-style: normal; font-size: 12.5px; }

/* conferências */
ul.checks { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
ul.checks li { padding: 10px 12px; border-radius: 8px; font-size: 14px; border: 1px solid; color: #2c2e35; }
ul.checks li.ok { background: #ecfaf0; border-color: #b8e6c6; }
ul.checks li.warn { background: #fff7e6; border-color: #f0d9a8; }

.erro { background: #fde8e6; border: 1px solid #f5b8b1; border-radius: 10px; padding: 18px; color: #2c2e35; }

.voltar { display: inline-block; margin-top: 26px; color: var(--mhm-dark); font-weight: 700; text-decoration: none; }
.voltar:hover { color: var(--mhm-red); }

footer { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px; }

/* vitrine de planos */
.planos { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 8px 0 24px; }
.plano { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.plano-destaque { border-color: var(--mhm-red); box-shadow: 0 12px 40px rgba(239,44,25,0.14); }
.plano-tag { position: absolute; top: -10px; right: 16px; background: var(--mhm-red); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plano-nome { font-size: 18px; font-weight: 800; }
.plano-preco { font-size: 24px; font-weight: 800; color: var(--mhm-red); }
.plano-resumo { color: var(--muted); font-size: 13px; margin: 0; min-height: 38px; }
.plano-itens { list-style: none; padding: 0; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.plano-itens li { padding-left: 18px; position: relative; }
.plano-itens li::before { content: "✓"; position: absolute; left: 0; color: var(--mhm-red); font-weight: 800; }
.btn-plano { margin-top: auto; display: block; text-align: center; text-decoration: none;
  background: var(--mhm-red); color: #fff; padding: 11px 14px; border-radius: 10px; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 30px rgba(239,44,25,0.35); }
.btn-plano:hover { background: var(--mhm-red-hover); }
.btn-plano-ghost { display: block; text-align: center; text-decoration: none; margin-top: 8px;
  color: var(--muted); border: 1px solid var(--border); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.btn-plano-ghost:hover { border-color: var(--mhm-red); color: var(--mhm-red); }
.rodape-acesso { text-align: center; color: var(--muted); font-size: 14px; }
.rodape-acesso a { color: var(--mhm-red); font-weight: 700; text-decoration: none; }

.sucesso { background: #ecfaf0; border: 1px solid #b8e6c6; border-radius: 10px; padding: 16px; color: #2c2e35; margin-bottom: 14px; }
.admin-topo { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-topo h1 { margin: 0; }
.admin-topo .btn-plano-ghost { margin: 0; }
.btn-copiar { margin-left: 10px; background: var(--mhm-escuro, #2c2e35); color: #fff; border: 0;
  padding: 4px 12px; border-radius: 7px; font: 600 12px var(--font); cursor: pointer; box-shadow: none; }
.btn-copiar:hover { background: var(--mhm-red); }
.copiado { margin-left: 8px; color: var(--mhm-red); font-weight: 700; font-size: 13px; display: none; }

/* normalização do EBITDA — linhas de ajuste (premium) */
.ajuste-linha { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.ajuste-linha select[name="ajuste_desc"], .ajuste-linha .ajuste-outro { flex: 1 1 200px; min-width: 0; }
.ajuste-linha select[name="ajuste_tipo"] { flex: 0 0 auto; }
.ajuste-linha input[name="ajuste_valor"] { flex: 0 1 140px; min-width: 0; }
.ajuste-linha input, .ajuste-linha select { margin: 0; }

/* diferenciais na vitrine */
.diferenciais { max-width: 720px; margin: 4px auto 22px; }
.diferenciais p { margin: 6px 0; font-size: 15px; }

/* triangulação — barras */
.tri { max-width: 720px; margin: 0 auto; }
.tri-linha { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.tri-nome { flex: 0 0 180px; font-size: 14px; }
.tri-nome em { color: var(--muted); font-style: normal; font-size: 12px; }
.tri-barra { flex: 1 1 auto; background: var(--field-bg); border: 1px solid var(--border); border-radius: 6px; height: 16px; overflow: hidden; }
.tri-barra > span { display: block; height: 100%; background: var(--muted); border-radius: 5px; min-width: 2px; }
.tri-barra > span.tri-fill-red { background: var(--mhm-red); }
.tri-val { flex: 0 0 auto; font-weight: 700; font-size: 14px; }
