:root {
  --primary: #1e3a8a;
  --primary-hover: #1d4ed8;
  --success: #15803d;
  --success-hover: #166534;
  --danger: #b91c1c;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #cbd5e1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  padding: 24px;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.top-header h1 {
  font-size: 1.6rem;
  color: var(--primary);
}

.top-header p {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 4px;
}

.btn-secondary {
  width: auto;
  background: #334155;
  padding: 10px 16px;
  font-size: 0.9rem;
  margin-top: 0;
}

.btn-secondary:hover {
  background: #1e293b;
}

.xml-card {
  margin-bottom: 20px;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
}

.xml-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.xml-box input[type="file"] {
  background: #ffffff;
  padding: 7px;
  font-size: 0.85rem;
}

.xml-status {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  color: #0369a1;
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 820px) {
  .grid, .xml-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
}

.card h2 {
  font-size: 1.12rem;
  margin-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.form-group {
  margin-bottom: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-empresa {
  display: grid;
  grid-template-columns: 0.85fr 1.45fr;
  gap: 12px;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: #334155;
}

input, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.94rem;
}

.btn-group {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
  margin-top: 8px;
}

button {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--primary-hover);
}

.btn-success {
  background: var(--success);
}

.btn-success:hover {
  background: var(--success-hover);
}

.badge {
  display: inline-block;
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.cards-resumo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}

.box.destaque {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.box h3 {
  font-size: 0.9rem;
  color: #475569;
  margin-bottom: 6px;
}

.box .valor {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.box .sub {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

.detalhes {
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
}

.detalhes h4 {
  font-size: 0.88rem;
  margin-bottom: 8px;
  color: #334155;
}

.detalhes ul {
  list-style: none;
  font-size: 0.88rem;
}

.detalhes li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #e2e8f0;
}

.detalhes li:last-child {
  border-bottom: none;
}

.parecer {
  background: #fefce8;
  border-left: 4px solid #eab308;
  padding: 12px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #713f12;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}

.btn-mini {
  width: auto;
  padding: 5px 10px;
  font-size: 0.8rem;
  margin-right: 4px;
}

.btn-danger {
  background: var(--danger);
}

.print-only {
  display: none;
}

@media print {
  body {
    background: #fff;
    padding: 0;
  }
  .no-print {
    display: none !important;
  }
  .print-only {
    display: block;
  }
  .print-banner {
    background: #1e3a8a;
    color: #fff;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
  }
  .card {
    box-shadow: none;
    border: 1px solid #cbd5e1;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}