/* =====================================================================
   Studio V4 · Bilder der Branchen-Seiten (branchen/handwerk/, branchen/treuhand/, branchen/verwaltung/)
   HTML: _src/components/branchen-bilder.js. Neutral gestaltet, keine fremden Oberflaechen.
   Gehoert zur Gruppe Vertrauens-Seiten. Tokens aus css/site.css. Schrift waechst mit dem Rahmen (cqi).
   ===================================================================== */

/* ------------------------------------------------------------------ Rahmen der Bildergeschichte */
.bilder__bild { container-type: inline-size; }
.bb {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 6% 7%;
  border-radius: 14px; background: var(--bg-tint); overflow: hidden;
  font-size: clamp(10.5px, 3.75cqi, 13.5px); line-height: 1.4; color: var(--text); text-align: left;
}
.bb--warm { background: var(--bg-warm); }
.bb--phone { padding-bottom: 0; place-items: end center; }
.bb > * { min-width: 0; }

/* ------------------------------------------------------------------ Kleinteile */
.bb-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 0.88em; line-height: 1.5; font-weight: 500;
}
.bb-chip--ki { background: var(--accent-soft); box-shadow: none; color: var(--accent); font: 600 0.8em/1.6 var(--f-mono); letter-spacing: 0.06em; }
.bb-chip--warn { background: var(--warn-soft); box-shadow: inset 0 0 0 1px #ecd98a; }
.bb-chip--sie { background: var(--ember-soft); box-shadow: none; color: var(--ember-ink); font-weight: 600; }
.bb-chip--ok { background: #e2f3ea; box-shadow: none; color: var(--ok); font-weight: 600; }
.bb-btn { display: inline-flex; align-items: center; height: 2.2em; padding: 0 1em; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.88em; font-weight: 600; }
.bb-btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.bb-actions { display: flex; justify-content: flex-end; gap: 6px; margin: 4px 0 0; }
.bb-note { margin: 0; color: var(--muted); font-size: 0.85em; text-align: right; }
.bb-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
.bb .ico { width: 1.25em; height: 1.25em; flex: none; }

/* Zeilen: Bezeichnung links, Wert rechts */
.bb-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0; padding: 3px 0; border-bottom: 1px solid var(--line); }
.bb-row span:last-child { color: var(--ink); font-weight: 550; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bb-row--sub { color: var(--muted); }
.bb-row--total { border-bottom: 0; border-top: 1.5px solid var(--ink); margin-top: 2px; padding-top: 5px; color: var(--ink); font-weight: 650; }
.bb-row--total span:last-child { font-weight: 700; }
.bb-row--status span:last-child { color: var(--ember-ink); white-space: normal; }
.bb-row--ok span:last-child { display: inline-flex; align-items: center; gap: 6px; white-space: normal; }
.bb-row--ok span:last-child::after {
  content: ''; flex: none; width: 0.55em; height: 0.3em; margin-bottom: 0.2em;
  border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg);
}

/* Gelb markierte Rueckfrage */
.bb-flag { margin: 4px 0 0; padding: 4px 8px; border-radius: 6px; background: var(--warn-soft); box-shadow: inset 3px 0 0 #d9b200; color: var(--ink); }

/* ------------------------------------------------------------------ Karte und Papier */
.bb-card { width: 100%; display: grid; gap: 4px; padding: 0.9em 1em; border-radius: 12px; background: var(--bg); box-shadow: var(--shadow-1); }
.bb-card__title { display: flex; align-items: center; gap: 6px; margin: 0 0 2px; color: var(--ink); font-weight: 650; }
.bb-card__title .ico { color: var(--accent); }
.bb-card__sub { margin: 4px 0 0; font: 500 0.8em/1.4 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

.bb-paper { width: 100%; padding: 0.9em 1em; border-radius: 6px; background: var(--bg); box-shadow: var(--shadow-1); }
.bb-paper__head { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--ink); font: 600 0.82em/1.4 var(--f-mono); letter-spacing: 0.04em; }
.bb-paper__head .ico { color: var(--accent); }
.bb-paper__foot { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; }
.bb-inv__firm { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink); font-weight: 650; }
.bb-inv__firm::before { content: ''; width: 1em; height: 1em; border-radius: 3px; background: linear-gradient(135deg, #7d8a98, #c4ccd5); }
.bb-inv__title { margin: 2px 0 4px; color: var(--muted); font-size: 0.9em; }
.bb-inv__small { margin: 4px 0 0; color: var(--muted); font-size: 0.82em; }
.bb-paper--inv { max-width: 86%; }

/* ------------------------------------------------------------------ Handy */
.bb-phone { width: 100%; padding: 6px; border-radius: 24px; background: #1b2532; box-shadow: var(--shadow-device); }
.bb-phone__screen { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; min-height: 100%; padding: 1.6em 0.8em 1em; border-radius: 18px; background: var(--bg); overflow: hidden; }
.bb-phone__screen > * { min-width: 0; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.bb-phone__screen::before { content: ''; position: absolute; top: 6px; left: 50%; width: 28%; height: 5px; border-radius: 5px; background: #1b2532; transform: translateX(-50%); }
.bb-phone__top { margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 500 0.78em/1.4 var(--f-mono); letter-spacing: 0.04em; color: var(--muted); }
.bb-phone--solo { width: 66%; border-radius: 26px 26px 0 0; padding-bottom: 0; }
.bb-phone--solo .bb-phone__screen { border-radius: 20px 20px 0 0; padding-bottom: 1.4em; }

.bb-voice { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 16px 16px 16px 4px; background: var(--bg-soft); }
.bb-voice__play { flex: none; display: grid; place-items: center; width: 2em; height: 2em; border-radius: 50%; background: var(--accent); color: #fff; }
.bb-voice__play .ico { width: 1em; height: 1em; fill: currentColor; }
.bb-voice__t { flex: none; font: 500 0.8em/1 var(--f-mono); color: var(--muted); }
.bb-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 1.9em; min-width: 0; }
.bb-wave i { flex: 1; min-width: 1px; height: var(--h); border-radius: 2px; background: #b9c3ce; }
.bb-wave i.is-played { background: var(--accent); }
.bb-bubble { margin: 0; padding: 7px 10px; border-radius: 16px 16px 16px 4px; background: var(--bg-soft); color: var(--ink); }
.bb-bubble b { display: block; font: 600 0.75em/1.5 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.bb-bubble--small { font-size: 0.92em; }
.bb-bubble--meta { padding: 0 4px; background: none; color: var(--muted); font: 500 0.78em/1.4 var(--f-mono); }

/* Posteingang */
.bb-mailitem { display: grid; gap: 0; margin: 0; padding: 6px 8px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.bb-mailitem b { color: var(--ink); font-weight: 600; }
.bb-mailitem span { color: var(--text); font-size: 0.92em; }
.bb-mailitem .bb-mailitem__pre { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-mailitem.is-sel { background: var(--bg-tint); box-shadow: inset 3px 0 0 var(--accent); }
.bb-file { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin-top: 3px; padding: 1px 7px; border-radius: 6px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); font: 500 0.82em/1.6 var(--f-mono) !important; color: var(--ink) !important; }
.bb-file .ico { width: 1.1em; height: 1.1em; color: var(--accent); }
.bb-card--inbox { gap: 5px; }

/* Buchung */
.bb-book { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.1fr) auto; gap: 3px 8px; margin: 0; }
.bb-book span { padding: 2px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.bb-book span:nth-child(-n+3) { font: 500 0.75em/1.6 var(--f-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.bb-book span:nth-child(3n) { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bb-why { margin: 6px 0 0; padding: 6px 8px; border-radius: 8px; background: var(--bg-tint); color: var(--ink); font-size: 0.9em; }
.bb-result { margin: 6px 0 0; }

/* Quellen und Antwort mit Verweisen */
.bb-sources { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bb-source { padding: 0.8em; border-radius: 8px; background: var(--bg); box-shadow: var(--shadow-1); }
.bb-source p { margin: 0 0 4px; }
.bb-source__file { display: flex; align-items: center; gap: 5px; padding-bottom: 5px; border-bottom: 1px solid var(--line); color: var(--ink); font: 600 0.8em/1.4 var(--f-mono); }
.bb-source__file .ico { color: var(--accent); }
.bb mark { padding: 0 3px; border-radius: 3px; background: var(--accent-soft); color: var(--ink); }
.bb-line { margin: 0 0 5px; color: var(--ink); }
.bb-line sup { color: var(--accent); font-weight: 700; }
.bb-src { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 0; }
.bb-src span { padding: 1px 6px; border-radius: 5px; background: var(--bg-soft); color: var(--muted); font: 500 0.75em/1.6 var(--f-mono); }

/* Liste der Anfragen */
.bb-listrow { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.bb-listrow--hoch { background: var(--warn-soft); box-shadow: inset 3px 0 0 #d9b200; }
.bb-listrow.is-sel { background: var(--bg-tint); box-shadow: inset 3px 0 0 var(--accent); }

/* ------------------------------------------------------------------ Hero: Handy, Kabel, Ergebnis */
.bb-hero { container-type: inline-size; }
.bb-hero__in {
  display: grid; grid-template-columns: minmax(0, 36fr) minmax(0, 14fr) minmax(0, 50fr); align-items: center;
  padding: 2% 0; font-size: clamp(9.5px, 2.15cqi, 14px); line-height: 1.4; color: var(--text);
}
.bb-hero .bb-phone { align-self: center; }
.bb-hero .bb-phone__screen { min-height: 19em; }
.bb-paper--hero { align-self: start; margin-top: 8%; padding: 1.1em 1.2em; box-shadow: var(--shadow-device); border-radius: 10px; }
.bb-cable { position: relative; align-self: stretch; display: grid; place-items: center; }
.bb-cable svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bb-cable__line { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0.55; }
.bb-cable__pulse { fill: none; stroke: var(--signal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 8 92; stroke-dashoffset: 100; opacity: 0; }
.bb-cable .bb-chip { position: relative; box-shadow: 0 0 0 4px var(--bg-tint); }
@media (prefers-reduced-motion: no-preference) {
  .bb-cable__pulse { opacity: 1; animation: bb-pulse 3.2s var(--ease-io) infinite; }
}
@keyframes bb-pulse { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@container (max-width: 420px) {
  .bb-hero__in { grid-template-columns: minmax(0, 42fr) minmax(0, 8fr) minmax(0, 50fr); }
  .bb-hero .bb-phone__screen { min-height: 17em; padding-inline: 0.6em; }
  .bb-hero .bb-cable .bb-chip { padding: 1px 5px; }
  .bb-hero .bb-row { flex-wrap: wrap; column-gap: 4px; }
  .bb-hero .bb-row span:last-child { margin-left: auto; }
  .bb-hero .bb-paper__head { font-size: 0.75em; }
}
@media (forced-colors: active) {
  .bb-cable__pulse { display: none; }
  .bb-chip, .bb-card, .bb-paper, .bb-phone { border: 1px solid CanvasText; }
}

/* Titel der Branchen-Seiten: nur an den weichen Trennstellen im Text trennen (kein "Be-leg") */
.hero .t-display { -webkit-hyphens: manual; hyphens: manual; }

/* Beispielrechnung (Komponente kiRechner, js/rechner.js): branchen/handwerk/, branchen/treuhand/ */
.rechner { display: grid; gap: var(--sp-5); max-width: 56rem; padding: clamp(22px, 3vw, 36px); border-radius: var(--r-stage); background: var(--bg); box-shadow: var(--shadow-1); }
.rechner__felder { display: grid; gap: var(--sp-4); }
@media (min-width: 760px) { .rechner__felder { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rechner__feld { display: grid; gap: 8px; color: var(--ink); font-weight: 550; font-size: 0.9375rem; }
.rechner__feld input { width: 100%; min-height: 52px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg); color: var(--ink); font: 600 1.25rem/1 var(--f-sans); font-variant-numeric: tabular-nums; }
.rechner__feld input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.rechner__zeile { margin: 0; padding: 0; border: 0; min-width: 0; }
.rechner__legend { margin: 0 0 var(--sp-3); padding: 0; font: 600 0.8125rem/1.3 var(--f-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted, var(--text)); }
@media (min-width: 760px) { .rechner__felder--satz { grid-template-columns: minmax(0, 1fr); max-width: 30rem; } }
.rechner__ergebnis { display: grid; gap: var(--sp-3); margin: 0; padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.rechner__ergebnis p { margin: 0; }
.rechner__haupt, .rechner__chf { color: var(--ink); font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.rechner__haupt output, .rechner__chf output { color: var(--accent); }
.rechner__jahr { font-weight: 450; color: var(--text); }
.rechner__jahr output { color: var(--text); font-weight: 600; }
.rechner__kosten, .rechner__ab { color: var(--text); line-height: 1.55; }
.rechner__ab output { color: var(--ink); font-weight: 550; }
.rechner__note { margin: 0; }
