/* =====================================================================
   Mapsmith – Ergänzungen Runde 5
   Laden nach ecu-ui.css, -r2, -r3, -r4. Alle Klassen mit Präfix r5-.
   A Einzelwert als Kennzahl · B Grenzen unter einem Kennfeld
   C Liste: Maps | Values, eine Steuerzeile · D Versionen mit Mini-Karte
   E Prüfliste vor dem Flashen · F Vorschläge, Rezepte: kompakte Zeilen
   G Vorlagen: Risiko · H Achsen-Editor · I Leerer Zustand · J Schätzwerte
   ===================================================================== */

/* ---------- A. Einzelwert als Kennzahl --------------------------------- */
.r5-val { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px 32px; align-items: end; padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-10); }
.r5-val__main { display: flex; flex-direction: column; gap: 2px; }
.r5-val__num { font-family: var(--font-mono); font-size: 40px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.r5-val__unit { margin-left: 6px; font-family: var(--font-sans); font-size: var(--fs-16); font-weight: 500; color: var(--text-3); }
.r5-val__raw { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-3); }
.r5-val__num.is-edited { color: var(--edit-ink); }
.r5-val__field { width: 160px; height: 52px; font-family: var(--font-mono); font-size: 32px; font-weight: 700; text-align: right; }
.r5-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0; }
.r5-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r5-facts dt { font-size: var(--fs-11); color: var(--text-3); }
.r5-facts dd { margin: 0; font-family: var(--font-mono); font-size: var(--fs-14); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r5-delta { font-size: var(--fs-12); font-weight: 600; color: var(--diff); }
/* Bereich: wo liegt die Grenze relativ zu den Kennfeldwerten, die sie begrenzt? */
.r5-range { position: relative; height: 10px; margin: 22px 0 18px; background: var(--surface-3); border-radius: 5px; }
.r5-range__fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 5px; background: var(--h4); }
.r5-range__mark { position: absolute; top: -6px; width: 2px; height: 22px; margin-left: -1px; background: var(--text); }
.r5-range__label { position: absolute; top: -20px; transform: translateX(-50%); font-family: var(--font-mono); font-size: var(--fs-11); white-space: nowrap; color: var(--text-2); }
.r5-range__label--below { top: 16px; }

/* ---------- B. Grenzen direkt unter einem Kennfeld --------------------- */
.r5-limits { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: var(--fs-12); color: var(--text-2); }
.r5-limit { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; font: inherit; font-size: var(--fs-12); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-pill); text-decoration: none; cursor: pointer; }
.r5-limit b { font-family: var(--font-mono); font-weight: 600; }
.r5-limit--hit { color: var(--warn-text); background: var(--warn-bg); border-color: var(--warn-border); }

/* ---------- C. Liste: Maps | Values, eine Steuerzeile ------------------ */
.r5-listbar { display: flex; align-items: center; gap: 6px; }
.r5-listbar .select { flex: 1; min-width: 0; }
.r5-listbar .select select { height: 30px; font-size: var(--fs-12); }
.r5-role { font-family: var(--font-sans); font-size: var(--fs-11); font-weight: 700; letter-spacing: .04em; color: var(--text-3); }

/* ---------- D. Versionen: Mini-Karte, wo sich etwas ändert ------------- */
.r5-thumb { display: grid; grid-template-columns: repeat(var(--cols, 13), 3px); gap: 1px; padding: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; width: max-content; }
.r5-thumb i { display: block; width: 3px; height: 2px; background: var(--surface-3); }
.r5-thumb i.on { background: var(--diff); }
.r5-thumb i.dn { background: var(--dn2); }
.r5-thumb i.up { background: var(--dp2); }
.r5-vrow { display: grid; grid-template-columns: minmax(0, 1.4fr) 56px 110px 120px 90px auto; gap: 12px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--border); font-size: var(--fs-13); }
.r5-vrow.is-a { background: var(--accent-soft); }
.r5-vrow .mono { font-size: var(--fs-12); }

/* ---------- E. Prüfliste vor dem Flashen ------------------------------- */
.r5-checks { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-10); overflow: hidden; background: var(--surface); }
.r5-check { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 12px; border-top: 1px solid var(--border); font-size: var(--fs-13); }
.r5-check:first-child { border-top: 0; }
.r5-check > svg { width: 16px; height: 16px; margin-top: 2px; }
.r5-check--warn { background: var(--warn-bg); color: var(--warn-text); }
.r5-check--warn > svg { color: var(--warn-icon); }
.r5-check--ok > svg { color: var(--ok); }
.r5-check--info > svg { color: var(--text-3); }
.r5-check__sub { grid-column: 2 / 4; font-size: var(--fs-12); color: var(--text-2); }
.r5-check--warn .r5-check__sub { color: inherit; opacity: .9; }
.r5-check__act { display: flex; gap: 6px; }

/* ---------- F. Kompakte Zeilen: Namensvorschläge, Rezepte -------------- */
.r5-grp { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; font: inherit; font-size: var(--fs-12); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); background: var(--surface-2); border: 0; border-top: 1px solid var(--border); text-align: left; cursor: pointer; }
.r5-grp .n { font-variant-numeric: tabular-nums; color: var(--text-3); }
.r5-grp__end { margin-left: auto; text-transform: none; letter-spacing: 0; font-weight: 500; }
.r5-sugg { display: grid; grid-template-columns: 22px 76px minmax(0, 1fr) minmax(0, 200px); gap: 10px; align-items: center; padding: 5px 12px; border-top: 1px solid var(--border); font-size: var(--fs-13); }
.r5-sugg input[type="text"] { height: 30px; width: 100%; }
.r5-sugg__why { font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r5-src { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; margin-right: 6px; font-size: var(--fs-11); font-weight: 600; color: var(--text-2); background: var(--surface-3); border-radius: var(--r-4); }
.r5-rrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 110px; gap: 10px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--border); font-size: var(--fs-13); }
.r5-how { font-size: var(--fs-12); font-weight: 600; color: var(--text-2); }
.r5-how--pct { color: var(--warn-text); }
.r5-how--skip { color: var(--danger); }
.r5-by { font-size: var(--fs-11); color: var(--text-3); }
.r5-by--soft { color: var(--warn-text); }

/* ---------- G. Vorlagen: Wert vs. Programmcode ------------------------- */
.r5-tpl { border: 1px solid var(--border); border-radius: var(--r-10); background: var(--surface); overflow: hidden; }
.r5-tpl__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.r5-tpl__head h3 { margin: 0; font-size: var(--fs-14); font-weight: 700; }
.r5-tpl--code { border-color: var(--warn-border); }
.r5-tpl--code .r5-tpl__head { background: var(--warn-bg); color: var(--warn-text); border-bottom-color: var(--warn-border); }
.r5-tpl__body { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; font-size: var(--fs-13); }
.r5-tpl__gate { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px dashed var(--warn-border); border-radius: var(--r-8); font-size: var(--fs-13); }
.r5-tpl__gate input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.r5-old { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: var(--fs-12); }
.r5-old svg { width: 13px; height: 13px; color: var(--ok); }
.r5-newfield { width: 120px; }
.r5-newfield input { width: 72px; }

/* ---------- H. Achsen-Editor: Zusammenfassung, Klick öffnet ------------ */
.r5-axis { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border); font-size: var(--fs-13); }
.r5-axis__name { font-weight: 600; }
.r5-axis__sum { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-2); }
.r5-axis__sum b { color: var(--text); }
.r5-axis__edit { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-top: 4px; }
.r5-hint { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; font-size: var(--fs-12); color: var(--accent-soft-text); background: var(--accent-soft); border-radius: var(--r-pill); }
.r5-hint .btn { height: 20px; padding: 0 8px; font-size: var(--fs-12); }

/* ---------- I. Leerer Zustand ----------------------------------------- */
.r5-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 520px; margin: 0 auto; padding: 40px 24px; text-align: center; }
.r5-empty__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); }
.r5-empty__icon svg { width: 26px; height: 26px; }
.r5-empty h2 { margin: 0; font-size: var(--fs-16); font-weight: 700; }
.r5-empty p { margin: 0; font-size: var(--fs-13); color: var(--text-2); }
.r5-empty__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }

/* ---------- J. Schätzwerte ------------------------------------------- */
.r5-est { font-variant-numeric: tabular-nums; color: var(--text-2); }
.r5-est::before { content: "≈ "; color: var(--text-3); }
.r5-axislabel { font-family: var(--font-mono); font-size: 10px; fill: var(--text-3); }
