/* ============================================================
   Shopify Produkt-Import Tool – Styles
   ============================================================ */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --border: #e1e3e5;
  --border-strong: #c9cccf;
  --text: #202223;
  --text-muted: #6d7175;
  --primary: #008060;
  --primary-hover: #006e52;
  --primary-light: #e3f1df;
  --danger: #d72c0d;
  --danger-light: #fdf1f0;
  --warning: #ffc453;
  --warning-light: #fff5e5;
  --success: #008060;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --radius: 8px;
  --radius-sm: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); }

/* ===== Header ===== */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.header h1 { font-size: 15px; font-weight: 600; margin: 0; }
.header-meta { color: var(--text-muted); font-size: 12px; }
.header-title { display: flex; flex-direction: column; gap: 2px; }

.header-nav {
  display: flex;
  gap: 4px;
}
.header-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
}
.header-nav a:hover { background: #f1f2f3; color: var(--text); }
.header-nav a.active { color: var(--primary); background: var(--primary-light); }

.header-right { display: flex; gap: 12px; align-items: center; }

.user-menu { display: flex; align-items: center; gap: 8px; }
.user-name { color: var(--text-muted); font-size: 13px; }

/* ===== Shop Switch ===== */
.shop-switch { position: relative; }
.shop-switch-btn {
  background: #f1f2f3;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  color: var(--text);
}
.shop-switch-btn:hover { background: #e1e3e5; }
.shop-switch-btn .caret { font-size: 10px; opacity: 0.6; }
.shop-dot {
  width: 6px; height: 6px;
  background: var(--success);
  border-radius: 50%;
  display: inline-block;
}
.shop-switch-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  min-width: 280px;
  z-index: 100;
  padding: 4px;
}
.shop-switch.open .shop-switch-menu { display: block; }
.shop-item {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
}
.shop-item:hover { background: #f1f2f3; }
.shop-item.active { background: var(--primary-light); }
.shop-item strong { display: block; font-size: 13px; }
.shop-item small { color: var(--text-muted); font-size: 11px; }
.shop-switch-foot { border-top: 1px solid var(--border); margin-top: 4px; padding: 8px 12px; }
.shop-switch-foot a { font-size: 12px; text-decoration: none; }

/* ===== Mode Toggle ===== */
.mode-switch {
  display: inline-flex;
  background: #f1f2f3;
  padding: 3px;
  border-radius: 8px;
  font-size: 12px;
}
.mode-switch label {
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.15s;
  font-weight: 500;
  user-select: none;
}
.mode-switch input { display: none; }
.mode-switch input:checked + label {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* ===== Buttons ===== */
.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { background: #f6f6f7; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link {
  background: none; border: none; color: var(--primary); cursor: pointer;
  font-size: 13px; padding: 4px 8px; font-family: inherit; font-weight: 500;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  justify-content: center;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}
body.pro .layout {
  grid-template-columns: 1fr 380px;
  justify-content: stretch;
}
.layout-wide { grid-template-columns: minmax(0, 1100px) !important; }

@media (max-width: 1024px) {
  body.pro .layout { grid-template-columns: 1fr; }
}

.main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sidebar { display: flex; flex-direction: column; gap: 16px; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 20px; }
.section-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px;
}

/* Pro-only */
.pro-only { display: none; }
body.pro .pro-only { display: block; }

.pro-badge {
  background: #f1f2f3;
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== Form Fields ===== */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
}
.field-label .required { color: var(--danger); margin-left: 2px; }
.field-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input.error { border-color: var(--danger); }
.input-sm, .select-sm { padding: 6px 10px; font-size: 13px; }
.textarea { resize: vertical; min-height: 110px; }

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

/* ===== Multiselect Chips ===== */
.chip-input {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: 40px;
  background: var(--surface);
  align-items: center;
}
.chip {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip .x { cursor: pointer; opacity: 0.6; font-size: 13px; }
.chip-add {
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.chip-add:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Image upload ===== */
.image-simple {
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #d4e9d4, #b5dab5);
  height: 220px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-weight: 500;
  position: relative;
}

/* ===== Status Card ===== */
.status-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
}
.status-card.warn {
  background: var(--warning-light);
  border-color: var(--warning);
  color: #8a5a00;
}
.status-card.error {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}
.status-left { display: flex; align-items: center; gap: 12px; }
.status-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  flex-shrink: 0;
}
.status-card.error .status-icon { background: var(--danger); }
.status-card.warn .status-icon { background: #b27300; }
.status-text strong { display: block; font-size: 15px; }
.status-text small { font-size: 12px; opacity: 0.85; }

details.validation-details {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
details.validation-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  list-style: none;
}
details.validation-details summary::-webkit-details-marker { display: none; }
details.validation-details summary::before { content: "▸ "; }
details.validation-details[open] summary::before { content: "▾ "; }

.validation-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.validation-icon {
  width: 16px; height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px;
  margin-top: 2px;
}
.ok .validation-icon { background: var(--success); }
.err .validation-icon { background: var(--danger); }
.warn-i .validation-icon { background: var(--warning); color: var(--text); }

/* ===== Variants ===== */
.variant-row {
  display: grid;
  grid-template-columns: 1fr 1fr 100px 100px 32px;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.variant-row:last-child { border-bottom: none; }
.variant-row .input { padding: 6px 10px; font-size: 13px; }
.variant-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-bottom: 8px;
}
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}
.icon-btn:hover { background: #f1f2f3; color: var(--danger); }

/* ===== Toggle Card ===== */
.toggle-card {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 16px 20px;
  background: #fafbfb;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.toggle-card .info { color: var(--text-muted); font-size: 13px; }
.toggle-card .info strong { color: var(--text); display: block; margin-bottom: 2px; }

/* ===== Sidebar Preview ===== */
.preview-product {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fafbfb;
}
.preview-image {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(135deg, #d4e9d4, #b5dab5);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary); font-size: 13px; font-weight: 500;
}
.preview-title { font-weight: 600; font-size: 16px; margin: 0 0 6px 0; }
.preview-price {
  font-size: 18px; font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.preview-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.preview-coll {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  margin-right: 4px;
  margin-bottom: 4px;
}

/* ===== Mapping debug ===== */
.mapping-pre {
  background: #1a1a1a;
  color: #d4d4d4;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== Badges & Alerts ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.badge-success { background: var(--primary-light); color: var(--primary); }
.badge-warn { background: var(--warning-light); color: #b27300; }
.badge-danger { background: var(--danger-light); color: var(--danger); }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-success { background: var(--primary-light); color: var(--primary); border:1px solid var(--primary); }
.alert-error   { background: var(--danger-light); color: var(--danger); border:1px solid var(--danger); }
.alert-info    { background: #f1f8ff; color: #005abb; border:1px solid #5cabfa; }

/* ===== Action Bar ===== */
.actions-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.04);
}
.actions-status {
  color: var(--text-muted);
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(0,128,96,0.15);
}

.intro-hint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
  display: flex; gap: 10px; align-items: center;
}
.intro-hint .num {
  background: var(--primary);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================
   FORMULAR-MODUS Override
   ============================================================ */
body.form .layout { grid-template-columns: minmax(0, 760px); }
body.form .intro-hint { display: none; }
body.form .card {
  box-shadow: none; border: none;
  background: transparent; border-radius: 0;
}
body.form .card + .card {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 8px;
}
body.form .card-header {
  padding: 8px 0 4px 0;
  border-bottom: none;
}
body.form .card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}
body.form .card-body { padding: 8px 0; }
body.form .row { display: contents; }
body.form .field {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
}
body.form .field-label { margin-bottom: 0; font-weight: 400; color: var(--text); }
body.form .field-help { grid-column: 2; margin-top: 4px; }
body.form .input, body.form .select, body.form .textarea {
  background: #fafbfb;
  border-color: var(--border);
}
body.form .input:focus, body.form .select:focus, body.form .textarea:focus {
  background: var(--surface);
}
body.form .textarea { min-height: 80px; }
body.form .toggle-card {
  background: transparent;
  border: 1px solid var(--border);
  padding: 12px 16px;
}
body.form .image-simple { height: 160px; }
body.form .status-card { border-radius: 4px; padding: 10px 14px; }
body.form .status-icon { width: 24px; height: 24px; font-size: 13px; }
body.form .status-text strong { font-size: 13px; }
body.form .variant-row {
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 10px 0;
}
body.form .variant-row.variant-header { display: none; }

/* ============================================================
   Settings Page
   ============================================================ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 20px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.settings-nav {
  position: sticky;
  top: 70px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-nav a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.settings-nav a:hover { background: var(--surface); color: var(--text); }
.settings-nav a.active { background: var(--primary-light); color: var(--primary); }

.settings-main { display: flex; flex-direction: column; gap: 16px; }

.settings-table-wrapper {
  overflow-x: auto;
  margin: 0 -4px;
}
.settings-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.settings-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
.settings-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow: hidden;
}
.settings-table code { font-size: 11px; word-break: break-all; }

/* Spaltenbreiten – Label nimmt den Rest */
.settings-table th:nth-child(1), .settings-table td:nth-child(1) { width: 60px; }
.settings-table th:nth-child(2), .settings-table td:nth-child(2) { width: 130px; }
.settings-table th:nth-child(4), .settings-table td:nth-child(4) { width: 80px; }
.settings-table th:nth-child(5), .settings-table td:nth-child(5) { width: 90px; }
.settings-table th:nth-child(6), .settings-table td:nth-child(6) { width: 60px; text-align: center; }
.settings-table th:nth-child(7), .settings-table td:nth-child(7) { width: 60px; text-align: center; }
.settings-table th:nth-child(8), .settings-table td:nth-child(8) { width: 200px; }
.settings-table th:nth-child(9), .settings-table td:nth-child(9) { width: 110px; }

.settings-table .input,
.settings-table .select { width: 100%; min-width: 0; box-sizing: border-box; }

.shop-item-edit {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 0;
  background: var(--surface);
}
.shop-item-edit summary {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
}
.shop-item-edit summary::-webkit-details-marker { display: none; }
.shop-item-edit summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 12px;
  transition: transform 0.15s;
}
.shop-item-edit[open] summary::before { transform: rotate(90deg); }
.shop-item-edit .muted { color: var(--text-muted); font-size: 12px; }
.shop-form {
  padding: 14px 18px 18px 18px;
  border-top: 1px solid var(--border);
}
.add-shop summary { color: var(--primary); }

.checkbox-row {
  display: flex;
  gap: 16px;
  margin: 12px 0;
  font-size: 13px;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.test-result {
  margin-top: 12px;
  font-size: 13px;
  font-family: ui-monospace, monospace;
}

.vendor-block { margin-bottom: 24px; }
.vendor-block-title {
  font-size: 13px;
  margin: 0 0 8px 0;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.vendor-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
}
.vendor-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}
.vendor-row:last-child { border-bottom: none; }
.vendor-row.inactive .vendor-name { opacity: 0.5; text-decoration: line-through; }
.vendor-add { display: flex; gap: 8px; align-items: center; }
.vendor-add .input { flex: 1; }

.muted { color: var(--text-muted); }

/* ===== Schema Update ===== */
.schema-version-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: #fafbfb;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.schema-version {
  font-size: 18px;
  font-weight: 600;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--text);
}
.schema-version.outdated { color: var(--danger); }
.schema-version.target { color: var(--success); }
.schema-arrow {
  font-size: 20px;
  color: var(--text-muted);
}

.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 8px;
}
.schema-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px;
  border-bottom: 2px solid var(--border);
  background: #fafbfb;
}
.schema-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.status-pending {
  color: #b27300;
  font-weight: 500;
  font-size: 12px;
}
.status-applied {
  color: var(--success);
  font-weight: 500;
  font-size: 12px;
}
.alert-warn {
  background: var(--warning-light);
  color: #8a5a00;
  border: 1px solid var(--warning);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.migration-result {
  padding: 8px 12px;
  border-radius: 4px;
  margin: 4px 0;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.migration-result.ok   { background: var(--primary-light); color: var(--primary); }
.migration-result.skip { background: #f1f2f3; color: var(--text-muted); }
.migration-result.err  { background: var(--danger-light); color: var(--danger); }
.migration-result code { background: rgba(0,0,0,0.05); padding: 1px 6px; border-radius: 3px; font-size: 11px; }

/* ===== Filter Bar ===== */
.filter-bar { margin-bottom: 16px; }
.filter-bar .card-body { padding: 12px 16px; }
.filter-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}
.filter-select {
  width: auto !important;
  min-width: 180px;
  padding: 6px 28px 6px 12px;
  font-size: 13px;
}
.filter-count {
  margin-left: auto;
  font-size: 13px;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .filter-select { min-width: 0; flex: 1; }
  .filter-count { margin-left: 0; width: 100%; }
}

/* ===== History page ===== */
.history-table {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  overflow: hidden;
}
.history-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: #fafbfb;
}
.history-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.history-table tr:last-child td { border-bottom: none; }

.meta-list {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  margin: 0;
  font-size: 13px;
}
.meta-list dt { color: var(--text-muted); font-weight: 500; }
.meta-list dd { margin: 0; }

/* ===== Auth page ===== */
.auth-body { background: var(--bg); }
.auth-body .header { display: none; }

/* ===== Field Config (Drag & Drop) ===== */
.field-group { margin-bottom: 24px; }
.field-group:last-child { margin-bottom: 0; }
.field-group-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}
.field-group-header h3 {
  font-size: 13px;
  margin: 0;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-group-header .muted { font-size: 12px; }

.field-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 60px;
  overflow: hidden;
}
.field-list[data-active="0"] {
  background: #fafbfb;
  opacity: 0.85;
}
.field-list.drop-target {
  border-color: var(--primary);
  background: var(--primary-light);
}
.field-list-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
/* Empty-Message ausblenden, sobald Reihen vorhanden sind */
.field-list:has(.field-row) > .field-list-empty { display: none; }

.field-row,
.field-list-header {
  display: grid;
  grid-template-columns: 28px 130px minmax(0, 1fr) 70px 70px 60px 200px 36px;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
}
.field-list-header {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fafbfb;
  border-bottom: 1px solid var(--border);
  padding-top: 8px;
  padding-bottom: 8px;
}
.field-row {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.1s;
  user-select: none;
}
.field-row:last-child { border-bottom: none; }
.field-row:hover { background: #f6f6f7; }
.field-row.dragging {
  opacity: 0.4;
  background: var(--primary-light);
}
.field-list[data-active="0"] .field-row { background: transparent; }
.field-list[data-active="0"] .field-row:hover { background: #f1f2f3; }

.drag-handle {
  cursor: grab;
  color: var(--border-strong);
  font-size: 14px;
  letter-spacing: -2px;
  text-align: center;
  user-select: none;
}
.drag-handle:active { cursor: grabbing; }

.row-key {
  text-align: left;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
}
.row-key code {
  background: #f1f2f3;
  padding: 2px 6px;
  border-radius: 3px;
}

.row-label {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-type {
  font-size: 12px;
  color: var(--text-muted);
  font-family: ui-monospace, Menlo, monospace;
}
.row-mode { display: flex; }
.row-required { text-align: center; font-size: 13px; color: var(--text-muted); }
.required-mark {
  color: #b27300;
  font-size: 12px;
}

.meta-pill {
  background: #f1f2f3;
  color: var(--text-muted);
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  white-space: nowrap;
}
.meta-pill.mode-basic { background: var(--primary-light); color: var(--primary); border-color: rgba(0,128,96,0.2); }
.meta-pill.mode-pro   { background: #e5e1f5; color: #5d3fd3; border-color: rgba(93,63,211,0.2); }

.row-mapping {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-mapping code {
  background: transparent;
  padding: 0;
}

.row-actions { text-align: right; }
.btn-edit-field {
  font-size: 16px;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 34, 35, 0.5);
  animation: fade-in 0.15s ease;
}
.modal-dialog {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: pop-in 0.18s ease;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-header .icon-btn {
  width: 28px; height: 28px;
  font-size: 18px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-muted);
}
.modal-header .icon-btn:hover { background: #f1f2f3; color: var(--text); }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}
.btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--surface);
}
.btn-danger-outline:hover { background: var(--danger-light); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 900px) {
  .field-row,
  .field-list-header {
    grid-template-columns: 24px 1fr 36px;
    grid-template-rows: auto auto;
    gap: 4px 10px;
  }
  .field-list-header { display: none; }
  .field-row .row-key { grid-column: 2; grid-row: 1; }
  .field-row .row-label { grid-column: 2; grid-row: 2; }
  .field-row .row-type,
  .field-row .row-mode,
  .field-row .row-required,
  .field-row .row-mapping { display: none; }
  .field-row .row-actions { grid-column: 3; grid-row: 1 / 3; }
}

/* ===== Help page ===== */
.help-content { font-size: 14px; line-height: 1.6; }
.help-content p { margin: 8px 0 12px; }
.help-content h3 { font-size: 14px; margin: 20px 0 8px; }
.help-content ul, .help-content ol { padding-left: 22px; margin: 8px 0; }
.help-content li { margin: 4px 0; }
.help-content code {
  background: #f1f2f3;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.help-steps { counter-reset: step; padding-left: 0; list-style: none; }
.help-steps > li {
  counter-increment: step;
  padding: 10px 0 10px 40px;
  position: relative;
  border-bottom: 1px dashed var(--border);
}
.help-steps > li:last-child { border-bottom: none; }
.help-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 12px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.help-note {
  background: #f1f8ff;
  border-left: 3px solid #5cabfa;
  padding: 8px 12px;
  border-radius: 4px;
  margin: 8px 0;
  font-size: 13px;
  color: #005abb;
}
.help-warn {
  background: var(--warning-light);
  border-left: 3px solid var(--warning);
  padding: 10px 14px;
  border-radius: 4px;
  margin: 14px 0;
  font-size: 13px;
  color: #8a5a00;
}
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0;
}
.help-table th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px;
  border-bottom: 2px solid var(--border);
  background: #fafbfb;
}
.help-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.help-table tr:last-child td { border-bottom: none; }
.help-table code { white-space: nowrap; }
