/* Einblick: Klick-Durchgang durch eine Kunden-App (Anfrage → Angaben → Angebot → Freigabe) und der
   Video-Platz .media-slot. Im Fenster nur Tinte, Kalk und Status-Farben; Licht (Hauch) nur auf der Bühne.
   Ablauf und Zustände setzt assets/motion/einblick.js. */

/* ---------- Abschnitt und Bühne ---------- */
.eb-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: clamp(40px, 5vw, 72px);
  padding: clamp(12px, 4.4vw, 72px) clamp(12px, 4vw, 64px) clamp(20px, 3.4vw, 52px);
  border-radius: var(--r-xl);
  background:
    radial-gradient(70% 55% at 18% 108%, var(--glow-tint), transparent 70%),
    radial-gradient(60% 50% at 88% 108%, var(--dusk-tint), transparent 70%),
    var(--kalk);
}
/* Lichtschein hinter dem Fenster, solange die KI arbeitet */
.eb-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(46% 38% at 50% 104%, color-mix(in srgb, var(--glow-amber) 30%, transparent), transparent 72%),
    radial-gradient(40% 34% at 30% 104%, color-mix(in srgb, var(--glow-rose) 14%, transparent), transparent 70%),
    radial-gradient(40% 34% at 72% 104%, color-mix(in srgb, var(--glow-violet) 12%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 1400ms var(--ease);
}
.eb-stage.is-thinking::before { opacity: 1; }

.eb-player { width: min(100%, 1120px); margin-inline: auto; zoom: var(--ui-zoom); }

/* ---------- Fenster ---------- */
.panel.eb-app { position: relative; height: 510px; padding: 0; grid-template-rows: minmax(0, 1fr); box-shadow: 0 40px 80px -40px rgb(40 30 60 / 0.32), 0 12px 24px -14px rgb(8 8 20 / 0.16); }
.eb-app .app-side a { transition: background-color 240ms var(--ease), color 240ms var(--ease); }
.eb-app .app-side a.eb-hover:not(.on) { background: var(--kalk); color: var(--ink); }
.eb-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.eb-topbar { display: none; }
.eb-views { position: relative; flex: 1; min-height: 0; }
.eb-view {
  position: absolute;
  inset: 0;
  padding: 24px 28px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(18px);
  transition: opacity 220ms var(--ease), transform 640ms var(--ease), visibility 0s linear 640ms;
}
.eb-view.is-left { transform: translateX(-18px); }
.eb-view.is-on { opacity: 1; visibility: visible; transform: none; transition: opacity 440ms var(--ease) 110ms, transform 700ms var(--ease) 40ms, visibility 0s; }
.eb-main.is-faded .eb-views, .eb-main.is-faded .eb-toast { opacity: 0; transition: opacity 240ms var(--ease); }
.eb-views { transition: opacity 500ms var(--ease); }
.eb-title { font-size: 28px; margin-bottom: 18px; }

/* Ohne Übergänge: beim Zurücksetzen und beim Springen zwischen Kapiteln */
.eb-instant, .eb-instant *, .eb-instant *::before, .eb-instant *::after, .eb-snap, .eb-snap * { transition: none !important; animation: none !important; }

/* Übersicht */
.eb-flow .fstep { padding: 13px 0; }

/* Liste */
.eb-list .row { transition: background-color 260ms var(--ease); }
.eb-list .row.eb-hover { background: color-mix(in srgb, var(--kalk) 70%, var(--paper)); }
.eb-list .row.eb-press { background: var(--kalk); }
.eb-new .row-name::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 8px; border-radius: 50%; background: var(--ink); vertical-align: 2px; transition: opacity 300ms; }
.eb-new.is-seen .row-name::after { opacity: 0; }
.eb-app .count { transition: background-color 300ms; }

/* Status-Pille wechselt */
.eb-app .chip { transition: opacity 160ms linear, transform 360ms var(--ease), background-color 300ms, color 300ms; }
.eb-app .chip.eb-swap { opacity: 0; transform: scale(0.92); }

/* ---------- Detail: Mail → Angaben → Angebot ---------- */
.eb-dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.eb-dhead .eb-title { font-size: 24px; margin: 2px 0 0; }
.eb-dhead .chip { margin-top: 22px; }
.eb-crumb { display: inline-flex; align-items: center; gap: 2px; margin-left: -4px; font-size: 13px; color: var(--muted); }
.eb-crumb .icon { width: 16px; height: 16px; }

/* Ausschnitt mit zwei sichtbaren Spalten; die Spur schiebt sich um eine Spalte weiter */
.eb-vp { --gap: 16px; margin-inline: calc(-1 * var(--gap)); padding: 0 var(--gap) 4px; overflow: hidden; container-type: inline-size;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--gap), #000 calc(100% - var(--gap)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--gap), #000 calc(100% - var(--gap)), transparent); }
.eb-track { display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - var(--gap)) / 2); gap: var(--gap); align-items: start; transition: transform 1000ms var(--ease); }
.eb-track.is-offer { transform: translateX(calc((100% + var(--gap)) / -2)); }
.eb-card { border: 1px solid var(--line); border-radius: var(--r-ui); padding: 16px; background: var(--paper); box-shadow: 0 2px 2px rgb(0 0 0 / 0.04); }
.eb-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; min-height: 36px; }
.eb-card-head b { display: block; font-weight: 500; }
.eb-card-head .sub { display: block; font-size: 12.5px; }

/* Mail: Text wird gelesen (Welle in Tinte), Fundstellen unterstrichen */
.eb-mail-head { display: flex; align-items: center; gap: 10px; }
.eb-mail-head .av { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--kalk); display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.eb-mail-head b { display: block; font-weight: 500; line-height: 1.25; }
.eb-mail-head .sub { font-size: 12.5px; }
.eb-subject { margin: 14px 0 8px; font-weight: 500; }
.eb-body { font-size: 13.5px; line-height: 1.62; }
.eb-sign { margin-top: 10px; }
.eb-mail .eb-w { color: var(--muted); transition: color 520ms var(--ease); transition-delay: calc(var(--n) * 24ms); }
.eb-mail.is-read .eb-w { color: var(--ink); }
.eb-mark {
  background: linear-gradient(var(--ink), var(--ink)) 0 calc(100% - 0.5px) / 0 1.5px no-repeat;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 560ms var(--ease);
}
.eb-mark.on { background-size: 100% 1.5px; }

/* Angaben: leere Felder als ruhige Balken, beim Erkennen läuft die Lichtkante über den Wert */
.eb-field { display: grid; grid-template-columns: 84px minmax(0, 1fr); column-gap: 12px; align-items: center; padding: 8px 6px; margin: 0 -6px; border-top: 1px solid var(--line); border-radius: var(--r-sm); transition: background-color 260ms var(--ease); }
.eb-field + .eb-field { border-top-color: var(--line); }
.eb-field.eb-hover { background: var(--kalk); }
.eb-k { font-size: 13px; color: var(--muted); }
.eb-v { position: relative; display: flex; align-items: center; gap: 8px; min-height: 22px; font-weight: 500; }
.eb-v::before { content: ""; position: absolute; left: 0; top: 50%; width: var(--w, 50%); height: 8px; margin-top: -4px; border-radius: var(--r-sm); background: var(--kalk); transition: opacity 300ms var(--ease); }
.eb-v > * { opacity: 0; filter: blur(5px); transition: opacity 380ms var(--ease), filter 520ms var(--ease); }
.eb-field.is-busy .eb-v::before, .eb-field.is-on .eb-v::before { opacity: 0; }
.eb-field.is-busy .eb-val, .eb-field.is-on .eb-v > * { opacity: 1; filter: none; }
.eb-field .zm-shimmer { animation-duration: 0.9s; }
.eb-src { grid-column: 2; font-size: 12px; color: var(--muted); opacity: 0; transition: opacity 400ms var(--ease) 200ms; }
.eb-field.is-on .eb-src { opacity: 1; }

/* Angebot: Zeilen entstehen aus Platzhaltern, Summe zählt */
.eb-table { font-size: 13px; }
.eb-tr { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 54px 70px 82px; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.eb-tr > :nth-child(n+2) { text-align: right; justify-self: end; }
.eb-tr b { display: block; font-weight: 500; }
.eb-tr small { display: block; font-size: 12px; color: var(--muted); }
.eb-th { padding: 4px 0 8px; border-top: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--subtle); }
.eb-tr[data-pos] > * { opacity: 0; filter: blur(5px); transition: opacity 400ms var(--ease), filter 560ms var(--ease); }
.eb-tr[data-pos].is-on > * { opacity: 1; filter: none; }
.eb-tr[data-pos]::before, .eb-tr[data-pos]::after { content: ""; position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--kalk) 0 30%, var(--kalk-deep) 50%, var(--kalk) 70% 100%) 0 0 / 300% 100%; transition: opacity 300ms var(--ease); }
.eb-tr[data-pos]::before { left: 0; width: 46%; }
.eb-tr[data-pos]::after { right: 0; width: 18%; }
.eb-offer.is-loading .eb-tr[data-pos]::before, .eb-offer.is-loading .eb-tr[data-pos]::after { animation: eb-skel 1.3s linear infinite; }
.eb-tr[data-pos].is-on::before, .eb-tr[data-pos].is-on::after { opacity: 0; animation: none; }
@keyframes eb-skel { from { background-position: 100% 0; } to { background-position: -50% 0; } }

.eb-input { position: relative; display: inline-flex; align-items: center; justify-content: flex-end; min-width: 46px; height: 28px; margin-right: -9px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); font-variant-numeric: tabular-nums; transition: border-color 200ms, box-shadow 260ms var(--ease); }
.eb-input.eb-hover { border-color: var(--line-strong); }
.eb-input.is-focus { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.eb-caret { display: none; width: 1.5px; height: 15px; margin-left: 1px; background: var(--ink); }
.eb-input.is-focus .eb-caret { display: block; }
.eb-input.is-focus.is-idle .eb-caret { animation: zm-blink 1s steps(1) infinite; }
.eb-sel { background: color-mix(in srgb, var(--ink) 16%, transparent); border-radius: 2px; }
.eb-flash { animation: eb-flash 1100ms var(--ease); border-radius: 4px; }
@keyframes eb-flash { from { background: var(--kalk-deep); box-shadow: 0 0 0 3px var(--kalk-deep); } to { background: transparent; box-shadow: 0 0 0 3px transparent; } }

.eb-sum { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; padding: 12px 0 2px; border-top: 1px solid var(--ink); font-size: 13px; opacity: 0; transition: opacity 400ms var(--ease); }
.eb-sum b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.eb-offer.is-summed .eb-sum { opacity: 1; }
.eb-actions { display: flex; gap: 8px; margin-top: 14px; opacity: 0.35; transition: opacity 500ms var(--ease); }
.eb-offer.is-ready .eb-actions { opacity: 1; }
.eb-approve { gap: 7px; min-width: 146px; justify-content: center; transition: background-color 220ms var(--ease), transform 160ms var(--ease); }
.eb-approve.eb-hover { background: color-mix(in srgb, var(--night) 84%, var(--paper)); }
.eb-approve.eb-press { transform: scale(0.96); }
.eb-approve .icon { display: none; width: 14px; height: 14px; stroke-width: 2.2; }
.eb-spin { display: none; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--on-night) 35%, transparent); border-top-color: var(--on-night); animation: eb-spin 700ms linear infinite; }
.eb-approve.is-busy .eb-spin { display: block; }
.eb-approve.is-done .icon { display: block; }
@keyframes eb-spin { to { transform: rotate(360deg); } }

/* ---------- Meldungen ---------- */
.eb-toast { position: absolute; z-index: 3; top: 16px; right: 16px; display: flex; align-items: center; gap: 12px; padding: 11px 16px 11px 11px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-ui); box-shadow: 0 16px 32px -16px rgb(8 8 20 / 0.3), 0 2px 4px rgb(0 0 0 / 0.04); opacity: 0; transform: translateY(-10px) scale(0.98); transition: opacity 300ms var(--ease), transform 600ms var(--ease); pointer-events: none; }
.eb-toast.is-on { opacity: 1; transform: none; }
.eb-toast b { display: block; font-weight: 500; line-height: 1.3; }
.eb-toast .sub { font-size: 12.5px; }
.eb-toast .row-ico { width: 30px; height: 30px; }
.eb-toast .eb-ok { background: color-mix(in srgb, var(--ok) 14%, var(--paper)); color: var(--ok-text); }
.eb-toast .eb-ok .icon { stroke-width: 2.2; }

/* ---------- Cursor (macOS-Pfeil, Textcursor, Tippen auf dem Handy) ---------- */
.eb-cursor { position: absolute; left: 0; top: 0; z-index: 10; width: 0; height: 0; pointer-events: none; will-change: transform; }
.eb-cursor svg { position: absolute; width: 28px; height: 28px; max-width: none; overflow: visible; filter: drop-shadow(0 1px 1.2px rgb(0 0 0 / 0.32)); transition: transform 110ms var(--ease); }
.eb-arrow { left: -8.2px; top: -4.6px; transform-origin: 8.2px 4.6px; fill: var(--ink); stroke: var(--paper); stroke-width: 1.5; stroke-linejoin: round; paint-order: stroke; }
.eb-ibeam { left: -14px; top: -14px; display: none; fill: none; stroke-linecap: round; }
.eb-ibeam .o { stroke: var(--paper); stroke-width: 4.2; }
.eb-ibeam .i { stroke: var(--ink); stroke-width: 1.6; }
.eb-cursor[data-shape="text"] .eb-arrow { display: none; }
.eb-cursor[data-shape="text"] .eb-ibeam { display: block; }
.eb-cursor.is-down .eb-arrow { transform: scale(0.88); }
.eb-ring { position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--ink) 55%, transparent); opacity: 0; }
.eb-touch { position: absolute; left: -17px; top: -17px; width: 34px; height: 34px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 18%, transparent); box-shadow: 0 0 0 1.5px rgb(255 255 255 / 0.9), 0 2px 8px rgb(0 0 0 / 0.18); opacity: 0; transform: scale(0.6); transition: opacity 220ms var(--ease), transform 320ms var(--ease); }
.eb-cursor[data-shape="touch"] svg { display: none; }
.eb-cursor[data-shape="touch"].is-touch .eb-touch { opacity: 1; transform: scale(1); }
.eb-cursor[data-shape="touch"].is-down .eb-touch { transform: scale(0.86); }

/* ---------- Kapitelmarken ---------- */
.eb-chapters { list-style: none; padding: 0; margin-bottom: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(10px, 2vw, 28px); margin-top: clamp(18px, 2vw, 28px); }
.eb-chapters button { display: grid; gap: 12px; width: 100%; padding: 6px 0; border: 0; background: none; text-align: left; cursor: pointer; font-family: var(--font-mono); font-size: var(--text-micro); line-height: 1.35; letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--subtle); transition: color 300ms var(--ease); }
.eb-chapters button:hover { color: var(--ink); }
.eb-chapters button[aria-current="step"] { color: var(--ink); }
.eb-bar { position: relative; display: block; height: 2px; overflow: hidden; background: color-mix(in srgb, var(--ink) 12%, transparent); }
.eb-bar i { position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left; will-change: transform; }
.eb-no { margin-right: 10px; color: var(--subtle); }
.eb-player.no-chapters .eb-chapters { display: none; }

/* ---------- Video-Platz ---------- */
.media-slot { position: relative; }
.media-slot > video, .media-slot > .media-poster { display: none; width: 100%; height: auto; border-radius: var(--r-md); background: var(--kalk); }
.media-slot.has-media > video, .media-slot.has-media > .media-poster { display: block; animation: rise 600ms var(--ease); }
.media-slot.has-media > :not(video):not(.media-poster) { display: none; }
/* Hintergrund-Variante: füllt eine Bildfläche (.art) über dem Canvas, Inhalt der Fläche bleibt darüber */
.media-slot.is-cover { position: absolute; inset: 0; z-index: -1; }
.media-slot.is-cover > video, .media-slot.is-cover > .media-poster { height: 100%; object-fit: cover; border-radius: 0; background: none; }
.eb-slot.has-media > video, .eb-slot.has-media > .media-poster { box-shadow: 0 40px 80px -40px rgb(40 30 60 / 0.32), 0 12px 24px -14px rgb(8 8 20 / 0.16); }

/* ---------- Ohne Seitenleiste (Tablet, Handy) ---------- */
@media (max-width: 1100px) {
  .eb-topbar { display: flex; align-items: center; gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--kalk) 50%, var(--paper)); }
  .eb-topbar .logo-sq { width: 26px; height: 26px; margin-right: 8px; flex: none; border-radius: var(--r-sm); background: var(--night); color: var(--on-night); display: grid; place-items: center; }
  .eb-topbar .logo-sq .icon { width: 15px; height: 15px; }
  .eb-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r-sm); font-size: 13px; color: var(--muted); transition: background-color 240ms var(--ease), color 240ms var(--ease); }
  .eb-tab.on { background: color-mix(in srgb, var(--kalk-deep) 50%, var(--kalk)); color: var(--ink); font-weight: 500; }
  .eb-tab.eb-hover:not(.on) { background: var(--kalk); color: var(--ink); }
  .eb-toast { top: 62px; }
  .eb-tab .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--night); color: var(--on-night); font-size: 10.5px; font-weight: 500; display: grid; place-items: center; }
}

/* Schmale Spalten: Einzelpreis weglassen */
@container (max-width: 760px) {
  .eb-tr { grid-template-columns: minmax(0, 1fr) 50px 82px; }
  .eb-unit { display: none; }
}

/* ---------- Handy: eine Seite statt zwei Spalten ---------- */
@media (max-width: 640px) {
  .panel.eb-app { height: 610px; padding: 0; }
  .eb-view { padding: 16px; }
  .eb-title { font-size: 22px; margin-bottom: 12px; }
  .eb-dhead { margin-bottom: 10px; }
  .eb-dhead .eb-title { font-size: 19px; }
  .eb-dhead .chip { margin-top: 18px; }
  .eb-flow .fstep { padding: 10px 0; gap: 12px; }
  .eb-flow .fstep > .mono, .eb-flow .fstep > .chip { display: none; }
  .eb-vp { -webkit-mask-image: none; mask-image: none; }
  .eb-track { grid-auto-flow: row; grid-template-columns: 100% 100%; grid-auto-columns: auto; grid-template-areas: "mail offer" "fields offer"; row-gap: 10px; }
  .eb-track.is-offer { transform: translateX(calc(-100% - var(--gap))); }
  .eb-mail { grid-area: mail; padding: 12px 14px; }
  .eb-fields { grid-area: fields; padding: 10px 14px; }
  .eb-offer { grid-area: offer; }
  .eb-mail-head .av { display: none; }
  .eb-subject { margin: 8px 0 4px; font-size: 13.5px; }
  .eb-body { font-size: 12.5px; line-height: 1.5; }
  .eb-sign { display: none; }
  .eb-card-head { min-height: 0; margin-bottom: 4px; }
  .eb-field { grid-template-columns: 74px minmax(0, 1fr); padding: 5px 6px; }
  .eb-k { font-size: 12.5px; }
  .eb-src { display: none; }
  .eb-tr { grid-template-columns: minmax(0, 1fr) 48px 80px; gap: 8px; }
  .eb-unit { display: none; }
  .eb-toast { left: 12px; right: 12px; top: 58px; }
  .eb-toast .row-ico { display: grid; }
  .eb-app .row { gap: 6px; padding: 10px 14px; }
  .eb-chapters { gap: 10px; }
  .eb-chapters button { font-size: 10.5px; gap: 10px; }
  .eb-no { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .eb-cursor { display: none; }
  .eb-stage::before { transition: none; }
}
