/*
  THESIS: a triage ledger, not a marketing dashboard -- every screen reads
  like a logbook Marcus can trust without anyone standing behind him.
  OWN-WORLD: near-black warm ground, one gold accent lifted from the
  existing Vaguinho WhatsApp badge, hairline gold-tinted borders, tabular
  data set in monospace so numbers/phones/JIDs line up and stay scannable.
  STORY: Marcus opens Dados, sees status counts at a glance, filters by
  decisao/status, and never needs to reopen WhatsApp to find a vaga.
  FIRST VIEWPORT: fixed left rail (wordmark + 5 nav items) + topbar with
  page title, content area leads with a status-count strip then the table.
  FORM: internal operations ledger, Restrained color strategy (neutrals +
  one gold accent), system-ui + ui-monospace type, no borrowed SaaS chrome.
*/

:root {
  --ground: #14110d;
  --surface: #1c1811;
  --surface-raised: #221c14;
  --border: rgba(212, 175, 55, 0.16);
  --border-strong: rgba(212, 175, 55, 0.32);
  --text: #f2ead9;
  --text-muted: #a89c86;
  --text-faint: #6f6553;
  --gold: #d4a017;
  --gold-bright: #e8bc3f;
  --gold-wash: rgba(212, 160, 23, 0.12);
  --ok: #6fbf73;
  --ok-wash: rgba(111, 191, 115, 0.12);
  --warn: #e0a941;
  --warn-wash: rgba(224, 169, 65, 0.12);
  --danger: #c96a53;
  --danger-wash: rgba(201, 106, 83, 0.12);
  --radius: 10px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; }

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.marca {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.marca .selo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--gold-bright), var(--gold) 60%, #8a6a10);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #1a1408;
  font-size: 15px;
  flex: none;
}

.marca .nome {
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 15px;
}

.marca .sub {
  display: block;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
}

nav.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

nav.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}

nav.nav a:hover {
  background: var(--surface-raised);
  color: var(--text);
}

nav.nav a.ativo {
  background: var(--gold-wash);
  color: var(--gold-bright);
}

nav.nav .icone {
  width: 16px;
  text-align: center;
  flex: none;
}

.rail-footer {
  margin-top: auto;
  padding: 10px 8px;
  font-size: 11px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
}

main.conteudo {
  padding: 28px 36px 60px;
  max-width: 1180px;
}

.topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}

.topo h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.topo p.legenda {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.contagens {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.contagem {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.contagem .n {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.contagem .rotulo {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.contagem.publicar .n { color: var(--ok); }
.contagem.pendente .n { color: var(--warn); }
.contagem.nao_publicar .n { color: var(--danger); }
.contagem.fila .n { color: var(--gold-bright); }

.painel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.filtros {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  align-items: center;
}

input[type="text"], input[type="search"], select, textarea {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 10px;
  font-family: var(--font-ui);
  font-size: 13px;
}

textarea { font-family: var(--font-mono); width: 100%; resize: vertical; }

input:focus, select:focus, textarea:focus, button:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px var(--gold-wash);
}

.busca { flex: 1; min-width: 180px; }

button, .botao {
  background: var(--gold);
  color: #1a1408;
  border: none;
  border-radius: 7px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}

button:hover, .botao:hover { background: var(--gold-bright); }

button.secundario, .botao.secundario {
  background: var(--surface-raised);
  color: var(--text);
  border: 1px solid var(--border);
}

button.secundario:hover { border-color: var(--border-strong); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-raised); }

td.mono, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-muted); }

.selo-decisao {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.selo-decisao.PUBLICAR { background: var(--ok-wash); color: var(--ok); }
.selo-decisao.PENDENTE { background: var(--warn-wash); color: var(--warn); }
.selo-decisao.NAO_PUBLICAR { background: var(--danger-wash); color: var(--danger); }

.selo-status {
  font-size: 11px;
  color: var(--text-faint);
}

.vazio {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
}

.grade-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 900px) {
  .grade-2 { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
}

.cartao {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.cartao h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.cartao .meta {
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.lista-grupos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.linha-grupo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
}

.linha-grupo .nome-grupo { flex: 1; }

.badge {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.badge.on { color: var(--ok); border-color: var(--ok); }
.badge.off { color: var(--text-faint); }
.badge.agenciador { color: var(--danger); border-color: var(--danger); }

.status-ponto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: var(--text-faint);
}

.status-ponto.conectado { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-wash); }
.status-ponto.conectando { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-wash); }
.status-ponto.erro { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash); }

.abas {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.aba {
  padding: 9px 4px;
  margin-right: 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}

.aba.ativa { color: var(--gold-bright); border-bottom-color: var(--gold); }

.painel-conteudo { padding: 18px; }

.ficha {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: pre-wrap;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text-muted);
}

.form-linha {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-linha label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.aviso {
  background: var(--warn-wash);
  border: 1px solid rgba(224, 169, 65, 0.4);
  color: var(--warn);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

.htmx-request .indicador-carregando { display: inline-block; }
.indicador-carregando { display: none; }
