/* database-sync — UI partilhada do assistente */
:root {
  --bg: #f0f2f7;
  --surface: #fff;
  --border: #dfe3ec;
  --text: #161922;
  --muted: #5b6478;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 12px;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }

body {
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 1.25rem;
  line-height: 1.5;
}

.wrap { max-width: 56rem; margin: 0 auto; }
.wrap-wide { max-width: 64rem; margin: 0 auto; }

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.75rem;
  color: #334155;
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
}

.card h2:first-child,
.card h3:first-child {
  margin-top: 0;
}

.sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-head h2 {
  margin: 0;
  flex: 1;
  min-width: 10rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
}

form.pair-remove { margin: 0; flex-shrink: 0; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  margin: 0 0 1rem;
  background: #fafbfc;
}

legend {
  padding: 0 0.5rem;
  font-weight: 600;
  color: #334155;
  font-size: 0.95rem;
}

label {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--muted);
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  max-width: 28rem;
  margin-top: 0.25rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface);
}

input:focus,
select:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 1px;
  border-color: var(--accent);
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: 0.92rem;
}

table.data thead th {
  text-align: left;
  padding: 0.65rem 1rem;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}

table.data thead th:first-child { border-radius: var(--radius) 0 0 0; }
table.data thead th:last-child { border-radius: 0 var(--radius) 0 0; }

table.data tbody td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:nth-child(even) { background: #f8fafc; }
table.data tbody tr:hover { background: #eff6ff; }

table.map {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: 0.88rem;
}

table.map thead th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  background: linear-gradient(180deg, #334155 0%, #1e293b 100%);
  color: #f1f5f9;
  font-weight: 600;
}

table.map tbody td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

table.map tbody tr:last-child td { border-bottom: none; }
table.map tbody tr:nth-child(even) { background: #f8fafc; }
table.map tbody tr:hover { background: #eff6ff; }

table.map select {
  width: 100%;
  min-width: 8rem;
  max-width: 100%;
  padding: 0.4rem 0.45rem;
  font-size: 0.88rem;
}

.columns-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.pill-yes {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #dcfce7;
  color: #166534;
}

.pill-no {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}

.order {
  font-size: 0.88rem;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0.5rem 0;
  color: #334155;
}

.order strong { color: #0f172a; }

.err { color: #b91c1c; font-weight: 500; }
.ok { color: #15803d; font-weight: 500; }
.bad { color: #b91c1c; font-weight: 500; }
.warn { color: #c2410c; font-weight: 500; }

.hint {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: #1e3a5f;
}

.result-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: 1rem 0;
  background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
}

.result-box ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.5;
  font-size: 0.92rem;
}

.nav-links {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

button,
.btn {
  display: inline-block;
  margin: 0.35rem 0.35rem 0.35rem 0;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: background 0.15s, transform 0.05s;
}

button[type="submit"] {
  background: var(--accent);
  color: #fff;
}

button[type="submit"]:hover { background: var(--accent-hover); }
button[type="submit"]:active { transform: scale(0.98); }

button[type="button"] {
  background: #e2e8f0;
  color: #334155;
}

button[type="button"]:hover { background: #cbd5e1; }

.btn {
  background: var(--accent);
  color: #fff !important;
}

.btn:hover {
  background: var(--accent-hover);
  color: #fff !important;
}

.btn-muted {
  background: #64748b !important;
  color: #fff !important;
}

.btn-muted:hover { background: #475569 !important; }

.btn-danger {
  background: #dc2626 !important;
  color: #fff !important;
}

.btn-danger:hover { background: #b91c1c !important; }

button.btn-remove-pair {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  margin-top: 0;
}

button.btn-remove-pair:hover { background: #fee2e2; }

a:not(.btn) {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a:not(.btn):hover { text-decoration: underline; }

code {
  font-size: 0.9em;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.cell-actions {
  width: 3rem;
  text-align: center;
  vertical-align: middle;
}

.form-inline-remove {
  display: inline;
  margin: 0;
}

.btn-remove-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0;
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 700;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  cursor: pointer;
}

.btn-remove-x:hover {
  background: #fee2e2;
}

.consistency-divergence-block {
  border-left: 4px solid #f97316;
}

.consistency-diff-table th,
.consistency-diff-table td {
  vertical-align: top;
  word-break: break-word;
}

.consistency-diff-table td.mono-cell {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  max-width: 22rem;
}

.consistency-diff-table td.differs {
  background: #fef2f2;
  box-shadow: inset 0 0 0 1px #fecaca;
}

.consistency-extra-row {
  border-left: 3px solid #cbd5e1;
  padding: 0.5rem 0.75rem;
  margin-top: 0.5rem;
  background: #f8fafc;
  border-radius: 0.25rem;
}

.consistency-extra-row.extra-side-source {
  border-left-color: #2563eb;
}

.consistency-extra-row.extra-side-target {
  border-left-color: #16a34a;
}

.consistency-extra-row .extra-row-title {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.consistency-extra-row .extra-row-badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #e2e8f0;
  color: #1e293b;
}

.consistency-extra-row.extra-side-source .extra-row-badge {
  background: #dbeafe;
  color: #1d4ed8;
}

.consistency-extra-row.extra-side-target .extra-row-badge {
  background: #dcfce7;
  color: #166534;
}
