:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #155eef;
  --danger: #b42318;
  --ok: #027a48;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.topbar {
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
}

.topbar span {
  margin-left: 10px;
  color: var(--muted);
  font-size: 14px;
}

.container {
  max-width: 1480px;
  margin: 24px auto;
  padding: 0 16px;
}

.panel, .login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.04);
  margin-bottom: 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card { width: 100%; max-width: 420px; }

h1, h2, h3 { margin-top: 0; }
p, .small-muted { color: var(--muted); }
.small-muted { font-size: 13px; margin: 8px 0; }

label {
  display: block;
  font-weight: 600;
  margin: 14px 0 6px;
}

input, select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  background: white;
}

.login-card input { width: 100%; }

button {
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #eef2f6;
  color: var(--text);
}

button.mini {
  padding: 5px 8px;
  margin-left: 8px;
  font-size: 12px;
  background: #eef2f6;
  color: var(--text);
}

form button { margin-top: 16px; width: 100%; }

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

th, td {
  border-bottom: 1px solid var(--border);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafc;
  color: #344054;
  position: sticky;
  top: 0;
  z-index: 1;
}

.alert {
  padding: 10px;
  border-radius: 10px;
  margin: 12px 0;
  background: #eef2f6;
}

.alert.error {
  background: #fef3f2;
  color: var(--danger);
}

.alert.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.hidden { display: none !important; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 480px;
  background: white;
  border-radius: 16px;
  padding: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.diff-table { margin-top: 16px; }

.diff-field { font-weight: 700; }

.diff-preview, .diff-farma {
  max-width: 460px;
  word-break: break-word;
  font-family: Consolas, monospace;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  font-size: 12px;
  margin: 2px;
}

.badge.danger {
  background: #fef3f2;
  color: var(--danger);
}

.badge.ok {
  background: #ecfdf3;
  color: var(--ok);
}

.filters {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fbfcfe;
  margin: 14px 0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.filter-row label {
  margin: 0;
}

.field-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-top: 12px;
  background: white;
}

.field-group summary {
  cursor: pointer;
  margin-bottom: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 6px 12px;
  max-height: 260px;
  overflow: auto;
  padding-top: 8px;
}

.check {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  font-weight: 400;
  font-size: 13px;
}

.check input {
  width: auto;
}

.same-row {
  background: #fcfffd;
}

.diff-row {
  background: #fffafa;
}