/* MAVT CRM — identidade visual MAVT (dark, minimal, azul tech) */
:root {
  color-scheme: dark;
  --page: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1c1c22;
  --ink: #f5f6f8;
  --ink-2: #b8bac2;
  --muted: #82848d;
  --grid: #26262e;
  --border: rgba(255, 255, 255, 0.08);
  --brand: #3b82f6;
  --brand-2: #2563eb;
  --brand-ink: #7fb0f9;
  --brand-grad: linear-gradient(180deg, #60a5fa, #2563eb);
  --good: #0ca30c;
  --good-text: #4ade80;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #ef4444;
  --sidebar-bg: radial-gradient(circle at 50% 30%, #101014 0%, #060607 100%);
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Outfit', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page); color: var(--ink); font-size: 14px; letter-spacing: .01em;
}
a { color: var(--brand-ink); }
button, input, select, textarea { font-family: inherit; }

/* ---------- wordmark ---------- */
.wordmark { font-weight: 600; letter-spacing: .38em; color: #fff; text-transform: uppercase; display: inline-flex; align-items: baseline; }
.wordmark .logo-a { position: relative; display: inline-block; }
.wordmark .logo-a::after {
  content: ''; position: absolute; left: 42%; bottom: .1em; transform: translateX(-50%);
  width: .38em; height: .34em; background: var(--brand-grad); clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.wordmark .sufixo { font-weight: 300; letter-spacing: .1em; color: var(--brand-ink); margin-left: .5em; text-transform: none; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 42%, #17171c 0%, #060607 70%); padding: 20px; }
.login-card { width: 360px; max-width: 100%; padding: 40px 36px; text-align: center; }
.login-card h1 { font-size: 30px; margin-bottom: 10px; }
.login-card .sub { color: var(--muted); margin-bottom: 30px; font-size: 13px; font-weight: 300; letter-spacing: .08em; }
.login-card label { display: block; text-align: left; font-size: 11.5px; color: var(--ink-2); margin: 14px 0 5px; letter-spacing: .06em; text-transform: uppercase; }
.login-card input { width: 100%; padding: 11px 14px; border: 1px solid var(--grid); border-radius: 10px; background: rgba(255,255,255,.04); color: var(--ink); font-size: 15px; }
.login-card input:focus { outline: none; border-color: var(--brand); }
.login-card button { width: 100%; margin-top: 26px; padding: 12px; border: 0; border-radius: 10px; background: var(--brand-grad); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; letter-spacing: .04em; }
.login-erro { color: var(--critical); font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--ink-2);
  display: flex; flex-direction: column; padding: 22px 0; position: sticky; top: 0; height: 100vh;
  border-right: 1px solid var(--border);
}
.logo { padding: 0 22px 24px; font-size: 17px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 22px; color: var(--ink-2); text-decoration: none;
  font-size: 13.5px; border-left: 2px solid transparent; transition: background .12s, color .12s;
}
.nav a:hover { background: rgba(255,255,255,.04); color: #fff; }
.nav a.ativa { border-left-color: var(--brand); color: #fff; background: linear-gradient(90deg, rgba(59,130,246,.14), transparent 80%); }
.nav .badge { margin-left: auto; background: var(--brand-2); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; font-weight: 600; }
.nav .badge.alerta { background: var(--critical); }
.sidebar .rodape { margin-top: auto; padding: 16px 22px; font-size: 12px; color: var(--muted); }
.sidebar .rodape .nome { color: var(--ink-2); font-weight: 500; }
.sidebar .rodape button { background: none; border: 1px solid var(--grid); color: var(--ink-2); border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 12px; margin: 8px 6px 0 0; }
.sidebar .rodape button:hover { border-color: var(--brand); color: #fff; }

.main { flex: 1; min-width: 0; padding: 28px 32px; max-width: 1600px; }
.main h2 { font-size: 20px; margin-bottom: 2px; font-weight: 600; }
.main .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; font-weight: 300; }
.topo-acoes { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 15px 17px; }
.tile.clicavel { cursor: pointer; transition: border-color .15s, transform .15s; }
.tile.clicavel:hover { border-color: var(--brand); transform: translateY(-1px); }
.tile .rotulo { font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 300; letter-spacing: .03em; }
.tile .valor { font-size: 25px; font-weight: 600; }
.tile .detalhe { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 300; }
.tile .valor.bom { color: var(--good-text); }
.tile .valor.ruim { color: var(--critical); }
.tile .valor.alerta { color: var(--warning); }

/* ---------- cards / tabelas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 18px; }
.card .card-titulo { padding: 13px 18px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--grid); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .card-titulo .dir { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.card .vazio { padding: 26px 18px; color: var(--muted); text-align: center; font-weight: 300; }
.tabela-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--grid); font-weight: 500; }
td { padding: 9px 14px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.linha { cursor: pointer; }
tbody tr.linha:hover { background: rgba(59,130,246,.06); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nome-lead { font-weight: 500; color: #fff; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nome-lead small { display: block; color: var(--muted); font-weight: 300; font-size: 11.5px; }
td.nowrap { white-space: nowrap; }
.atrasada td { background: rgba(239,68,68,.05); }
.hoje-td { color: var(--warning); font-weight: 600; }
.passou-td { color: #f87171; font-weight: 600; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 2.5px 10px; border-radius: 20px; white-space: nowrap; }
.chip::before { font-size: 10px; }
.chip.novo { background: rgba(130,132,141,.16); color: var(--ink-2); }            .chip.novo::before { content: "○"; }
.chip.nao_agendado { background: rgba(250,178,25,.15); color: var(--warning); }  .chip.nao_agendado::before { content: "↻"; }
.chip.nao_existe { background: rgba(130,132,141,.16); color: var(--muted); }     .chip.nao_existe::before { content: "⤫"; }
.chip.agendado { background: rgba(59,130,246,.16); color: var(--brand-ink); }    .chip.agendado::before { content: "📅"; }
.chip.reagendado { background: rgba(59,130,246,.16); color: var(--brand-ink); }  .chip.reagendado::before { content: "↺"; }
.chip.sem_resposta { background: rgba(250,178,25,.15); color: var(--warning); }  .chip.sem_resposta::before { content: "…"; }
.chip.confirmado { background: rgba(12,163,12,.16); color: var(--good-text); }   .chip.confirmado::before { content: "✓"; }
.chip.follow_up { background: rgba(236,131,90,.15); color: var(--serious); }     .chip.follow_up::before { content: "→"; }
.chip.venda { background: rgba(12,163,12,.22); color: var(--good-text); }        .chip.venda::before { content: "★"; }
.chip.perdida { background: rgba(239,68,68,.16); color: #f87171; }               .chip.perdida::before { content: "✕"; }
.chip.etapa { background: rgba(255,255,255,.06); color: var(--ink-2); }
.chip.neutro { background: rgba(130,132,141,.16); color: var(--ink-2); }
.chip.cat { background: rgba(255,255,255,.05); color: var(--muted); font-weight: 400; }

/* ---------- filtros / botões ---------- */
.filtros { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filtros input, .filtros select, .campo input, .campo select, .campo textarea {
  padding: 8px 12px; border: 1px solid var(--grid); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13.5px;
}
.filtros input:focus, .filtros select:focus, .campo input:focus, .campo select:focus, .campo textarea:focus { outline: none; border-color: var(--brand); }
.filtros input[type="text"], .filtros input[type="search"] { width: 260px; max-width: 100%; }
.filtros .conta { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.abas { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.abas button { background: none; border: 1px solid var(--grid); color: var(--ink-2); border-radius: 20px; padding: 6px 14px; cursor: pointer; font-size: 12.5px; }
.abas button.ativa { background: rgba(59,130,246,.16); border-color: var(--brand); color: #fff; }
.abas button .n { color: var(--muted); margin-left: 5px; font-variant-numeric: tabular-nums; }

.btn-pri, .btn-sec, .btn-perigo, .btn-ok, .btn-alerta {
  padding: 9px 16px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; letter-spacing: .02em;
}
.btn-pri { background: var(--brand-grad); color: #fff; }
.btn-pri:hover { filter: brightness(1.12); }
.btn-sec { background: transparent; color: var(--ink-2); border-color: var(--grid); }
.btn-sec:hover { border-color: var(--brand); color: #fff; }
.btn-ok { background: rgba(12,163,12,.2); color: var(--good-text); border-color: rgba(74,222,128,.35); }
.btn-ok:hover { background: rgba(12,163,12,.32); }
.btn-alerta { background: rgba(250,178,25,.14); color: var(--warning); border-color: rgba(250,178,25,.35); }
.btn-alerta:hover { background: rgba(250,178,25,.24); }
.btn-perigo { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.35); }
.btn-perigo:hover { background: rgba(239,68,68,.24); }
button:disabled { opacity: .5; cursor: default; }
.btn-grande { padding: 13px 22px; font-size: 14.5px; }
.paginacao { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- modal do lead ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 28px 14px; overflow-y: auto; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 880px; max-width: 100%; padding: 22px 24px 24px; position: relative; }
.modal.pequeno { width: 460px; }
.modal .fechar { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal .fechar:hover { color: #fff; }
.modal h3 { font-size: 19px; font-weight: 600; margin-bottom: 4px; padding-right: 30px; }
.modal .modal-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; font-weight: 300; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bloco { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.bloco h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.dado { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--grid); font-size: 13px; }
.dado:last-child { border-bottom: 0; }
.dado .k { color: var(--muted); width: 108px; flex-shrink: 0; font-weight: 300; }
.dado .v { flex: 1; min-width: 0; word-break: break-word; }
.dado .v.grande { font-size: 15px; font-weight: 600; color: #fff; }
.link-tel { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-tel a { text-decoration: none; padding: 3px 10px; border-radius: 16px; font-size: 12px; font-weight: 500; }
.link-tel a.wpp { background: rgba(37,211,102,.16); color: #5ee38a; }
.link-tel a.tel { background: rgba(59,130,246,.16); color: var(--brand-ink); }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.acoes button { flex: 1 1 auto; min-width: 120px; padding: 12px 14px; font-size: 13.5px; }
.form-acao { margin-top: 12px; border-top: 1px solid var(--grid); padding-top: 12px; }
.form-acao .titulo-acao { font-weight: 600; margin-bottom: 8px; }
.campo { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.campo label { font-size: 11.5px; color: var(--ink-2); letter-spacing: .05em; text-transform: uppercase; }
.campo textarea { min-height: 64px; resize: vertical; }
.linha-botoes { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.erro-inline { color: var(--critical); font-size: 12.5px; min-height: 16px; margin-top: 6px; }
.historico { list-style: none; max-height: 260px; overflow-y: auto; }
.historico li { padding: 7px 0; border-bottom: 1px dashed var(--grid); font-size: 12.5px; display: flex; gap: 10px; }
.historico li:last-child { border-bottom: 0; }
.historico .quando { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 300; }
.historico .quem { color: var(--brand-ink); font-weight: 500; }
.historico .det { color: var(--ink-2); }
.notas textarea { width: 100%; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--border); z-index: 99; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.toast.erro { background: #3a1a1a; border-color: rgba(239,68,68,.4); }
.toast.ok { background: #14301a; border-color: rgba(74,222,128,.35); }

.papel-check { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; font-size: 13px; }
.aviso { background: rgba(250,178,25,.1); border: 1px solid rgba(250,178,25,.3); color: var(--warning); padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- mobile ---------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 20; padding: 10px 0 0; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--border); background: #09090b; }
  .logo { padding: 4px 16px 8px; font-size: 15px; }
  .nav { display: flex; width: 100%; overflow-x: auto; }
  .nav a { padding: 10px 14px; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13px; }
  .nav a.ativa { border-bottom-color: var(--brand); background: none; }
  .sidebar .rodape { margin: 0 0 0 auto; padding: 4px 16px 8px; display: flex; gap: 8px; align-items: center; }
  .sidebar .rodape button { margin: 0; }
  .sidebar .rodape .nome { display: none; }
  .main { padding: 16px 14px; }
  .grade { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px 20px; }
  .modal-fundo { padding: 10px 6px; }
  .tile .valor { font-size: 21px; }
  .dado .k { width: 90px; }
  .filtros input[type="text"], .filtros input[type="search"] { width: 100%; }
}
