@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 400;
  src: url('vendor/fonts/SpaceGrotesk-400.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500;
  src: url('vendor/fonts/SpaceGrotesk-500.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 600;
  src: url('vendor/fonts/SpaceGrotesk-600.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 700;
  src: url('vendor/fonts/SpaceGrotesk-700.woff2') format('woff2');
  font-display: swap;
}

:root {
  --bg: #101010;
  --surface: #1b1b1a;
  --surface-2: #262420;
  --border: #3a352c;
  --text: #f1ece0;
  --text-muted: #ada58f;

  --gold: #c9a227;
  --gold-bright: #e2bd3d;
  --gold-dark: #8f7115;
  --on-gold: #171205;

  --sat: #4e8f5c;
  --sat-ap: #c9a227;
  --insat: #c0483a;
  --na: #6f6a5e;

  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.topbar {
  background: #000000;
  color: var(--text);
  border-bottom: 1px solid var(--gold-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  flex-wrap: wrap;
  gap: 10px;
}

.brand { display: flex; flex-direction: column; }
.brand-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.brand-sub { font-size: 11.5px; color: var(--text-muted); }

.tabs { display: flex; gap: 6px; }
.tab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
}
.tab-btn:hover { background: rgba(201, 162, 39, 0.12); color: var(--text); }
.tab-btn.active { background: var(--gold); color: var(--on-gold); font-weight: 700; border-color: var(--gold); }

main#app { padding: 20px 26px 60px; max-width: 1300px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

.subtabs { display: flex; gap: 8px; margin: 14px 0 20px; border-bottom: 1px solid var(--border); padding-bottom: 14px; flex-wrap: wrap; }
.subtab-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.subtab-btn:hover { background: rgba(201, 162, 39, 0.1); color: var(--text); }
.subtab-btn.active { background: transparent; color: var(--gold); border-color: var(--gold); font-weight: 700; }

.subview { display: none; }
.subview.active { display: block; }

h1 { font-size: 21px; margin: 4px 0 6px; color: var(--gold); font-weight: 700; }
h2 { font-size: 16px; margin: 26px 0 8px; color: var(--gold); font-weight: 600; }
h3 { font-size: 14.5px; margin: 0 0 10px; color: var(--gold); font-weight: 600; }

.hint { color: var(--text-muted); max-width: 900px; margin: 0 0 16px; line-height: 1.5; }

hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.dragover { border-color: var(--gold); background: rgba(201, 162, 39, 0.08); }
.dropzone-inner { display: flex; flex-direction: column; gap: 6px; color: var(--text-muted); }
.dropzone-inner strong { color: var(--gold); font-size: 16px; }

.import-results { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.import-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--sat);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
}
.import-item.warn { border-left-color: var(--sat-ap); background: #241f10; }
.import-item.error { border-left-color: var(--insat); background: #2a1613; }
.import-item.duplicate { border-left-color: var(--na); opacity: 0.75; }
.import-item .fname { font-weight: 600; color: var(--text); }
.import-item .warnlist { margin: 6px 0 0 16px; color: #d8c17e; }

.import-summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  padding: 4px 2px 2px;
}

.data-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

button {
  background: var(--gold);
  color: var(--on-gold);
  border: 1px solid var(--gold);
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { background: rgba(255,255,255,0.06); }
button.danger { background: var(--insat); color: #fff; border-color: var(--insat); }
button.danger:hover { background: #d6584a; border-color: #d6584a; }
button.small { padding: 4px 9px; font-size: 12px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
table.data-table th, table.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.data-table th { background: var(--surface-2); color: var(--gold); font-weight: 600; white-space: nowrap; }
table.data-table tbody tr:hover { background: rgba(201, 162, 39, 0.06); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.badge.sat { background: var(--sat); color: #fff; }
.badge.sat-ap { background: var(--sat-ap); color: var(--on-gold); }
.badge.insat { background: var(--insat); color: #fff; }
.badge.na { background: var(--na); color: #fff; }

.filters {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 170px; }
.filter-field.grow { flex: 1; min-width: 260px; }
.filter-field label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.filter-field select, .filter-field input {
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text);
}
.filter-field select:focus, .filter-field input:focus { outline: 1px solid var(--gold); }

.cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 160px;
  flex: 1;
}
.card .num { font-size: 26px; font-weight: 700; color: var(--gold); }
.card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

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

.chart { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.chart-row { display: grid; grid-template-columns: 190px 1fr 40px; align-items: center; gap: 8px; font-size: 12.5px; }
.chart-row .bar-label { text-align: right; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-bar-bg { background: var(--surface-2); border-radius: 4px; height: 14px; position: relative; }
.chart-bar-fill { background: var(--gold); height: 100%; border-radius: 4px; }
.chart-row .bar-value { color: var(--text-muted); }

.gerador-toolbar { display: flex; gap: 10px; margin-bottom: 10px; }
#servidorTexto, #avParagrafo, #avConclusao {
  width: 100%;
  font-family: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  resize: vertical;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--gold-dark);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }

.empty-msg { color: var(--text-muted); font-style: italic; padding: 10px 0; }

/* Tabelas "prontas para copiar e colar" no Gerador de Texto: deliberadamente claras (fundo
   branco, texto escuro), mesmo com o app em tema escuro — para que, ao colar no Word, o
   resultado seja uma tabela de documento normal, não um bloco com fundo preto. */
table.copy-table,
table.copy-table th,
table.copy-table td {
  background: #ffffff;
  color: #161616;
  border: 1px solid #999999;
}
table.copy-table th {
  background: #1f3864;
  color: #ffffff;
  font-weight: 700;
}
table.copy-table tbody tr:hover { background: #f2f2f2; }
table.copy-table .empty-msg { color: #666666; }

ol#avFalhas, ol#avFalhas li { color: var(--text); }
