/* Haja CRM — interface
   Paleta: tinta (barra lateral), papel (fundo), verde-petróleo (ações), amarelo-sinal (o que pede atenção).
   As cores das etapas seguem a etapa-padrão, iguais em todas as empresas. */

:root {
  --ink: #12313a;
  --ink-2: #1c4550;
  --ink-text: #d7e4e2;
  --paper: #eef1ef;
  --surface: #ffffff;
  --line: #d9dfdc;
  --line-strong: #b9c4c0;
  --text: #17262b;
  --muted: #5d6f73;
  --action: #0f6e63;
  --action-hover: #0b5a51;
  --signal: #f2c230;
  --danger: #b4372f;
  --danger-bg: #fbeceb;
  --ok-bg: #e5f3ef;
  --info-bg: #eaf0f7;

  /* etapas-padrão */
  --st-novo: #f2c230;
  --st-contato: #6aa6c8;
  --st-qualificado: #3f86a3;
  --st-agendado: #7c6fb0;
  --st-proposta: #c98a3d;
  --st-negociacao: #b5683a;
  --st-ganho: #2f8a5b;
  --st-perdido: #9aa3a5;

  --radius: 6px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--action); }
a:hover { color: var(--action-hover); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0 0 0.75rem; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) 236px, var(--paper) 236px); }
.nowrap { white-space: nowrap; }
.sidebar {
  background: var(--ink);
  color: var(--ink-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-weight: 700; font-size: 1.05rem; color: #fff; padding: 0 8px; text-decoration: none; }
.brand img { display: block; height: 30px; width: auto; }
.guest-side .brand img { height: 36px; }
.switcher label { display: block; font-size: 0.78rem; color: #9fb7b5; padding: 0 8px 4px; }
.switcher select {
  width: 100%;
  background: var(--ink-2);
  color: #fff;
  border: 1px solid #2c5b66;
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
}
.switcher .company-name { color: #fff; font-weight: 600; padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--ink-text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius);
  border-left: 3px solid transparent;
}
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-2); color: #fff; border-left-color: var(--signal); }
.nav .group { font-size: 0.78rem; color: #9fb7b5; padding: 14px 10px 4px; }
.sidebar-foot { margin-top: auto; font-size: 0.85rem; padding: 0 8px; }
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot .role { color: #9fb7b5; }
.sidebar-foot form { margin-top: 8px; }
.sidebar-foot a { color: var(--ink-text); }
.linklike { background: none; border: 0; padding: 0; color: var(--ink-text); font: inherit; text-decoration: underline; cursor: pointer; }

.main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.content { max-width: 1180px; }

/* ---------- blocos ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-body { padding: 18px; }
.stack > * + * { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }

/* números do painel: linha única, sem cartões */
.figures { display: flex; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.figure { flex: 1; padding: 16px 20px; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure .n { font-size: 2rem; font-weight: 600; line-height: 1.1; }
.figure .l { color: var(--muted); font-size: 0.88rem; }
.figure.attention .n { color: var(--text); box-shadow: inset 0 -6px 0 var(--signal); display: inline-block; }

/* o pipeline como uma faixa proporcional: o elemento-assinatura da interface */
.pipeline-strip { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--paper); margin: 4px 0 16px; }
.pipeline-strip span { display: block; height: 100%; min-width: 3px; }
.pipeline-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 20px; }
.pipeline-legend a { display: flex; justify-content: space-between; gap: 8px; text-decoration: none; color: var(--text); padding: 4px 0; border-bottom: 1px dashed var(--line); }
.pipeline-legend a:hover { color: var(--action); }
.pipeline-legend .count { font-weight: 600; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--st-perdido); }
.st-novo { background: var(--st-novo); }
.st-contato { background: var(--st-contato); }
.st-qualificado { background: var(--st-qualificado); }
.st-agendado { background: var(--st-agendado); }
.st-proposta { background: var(--st-proposta); }
.st-negociacao { background: var(--st-negociacao); }
.st-ganho { background: var(--st-ganho); }
.st-perdido { background: var(--st-perdido); }

/* ---------- tabelas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 0.82rem; font-weight: 600; color: var(--muted); background: #f7f9f8; }
tbody tr:hover { background: #fafbfa; }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; }
.row-link { color: var(--text); text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--action); }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.tag.on { border-color: var(--action); color: var(--action); }
.tag.off { border-style: dashed; }

/* ---------- formulários ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 500; margin-bottom: 5px; }
.field .hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search], input[type=number], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: var(--text);
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(15, 110, 99, 0.15); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: 0.86rem; margin-top: 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check input { margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.inline-form { display: inline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input[type=search] { max-width: 300px; }
.filters select { max-width: 220px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--action);
  background: var(--action); color: #fff; font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--action-hover); color: #fff; }
.btn.secondary { background: #fff; color: var(--action); }
.btn.secondary:hover { background: var(--ok-bg); color: var(--action-hover); }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-bg); }
.btn.small { padding: 5px 10px; font-size: 0.86rem; font-weight: 500; }
.btn.block { width: 100%; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- avisos ---------- */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 18px; border-left: 4px solid; }
.flash.success { background: var(--ok-bg); border-color: var(--action); }
.flash.error { background: var(--danger-bg); border-color: var(--danger); }
.flash.info { background: var(--info-bg); border-color: var(--st-contato); }

.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 6px; font-size: 1.02rem; }

/* ---------- ficha do lead ---------- */
.facts { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 12px 0 12px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li.stage::before { background: var(--action); }
.timeline .when { color: var(--muted); font-size: 0.84rem; }
.timeline .body { white-space: pre-wrap; }

/* ---------- telas sem login ---------- */
.guest { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.guest-side { background: var(--ink); color: var(--ink-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.guest-side .brand { padding: 0; font-size: 1.3rem; }
.guest-side .claim { font-size: 1.9rem; line-height: 1.25; color: #fff; font-weight: 500; max-width: 18ch; }
.guest-side .strip { display: flex; height: 10px; border-radius: 3px; overflow: hidden; max-width: 360px; margin-top: 28px; }
.guest-side .strip span { flex: var(--w); }
.guest-side .foot { font-size: 0.85rem; color: #9fb7b5; }
.guest-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.guest-card { width: 100%; max-width: 400px; }
.guest-card h1 { margin-bottom: 6px; }
.guest-card .lead-in { color: var(--muted); margin-bottom: 24px; }
.guest-links { margin-top: 18px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 0.92rem; }
.lang-switch { display: flex; gap: 6px; }
.lang-switch button { background: none; border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 0.82rem; cursor: pointer; color: var(--muted); }
.lang-switch button.current { border-color: var(--action); color: var(--action); }
.code-input { font-size: 1.6rem !important; letter-spacing: 0.4em; text-align: center; }

/* ---------- celular ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: var(--paper); }
  .col-opt { display: none; }
  .sidebar { position: static; height: auto; padding: 14px 16px; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .nav a.active { border-bottom-color: var(--signal); }
  .nav .group { display: none; }
  .sidebar-foot { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
  .sidebar-foot form { margin: 0; }
  .main { padding: 20px 16px 40px; }
  .grid-2, .grid-side, .form-row { grid-template-columns: 1fr; }
  .figures { flex-wrap: wrap; }
  .figure { flex: 1 1 50%; border-left: 0; border-top: 1px solid var(--line); }
  .guest { grid-template-columns: 1fr; }
  .guest-side { padding: 24px 16px; gap: 16px; }
  .guest-side .claim { font-size: 1.3rem; }
  .guest-side .foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
