/* Paleta da 2DEP (mesmos valores do site 2dep.com.br): cinza carvão, grafite, névoa e laranja. */
:root {
  color-scheme: light;
  --radius: 0.625rem;
  --radius-md: calc(var(--radius) - 2px);
  --radius-xl: calc(var(--radius) + 4px);
  --carvao: #2D3132;   /* fundo do logo e da faixa do topo, nos dois temas */
  --laranja: #ED8936;

  --background: #F7FAFC;
  --foreground: #2D3132;
  --card: #FFFFFF;
  --muted: #F7FAFC;
  --muted-foreground: #4A5568;
  --border: #E2E8F0;
  --input: #CBD5E0;
  --accent: #E2E8F0;
  --primary: var(--laranja);
  --primary-foreground: #2D3132;
  --ring: var(--laranja);
  --destructive: #C53030;
}
.dark {
  color-scheme: dark;
  --background: #1F2223;
  --foreground: #F7FAFC;
  --card: #2D3132;
  --muted: #1F2223;
  --muted-foreground: #A0AEC0;
  --border: #4A5568;
  --input: #4A5568;
  --accent: #3A4041;
  --destructive: #FC8181;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--background); color: var(--foreground);
  font: 400 14px/1.45 "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif;
}
main { max-width: 920px; margin: 0 auto; padding: 32px 16px 48px; display: grid; gap: 24px; }
[hidden] { display: none !important; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Header de página */
header {
  display: flex; align-items: center; gap: 16px; padding: 12px 20px; flex-wrap: wrap;
  background: var(--carvao); color: #F7FAFC; border-radius: var(--radius-xl); border-bottom: 3px solid var(--laranja);
}
header img { height: 52px; width: auto; display: block; }
header > div:not(.direita) { flex: 1; min-width: 0; }
h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.sub { margin: 0; font-size: 12px; color: #A0AEC0; }
.sub.alerta { color: var(--laranja); font-weight: 600; }
header button.fantasma:hover { background: #4A5568; }
.direita { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Badge semântico: fundo soft, texto na cor, bolinha */
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid;
  padding: 4px 8px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.pill.teste { background: transparent; color: #E2E8F0; border-color: #718096; }
.pill.producao { background: var(--laranja); color: var(--carvao); border-color: var(--laranja); }

/* Card */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 24px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.card h2 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.bloco { background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px; margin-top: 12px; }
.dark .bloco { background: var(--background); }

/* Campos */
label { display: block; font-size: 12px; color: var(--muted-foreground); margin: 16px 0 6px; }
.campos > label:first-child, .campos > .grade:first-child label { margin-top: 0; }
input, select {
  width: 100%; height: 36px; padding: 0 12px; font: inherit; color: inherit;
  background: var(--background); border: 1px solid var(--input); border-radius: var(--radius-md);
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid color-mix(in oklab, var(--ring) 55%, transparent); outline-offset: 1px; }
.grade { display: grid; gap: 12px; grid-template-columns: repeat(var(--col, 2), minmax(0, 1fr)); }
.grade.c3 { grid-template-columns: 1fr 2fr 1fr; }
.linha { display: flex; gap: 8px; }
.linha > input, .linha > select { flex: 1; min-width: 0; }
@media (max-width: 520px) { .grade, .grade.c3 { grid-template-columns: 1fr; gap: 0; } }

/* Botões */
button {
  height: 36px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent;
  font: inherit; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
button.primario { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
button.primario:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
button.contorno { background: var(--background); border-color: var(--input); color: inherit; box-shadow: 0 1px 2px rgb(0 0 0 / 0.05); }
button.fantasma { background: transparent; color: inherit; padding: 0 10px; }
button.contorno:hover, button.fantasma:hover { background: var(--accent); }
button:disabled { opacity: 0.5; pointer-events: none; }
.acoes { display: flex; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.acoes.curta { margin-top: 16px; }

/* Avisos e erro */
.nota-info { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted-foreground); }
.nota-info svg { margin-top: 1px; }
.erro {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius); font-size: 14px; color: var(--destructive);
  border: 1px solid color-mix(in oklab, var(--destructive) 40%, transparent);
  background: color-mix(in oklab, var(--destructive) 10%, transparent);
}

/* Resumo da prévia: linhas, não tabela */
.resumo { display: grid; gap: 8px; }
.item { display: flex; gap: 16px; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 12px 16px; }
.item span:first-child { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-foreground); padding-top: 3px; }
.item span:last-child { text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.item .destaque { font-size: 24px; font-weight: 700; color: var(--foreground); line-height: 1.1; }
details { margin-top: 12px; font-size: 12px; color: var(--muted-foreground); }
summary { cursor: pointer; }
pre { margin: 8px 0 0; padding: 12px; background: var(--muted); border-radius: var(--radius); font-size: 11px; white-space: pre-wrap; word-break: break-all; max-height: 260px; overflow: auto; color: var(--foreground); }
.dark pre { background: var(--background); }

/* Navegação entre telas (dentro da faixa do topo) */
nav { flex-basis: 100%; display: flex; gap: 4px; border-top: 1px solid #4A5568; margin: 4px -4px -4px; padding-top: 8px; }
nav a { color: #CBD5E0; text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: var(--radius-md); }
nav a:hover { background: #3A4041; color: #F7FAFC; }
nav a.ativa { background: var(--laranja); color: var(--carvao); }

/* Seções com tabela de notas */
.cabecalho-secao { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cabecalho-secao .linha { align-items: center; }
.cabecalho-secao select { width: auto; min-width: 170px; }
.titulo-secao { margin: 0; font-size: 16px; font-weight: 600; }
.card.tabela { padding: 0; overflow: auto; max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { position: sticky; top: 0; background: var(--muted); text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
     font-weight: 600; color: var(--muted-foreground); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td small { display: block; font-size: 11px; color: var(--muted-foreground); }
td.acoes-nota { white-space: nowrap; }
td.acoes-nota button + button { margin-left: 6px; }
tr.aviso-linha td { font-size: 12px; color: var(--muted-foreground); padding-top: 0; overflow-wrap: anywhere; }
td.vazio-tabela { text-align: center; color: var(--muted-foreground); padding: 40px 16px; }
button.pequeno { height: 30px; padding: 0 10px; font-size: 12px; }
.etiqueta { display: inline-block; border: 1px solid var(--input); border-radius: 999px; padding: 1px 8px; font-size: 11px; color: var(--muted-foreground); }
.sub-nota { margin: 8px 4px 0; font-size: 12px; color: var(--muted-foreground); overflow-wrap: anywhere; }

/* Configurações */
.ajuda { margin: 8px 0 0; font-size: 12px; color: var(--muted-foreground); }
.ajuda code { font-size: 11px; background: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
.grade.c3i { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .grade.c3i { grid-template-columns: 1fr; gap: 0; } }
select { text-overflow: ellipsis; }

/* Tela de entrada e botão sair */
main.estreito { max-width: 420px; padding-top: 64px; }
header form { margin: 0; }
