:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #17202a;
  --ink-2: #4b5563;
  --ink-3: #8a94a3;
  --line: #e3e6eb;
  --brand: #0f4c5c;
  --brand-2: #e8f1f3;
  --accent: #e0a526;
  --ok: #1f8a4c;
  --ok-bg: #e6f4ec;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --info: #2563a8;
  --info-bg: #e8f0fa;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --c-lancado: #64748b;
  --c-enviado: #2563a8;
  --c-sem_resposta: #b45309;
  --c-respondido: #7c3aed;
  --c-finalizado: #1f8a4c;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1 { font-size: 20px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 20px;
  background: var(--brand); color: #fff;
}
.marca { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; text-decoration: none; white-space: nowrap; }
.marca-logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--brand); font-weight: 800;
}
.marca small { font-weight: 500; opacity: .7; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a {
  color: rgba(255,255,255,.78); text-decoration: none; padding: 7px 12px; border-radius: 7px; white-space: nowrap; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.ativo { background: rgba(255,255,255,.14); color: #fff; }
.topo-dir { display: flex; align-items: center; gap: 10px; }
.sino {
  position: relative; background: transparent; border: 0; color: #fff; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px; font-size: 18px;
}
.sino:hover { background: rgba(255,255,255,.1); }
.sino-badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--brand); font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
}
.usuario { position: relative; }
.usuario > button {
  background: rgba(255,255,255,.1); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; cursor: pointer; font: inherit;
}
.menu {
  position: absolute; right: 0; top: 44px; min-width: 200px; background: var(--surface); color: var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink);
  text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.notif-painel { width: 340px; max-height: 420px; overflow: auto; padding: 0; }
.notif-painel header { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; }
.notif-item { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.notif-item:hover { background: var(--surface-2); }
.notif-item.nova { background: #fffbeb; }
.notif-vazio { padding: 24px 12px; text-align: center; color: var(--ink-3); }

/* ---------- layout ---------- */
.pagina { padding: 20px; max-width: 1600px; margin: 0 auto; }
.pagina.estreita { max-width: 980px; }
.cabeca { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }

/* ---------- formulários ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 5px; color: var(--ink-2); }
.campo { margin-bottom: 14px; }
.campo .dica { font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search],
input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff;
  font: inherit; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(15,76,92,.25); border-color: var(--brand); }
textarea { resize: vertical; min-height: 70px; }
.grade { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grade .campo { margin-bottom: 0; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
.check input { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 8px; border: 1px solid #cfd4dc; background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn-pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-pri:hover { background: #0c3d4a; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #18733f; }
.btn-zap { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-zap:hover { background: #188c46; }
.btn-perigo { color: var(--bad); border-color: #f1c4bf; }
.btn-perigo:hover { background: var(--bad-bg); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.alerta { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.alerta.ok { background: var(--ok-bg); color: var(--ok); }
.alerta.erro { background: var(--bad-bg); color: var(--bad); }
.alerta.info { background: var(--info-bg); color: var(--info); }

/* ---------- tabelas ---------- */
.tabela { width: 100%; border-collapse: collapse; background: var(--surface); }
.tabela th, .tabela td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tabela th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: var(--surface-2); position: sticky; top: 0; }
.tabela tr:hover td { background: #fbfcfd; }
.tabela-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: 70vh; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.tag.roxo { background: #f1ebfe; color: #6d28d9; border-color: transparent; }

.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.abas a, .abas button {
  padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border: 0; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; font: inherit; white-space: nowrap;
}
.abas .ativo { color: var(--brand); border-bottom-color: var(--brand); }

/* ---------- filtros + kanban ---------- */
.filtros {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px;
}
.filtros .campo { margin: 0; min-width: 150px; }
.filtros .campo.busca { flex: 1; min-width: 220px; }
.filtros label { font-size: 12px; }

.quadro {
  display: grid; grid-template-columns: repeat(5, minmax(260px, 1fr)); gap: 12px;
  overflow-x: auto; padding-bottom: 8px; align-items: start;
}
.coluna {
  background: #eceef2; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 200px;
}
.coluna-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 8px;
  border-top: 3px solid var(--cor); border-radius: 12px 12px 0 0;
}
.coluna-topo h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.coluna-topo .contagem { background: #fff; border-radius: 999px; padding: 1px 9px; font-weight: 700; font-size: 12px; color: var(--cor); }
.coluna-total { padding: 0 12px 8px; font-size: 12px; color: var(--ink-3); }
.coluna-corpo { padding: 4px 8px 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.coluna.sobre { outline: 2px dashed var(--cor); outline-offset: -4px; }
.coluna-vazia { color: var(--ink-3); text-align: center; padding: 20px 8px; font-size: 13px; }

.tcard {
  background: var(--surface); border-radius: 9px; padding: 10px 11px; box-shadow: var(--shadow);
  border-left: 3px solid var(--cor); cursor: pointer; position: relative; transition: transform .08s;
}
.tcard:hover { box-shadow: 0 4px 12px rgba(16,24,40,.12); }
.tcard.arrastando { opacity: .4; }
.tcard.novo { animation: pisca 1.6s ease 2; }
@keyframes pisca { 50% { background: #fff7e0; } }
.tcard-l1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tcard-valor { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.tcard-data { font-size: 12px; color: var(--ink-3); }
.tcard-desc { font-weight: 500; margin: 3px 0 6px; word-break: break-word; padding-right: 18px; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tcard-resp { margin-top: 7px; padding: 6px 8px; background: #f5f0ff; border-radius: 6px; font-size: 12px; color: #4c1d95; }
.tcard-final { margin-top: 7px; padding: 6px 8px; background: var(--ok-bg); border-radius: 6px; font-size: 12px; color: #14532d; }
.tcard-sel { position: absolute; top: 9px; right: 9px; width: 16px; height: 16px; }
.empresa-chip { font-size: 11px; font-weight: 700; color: var(--brand); background: var(--brand-2); padding: 1px 7px; border-radius: 4px; }

.barra-lote {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 35;
  background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 12px 10px 18px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-lg);
}

/* ---------- gaveta de detalhes ---------- */
.fundo { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 50; }
.gaveta {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 51;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
}
.gaveta-topo { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.gaveta-corpo { padding: 18px 20px; overflow-y: auto; flex: 1; }
.gaveta-rodape { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.fechar { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--ink-3); line-height: 1; padding: 4px; }
.secao { margin-bottom: 20px; }
.secao h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 10px; }
.dados { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; }
.dados dt { color: var(--ink-3); }
.dados dd { margin: 0; font-weight: 500; word-break: break-word; }
.caixa-link { display: flex; gap: 6px; }
.caixa-link input { font-family: ui-monospace, monospace; font-size: 12px; background: var(--surface-2); }
.resposta { background: #f5f0ff; border: 1px solid #e4d8fd; border-radius: 10px; padding: 12px 14px; }
.resposta-cat { font-size: 16px; font-weight: 700; color: #4c1d95; margin-bottom: 4px; }
.validacao { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.fontes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.historico { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.historico li { padding: 6px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; gap: 10px; }

/* combobox com busca */
.combo { position: relative; }
.combo-lista {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 60; background: #fff;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto;
}
.combo-op { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; }
.combo-op:hover, .combo-op.foco { background: var(--brand-2); }
.combo-op .cod { font-family: ui-monospace, monospace; color: var(--ink-3); font-size: 12px; min-width: 70px; }

.toast-area { position: fixed; right: 20px; bottom: 20px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 360px; animation: entra .2s ease; }
.toast.ok { background: var(--ok); }
.toast.erro { background: var(--bad); }
.toast a { color: #fff; font-weight: 700; }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #0f4c5c 0%, #0b2f39 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 30px; box-shadow: var(--shadow-lg); }
.login-card .marca { color: var(--ink); margin-bottom: 22px; font-size: 18px; }
.login-card .btn { width: 100%; padding: 11px; }

.sucesso-link { text-align: center; padding: 26px 18px; }
.sucesso-link .icone { font-size: 40px; }
.passos { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .topo { gap: 10px; padding: 0 12px; }
  .marca small { display: none; }
  .pagina { padding: 14px; }
  .quadro { grid-template-columns: repeat(5, 86vw); scroll-snap-type: x mandatory; }
  .coluna { scroll-snap-align: start; }
  .dados { grid-template-columns: 1fr; }
  .dados dt { margin-top: 6px; }
}
.tcard:has(.tcard-sel) .tcard-l1 { padding-right: 24px; }
