/* =====================================================================
   Mapsmith – Ergänzungen Runde 4
   Laden nach ecu-ui.css, ecu-ui-r2.css, ecu-ui-r3.css.
   Alle neuen Klassen haben eindeutige Präfixe (r4-, fnh-, cb-), damit
   nichts mit .menu, .ln oder anderen Seitenklassen kollidiert.
   A Dialog mit festem Kopf/Fuß · B Dateiname mittig kürzen
   C Funktionskopf & Aufrufer · D Changes: Achsen neutral, Hinweis
   E Legende bei gleichen Werten · F Handy-Code: eine Steuerzeile
   Changes when copied into the explorer: .dlg only when [open]; placeholders in F replaced.
   ===================================================================== */

/* ---------- A. Dialog: Kopf und Fuß bleiben sichtbar -------------------- */
.dlg[open] { display: flex; flex-direction: column; max-height: min(760px, calc(100dvh - 32px)); }   /* [open]: a plain .dlg rule would show closed dialogs */
dialog.dlg { overflow: hidden; }            /* kein Scrollbalken um den ganzen Dialog */
.dlg__head, .dlg__foot { flex: none; }
.dlg__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.dlg__body.r4-scrolled { box-shadow: inset 0 8px 8px -8px rgba(16, 24, 40, .18); } /* optional per JS */

/* ---------- B. Dateiname in der Mitte kürzen ---------------------------- */
/* JS teilt den Namen: <span class="r4-mid"><span class="r4-mid__head">my_car_tuned </span><span class="r4-mid__tail">v1.bin</span></span>
   Tail = die letzten ~8 Zeichen, mindestens die Endung. So bleibt „v1“ vs. „v2“ lesbar. */
.r4-mid { display: inline-flex; min-width: 0; max-width: 100%; white-space: nowrap; }
.r4-mid__head { min-width: 3ch; overflow: hidden; text-overflow: ellipsis; }
.r4-mid__tail { flex: none; }

/* ---------- C. Funktionskopf & Aufrufer --------------------------------- */
.code .fnh { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.code .fnh__name { font-family: var(--font-sans); font-size: var(--fs-13); font-weight: 700; color: var(--text); }
.code .fnh__name--none { font-weight: 500; font-style: normal; color: var(--text-3); }
.code .fnh__addr { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-3); }
.code .fnh__meta { font-family: var(--font-sans); font-size: var(--fs-12); color: var(--text-3); }
.code .fnh input { height: 24px; padding: 0 6px; font: inherit; font-family: var(--font-sans); font-size: var(--fs-13); font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--focus); border-radius: var(--r-4); box-shadow: 0 0 0 3px var(--accent-soft); }
.code .call { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Aufrufer-Zeile: Adresse · aufrufende Funktion (nicht das Ziel, das ist ja die gewählte Funktion) */
.r4-xref { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 6px 10px; color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
.r4-xref:hover { background: var(--surface-2); }
.r4-xref__addr { font-family: var(--font-mono); font-size: var(--fs-12); }
.r4-xref__in { font-size: var(--fs-12); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r4-xref__in b { font-weight: 600; color: var(--text); }

/* ---------- D. Changes ------------------------------------------------- */
.r4-axes { font-family: var(--font-mono); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); white-space: nowrap; }
.r4-axes--none { color: var(--text-3); font-weight: 400; }
.kind--look { color: var(--warn-text); background: var(--warn-bg); }
.r4-chev { display: inline-block; width: 6px; height: 6px; margin-left: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(-45deg); }
[aria-expanded="true"] > .r4-chev, [aria-expanded="true"] .r4-chev { transform: translateY(-3px) rotate(45deg); }

/* ---------- E. Legende, wenn alle Werte gleich sind --------------------- */
.r4-flat { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-2); }
.r4-flat i { width: 22px; height: 10px; border-radius: 2px; background: var(--h3); border: 1px solid var(--border); }

/* ---------- F. Handy-Code: eine Steuerzeile, kein verschachteltes Scrollen */
.cb-bar {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 6px; padding: 8px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.cb-bar .field { flex: 1; min-width: 0; }
.cb-bar .field input { width: 100%; text-align: left; }
/* #codeCard = the code card, .cvlist = the listing (placeholders .code-card / .code-scroll replaced) */
@media (max-width: 599px) {
  #codeCard, #codeCard .cvlist { max-height: none !important; overflow: visible !important; border-radius: 0; border-inline: 0; }
}
.cb-more { display: flex; justify-content: center; padding: 6px; }
.cb-sel {
  position: sticky; bottom: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px;
  background: var(--surface-2); border-top: 1px solid var(--border);
}
