/* ===== Reset / Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", Calibri, Arial, sans-serif;
  font-size: 14px;
  background: #f0f2f5;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Header ===== */
header {
  background: #1b5e20;
  color: #fff;
  padding: 0 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 28px; }
.logo-title { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.logo-sub { font-size: 11px; opacity: .75; }

/* ===== Main ===== */
main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Cards ===== */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.card h2 {
  font-size: 15px;
  font-weight: 700;
  color: #1b5e20;
  border-bottom: 2px solid #70ad47;
  padding-bottom: 8px;
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== Arquivos detectados ===== */
.arquivos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) { .arquivos-grid { grid-template-columns: 1fr; } }

.arquivo-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #fafafa;
}

.arquivo-item.ok  { border-color: #70ad47; background: #f1fce7; }
.arquivo-item.erro { border-color: #e53935; background: #fff5f5; }

.arquivo-icon { font-size: 22px; margin-top: 2px; }
.arquivo-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: .4px; }
.arquivo-nome { font-size: 13px; font-weight: 600; color: #222; margin-top: 2px; word-break: break-all; }
.arquivo-data { font-size: 11px; color: #888; margin-top: 2px; }

/* ===== Formulário ===== */
.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.field-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #888;
  margin-top: 2px;
}

.field input[type="text"],
.field input[type="file"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
  transition: border-color .2s;
  background: #fafafa;
}

.field input[type="text"]:focus,
.field input[type="file"]:focus {
  outline: none;
  border-color: #70ad47;
  background: #fff;
}

/* ===== Botões ===== */
.btn-group { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: filter .15s, opacity .15s;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(.92); }

.btn-primary  { background: #1b5e20; color: #fff; }
.btn-success  { background: #70ad47; color: #fff; }
.btn-secondary { background: #5c5e5b; color: #fff; }

.btn.loading::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-left: 4px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Status ===== */
.status-msg {
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
}

.status-ok   { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.status-erro { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* ===== NF Info ===== */
.nf-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #f5f9f2;
  border-radius: 6px;
  border: 1px solid #c8e6c9;
  font-size: 13px;
}

.nf-info span { white-space: nowrap; }
.arquivo-usado { color: #666; font-size: 12px; }

/* ===== Tabela de preview ===== */
.tabela-wrapper { overflow-x: auto; }

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

thead th {
  background: #5c5e5b;
  color: #fff;
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

tbody tr:nth-child(even) { background: #daf2d0; }
tbody tr:nth-child(odd)  { background: #fff; }
tbody tr:hover           { filter: brightness(.97); }

tbody td, tfoot td { padding: 8px 12px; vertical-align: middle; }

.col-num   { text-align: center; }
.col-valor { text-align: right; font-variant-numeric: tabular-nums; }

tfoot .row-total td {
  background: #70ad47;
  color: #fff;
  font-size: 13px;
  border-top: 2px solid #4e8230;
}

.dept-cod { color: #888; font-size: 12px; }

/* ===== Aviso preços ===== */
.aviso-licencas {
  margin-top: 16px;
  padding: 12px 14px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 6px;
  font-size: 13px;
  color: #5d4037;
}

.aviso-licencas strong { display: block; margin-bottom: 8px; }
.preco-item { margin: 4px 0; }
.preco-item code {
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
}

/* ===== Card de divergências ===== */
.card-div { border-left: 4px solid #f59e0b; }
.card-div h2 { color: #b45309; border-bottom-color: #f59e0b; }

.div-descricao {
  font-size: 13px;
  color: #555;
  margin-bottom: 16px;
  line-height: 1.5;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-pos { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-neg { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

.lic-code {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  color: #475569;
}

.select-depto {
  width: 100%;
  min-width: 220px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 13px;
  background: #fafafa;
  cursor: pointer;
  transition: border-color .2s;
}

.select-depto:focus { outline: none; border-color: #70ad47; background: #fff; }
.select-depto.select-erro { border-color: #ef4444; background: #fff5f5; }

/* ===== Status aviso (amarelo) ===== */
.status-aviso { background: #fffbeb; color: #92400e; border: 1px solid #fcd34d; }

/* ===== Alertas de consistência ===== */
.card-alertas { border-left: 4px solid #dc2626; }
.card-alertas h2 { color: #991b1b; border-bottom-color: #dc2626; }

.alerta-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

.alerta-item:last-child { margin-bottom: 0; }

.alerta-icone { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.alerta-critico {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

.alerta-aviso {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
}

.alerta-info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: #888;
  border-top: 1px solid #ddd;
  margin-top: 16px;
}
