/* Cockpit live: das Content Dashboard der App, abgespeckt und in Bewegung. Tokens aus lunet.css, Präfix db-.
   Ohne Skript steht der Endzustand da (alle Balken, Kurven und Zahlen fertig), es bewegt sich nur nichts.
   Plattform- und Story-Farben wie in booster/components/cockpit/dashboard/palette.css (dort validiert). */

.db {
  --db-ig: #4a3aa7;
  --db-yt: #e34948;
  --db-tt: #2a78d6;
  --db-nurturing: #2a78d6;
  --db-nurturing-soft: #e8f0fb;
  --db-nurturing-text: #1f5fae;
  --db-sales: #eb6834;
  --db-sales-soft: #fdeee6;
  --db-sales-text: #b0461b;
  --db-zeile: 46px;
}

/* ── Kopf des Abschnitts ───────────────────────────────────────────── */

.db-oberzeile { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; color: var(--mid); }
.db .abschnitt-titel { margin-bottom: 16px; }
.db-lead {
  margin: 0 0 32px;
  max-width: 38em;
  color: var(--ink-2);
  font-size: 17px;
  line-height: 1.55;
}

/* ── Rahmen ────────────────────────────────────────────────────────── */

.db-demo { container-type: inline-size; }

.db-kopf { flex-wrap: wrap; align-items: center; row-gap: 6px; }
.db-kopf-rechts { display: inline-flex; align-items: center; gap: 12px; }
.demo-kopf .db-kopf-rechts .mono:first-child { color: var(--mid); }

.db-live { display: inline-flex; align-items: center; gap: 6px; color: var(--pos); }
.db-live i, .db-heute {
  position: relative;
  display: block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--pos);
}
.db-live i::after, .db-heute::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  opacity: 0;
}
.db-laeuft .db-live i::after,
.db-laeuft .db-heute::after { animation: db-puls 1.8s linear infinite; }
@keyframes db-puls {
  from { transform: scale(1); opacity: 0.45; }
  to { transform: scale(3); opacity: 0; }
}

/* ── Raster ────────────────────────────────────────────────────────── */

.db-raster {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "views" "formate" "story" "output" "follower" "plattformen";
}
@container (min-width: 560px) {
  .db-raster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "views views"
      "formate story"
      "output output"
      "follower plattformen";
  }
}
@container (min-width: 880px) {
  .db-raster {
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "views views formate"
      "story output output"
      "story follower plattformen";
  }
}
.db-views { grid-area: views; }
.db-formate { grid-area: formate; }
.db-story { grid-area: story; }
.db-output { grid-area: output; }
.db-follower { grid-area: follower; }
.db-plattformen { grid-area: plattformen; }

.db-kachel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border-radius: 20px;
  background: var(--tile);
}
@container (min-width: 880px) { .db-kachel { padding: 20px; } }

.db-kachel-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.db-kachel-kopf > * { min-width: 0; }
.db-k-titel { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.3; letter-spacing: -0.012em; color: var(--ink); }
.db-k-zusatz { margin: 2px 0 0; font-size: 13px; line-height: 1.35; color: var(--mid); }

.db-punkt { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 3px; }
.db-punkt.db-ig { background: var(--db-ig); }
.db-punkt.db-yt { background: var(--db-yt); }
.db-punkt.db-tt { background: var(--db-tt); }
.db-punkt.db-n { background: var(--db-nurturing); }
.db-punkt.db-s { background: var(--db-sales); }

.db-achse { display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--faint); }

.db-legende { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 12px 0 0; padding: 0; list-style: none; }
.db-legende li { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; line-height: 1.35; color: var(--ink-2); white-space: nowrap; }
.db-legende b { font-weight: 500; color: var(--ink); }

.db-raster-linie { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.db-grundlinie { stroke: #d6d6d1; stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ── 1 Views ───────────────────────────────────────────────────────── */

.db-views-zahl { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 14px; }
.db-gross-rahmen { position: relative; isolation: isolate; display: inline-block; }
.db-gross {
  display: block;
  font-size: clamp(40px, 3.6cqi + 22px, 56px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
}
.db-glanz {
  position: absolute;
  inset: -14px -22px;
  z-index: -1;
  border-radius: 24px;
  background: radial-gradient(closest-side, rgb(29 122 76 / 0.16), rgb(29 122 76 / 0));
  opacity: 0;
  pointer-events: none;
}
.db-plus {
  position: absolute;
  left: calc(100% + 6px);
  top: -6px;
  color: var(--pos);
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.db-delta { font-size: 14px; font-weight: 500; color: var(--pos); white-space: nowrap; }
.db-delta span { font-weight: 400; color: var(--mid); }

.db-minute {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  height: 26px;
  margin: 14px 0 0;
  padding-inline: 10px 11px;
  border-radius: 999px;
  background: var(--pos-soft);
  color: var(--pos);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.db-minute i { width: 6px; height: 6px; border-radius: 50%; background: var(--pos); }

.db-unten { margin-top: auto; padding-top: 22px; }
.db-verlauf { position: relative; height: 110px; }
.db-verlauf-bild { display: block; width: 100%; height: 100%; overflow: visible; }
.db-flaeche { fill: var(--blau); fill-opacity: 0.1; }
.db-linie { fill: none; stroke: var(--blau); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.db-verlauf .db-heute { position: absolute; left: 100%; top: 73.3%; margin: -4.5px 0 0 -4.5px; width: 9px; height: 9px; background: var(--blau); box-shadow: 0 0 0 2px var(--tile); }

/* ── 2 Formate ─────────────────────────────────────────────────────── */

.db-formatliste { display: grid; gap: 14px; margin: 18px 0 0; padding: 0; list-style: none; }
.db-format-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0; font-size: 14px; line-height: 1.3; color: var(--ink); }
.db-anzahl { font-size: 12.5px; color: var(--mid); }
.db-marke {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding-inline: 7px;
  border-radius: 999px;
  background: var(--pos-soft);
  color: var(--pos);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.db-format-wert { display: flex; align-items: center; gap: 10px; margin: 6px 0 0; }
.db-format-wert b { flex: none; min-width: 52px; font-size: 13.5px; font-weight: 500; text-align: right; color: var(--ink); }
.db-leiste { flex: 1; min-width: 0; height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.db-leiste i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--mid);
  transform-origin: left center;
  transition: transform 700ms var(--ease-out);
}
.db-bester .db-leiste i { background: var(--ink); }
[data-db-f="1"] { transform: none; }
[data-db-f="2"] { transform: scaleX(0.6618); }
[data-db-f="3"] { transform: scaleX(0.5685); }
[data-db-f="4"] { transform: scaleX(0.2656); }
.db-format:nth-child(2) .db-leiste i { transition-delay: 60ms; }
.db-format:nth-child(3) .db-leiste i { transition-delay: 120ms; }
.db-format:nth-child(4) .db-leiste i { transition-delay: 180ms; }

.db-fazit { margin: auto 0 0; padding-top: 16px; font-size: 13px; line-height: 1.4; color: var(--mid); }
.db-fazit b { font-weight: 500; color: var(--ink-2); }

/* ── 3 Content-Output ──────────────────────────────────────────────── */

.db-summe { margin: 0; font-size: 13px; line-height: 1.3; color: var(--mid); text-align: right; white-space: nowrap; }
.db-summe b { display: block; font-size: 26px; font-weight: 500; line-height: 1.05; letter-spacing: -0.035em; color: var(--ink); }
.db-balken { height: 132px; }
.db-balken svg { display: block; width: 100%; height: 100%; overflow: visible; }
.db-balken .db-ig { fill: var(--db-ig); }
.db-balken .db-yt { fill: var(--db-yt); }
.db-balken .db-tt { fill: var(--db-tt); }
.db-woche { transform-box: fill-box; transform-origin: 50% 100%; transition: transform 600ms var(--ease-out); }
.db-woche:nth-of-type(2) { transition-delay: 30ms; }
.db-woche:nth-of-type(3) { transition-delay: 60ms; }
.db-woche:nth-of-type(4) { transition-delay: 90ms; }
.db-woche:nth-of-type(5) { transition-delay: 120ms; }
.db-woche:nth-of-type(6) { transition-delay: 150ms; }
.db-woche:nth-of-type(7) { transition-delay: 180ms; }
.db-woche:nth-of-type(8) { transition-delay: 210ms; }
.db-woche:nth-of-type(9) { transition-delay: 240ms; }
.db-woche:nth-of-type(10) { transition-delay: 270ms; }
.db-woche:nth-of-type(11) { transition-delay: 300ms; }
.db-woche:nth-of-type(12) { transition-delay: 330ms; }

/* ── 4 Story-Sequenzen ─────────────────────────────────────────────── */

.db-verh { margin-top: 16px; }
.db-verh-zeile { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 13px; color: var(--ink-2); }
.db-verh-zeile span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.db-verh-zeile b { display: inline-block; min-width: 2ch; font-weight: 500; color: var(--ink); }
.db-verh-leiste { display: block; height: 8px; margin-top: 8px; border-radius: 4px; background: var(--db-sales); overflow: hidden; }
.db-verh-leiste i {
  display: block;
  height: 100%;
  background: var(--db-nurturing);
  box-shadow: 2px 0 0 var(--tile);
  transform-origin: left center;
  transform: scaleX(0.7419);
  transition: transform 450ms var(--ease-out);
}
.db-verh-unter { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0 0; font-size: 12.5px; color: var(--mid); }

.db-storys {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: calc(4 * var(--db-zeile) + 3 * 6px);
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
}
/* Breit: die Kachel geht über zwei Reihen, die Liste füllt sie und läuft unten weich aus */
@container (min-width: 880px) {
  .db-story { --db-zeile: 52px; }
  .db-story .db-storys {
    flex: 1 1 0;
    height: auto;
    min-height: calc(4 * var(--db-zeile) + 3 * 6px);
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  }
  .db-story .db-mini i { width: 19px; height: 34px; }
}

.db-seq {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  height: var(--db-zeile);
  padding-inline: 10px;
  border-radius: 14px;
  background: var(--bg);
}
.db-zeit { flex: none; width: 38px; color: var(--mid); }
.db-mini { display: flex; flex: none; gap: 3px; }
.db-mini i {
  position: relative;
  display: block;
  width: 17px;
  height: 30px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(180deg, #d4d4ce 0%, #bdbdb6 100%);
}
.db-mini i::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px; right: 2px;
  height: 1.5px;
  border-radius: 1px;
  background: rgb(255 255 255 / 0.7);
}
.db-mini .db-t2 { background: linear-gradient(180deg, #45453f 0%, #1c1c1a 100%); }
.db-mini .db-t3 { background: linear-gradient(180deg, #9a9a93 0%, #72726c 100%); }
.db-mini .db-t4 { background: linear-gradient(180deg, #e7e7e2 0%, #d3d3cd 100%); }
.db-mini .db-t4::before { background: rgb(11 11 10 / 0.18); }
.db-mini .db-t5 { background: radial-gradient(80% 60% at 60% 100%, #6c6c65 0%, rgb(108 108 101 / 0) 70%), linear-gradient(180deg, #2c2c29 0%, #121211 100%); }
.db-mini .db-cta::after {
  content: "";
  position: absolute;
  left: 3px; right: 3px; bottom: 5px;
  height: 4px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 0.5px rgb(11 11 10 / 0.12);
}

.db-pille {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 22px;
  margin-left: auto;
  padding-inline: 9px;
  border-radius: 999px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--fill);
  color: var(--mid);
}
.db-seq[data-typ="nurturing"] .db-pille { background: var(--db-nurturing-soft); color: var(--db-nurturing-text); }
.db-seq[data-typ="sales"] .db-pille { background: var(--db-sales-soft); color: var(--db-sales-text); }
.db-seq[data-typ="offen"] .db-pille::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(255 255 255 / 0) 0%, rgb(255 255 255 / 0.75) 50%, rgb(255 255 255 / 0) 100%);
  transform: translateX(-100%);
}
.db-laeuft .db-seq[data-typ="offen"] .db-pille::after { animation: db-schimmer 1.3s linear infinite; }
@keyframes db-schimmer { to { transform: translateX(100%); } }

/* ── 5 Follower ────────────────────────────────────────────────────── */

.db-follower-zahl { margin: 14px 0 0; }
.db-follower-zahl b { display: inline-block; font-size: 40px; font-weight: 500; line-height: 1; letter-spacing: -0.045em; }
.db-follower .db-k-zusatz b { display: inline-block; font-weight: 400; color: var(--ink-2); }
.db-spark { position: relative; height: 54px; }
.db-follower .db-unten { padding-top: 16px; }
.db-spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.db-spark-flaeche { fill: var(--pos); fill-opacity: 0.09; }
.db-spark-linie { fill: none; stroke: var(--pos); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.db-spark .db-heute { position: absolute; left: 100%; top: 7.2%; margin: -4.5px 0 0 -4.5px; width: 9px; height: 9px; box-shadow: 0 0 0 2px var(--tile); }
.db-follower .db-legende { margin-top: 12px; }
.db-follower .db-legende b { display: inline-block; }

/* ── 6 Plattformen ─────────────────────────────────────────────────── */

.db-platt { display: flex; align-items: center; gap: 18px; margin-top: auto; padding-top: 16px; }
.db-donut { position: relative; flex: none; width: 116px; height: 116px; }
.db-donut svg { display: block; width: 100%; height: 100%; transition: transform 700ms var(--ease-out), opacity 400ms ease; }
.db-donut circle { fill: none; stroke-width: 12; }
.db-donut .db-ig { stroke: var(--db-ig); }
.db-donut .db-yt { stroke: var(--db-yt); }
.db-donut .db-tt { stroke: var(--db-tt); }
.db-donut .db-ring { stroke: var(--fill); }
.db-donut-mitte { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.db-donut-mitte b { font-size: 28px; font-weight: 500; line-height: 1; letter-spacing: -0.04em; }
.db-donut-mitte span { margin-top: 3px; font-size: 11.5px; line-height: 1.2; color: var(--mid); }
.db-platt .db-legende { display: grid; gap: 7px; margin: 0; flex: 1; min-width: 0; }
.db-platt .db-legende li { justify-content: flex-start; }
.db-platt .db-legende b { margin-left: auto; padding-left: 10px; }

/* ── Fuß ───────────────────────────────────────────────────────────── */

.db-hinweis { margin: 14px 0 0; font-size: 13px; line-height: 1.45; color: var(--mid); }

/* ── Erster Auftritt (nur mit Skript, das data-db-bereit setzt) ────── */

.db-verlauf-bild, .db-spark svg { clip-path: inset(0 0 0 0); transition: clip-path 1100ms var(--ease-out); }
.db-verlauf .db-heute, .db-spark .db-heute { transition: opacity 300ms ease 700ms; }

.db-demo[data-db-bereit]:not(.db-da) .db-leiste i { transform: scaleX(0); }
.db-demo[data-db-bereit]:not(.db-da) .db-woche { transform: scaleY(0); }
.db-demo[data-db-bereit]:not(.db-da) .db-verlauf-bild,
.db-demo[data-db-bereit]:not(.db-da) .db-spark svg { clip-path: inset(0 100% 0 0); }
.db-demo[data-db-bereit]:not(.db-da) .db-heute { opacity: 0; }
.db-demo[data-db-bereit]:not(.db-da) .db-donut svg { opacity: 0; transform: rotate(-40deg) scale(0.96); }

/* ── Reduzierte Bewegung: keine Dauerbewegung, nichts wächst ───────── */

@media (prefers-reduced-motion: reduce) {
  .db-laeuft .db-live i::after,
  .db-laeuft .db-heute::after,
  .db-laeuft .db-seq[data-typ="offen"] .db-pille::after { animation: none; }
  .db-leiste i, .db-woche, .db-verlauf-bild, .db-spark svg, .db-donut svg, .db-verh-leiste i { transition: none; }
}

/* Handy: etwas enger */
@media (max-width: 479px) {
  .db-lead { font-size: 16px; margin-bottom: 24px; }
  .db-kachel { padding: 16px; border-radius: 18px; }
  .db-seq { gap: 8px; padding-inline: 8px; }
  .db-zeit { width: 36px; }
  .db-mini i { width: 15px; height: 27px; }
  .db-donut { width: 104px; height: 104px; }
}
