/* =====================================================================
   Mapsmith – ecu-ui.css, Ergänzungen Runde 2
   Nach ecu-ui.css laden (oder unten anhängen). Nichts hier ändert
   bestehende Klassen grundlegend; es korrigiert und ergänzt.
   A Tokens · B Kopfleiste Desktop · C Handy-Kopf & Map-Navigation
   D Segment & untere Leiste · E Tabelle mit Log · F Lanes
   G Cursor-Leiste · H Liste: gleiche Namen · I Begrenzer-Finder
   J Popover · K Handy-Bearbeitung · L Kleinkram
   ===================================================================== */

/* ---------- A. Neue Tokens --------------------------------------------- */
:root, [data-theme="light"] {
  --danger-soft: #FDECEA;
  --line-off: #B9C1CC;                    /* Linie, wo der Filter Samples ausblendet */
  --pass-band: rgba(31, 95, 209, .07);    /* Zeitbereiche, die der Filter durchlässt */
  --bubble-bg: #15191F;                   /* Wertblase am Cursor */
  --bubble-ink: #FFFFFF;
}
[data-theme="dark"] {
  --danger-soft: #3A1D1B;
  --line-off: #3E4754;
  --pass-band: rgba(126, 168, 255, .09);
  --bubble-bg: #E8ECF2;
  --bubble-ink: #0E1116;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --danger-soft: #3A1D1B; --line-off: #3E4754; --pass-band: rgba(126, 168, 255, .09);
    --bubble-bg: #E8ECF2; --bubble-ink: #0E1116;
  }
}

/* ---------- B. Kopfleiste Desktop: kürzen statt umbrechen --------------- */
@media (min-width: 720px) {
  .hdr { flex-wrap: nowrap; }
  .hdr__files { flex: 0 1 auto; min-width: 0; flex-wrap: nowrap; }
  .hdr .slot { flex: 0 1 auto; min-width: 0; }
  .hdr .slot__name { min-width: 0; }
  .hdr .pill { flex: 0 1 auto; min-width: 0; overflow: hidden; }
  .hdr .pill__text { overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 1279px) {
  .hdr .slot__meta { display: none; }       /* 448 KB, Samples … */
  .hdr .slot__name { max-width: 16ch; }
  .hdr .pill--ok .pill__text { display: none; } /* nur ✓ + Zahl */
}
/* Ohne Datei: nur die Hauptaktion zeigen */
.hdr[data-state="empty"] .hdr__files,
.hdr[data-state="empty"] .js-needs-file { display: none; }

/* ---------- C. Handy-Kopf & Map-Navigation ------------------------------ */
.mhdr {
  display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 6px 0 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.filestack {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 44px; padding: 0 12px 0 6px;
  font: inherit; font-size: var(--fs-14); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-pill); cursor: pointer;
}
.filestack__keys { display: flex; flex: none; }
.filestack__keys .slot__key { box-shadow: 0 0 0 2px var(--surface); }
.filestack__keys .slot__key + .slot__key { margin-left: -6px; }
.filestack__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mapnav {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center;
  padding: 4px 4px 6px; background: var(--surface);
}
.mapnav__title {
  display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 2px 6px;
  font: inherit; color: var(--text); background: transparent; border: 0; border-radius: var(--r-8); cursor: pointer;
}
.mapnav__title b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-16); }
.mapnav__title span { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-3); }

/* ---------- D. Segment & untere Leiste (Korrektur) ---------------------- */
/* Falls im Segment .btn benutzt wird: Rahmen weg, gedrückt sichtbar */
.seg > .btn { height: calc(var(--ctl-h) - 6px); border-color: transparent; background: transparent; color: var(--text-2); box-shadow: none; }
.seg > .btn[aria-pressed="true"],
.seg > button[aria-pressed="true"] { color: var(--text); background: var(--seg-on); box-shadow: var(--shadow-1); font-weight: 600; }
.seg--fill { display: flex; }
.seg--fill > * { flex: 1; }

.bottombar a, .bottombar button { position: relative; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.bottombar svg { width: 22px; height: 22px; }
.bottombar [aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--accent);
}

/* ---------- E. Tabelle mit Log: Punkte überdecken keine Ziffern --------- */
.has-log .c { padding-left: 16px; }
.has-log .c[data-log]::after { left: 5px; top: 50%; bottom: auto; transform: translateY(-50%); }
.has-log .c[data-log="3"]::after { left: 3.5px; }
/* kurze Ecke; voller Text im title-Attribut */
.corner-short { font-family: var(--font-sans); font-size: var(--fs-12); font-weight: 500; color: var(--text-3); white-space: nowrap; }

/* ---------- F. Lanes -------------------------------------------------- */
.lane { display: grid; grid-template-columns: 136px minmax(0, 1fr); align-items: stretch; border-top: 1px solid var(--border); }
.lane__label { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; padding: 4px 8px 4px 12px; font-size: var(--fs-12); }
.lane__name { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: var(--fs-13); font-weight: 600; }
.lane__name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lane__range { font-family: var(--font-mono); font-size: var(--fs-11); color: var(--text-3); white-space: nowrap; }
.lane__axis { flex: none; padding: 0 4px; font-size: 10px; font-weight: 700; line-height: 16px; border-radius: 3px; color: var(--text-2); background: var(--surface-3); }
.lane__plot { position: relative; height: 56px; }
.lane__plot svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.lane .pass { fill: var(--pass-band); }
.lane .line-on { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.lane .line-on--map { stroke: var(--text); }
.lane .line-off { fill: none; stroke: var(--line-off); stroke-width: 1; }
.lane .cur { stroke: var(--cursor); stroke-width: 1.5; }
.lane__bubble {
  position: absolute; top: 4px; transform: translateX(6px); padding: 0 5px;
  font-family: var(--font-mono); font-size: var(--fs-11); font-weight: 600; line-height: 18px; white-space: nowrap;
  color: var(--bubble-ink); background: var(--bubble-bg); border-radius: 4px; pointer-events: none;
}
.lane__bubble--left { transform: translateX(calc(-100% - 6px)); }
.lane__remove { width: 22px; height: 22px; padding: 0; margin-left: auto; flex: none; }
.timeaxis { display: flex; justify-content: space-between; padding: 4px 0 8px; font-family: var(--font-mono); font-size: var(--fs-11); color: var(--text-3); }
@media (max-width: 599px) {
  .lane { grid-template-columns: minmax(0, 1fr); }
  .lane__label { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 6px 12px 0; }
  .lane__plot { height: 52px; margin: 0 12px 4px; }
}

/* ---------- G. Cursor-Leiste (ersetzt den „At cursor“-Kasten) ---------- */
.cursorbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  padding: 6px 8px 6px 12px; font-size: var(--fs-13);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-10);
}
.cursorbar__vals { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; }
.cursorbar__vals div { display: flex; flex-direction: column; line-height: 1.2; }
.cursorbar dt { font-size: var(--fs-11); color: var(--text-3); white-space: nowrap; }
.cursorbar dd { margin: 0; font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cursorbar .is-map dd { color: var(--cursor); }
[data-theme="light"] .cursorbar .is-map dd { color: #A11E69; }   /* 6.4:1 auf Weiß */
.cursorbar__nav { display: flex; gap: 4px; margin-left: auto; }
.cursorbar--sticky { position: sticky; top: 0; z-index: 4; box-shadow: var(--shadow-1); }
.cursorbar--dock {                     /* Handy: über der Tab-Leiste */
  position: sticky; bottom: 0; z-index: 6; flex-wrap: nowrap; gap: 12px;
  border-radius: 0; border-inline: 0; border-bottom: 0; padding: 6px 6px 6px 12px;
}
.cursorbar--dock .cursorbar__vals { flex-wrap: nowrap; gap: 12px; overflow: hidden; }

/* ---------- H. Liste: gleiche Namen zusammengefasst --------------------- */
.mi--stack .mi__no { font-family: var(--font-sans); font-weight: 600; color: var(--text-2); }
.mi__chev { width: 16px; height: 16px; color: var(--text-3); transition: transform .15s; }
.mi--stack[aria-expanded="true"] .mi__chev { transform: rotate(90deg); }
.mi-kids { position: relative; margin: 0 0 4px 24px; border-left: 1.5px solid var(--border-strong); }
.mi-kids .mi { grid-template-columns: 44px minmax(0, 1fr) auto; padding-left: 10px; }
.mi-kids .mi__name { font-weight: 400; color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-12); }

/* ---------- I. Begrenzer-Finder ---------------------------------------- */
.finder { border: 1px solid var(--border); border-radius: var(--r-8); overflow: hidden; }
.finder__head, .finder__row { display: grid; grid-template-columns: minmax(0, 1fr) 72px 92px; gap: 10px; align-items: center; padding: 7px 10px; }
.finder__head { font-size: var(--fs-11); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); background: var(--surface-2); }
.finder__row { border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.finder__row:hover { background: var(--surface-2); }
.finder__row[aria-current="true"] { background: var(--accent-soft); }
.finder__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-13); font-weight: 500; }
.finder__meta { font-family: var(--font-mono); font-size: var(--fs-11); color: var(--text-3); }
.finder__pct { font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 600; text-align: right; }
.meter { display: block; width: 56px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); }
.verdict { font-size: var(--fs-11); font-weight: 600; }
.verdict--hi { color: var(--ok); }
.verdict--mid { color: var(--text-2); }
.verdict--lo { color: var(--text-3); }
.finder__foot { padding: 8px 10px; font-size: var(--fs-12); color: var(--text-3); background: var(--surface-2); border-top: 1px solid var(--border); }

/* ---------- J. Popover --------------------------------------------------- */
.pop {
  position: absolute; z-index: 20; min-width: 240px; max-width: 360px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-10); box-shadow: var(--shadow-2);
}
.pop::before {                         /* Pfeil zum Auslöser */
  content: ""; position: absolute; top: -6px; left: var(--arrow-x, 24px);
  width: 10px; height: 10px; background: var(--surface);
  border-left: 1px solid var(--border); border-top: 1px solid var(--border); transform: rotate(45deg);
}
.pop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 6px 8px 14px; border-bottom: 1px solid var(--border); }
.pop__head h3 { margin: 0; font-size: var(--fs-13); font-weight: 700; }
.pop__body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; font-size: var(--fs-13); }
.pop__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 10px 14px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-10) var(--r-10); }
.msg { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-12); }
.msg svg { flex: none; margin-top: 1px; }
.msg--error { color: var(--danger); }
.msg--info { color: var(--text-2); }
.field[aria-invalid="true"], .field.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.btn--danger-ghost { color: var(--danger); background: transparent; border-color: transparent; }
.btn--danger-ghost:hover { background: var(--danger-soft); }
.btn--primary:disabled { color: var(--text-3); background: var(--surface-3); border-color: var(--surface-3); }

/* ---------- K. Handy-Bearbeitung --------------------------------------- */
.editbar {
  display: flex; align-items: center; gap: 6px; padding: 8px;
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 16px rgba(16, 24, 40, .08);
}
.count {
  display: grid; place-items: center; flex: none; min-width: 34px; height: 30px; padding: 0 8px;
  font-size: var(--fs-13); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--surface); background: var(--text); border-radius: var(--r-pill);
}
.opbtn { flex: none; min-width: 76px; padding: 0 8px; }
.tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tool {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 60px; padding: 10px 12px; text-align: left;
  font: inherit; font-size: var(--fs-14); font-weight: 600; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-10); cursor: pointer;
}
.tool span { font-size: var(--fs-12); font-weight: 400; color: var(--text-3); }
.tool:disabled { color: var(--text-3); background: transparent; cursor: not-allowed; }

/* Mini-Heatmap (Handy-Log): ganze Map ohne Zahlen */
.minimap { display: grid; grid-template-columns: repeat(var(--cols, 13), minmax(0, 1fr)); gap: 1px; padding: 1px; background: var(--border); border-radius: var(--r-6); overflow: hidden; }
.minimap > i { position: relative; display: block; height: 9px; }
.minimap > i.has-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; border-radius: 50%; background: var(--dot-fill); box-shadow: 0 0 0 1px var(--dot-ring); }
.minimap > i.is-cur { outline: 2px solid var(--cursor); outline-offset: -1px; z-index: 1; }

/* ---------- L. Kleinkram ------------------------------------------------ */
.fchip[aria-disabled="true"] { color: var(--text-3); border-style: dashed; cursor: default; }
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs--fade { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.summary-row {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 8px 6px 12px;
  font: inherit; font-size: var(--fs-13); text-align: left; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-8); cursor: pointer;
}
.summary-row .muted { margin-left: auto; }
