/* Demo „Daten bereinigen“: ergänzt kit.css */
[hidden] { display: none !important; }

/* ---------- Kopf ---------- */
.mg-facts { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); max-width: 980px; }
.mg-facts li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.mg-fact-k { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); padding-top: 2px; }
@media (min-width: 900px) {
  .mg-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
  .mg-facts li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

/* ---------- Rahmen ---------- */
.mg-section { padding-top: 8px; }
.mg-app { background: var(--white); border: 1px solid var(--line-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 18px 16px 24px; scroll-margin-top: 84px; }
@media (min-width: 768px) { .mg-app { padding: 28px 32px 32px; } }

/* ---------- Schritte ---------- */
.mg-nav { margin-bottom: 28px; }
.mg-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.mg-step { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px 6px 0; border: 0; background: none; color: var(--ink-2); font-size: 14.5px; text-align: left; cursor: pointer; border-radius: 10px; }
.mg-step:hover:not([disabled]) { color: var(--ink); }
.mg-step[disabled] { cursor: not-allowed; color: var(--ink-3); }
.mg-step[disabled] .mg-step-n { border-style: dashed; }
.mg-step-n { flex-shrink: 0; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; border: 1px solid var(--ink-3); font-family: var(--mono); font-size: 13px; background: var(--white); transition: background-color .3s, color .3s, border-color .3s; }
.mg-step.is-done .mg-step-n { border-color: var(--ink); color: var(--ink); background: var(--paper-2); }
.mg-step[aria-current="step"] { color: var(--ink); font-weight: 500; }
.mg-step[aria-current="step"] .mg-step-n { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.mg-step-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-progress { position: relative; height: 2px; margin-top: 12px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mg-progress span { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--signal); transition: width .7s var(--ease); }
@media (max-width: 719px) {
  .mg-steps { grid-template-columns: repeat(5, auto); justify-content: space-between; }
  .mg-step { padding-right: 0; gap: 8px; }
  .mg-step:not([aria-current="step"]) .mg-step-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

/* ---------- Panels ---------- */
.mg-panel.is-enter, .is-enter { animation: kit-in .5s var(--ease) both; }
.mg-panel-head { margin-bottom: 24px; }
.mg-panel-head .eyebrow { margin-bottom: 8px; }
.mg-panel-head h2:focus { outline: none; }
.mg-panel-head h2:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.mg-intro { margin: 10px 0 0; max-width: 70ch; font-size: 15.5px; }
.mg-sub { margin: 28px 0 12px; font-size: 1.05rem; }
.mg-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.mg-actions .btn-primary:only-child { margin-left: auto; }
.mg-note { margin: 10px 0 0; }

/* ---------- Schritt 1 ---------- */
.mg-load { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .mg-load { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; } }
.mg-drop { position: relative; border: 1.5px dashed rgba(18, 18, 17, 0.32); border-radius: var(--radius-lg); background: var(--sheet); transition: border-color .2s, background-color .2s, transform .3s var(--ease); }
.mg-drop:hover { border-color: var(--ink); }
.mg-drop:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
.mg-drop.is-over { border-color: var(--signal); border-style: solid; background: var(--white); transform: scale(1.01); }
.mg-drop-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; text-align: center; cursor: pointer; }
.mg-drop-icon { color: var(--ink); margin-bottom: 8px; transition: transform .4s var(--ease); }
.mg-drop:hover .mg-drop-icon, .mg-drop.is-over .mg-drop-icon { transform: translateY(-3px); }
.mg-drop-title { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.mg-drop-sub { color: var(--ink-2); font-size: 15px; }
.mg-link { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; color: var(--ink); }
.mg-drop-hint { margin-top: 6px; font-size: 13px; color: var(--ink-3); }
.mg-sample { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; padding: 20px; border-radius: var(--radius-lg); background: var(--paper); }
.mg-sample .label { margin: 0; }
.mg-sample p.tiny { margin: 0; }
.mg-error { margin-top: 16px; border-color: rgba(179, 38, 30, 0.35); background: var(--err-soft); color: var(--err); }
.mg-error .dot { background: var(--err); }
#load-result { margin-top: 28px; }
.mg-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; margin: 0; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.mg-meta-item { background: var(--sheet); padding: 12px 14px; min-width: 0; }
.mg-meta dt { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.mg-meta dd { margin: 4px 0 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Tabellen ---------- */
.mg-scroll { position: relative; max-height: 420px; overflow: auto; }
.mg-pair-table-wrap, .mg-app, .mg-panel { position: relative; }
.mg-scroll-tall { max-height: 560px; }
.mg-scroll:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mg-table { font-size: 13.5px; }
.mg-table th { position: sticky; top: 0; z-index: 2; }
.mg-table td { white-space: nowrap; padding: 9px 14px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.mg-table .mg-rn { font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-weight: 400; width: 1%; position: sticky; left: 0; background: var(--white); z-index: 1; }
.mg-table thead .mg-rn { background: var(--paper); z-index: 3; }
.mg-empty-val { color: var(--ink-3); font-style: italic; }
.mg-none { text-align: center; color: var(--ink-2); padding: 28px 14px !important; white-space: normal !important; }

/* ---------- Schritt 2 ---------- */
.mg-cols { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.mg-col { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); transition: border-color .3s, box-shadow .3s; }
.mg-col.is-changed { border-color: var(--ink); }
.mg-col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.mg-col-name { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.mg-col-idx { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.mg-col .field > span { margin-bottom: 4px; }
.mg-col .select { height: 40px; }
.mg-fit { margin: -4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.mg-samples { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.mg-samples-k { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.mg-samples ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.mg-samples li { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-samples p { margin: 0; font-size: 13px; }
.mg-col-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.mg-req { align-items: center; min-height: 32px; }
.mg-req input { margin-top: 0; width: 18px; height: 18px; }
.mg-col-empty { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Schritt 3: Regeln ---------- */
.mg-rules { border: 0; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.mg-rule { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--sheet); cursor: pointer; transition: border-color .2s, background-color .2s; }
.mg-rule:hover { border-color: rgba(18, 18, 17, 0.45); }
.mg-rule:has(.mg-switch:checked) { background: var(--white); border-color: rgba(18, 18, 17, 0.35); }
.mg-rule.is-off { cursor: default; opacity: .7; }
.mg-rule-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mg-rule-name { font-weight: 500; font-size: 15px; }
.mg-rule-desc { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.mg-rule-count { margin-top: 6px; font-family: var(--mono); font-size: 12px; color: var(--ok); }
.mg-rule-count.is-zero { color: var(--ink-3); }

.mg-switch { appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0; width: 42px; height: 26px; margin: 0; border-radius: 99px; border: 1.5px solid var(--ink-3); background: var(--paper-2); cursor: pointer; transition: background-color .25s, border-color .25s; }
.mg-switch::before { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 99px; background: var(--ink-3); transition: transform .3s var(--ease), background-color .25s; }
.mg-switch:checked { background: var(--ink); border-color: var(--ink); }
.mg-switch:checked::before { transform: translateX(16px); background: var(--white); }
.mg-switch:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 99px; }
.mg-switch:disabled { cursor: not-allowed; opacity: .5; }

/* ---------- Schritt 3: Vorschau ---------- */
.mg-preview-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mg-preview-bar .chip { min-height: 36px; }
.mg-chip-n { font-family: var(--mono); font-size: 12px; opacity: .75; }
.mg-legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); }
.mg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.mg-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; }
.mg-sw-ch { background: #d5eadf; border: 1px solid rgba(30, 122, 79, 0.45); }
.mg-sw-is { background: #f6dcda; border: 1px solid rgba(179, 38, 30, 0.45); }
.mg-sw-d { background: #fbecd0; border: 1px solid rgba(154, 91, 0, 0.45); }
.mg-diff td, .mg-diff tbody th { vertical-align: top; }
.mg-diff tbody th.mg-rn { padding-top: 10px; border-bottom: 1px solid var(--line-soft); }
.mg-issues td { white-space: normal; min-width: 90px; }
.mg-issues td.mg-rn { min-width: 0; }
.mg-issues .badge { white-space: nowrap; }
.mg-issues td.mono { overflow-wrap: anywhere; }
.mg-diff td.is-ch { background: rgba(30, 122, 79, 0.085); }
.mg-diff td.is-is { background: rgba(179, 38, 30, 0.07); }
.mg-new { display: block; }
.mg-old { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.mg-old s { text-decoration-color: rgba(18, 18, 17, 0.45); }
.mg-flag { display: block; margin-top: 3px; font-size: 11.5px; font-weight: 500; color: var(--err); }

/* ---------- Schritt 4 ---------- */
.mg-dup-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.mg-dup-status { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.mg-pairs { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.mg-pair { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; background: var(--sheet); scroll-margin-top: 90px; }
@media (min-width: 768px) { .mg-pair { padding: 20px 22px; } }
.mg-pair.is-decided { background: var(--white); border-color: var(--line-soft); }
.mg-pair-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.mg-pair-title-wrap { min-width: 0; }
.mg-pair-title { margin: 0; font-size: 17px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.3; overflow-wrap: anywhere; }
.mg-pair-and { color: var(--ink-3); font-weight: 400; }
.mg-pair-rows { margin: 4px 0 0; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.mg-score { display: grid; justify-items: end; gap: 2px; flex-shrink: 0; min-width: 84px; }
.mg-score-n { font-size: 22px; font-weight: 500; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.mg-score-l { font-size: 11.5px; color: var(--ink-3); }
.mg-score-bar { display: block; width: 84px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 4px; }
.mg-score-bar span { display: block; height: 100%; background: var(--ink); }
.mg-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 14px; }
.mg-pair.is-decided .mg-reasons { margin-bottom: 10px; }
.mg-pair-table-wrap { max-height: none; }
.mg-pair-table th[scope="row"] { position: static; background: none; font-size: 12.5px; color: var(--ink-3); font-weight: 400; padding: 7px 14px; border-bottom: 1px solid var(--line-soft); }
.mg-pair-table td { padding: 7px 14px; font-size: 13px; }
.mg-pair-table tr.is-diff td.is-d { background: rgba(245, 165, 36, 0.13); }
.mg-pair-table td.mg-res { font-weight: 500; border-left: 1px solid var(--line-soft); }
.mg-pair-table td.mg-res.is-filled { background: rgba(30, 122, 79, 0.085); }
.mg-keep { font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); margin-left: 4px; }
.mg-pair-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.mg-pair-legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--ink-3); }
.mg-pair-legend .mg-sw + * { margin-right: 6px; }
.mg-decided { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; }
.mg-empty { padding: 32px 20px; border: 1px dashed var(--line); border-radius: var(--radius-lg); text-align: center; color: var(--ink-2); }
.mg-empty p { margin: 0 auto; max-width: 52ch; }

/* ---------- Schritt 5 ---------- */
.mg-stats { display: grid; gap: 18px 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); margin-bottom: 8px; }
.mg-stat { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--ink); }
.mg-stat-n { font-size: 2rem; font-weight: 500; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.mg-stat-l { font-size: 13px; color: var(--ink-2); }
.mg-stat.is-warn { border-top-color: var(--err); }
.mg-stat.is-warn .mg-stat-n { color: var(--err); }
.mg-stat.is-ok { border-top-color: var(--ok); }
.mg-stat.is-ok .mg-stat-n { color: var(--ok); }
.mg-report { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 980px) { .mg-report { grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; } }
.mg-report .mg-sub { margin-top: 32px; }
#issue-intro { margin: 0 0 14px; max-width: 70ch; }
.mg-inline-btn { border: 0; padding: 0; background: none; color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 24px; }
.mg-export { margin-top: 32px; padding: 22px; border-radius: var(--radius-lg); background: var(--paper); display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.mg-export h3 { margin: 0; }
.mg-export p { margin: 0; }
.mg-export .hr { margin: 8px 0; }
.mg-dl { width: 100%; }
.mg-dl + p { margin-top: -4px; text-align: center; }
.mg-excel { align-items: center; margin-top: 4px; color: var(--ink); }
.mg-excel input { margin-top: 0; width: 18px; height: 18px; }
.mg-excel-hint { margin-top: -6px !important; }
.mg-export .btn-soft { align-self: flex-start; }

.mg-outro { max-width: 70ch; margin-top: 28px; }
.mg-outro p { margin: 0; }

@media (max-width: 480px) {
  .mg-pair-head { flex-direction: column; gap: 10px; }
  .mg-score { justify-items: start; }
  .mg-pair-legend { margin-left: 0; width: 100%; }
  .mg-actions .btn { flex: 1 1 auto; }
}
