:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-hover: #f0f1f4;
  --border: #e5e7eb;
  --accent: #6c63ff;
  --accent-light: #f0edff;
  --green: #10b981;
  --green-light: #ecfdf5;
  --red: #ef4444;
  --red-light: #fef2f2;
  --yellow: #f59e0b;
  --yellow-light: #fffbeb;
  --text: #1a1d27;
  --muted: #6b7280;
  --radius: 12px;
  --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
}

.header-spacer {
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 20px;
  border-right: 1px solid var(--border);
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: block;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--text);
}

nav.main-nav {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

nav.main-nav a {
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
}

nav.main-nav a:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

nav.main-nav a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

#user-menu {
  display: flex;
  align-items: center;
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.customer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color .15s;
}

.customer-card:hover { border-color: #d1d5db; }

.customer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  cursor: pointer;
  user-select: none;
}

.customer-header:hover { background: var(--surface-hover); }

.customer-name {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.customer-chevron {
  font-size: 12px;
  color: var(--muted);
  transition: transform .2s;
}

.customer-card.open .customer-chevron { transform: rotate(180deg); }

.customer-body {
  display: none;
  padding: 0 22px 22px;
  border-top: 1px solid var(--border);
}

.customer-card.open .customer-body { display: block; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 12px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-label:first-child { margin-top: 16px; }

.system-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.system-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
}

.system-chip:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(108, 99, 255, .12);
}

.system-chip-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.system-chip-icon.nxt { background: #6366f1; }
.system-chip-icon.pogo { background: #10b981; }
.system-chip-icon.vipps { background: #f59e0b; }
.system-chip-icon.xledger { background: #3b82f6; }
.system-chip-icon.accounting { background: #64748b; }

.system-chip-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
}
.system-chip-status.connected { background: var(--green); }
.system-chip-status.error { background: var(--red); }
.system-chip-status.pending { background: var(--yellow); }

.edit-connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.edit-connection-status.connected { color: var(--green); background: var(--green-light); }
.edit-connection-status.error { color: var(--red); background: var(--red-light); }
.edit-connection-status.pending { color: var(--yellow); background: var(--yellow-light); }
.edit-connection-status .system-chip-status {
  width: 6px;
  height: 6px;
}

.flow-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color .15s;
}

.flow-item:hover { border-color: var(--accent); }

.flow-group.open > .flow-item {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-color: var(--accent);
}

.flow-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.flow-expand-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
}

.flow-group.open .flow-expand-chevron { transform: rotate(180deg); }

.flow-group.open .flow-tags { display: none; }

.flow-dimensions {
  display: none;
  border-left: 2px solid var(--border);
  margin-left: 30px;
  padding-left: 16px;
}

.flow-group.open .flow-dimensions { display: flex; flex-direction: column; gap: 0; }

.flow-dim-line {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .1s;
  border-bottom: 1px solid var(--border);
}

.flow-dim-line:last-child { border-bottom: none; }

.flow-dim-line:hover { background: var(--surface-hover); }

.flow-debug-panel {
  margin: 8px 0 12px 14px;
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #0f172a;
  color: #dbeafe;
  overflow: hidden;
}

.flow-debug-section {
  border-top: 1px solid rgba(219, 234, 254, .14);
}

.flow-debug-section:first-child {
  border-top: none;
}

.flow-debug-title {
  padding: 9px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #93c5fd;
  background: rgba(15, 23, 42, .95);
}

.flow-debug-panel pre {
  max-height: 320px;
  overflow: auto;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.flow-dim-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 80px;
}

.schedule-text {
  margin-left: auto;
}

.flow-node {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.flow-node-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.flow-node-dot.source { background: var(--accent); }
.flow-node-dot.dest { background: var(--green); }

.flow-arrow {
  color: var(--muted);
  font-size: 16px;
  flex-shrink: 0;
}

.flow-tags {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.flow-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 5px;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
}

.flow-tag.green { background: var(--green-light); color: var(--green); }
.flow-tag.yellow { background: var(--yellow-light); color: var(--yellow); }

.btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity .12s, transform .1s;
  font-family: inherit;
}

.btn:hover { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: #d1d5db; }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 16px;
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.flow-modal { width: 600px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}

.form-group:last-child { margin-bottom: 0; }

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 9px 12px;
  font-family: inherit;
  transition: border-color .15s;
}

input[type="checkbox"] {
  width: auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

input.field-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row > * { flex: 1; }

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

.product-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}

.product-option:hover { border-color: var(--accent); }

.product-option.disabled,
.product-option.disabled:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}

.product-option.disabled .product-option-icon {
  filter: grayscale(1);
}

.product-option-sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.product-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.product-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.product-option-icon.nxt { background: #6366f1; }
.product-option-icon.pogo { background: #10b981; }
.product-option-icon.vipps { background: #f59e0b; }
.product-option-icon.xledger { background: #3b82f6; }
.product-option-icon.poweroffice { background: #8b5cf6; }
.product-option-icon.fiken { background: #ec4899; }

.product-option-name { font-size: 13px; font-weight: 700; }

.mapping-section { margin-bottom: 20px; }

.mapping-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.mapping-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.mapping-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.mapping-table tr:hover td { background: var(--surface-hover); }

.mapping-arrow { color: var(--muted); text-align: center; }

.steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--muted);
  transition: all .2s;
  flex-shrink: 0;
}

.step.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step.done .step-num {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.step.skipped .step-num {
  background: var(--bg);
  border-color: var(--muted);
  color: var(--muted);
  font-size: 0;
}

.step.skipped .step-num::before {
  content: "»";
  font-size: 16px;
  line-height: 1;
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  display: none;
}

.step.active .step-label { color: var(--text); display: inline; }

.step-connector {
  width: 24px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}

.step-connector.done { background: var(--green); }

.flow-wizard-panel { display: none; }
.flow-wizard-panel.active { display: block; }

.endpoint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.endpoint-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}

.endpoint-option:hover { border-color: var(--accent); }

.endpoint-option.disabled,
.endpoint-option.disabled:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}

.endpoint-option.disabled .system-chip-icon {
  filter: grayscale(1);
}

.endpoint-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.endpoint-system-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.endpoint-option-name { font-size: 13px; font-weight: 700; }
.endpoint-option-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

.mapping-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  white-space: nowrap;
}

.mapping-status.mapped {
  background: var(--green-light);
  color: var(--green);
}

.mapping-status.unmapped {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.mapping-status.fuzzy {
  background: var(--yellow-light);
  color: var(--yellow);
}

.mapping-sub {
  font-size: 11px;
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.mapping-select {
  width: auto;
  min-width: 160px;
  padding: 5px 8px;
  font-size: 12px;
}

.flow-modal.mapping-expanded {
  width: min(1180px, 96vw);
  height: 94vh;
  max-width: 96vw;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width .25s ease, height .25s ease;
}

.flow-modal.mapping-expanded .modal-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 16px 20px;
}

.flow-modal.mapping-expanded .steps {
  justify-content: center;
  margin-bottom: 12px;
}

.flow-modal.mapping-expanded .modal-footer {
  flex-shrink: 0;
}

.flow-modal.mapping-expanded #flow-step-5.flow-wizard-panel.active {
  display: flex;
  flex: 1;
  min-height: 0;
}

.mapping-workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  position: relative;
  width: 100%;
  gap: 12px;
}

.mapping-workspace-header,
.mapping-toolbar,
.mapping-summary {
  flex-shrink: 0;
}

.mapping-workspace-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.mapping-workspace-subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.mapping-counts {
  color: var(--muted);
  display: flex;
  gap: 16px;
  font-size: 12px;
  white-space: nowrap;
}

.mapping-toolbar {
  align-items: center;
  display: flex;
  gap: 8px;
}

.mapping-search {
  flex: 1;
  min-width: 240px;
}

.mapping-filter {
  min-width: 130px;
  width: auto;
}

.mapping-main {
  flex: 1;
  min-height: 0;
}

.mapping-list-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mapping-list-head,
.mapping-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) minmax(260px, 1fr) 110px;
}

.mapping-list-head {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 10px 12px;
  text-transform: uppercase;
}

.mapping-row-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.mapping-row {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 0;
  padding: 12px;
}

.mapping-row:hover { background: var(--surface-hover); }

.mapping-row-cell {
  min-width: 0;
  padding-right: 14px;
}

.mapping-row-name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-row-meta {
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mapping-row-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.mapping-row-dest {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mapping-row-dest-info {
  min-width: 0;
}

.mapping-row-dest-btns {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mapping-row-dest-btns .btn { white-space: nowrap; }

.mapping-empty {
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.mapping-popup-overlay {
  background: rgba(0,0,0,.35);
  bottom: 0;
  display: flex;
  left: 0;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 9999;
}

.mapping-popup {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  margin: auto;
  max-height: 80vh;
  max-width: 520px;
  width: 90%;
}

.mapping-popup--review {
  max-width: 680px;
}

.mapping-popup-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 16px 20px;
}

.mapping-popup-title {
  font-size: 15px;
  font-weight: 700;
}

.mapping-popup-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
}

.mapping-popup-footer {
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 12px 20px;
}

.mapping-detail-meta {
  color: var(--muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  margin-bottom: 14px;
}

.mapping-detail-current {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px;
}

.mapping-dest-search { margin-bottom: 10px; }

.mapping-dest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mapping-dest-option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.mapping-dest-option:hover,
.mapping-dest-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.mapping-review-section {
  margin-bottom: 16px;
}

.mapping-review-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.mapping-review-row {
  align-items: center;
  display: flex;
  gap: 12px;
  font-size: 13px;
  padding: 6px 0;
}

.mapping-review-arrow { color: var(--muted); }

.mapping-review-score {
  color: var(--yellow);
  font-size: 11px;
  font-weight: 600;
}

.mapping-summary {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.mapping-summary-counts {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
}

.mapping-summary-total {
  color: var(--muted);
  margin-left: auto;
}

.mapping-progress {
  background: var(--bg);
  border-radius: 3px;
  display: flex;
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
}

.mapping-progress-mapped,
.mapping-progress-fuzzy {
  height: 100%;
  transition: width .3s;
}

.mapping-progress-mapped { background: var(--green); }
.mapping-progress-fuzzy { background: var(--yellow); }

.pending-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--yellow-light);
  color: var(--yellow);
  white-space: nowrap;
}

#auto-map-btn { white-space: nowrap; }

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

.system-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: border-color .15s;
}

.system-card:hover { border-color: var(--accent); }

.system-card.disabled,
.system-card.disabled:hover {
  opacity: .55;
  cursor: not-allowed;
  border-color: var(--border);
}

.system-card.disabled .system-card-icon {
  filter: grayscale(1);
}

.system-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.system-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.system-card-icon.nxt { background: #6366f1; }
.system-card-icon.pogo { background: #10b981; }
.system-card-icon.vipps { background: #f59e0b; }
.system-card-icon.xledger { background: #3b82f6; }
.system-card-icon.accounting { background: #64748b; }

.system-card-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.system-card-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.system-card-dimensions {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dim-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dim-group-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dim-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dim-dot.source { background: var(--accent); }
.dim-dot.dest { background: var(--green); }

.dim-list {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.schedule-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}

.schedule-text.manual {
  font-style: italic;
  color: #9ca3af;
}

.run-btn {
  white-space: nowrap;
  transition: all .15s;
}

.debug-btn {
  white-space: nowrap;
}

.run-btn:disabled {
  cursor: not-allowed;
  opacity: .5;
  pointer-events: none;
}

.debug-btn:disabled {
  cursor: not-allowed;
  opacity: .5;
  pointer-events: none;
}

.remove-flow-btn {
  color: var(--red);
  white-space: nowrap;
}

.schedule-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.schedule-option {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
  transition: all .15s;
}

.schedule-option:hover { border-color: var(--accent); }

.schedule-option.disabled,
.schedule-option.disabled:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  opacity: .55;
}

.schedule-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.schedule-option-radio {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  position: relative;
  transition: all .15s;
}

.schedule-option.selected .schedule-option-radio {
  border-color: var(--accent);
}

.schedule-option.selected .schedule-option-radio::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.schedule-option-name {
  font-size: 14px;
  font-weight: 700;
}

.schedule-option-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.time-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.time-input {
  width: 130px;
  flex-shrink: 0;
}

.status-banner {
  margin-top: 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 10px 12px;
  font-size: 13px;
  display: none;
  white-space: pre-wrap;
}

.status-banner.show { display: block; }
.status-banner.ok { background: var(--green-light); border-color: #a7f3d0; color: #065f46; }
.status-banner.bad { background: var(--red-light); border-color: #fecaca; color: #991b1b; }

.field-error-msg {
  font-size: 12px;
  color: var(--red);
  display: none;
  margin-top: 3px;
}

.field-error-msg.show { display: block; }

@media (max-width: 700px) {
  .header-inner { padding: 0 14px; gap: 10px; }
  .brand { padding-right: 10px; }
  main { padding: 20px 14px 40px; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .endpoint-grid { grid-template-columns: 1fr; }
  .systems-grid { grid-template-columns: 1fr; }
  .flow-item { flex-wrap: wrap; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color .15s;
}

.kpi-card:hover { border-color: var(--accent); }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-sub {
  font-size: 12px;
  color: var(--muted);
}

.health-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}

.health-row:last-child { border-bottom: none; }
.health-row:hover { background: var(--surface-hover); }

.health-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-name {
  font-size: 14px;
  font-weight: 600;
}

.health-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-status-dot.healthy { background: var(--green); }
.health-status-dot.warning { background: var(--yellow); }
.health-status-dot.error { background: var(--red); }

.health-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.health-meta {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
}

.health-meta.muted { color: var(--muted); }

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

.variables-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.variables-scope-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.variables-scope-tab {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}

.variables-scope-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.variables-company-select {
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 180px;
}

.var-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.var-badge-global {
  background: rgba(9, 171, 59, 0.15);
  color: var(--green);
}

.var-badge-company {
  background: rgba(250, 202, 43, 0.15);
  color: var(--yellow);
}

.var-badge-sensitive {
  background: rgba(255, 43, 43, 0.15);
  color: var(--red);
}
