:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-d: #1d4ed8;
  --ok: #16a34a;
  --err: #dc2626;
  --warn: #b45309;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f1f5f9;
  color: var(--ink);
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.erro { color: var(--err); }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 0.85em; }

/* Login */
.login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card { width: 360px; text-align: center; }
.login-card h1 { margin: 0 0 4px; }

/* Header */
header {
  display: flex; align-items: center; gap: 20px;
  background: var(--panel); color: #fff;
  padding: 12px 20px;
}
.brand { font-weight: 700; font-size: 1.1rem; }
nav { display: flex; gap: 6px; flex: 1; }
.tab {
  background: transparent; color: #cbd5e1; border: none;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 0.95rem;
}
.tab:hover { background: rgba(255,255,255,0.08); }
.tab.active { background: var(--brand); color: #fff; }
.link { background: none; border: none; color: #94a3b8; cursor: pointer; text-decoration: underline; }

main { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 10px; }
.card.warn { background: #fffbeb; border-color: #fde68a; }
.card.warn h3 { margin-top: 0; color: var(--warn); }
.card.warn li { margin-bottom: 6px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
label.check, label.radio-row label { font-weight: 400; }
input[type=text], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit;
}
textarea { resize: vertical; }

button {
  background: var(--brand); color: #fff; border: none;
  padding: 10px 18px; border-radius: 8px; font-size: 0.95rem;
  cursor: pointer; font-weight: 600;
}
button:hover { background: var(--brand-d); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  display: inline-block; background: #e2e8f0; color: var(--ink);
  padding: 10px 16px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.btn-file {
  display: inline-block; background: #e2e8f0; color: var(--ink);
  padding: 10px 16px; border-radius: 8px; cursor: pointer; font-weight: 600;
}

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.row.between { justify-content: space-between; }
.radio-row { display: flex; gap: 20px; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

.pill {
  background: var(--brand); color: #fff; border-radius: 999px;
  padding: 2px 10px; font-size: 0.8rem; margin-left: 6px;
}
.msg { margin-top: 12px; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--err); }

/* Tabelas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
tbody tr:hover { background: #f8fafc; }

.badge { padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge.yes { background: #dcfce7; color: var(--ok); }
.badge.no { background: #f1f5f9; color: var(--muted); }
.badge.draft { background: #f1f5f9; color: var(--muted); }
.badge.sending { background: #fef9c3; color: var(--warn); }
.badge.sent { background: #dcfce7; color: var(--ok); }

.btn-mini { padding: 4px 10px; font-size: 0.8rem; }

fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px 18px; margin: 16px 0; }
fieldset legend { font-weight: 700; color: var(--brand); padding: 0 6px; }
fieldset.dim { opacity: 0.45; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .grid2 { grid-template-columns: 1fr; } }
select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 0.95rem; }
