/* Layout e componentes (spec seções 15.2–15.6). */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Topo 64px ===== */
.topo {
  position: sticky; top: 0; z-index: 50;
  height: 64px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: color-mix(in srgb, var(--surface-1) 85%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topo .logo {
  font-weight: 600; font-size: 16px; color: var(--text-1);
  display: flex; align-items: center; gap: 8px;
}
.topo .logo .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); }

/* Pílula de navegação central */
.nav-pilula {
  margin: 0 auto;
  display: flex; gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.nav-pilula a {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}
.nav-pilula a:hover { color: var(--text-1); text-decoration: none; }
.nav-pilula a.ativa { background: var(--lime); color: #0B0E14; }

.topo .acoes { display: flex; align-items: center; gap: 10px; }
.topo .usuario-inicial {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-1);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* ===== Sidebar 64px ===== */
.leiaute { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 64px; flex: 0 0 64px;
  background: color-mix(in srgb, var(--surface-1) 85%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px;
}
.sidebar a {
  position: relative;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-ctl);
  color: var(--text-2);
  border-left: 2px solid transparent;
}
.sidebar a:hover { background: var(--surface-3); color: var(--text-1); text-decoration: none; }
.sidebar a.ativa { background: var(--surface-3); color: var(--text-1); border-left-color: var(--lime); }
.sidebar a .dica {
  display: none; position: absolute; left: 54px; top: 50%; transform: translateY(-50%);
  background: var(--surface-3); color: var(--text-1);
  padding: 4px 10px; border-radius: var(--radius-ctl);
  font-size: 12px; white-space: nowrap; border: 1px solid var(--border);
  z-index: 60;
}
.sidebar a:hover .dica { display: block; }

/* ===== Conteúdo ===== */
.conteudo { flex: 1; max-width: 1440px; padding: 24px; width: 100%; margin: 0 auto; }
.cabecalho-pagina { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.cabecalho-pagina h1 { font-size: 24px; font-weight: 600; margin: 0; }
.cabecalho-pagina .acoes { margin-left: auto; display: flex; gap: 8px; }
h2 { font-size: 16px; font-weight: 600; }

/* ===== Cards ===== */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}
.grid-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1280px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }

.metric-card { position: relative; }
.metric-card .rotulo {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-2);
}
.metric-card .valor {
  font-size: 28px; font-weight: 600; color: var(--text-1);
  font-variant-numeric: tabular-nums;
  margin: 6px 0 2px;
}
.metric-card .contexto { font-size: 12px; }
.metric-card .contexto.sobe { color: var(--lime); }
.metric-card .contexto.desce { color: var(--red); }
.metric-card .rodape { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.metric-card .ir {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-1); border: 1px solid var(--border);
}
.metric-card .ir:hover { background: var(--lime); color: #0B0E14; text-decoration: none; }
.barra-progresso { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); margin-top: 10px; overflow: hidden; }
.barra-progresso > div { height: 100%; border-radius: var(--radius-pill); background: var(--lime); }

/* ===== Pílulas de status ===== */
.pilula {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500;
}
.pilula.lime { background: var(--lime-bg); color: var(--lime); }
.pilula.amber { background: var(--amber-bg); color: var(--amber); }
.pilula.red { background: var(--red-bg); color: var(--red); }
.pilula.blue { background: var(--blue-bg); color: var(--blue); }
.pilula.neutra { background: var(--surface-3); color: var(--text-2); }

/* ===== Tabela ===== */
.tabela-envelope { overflow-x: auto; border-radius: var(--radius-card); border: 1px solid var(--border); background: var(--surface-1); }
table.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tabela th {
  position: sticky; top: 0;
  background: var(--surface-1);
  text-align: left; font-weight: 500; color: var(--text-2);
  padding: 0 12px; height: 40px;
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}
table.tabela td { padding: 0 12px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tabela tbody tr:nth-child(even) { background: var(--surface-2); }
table.tabela tbody tr:hover { background: var(--surface-3); }
table.tabela .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tabela .mono { font-family: var(--font-mono); font-size: 12px; }
table.tabela td.acoes { text-align: right; }
table.tabela td.acoes a { visibility: hidden; }
table.tabela tr:hover td.acoes a { visibility: visible; }

.rodape-tabela {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; color: var(--text-3); font-size: 12px;
}
.rodape-tabela .paginas { display: flex; gap: 6px; }
.rodape-tabela .paginas a, .rodape-tabela .paginas span {
  padding: 3px 10px; border-radius: var(--radius-ctl); border: 1px solid var(--border);
}
.rodape-tabela .paginas span.atual { background: var(--surface-3); color: var(--text-1); }

/* Chips de filtro */
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px;
}
.chip:hover { background: var(--surface-3); text-decoration: none; }
.chip.ativa { background: var(--blue-bg); color: var(--blue); border-color: transparent; }

/* ===== Botões ===== */
.botao {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 18px;
  border-radius: var(--radius-ctl);
  border: 1px solid transparent;
  font: inherit; font-weight: 500; cursor: pointer;
  background: transparent; color: var(--text-1);
}
.botao.primario { background: var(--lime); color: #0B0E14; font-weight: 600; }
.botao.primario:hover { filter: brightness(1.08); }
.botao.secundario { border-color: var(--border-strong); }
.botao.secundario:hover { background: var(--surface-3); }
.botao.perigo { border-color: var(--red); color: var(--red); }
.botao.perigo:hover { background: var(--red-bg); }
a.botao:hover { text-decoration: none; }

/* ===== Formulários ===== */
.formulario { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; max-width: 860px; }
.formulario .campo-largo { grid-column: 1 / -1; }
.campo label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.campo input[type="text"], .campo input[type="password"], .campo input[type="email"],
.campo input[type="date"], .campo input[type="number"], .campo select, .campo textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--radius-ctl);
  font: inherit;
}
.campo textarea { height: auto; padding: 10px 12px; }
.campo input:focus, .campo select:focus, .campo textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-bg);
}
.campo .erro { color: var(--red); font-size: 12px; margin-top: 4px; }
.campo-check { display: flex; align-items: center; gap: 8px; padding-top: 24px; }
.campo-check label { margin: 0; font-size: 13px; color: var(--text-1); }

/* ===== Toast / flash ===== */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  padding: 12px 18px; border-radius: var(--radius-ctl);
  background: var(--surface-1); border: 1px solid var(--border-strong);
  color: var(--text-1); font-size: 13px;
  animation: aparecer .15s ease-out;
  border-left: 3px solid var(--blue);
}
.toast.lime { border-left-color: var(--lime); }
.toast.red { border-left-color: var(--red); }
.toast.amber { border-left-color: var(--amber); }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ===== Estado vazio ===== */
.estado-vazio {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 48px 20px; color: var(--text-2); text-align: center;
}
.estado-vazio svg { width: 32px; height: 32px; color: var(--text-3); }

/* ===== Login ===== */
.pagina-login {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.pagina-login .card { width: 380px; padding: 32px; }
.pagina-login h1 { font-size: 24px; margin: 0 0 4px; }
.pagina-login .sub { color: var(--text-2); margin: 0 0 24px; font-size: 13px; }
.pagina-login .campo { margin-bottom: 16px; }
.pagina-login .botao { width: 100%; justify-content: center; }

/* ===== JSON da auditoria ===== */
details.json-detalhe summary { cursor: pointer; color: var(--blue); font-size: 12px; }
details.json-detalhe pre {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-ctl); padding: 10px; margin: 6px 0 0;
  max-width: 480px; overflow-x: auto; white-space: pre-wrap;
}

/* Grid de atalhos de cadastros */
.grid-atalhos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.atalho { display: flex; align-items: center; gap: 12px; color: var(--text-1); }
.atalho:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); }
.atalho .icone {
  width: 40px; height: 40px; border-radius: var(--radius-ctl);
  background: var(--surface-3); display: flex; align-items: center; justify-content: center;
  color: var(--lime);
}
.atalho small { display: block; color: var(--text-3); }

/* ---- Fase 10: formulário de usuários ---- */
.campo .dica-campo, .dica-campo { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.lista-opcoes { display: flex; flex-direction: column; gap: 8px; }
.lista-opcoes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-opcoes li, .lista-opcoes .opcao { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-1); }
.lista-opcoes li label, .lista-opcoes .opcao span { margin: 0; font-size: 13px; color: var(--text-1); }
