/* =====================================================================
   Mapsmith – Ergänzungen Runde 3
   Laden nach ecu-ui.css und ecu-ui-r2.css.
   A Akzent-Vorgaben · B Kopfleiste nach Priorität · C Ansehen/Bearbeiten
   D Bearbeitungsleiste einzeilig · E Changes (Desktop + Karten)
   F Code-Listing · G Querverweise · H Einstellungen · I Ask AI · J Handy
   Changes when copied into the explorer: the .menu rules are left out and .ln is scoped to .code
   (both names were already in use). Nothing else is changed.
   ===================================================================== */

/* ---------- A. Akzent-Vorgaben (<html data-accent="…">) --------------- */
/* Weiß auf --accent ≥ 5:1 in beiden Modi. Blau = Standard aus ecu-ui.css.
   Kein Grün (zu nah an „ok“), kein Rot/Orange/Pink/Lila (feste Bedeutungen). */
[data-accent="sky"]      { --accent: #0B6FA4; --accent-hover: #095E8C; --accent-soft: #E3F1F9; --accent-soft-text: #095E8C; --focus: #0B6FA4; }
[data-accent="teal"]     { --accent: #0F766E; --accent-hover: #0B5F58; --accent-soft: #E2F4F2; --accent-soft-text: #0B5F58; --focus: #0F766E; }
[data-accent="olive"]    { --accent: #5E6B12; --accent-hover: #4B5610; --accent-soft: #F0F3DC; --accent-soft-text: #4B5610; --focus: #5E6B12; }
[data-accent="graphite"] { --accent: #3D4652; --accent-hover: #2C333C; --accent-soft: #ECEEF1; --accent-soft-text: #3D4652; --focus: #3D4652; }
[data-theme="dark"][data-accent="sky"]      { --accent-soft: #12303F; --accent-soft-text: #8CD0F2; --focus: #6CC3EE; }
[data-theme="dark"][data-accent="teal"]     { --accent-soft: #10302D; --accent-soft-text: #7EDACF; --focus: #5FD0C2; }
[data-theme="dark"][data-accent="olive"]    { --accent-soft: #2A2F12; --accent-soft-text: #C9D67E; --focus: #B9C96A; }
[data-theme="dark"][data-accent="graphite"] { --accent-soft: #262C35; --accent-soft-text: #C3CBD6; --focus: #AEB8C6; }
/* A vs B % bleibt fest (Blau/Rot, Tokens dn3 … dp3): Bedeutung, nicht Geschmack. */

/* ---------- B. Kopfleiste: was bei welcher Breite weicht --------------- */
/* Regel: Zahlen werden nie abgeschnitten – ganze Teile verschwinden.
   1. Dateigrößen/Samples  2. Text der Status-Pille  3. Thema-Knopf
   4. Namen von B und Log  5. Text am Edit-Knopf (nur Stift)            */
.hdr .slot__name { flex: 0 1 auto; min-width: 5ch; }
.pill__count { flex: none; font-variant-numeric: tabular-nums; }
@media (max-width: 1439px) {
  .hdr .slot__meta { display: none; }
  .hdr .pill--ok .pill__text { display: none; }
}
@media (max-width: 1365px) {
  .hdr .slot__name { max-width: 15ch; }
  .hdr .slot--b .slot__name,
  .hdr .slot--log .slot__name { max-width: 10ch; }
  .hdr .js-theme { display: none; }          /* Thema → Settings › Appearance */
}
@media (max-width: 1199px) {
  .hdr .slot--b .slot__name,
  .hdr .slot--log .slot__name { display: none; }
  .hdr .btn--mode .btn__label { display: none; }
}

/* ---------- C. Ansehen ↔ Bearbeiten ----------------------------------- */
.btn--mode[aria-pressed="true"] {
  color: var(--accent-text); background: var(--accent); border-color: var(--accent); font-weight: 600;
}
.btn--mode[aria-pressed="true"]:hover { background: var(--accent-hover); }
/* Tabelle bekommt im Bearbeitungsmodus einen Rahmen und ein Reiter-Etikett */
.grid-frame { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.grid-flag {
  display: none; align-items: center; gap: 6px; height: 22px; padding: 0 10px;
  font-size: var(--fs-12); font-weight: 600; color: var(--accent-text); background: var(--accent);
  border-radius: var(--r-6) var(--r-6) 0 0;
}
.is-editing .grid-flag { display: inline-flex; }
.is-editing .grid-wrap { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); border-top-left-radius: 0; }
.is-viewing .c { cursor: default; }
.viewbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px 6px 12px; font-size: var(--fs-13); color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-10); }
.viewbar b { color: var(--text); }

/* ---------- D. Bearbeitungsleiste einzeilig ---------------------------- */
.mapmain { container-type: inline-size; }
.tb--one { flex-wrap: nowrap; }
.tb--one .tb__more { margin-left: auto; }
@container (max-width: 1000px) { .tb .tb__opt-1 { display: none; } }   /* Copy from B → ⋯ */
@container (max-width: 860px)  { .tb .tb__opt-2 { display: none; } }   /* Smooth → ⋯ */
@container (max-width: 760px)  { .tb .tb__opt-3 { display: none; } }   /* Interpolate → ⋯ */
/* .menu, .menu__item, .menu__sep, .menu__label: left out here, the page uses .menu for <details> menus and .menubox/.mitem for their boxes */

/* ---------- E. Changes ------------------------------------------------ */
.stats { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.stat { display: flex; flex-direction: column; line-height: 1.2; }
.stat b { font-size: var(--fs-20); font-weight: 700; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--fs-12); color: var(--text-3); }
.kind { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; font-size: var(--fs-11); font-weight: 600; border-radius: var(--r-4); color: var(--text-2); background: var(--surface-3); white-space: nowrap; }
.dir { font-family: var(--font-mono); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); white-space: nowrap; }
.cellbar { display: block; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.cellbar > i { display: block; height: 100%; background: var(--diff); }
.cellbar--edits > i { background: var(--edit); }
/* Karten am Handy */
.chg-list { display: flex; flex-direction: column; gap: 8px; }
.chg {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 12px;
  color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-10);
}
.chg__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-14); font-weight: 600; }
.chg__meta { font-family: var(--font-mono); font-size: var(--fs-11); color: var(--text-3); }
.chg__nums { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1.3fr 0.8fr; gap: 8px; margin: 6px 0 0; }
.chg__nums div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.chg__nums dt { font-size: var(--fs-11); color: var(--text-3); }
.chg__nums dd { margin: 0; font-family: var(--font-mono); font-size: var(--fs-13); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chg__aside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* ---------- F. Code-Listing ------------------------------------------- */
.code { font-family: var(--font-mono); font-size: var(--fs-12); line-height: 22px; font-variant-numeric: tabular-nums; }
.code .ln {
  display: grid; grid-template-columns: 18px 76px 72px minmax(160px, 1fr) minmax(0, 240px);
  align-items: center; column-gap: 12px; padding: 0 10px 0 4px;
}
.code .ln:hover { background: var(--surface-2); }
.code .ln.is-cur { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.code .ln__gut { color: var(--text-3); text-align: center; font-size: 11px; }
.code .ln__addr { color: var(--text-2); }
.code .ln__word { color: var(--text-3); }
.code .ln__ins { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.code .ln__ins .mn { display: inline-block; min-width: 7ch; font-weight: 600; }
.code .ln__ins .reg { color: var(--text-2); }
.code .ln__ref { display: flex; justify-content: flex-start; min-width: 0; }
/* Sprung: Link mit Richtungspfeil; Aufruf: eigener Chip; Rückkehr: Linie */
.br { color: var(--accent-soft-text); text-decoration: underline; text-underline-offset: 2px; }
.br::before { content: "↓ "; text-decoration: none; display: inline-block; margin-right: 2px; }
.br--back::before { content: "↑ "; }                    /* Rücksprung = Schleife */
.call { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 6px; font-size: var(--fs-11); font-weight: 600; color: var(--text); background: var(--surface-3); border-radius: var(--r-4); text-decoration: none; }
.call::before { content: "call"; font-weight: 700; color: var(--text-3); }
.code .ln--ret { border-bottom: 1px dashed var(--border-strong); }
.fn-head { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; padding: 6px 10px 2px 26px; font-family: var(--font-sans); font-size: var(--fs-12); color: var(--text-3); border-top: 1px solid var(--border); }
.fn-head b { font-family: var(--font-mono); color: var(--text); }
/* Ziel-Chips in der rechten Spalte */
.ref { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 20px; padding: 0 7px; font-size: var(--fs-11); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: var(--r-4); text-decoration: none; }
.ref i { font-style: normal; font-weight: 700; font-family: var(--font-sans); letter-spacing: .04em; }
.ref--map { color: var(--accent-soft-text); background: var(--accent-soft); }
.ref--ram { color: var(--text-2); background: var(--surface-3); }
.ref--const { color: var(--text-2); border: 1px solid var(--border); }

/* ---------- G. Querverweise (Aufrufer) --------------------------------- */
.xrefs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.xref { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 8px; align-items: center; padding: 6px 10px; font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
.xref:hover { background: var(--surface-2); }
.xref span:last-child { font-family: var(--font-sans); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- H. Einstellungen ------------------------------------------ */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; cursor: pointer;
  background: var(--sw); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong);
}
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch-lab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: var(--fs-11); color: var(--text-2); }
.live-note { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-3); }

/* ---------- I. Ask AI ------------------------------------------------- */
.qchips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.qchips::-webkit-scrollbar { display: none; }
.qchip { flex: none; height: 30px; padding: 0 12px; font: inherit; font-size: var(--fs-13); white-space: nowrap; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-pill); cursor: pointer; }
.qchip:hover { background: var(--surface-2); }

/* ---------- J. Handy -------------------------------------------------- */
@media (max-width: 599px) {
  .code .ln { grid-template-columns: 12px 54px minmax(0, 1fr); column-gap: 8px; }
  .code .ln__word { display: none; }
  .code .ln__ref { grid-column: 3; margin: -2px 0 4px; }
  .fn-head { padding-left: 20px; }
}
.code--narrow .ln { grid-template-columns: 12px 54px minmax(0, 1fr); column-gap: 8px; }
.code--narrow .ln__word { display: none; }
.code--narrow .ln__ref { grid-column: 3; margin: -4px 0 4px; }
.code--narrow .ln__ref:empty { display: none; }
.code--narrow .fn-head { padding-left: 20px; }
.navlist { display: flex; flex-direction: column; }
.navlist a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 6px 16px; color: var(--text); text-decoration: none; border-top: 1px solid var(--border); }
.navlist a[aria-current="page"] { background: var(--accent-soft); }
.navlist small { display: block; font-size: var(--fs-12); color: var(--text-3); }
