/* Marketing Pipeline — UI kit styles. Imports tokens from ../../colors_and_type.css */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--fg-default);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
::selection { background: var(--red-100); }

/* ---------- App shell ---------- */
.app { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: var(--nav-top-h); flex: none;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 22px; padding: 0 18px; z-index: 20;
}
.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__logo { height: 19px; width: auto; }
.topbar__divider { width: 1px; height: 20px; background: var(--border-strong); }
.topbar__app { font-size: 14px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; white-space: nowrap; }
.topbar__sp { flex: 1; }

/* compact main navigation (horizontal) */
.topnav { display: flex; align-items: center; gap: 2px; height: 100%; }
.topnav__item {
  position: relative; border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--fg-muted);
  padding: 0 12px; height: 100%; display: flex; align-items: center;
  border-bottom: 2px solid transparent; transition: color var(--dur-fast);
}
.topnav__item:hover { color: var(--fg-default); }
.topnav__item--on { color: var(--accent-hover); border-bottom-color: var(--accent); }

.topbar__search {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--gray-50);
  color: var(--fg-subtle); font-size: 13px; width: 220px; cursor: text;
}
.topbar__search input { border: 0; background: transparent; outline: none; font: inherit; color: var(--fg-default); width: 100%; }
.avatar {
  width: 28px; height: 28px; border-radius: var(--radius-full);
  background: var(--gray-200); color: var(--fg-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex: none;
}

/* mobile bottom nav */
.mnav { display: none; }

.shell { flex: 1; display: flex; min-height: 0; }
.content { flex: 1; overflow-y: auto; overflow-x: hidden; }
@media (min-width: 721px) { body { overflow: hidden; } }
.page { max-width: var(--content-max); margin: 0 auto; padding: 24px var(--content-pad) 56px; }

/* ---------- Page header ---------- */
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.pagehead__main { flex: 1; min-width: 0; }
.pagehead h1 { font-size: var(--text-h1); font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; margin: 0; }
.pagehead .sub { font-size: 13px; color: var(--fg-muted); margin-top: 3px; }
.pagehead__actions { display: flex; gap: 8px; align-items: center; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-size: 13px; font-weight: 600; line-height: 1; padding: 8px 13px;
  border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), border-color var(--dur-fast); white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active { background: var(--accent-press); }
.btn--secondary { background: var(--bg-surface); color: var(--fg-default); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--bg-muted); }
.btn--ghost { background: transparent; color: var(--fg-muted); }
.btn--ghost:hover { background: var(--bg-muted); color: var(--fg-default); }
.btn--approve { background: var(--st-approved-fg); color: #fff; }
.btn--approve:hover { filter: brightness(.94); }
.btn--danger { background: var(--bg-surface); color: var(--st-rejected-fg); border-color: var(--st-rejected-bd); }
.btn--danger:hover { background: var(--st-rejected-bg); }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { background: var(--bg-muted); color: var(--fg-subtle); border-color: var(--border); cursor: not-allowed; }

/* ---------- Cards / panels (single border, no nesting) ---------- */
.card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--divider); }
.card__head h3 { font-size: var(--text-h3); font-weight: 600; color: var(--fg-strong); margin: 0; white-space: nowrap; }
.card__head .ds-meta { white-space: nowrap; }
.card__head .sp { flex: 1; }
.card__body { padding: 16px; }
.card__body--flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: 1fr 1fr; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--main { grid-template-columns: 1fr 320px; align-items: start; }

/* ---------- Stat tiles ---------- */
.stat { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; }
.stat__label { font-size: 12px; color: var(--fg-muted); display: flex; align-items: center; gap: 6px; }
.stat__value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--fg-strong); margin-top: 8px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stat__value .accent { color: var(--accent); }
.stat__sub { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); text-align: left; padding: 10px 14px; background: var(--gray-50); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--divider); color: var(--fg-default); }
.tbl tbody tr { cursor: pointer; transition: background var(--dur-fast); }
.tbl tbody tr:hover { background: var(--bg-muted); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.tbl .id { color: var(--fg-strong); font-weight: 500; }
.tbl .title { color: var(--fg-strong); font-weight: 500; }
.tbl .muted { color: var(--fg-subtle); }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge .dot { width: 5px; height: 5px; border-radius: var(--radius-full); background: currentColor; flex: none; }

/* ---------- Filter chips / tabs ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; font-weight: 500; padding: 5px 11px; border-radius: var(--radius-full); border: 1px solid var(--border-strong); background: var(--bg-surface); color: var(--fg-muted); cursor: pointer; transition: all var(--dur-fast); }
.chip:hover { background: var(--bg-muted); color: var(--fg-default); }
.chip--on, .chip--on:hover { background: var(--gray-900); color: #fff; border-color: var(--gray-900); }
/* Chips sind <label> und stehen oft in einem .field — ".field label" (dunkler
   --fg-strong) darf die Chip-Farben NICHT überschreiben (sonst dunkel auf dunkel). */
.chips .chip { color: var(--fg-muted); font-weight: 500; margin-bottom: 0; display: inline-flex; align-items: center; }
.chips .chip--on { color: #fff; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab { font-size: 13px; font-weight: 600; color: var(--fg-muted); padding: 9px 13px; border: 0; background: transparent; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--fg-default); }
.tab--on { color: var(--accent-hover); border-bottom-color: var(--accent); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-strong); margin-bottom: 6px; }
.field .req { color: var(--accent); }
.input, .textarea, .select {
  width: 100%; font-family: var(--font-sans); font-size: 13px; padding: 9px 11px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--fg-default); transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.field .hint { font-size: 11px; color: var(--fg-subtle); margin-top: 5px; }

/* ---------- Dropzone ---------- */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); padding: 26px; text-align: center; background: var(--gray-50); cursor: pointer; transition: all var(--dur-fast); }
.dropzone:hover, .dropzone--over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { color: var(--fg-subtle); margin: 0 auto; }
.dropzone .t { font-size: 13px; color: var(--fg-default); margin-top: 9px; }
.dropzone .t b { color: var(--accent); font-weight: 600; }
.dropzone .h { font-size: 11px; color: var(--fg-subtle); margin-top: 3px; }

/* file rows */
.filerow { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); font-size: 13px; }
.filerow + .filerow { margin-top: 7px; }
.filerow svg.ficon { color: var(--fg-muted); }
.filerow .nm { color: var(--fg-strong); font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow .sz { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); }
.filerow .act { color: var(--fg-subtle); cursor: pointer; background: none; border: 0; padding: 3px; border-radius: 4px; display: flex; }
.filerow .act:hover { color: var(--accent); background: var(--bg-muted); }

/* ---------- Audit / notes / steps ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 5px; bottom: 5px; width: 1px; background: var(--border); }
.tl-ev { position: relative; padding-bottom: 14px; }
.tl-ev:last-child { padding-bottom: 0; }
.tl-ev::before { content: ""; position: absolute; left: -17px; top: 4px; width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--gray-400); border: 1.5px solid var(--bg-surface); box-shadow: 0 0 0 1px var(--border); }
.tl-ev.ok::before { background: var(--st-approved-fg); }
.tl-ev.rej::before { background: var(--st-rejected-fg); }
.tl-ev.err::before { background: var(--st-error-bg); }
.tl-ev .line { font-size: 13px; color: var(--fg-default); }
.tl-ev .line b { color: var(--fg-strong); font-weight: 600; }
.tl-ev .meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); margin-top: 1px; }

.note { display: flex; gap: 10px; }
.note + .note { margin-top: 14px; }
.note .who { font-size: 12px; }
.note .who b { color: var(--fg-strong); font-weight: 600; }
.note .who .t { font-family: var(--font-mono); font-size: 10px; color: var(--fg-subtle); margin-left: 7px; }
.note .txt { font-size: 13px; color: var(--fg-default); margin-top: 2px; line-height: 1.5; }
.note .avatar { width: 26px; height: 26px; }

/* work steps */
.step { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--divider); }
.step:last-child { border-bottom: 0; }
.step__ic { width: 24px; height: 24px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; flex: none; border: 1px solid var(--border); color: var(--fg-subtle); }
.step__ic--done { background: var(--st-approved-bg); border-color: var(--st-approved-bd); color: var(--st-approved-fg); }
.step__ic--run { background: var(--accent-soft); border-color: var(--accent-soft-border); color: var(--accent); }
.step__ic--err { background: var(--st-error-bg); border-color: var(--st-error-bd); color: #fff; }
.step__main { flex: 1; }
.step__name { font-size: 13px; font-weight: 500; color: var(--fg-strong); }
.step__meta { font-size: 11px; color: var(--fg-subtle); font-family: var(--font-mono); margin-top: 1px; }

/* ---------- Definition list ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 9px 20px; font-size: 13px; }
.dl dt { color: var(--fg-muted); }
.dl dd { margin: 0; color: var(--fg-strong); font-weight: 500; }
.dl dd.mono { font-family: var(--font-mono); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 40px 20px; }
.empty svg { color: var(--gray-400); margin: 0 auto; }
.empty .t { font-size: 14px; font-weight: 600; color: var(--fg-strong); margin-top: 11px; }
.empty .s { font-size: 12px; color: var(--fg-subtle); margin-top: 3px; }
.empty .btn { margin-top: 15px; }

/* ---------- Alert inline ---------- */
.alert { display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius-md); border: 1px solid; font-size: 13px; align-items: flex-start; }
.alert b { font-weight: 600; }
.alert svg { margin-top: 1px; }
.alert--info { color: var(--info-fg); background: var(--info-bg); border-color: var(--info-bd); }
.alert--success { color: var(--success-fg); background: var(--success-bg); border-color: var(--success-bd); }
.alert--warning { color: var(--warning-fg); background: var(--warning-bg); border-color: var(--warning-bd); }
.alert--danger { color: var(--danger-fg); background: var(--danger-bg); border-color: var(--danger-bd); }

/* ---------- Result block (inset, not nested card) ---------- */
.result { background: var(--bg-subtle); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); }

/* ---------- Dialog ---------- */
.scrim { position: fixed; inset: 0; background: rgba(24,27,31,.42); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fade var(--dur-base) var(--ease-standard); }
.dialog { width: 400px; max-width: calc(100vw - 32px); background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); overflow: hidden; animation: pop var(--dur-base) var(--ease-standard); }
.dialog__body { padding: 20px; }
.dialog__ic { width: 36px; height: 36px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.dialog__ic--danger { background: var(--st-rejected-bg); color: var(--st-rejected-fg); }
.dialog h3 { font-size: 15px; font-weight: 600; color: var(--fg-strong); margin: 0; }
.dialog p { font-size: 13px; color: var(--fg-muted); margin: 6px 0 0; line-height: 1.5; }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; background: var(--gray-50); border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.99); } }

/* tool/pipeline list rows */
.listrow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--divider); cursor: pointer; transition: background var(--dur-fast); }
.listrow:last-child { border-bottom: 0; }
.listrow:hover { background: var(--bg-muted); }
.listrow__ic { width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--gray-100); color: var(--fg-muted); display: flex; align-items: center; justify-content: center; flex: none; }
.listrow__main { flex: 1; min-width: 0; }
.listrow__name { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.listrow__desc { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }
.listrow__meta { flex: none; text-align: right; white-space: nowrap; display: flex; flex-direction: column; gap: 2px; }
.listrow__meta .m1 { font-size: 12px; font-weight: 600; color: var(--fg-default); }
.listrow__meta .m2 { font-size: 11px; color: var(--fg-subtle); font-family: var(--font-mono); }

.divider { height: 1px; background: var(--divider); margin: 16px 0; }
.spacer { flex: 1; }
.ds-section { font-size: var(--text-h2); font-weight: 600; color: var(--fg-strong); margin: 0; letter-spacing: -0.01em; }

/* ---------- Table action link ---------- */
.tbl .act-link { color: var(--fg-link); font-weight: 600; font-size: 13px; }
.tbl tbody tr:hover .act-link { text-decoration: underline; text-underline-offset: 2px; }
.tbl td.act-cell { text-align: right; white-space: nowrap; }

/* ---------- Attention list (compact) ---------- */
.attn { display: flex; flex-direction: column; }
.attn__row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--divider); cursor: pointer; transition: background var(--dur-fast); }
.attn__row:last-child { border-bottom: 0; }
.attn__row:hover { background: var(--bg-muted); }
.attn__ic { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex: none; }
.attn__ic--review { background: var(--st-review-bg); color: var(--st-review-fg); }
.attn__ic--error { background: var(--st-error-bg); color: #fff; }
.attn__ic--draft { background: var(--st-draft-bg); color: var(--st-draft-fg); }
.attn__main { flex: 1; min-width: 0; }
.attn__title { font-size: 13px; font-weight: 600; color: var(--fg-strong); }
.attn__sub { font-size: 12px; color: var(--fg-muted); margin-top: 1px; }
.attn__sub .mono { font-family: var(--font-mono); }
.attn__when { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); white-space: nowrap; }

/* ---------- Responsive: tablet & mobile ---------- */
@media (max-width: 920px) {
  .grid--main { grid-template-columns: 1fr; }
  .grid--3 { grid-template-columns: 1fr 1fr; }
  .medgrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .topnav { display: none; }
  .topbar__search { display: none; }
  .topbar__app { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar { gap: 12px; padding: 0 14px; }
  .topbar__brand { min-width: 0; }
  .topbar__user { display: none; }
  .topbar__account { margin-left: 8px; }
  .content { padding-bottom: 64px; }
  .page { padding: 18px 16px 40px; }
  .grid--3 { grid-template-columns: 1fr 1fr; }
  .grid--2 { grid-template-columns: 1fr; }
  .medgrid { grid-template-columns: 1fr; }
  .prodhead { gap: 16px; }
  .ministats { flex-wrap: wrap; }
  .ministat { flex: 1 1 40%; border-bottom: 1px solid var(--divider); }
  .pagehead { flex-direction: column; gap: 12px; }
  .pagehead__actions { width: 100%; }
  .pagehead__actions .btn { flex: 1; }
  .mnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
    background: var(--bg-surface); border-top: 1px solid var(--border); z-index: 30;
  }
  .mnav__item {
    /* flex-basis auto statt 0: gleich breite Spalten geben "Runs" zu viel und
       "Playground" zu wenig Platz — mit auto richtet sich die Breite nach dem
       Label, und alle sieben Eintraege passen bei 375px vollstaendig hin. */
    flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; cursor: pointer; font-family: inherit;
    font-size: 10px; font-weight: 600; color: var(--fg-subtle);
    /* Ohne min-width:0 bleibt jedes Item auf seiner min-content-Breite stehen
       (das laengste Label bestimmt sie) — ab 6-7 Eintraegen schob die Leiste
       damit die ganze Seite auf 375px in die Waagerechte. */
    min-width: 0; padding: 0 1px;
  }
  .mnav__item span {
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .mnav__item--on { color: var(--accent); }
  /* let wide tables scroll */
  .table-wrap { -webkit-overflow-scrolling: touch; }
}
@media (max-width: 460px) {
  .grid--3 { grid-template-columns: 1fr; }
}

/* ---------- Mini stats (medium header) ---------- */
.ministats { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-surface); overflow: hidden; }
.ministat { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-right: 1px solid var(--divider); }
.ministat:last-child { border-right: 0; }
.ministat .v { font-size: 18px; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.ministat .v.accent { color: var(--accent); }
.ministat .v.mono-v { font-family: var(--font-mono); font-size: 13px; font-weight: 600; padding-top: 4px; }
.ministat .l { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-subtle); }

/* ---------- Pipeline rows (compact, right rail) ---------- */
.pipeline-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--divider); cursor: pointer; transition: background var(--dur-fast); }
.pipeline-row:last-child { border-bottom: 0; }
.pipeline-row:hover { background: var(--bg-muted); }
.pipeline-row__main { flex: 1; min-width: 0; }
.pipeline-row__name { font-size: 13px; font-weight: 600; color: var(--fg-strong); }
.pipeline-row__desc { font-size: 12px; color: var(--fg-muted); margin-top: 1px; line-height: 1.4; }
.pipeline-row__meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); margin-top: 4px; }
.pipeline-row .act-link { font-size: 12px; font-weight: 600; color: var(--fg-link); white-space: nowrap; padding-top: 1px; }
.pipeline-row:hover .act-link { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Book cover placeholder ---------- */
.bookcover { position: relative; border-radius: 2px; flex: none; box-shadow: var(--shadow-sm); overflow: hidden; display: flex; }
.bookcover--img { object-fit: cover; display: block; background: var(--gray-100); }
.bookcover__spine { position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: rgba(255,255,255,.18); border-right: 1px solid rgba(0,0,0,.12); }
.bookcover__txt { display: flex; flex-direction: column; justify-content: space-between; height: 100%; padding: 13px 12px 13px 15px; color: #fff; box-sizing: border-box; }
.bookcover__title { font-size: 14px; font-weight: 600; line-height: 1.22; letter-spacing: -0.01em; text-wrap: balance; }
.bookcover__author { font-size: 9.5px; font-weight: 500; opacity: .8; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- Mediums grid ---------- */
.medgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.medcard { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 15px 16px; display: flex; flex-direction: column; gap: 11px; cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.medcard:hover { border-color: var(--border-strong); background: var(--gray-25); }
.medcard--off { opacity: .62; cursor: default; }
.medcard--off:hover { border-color: var(--border); background: var(--bg-surface); }
.medcard__top { display: flex; align-items: center; gap: 11px; }
.medcard__ic { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--gray-100); color: var(--fg-muted); display: flex; align-items: center; justify-content: center; flex: none; }
.medcard__name { font-size: 14px; font-weight: 600; color: var(--fg-strong); flex: 1; }
.medcard__desc { font-size: 12px; color: var(--fg-muted); line-height: 1.45; min-height: 34px; }
.medcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--divider); }
.medcard__meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.medcard__meta b { color: var(--fg-default); font-weight: 600; }
.medcard__hint { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg-muted); margin-top: -2px; }
.medcard__hintdot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--gray-300); flex: none; }
.medcard__hint--review { color: var(--st-review-fg); }
.medcard__hint--review .medcard__hintdot { background: var(--st-review-fg); }
.medcard__hint--error { color: var(--st-error-bg); }
.medcard__hint--error .medcard__hintdot { background: var(--st-error-bg); }
.medcard__hint--uploaded .medcard__hintdot { background: var(--st-upload-fg); }
.medcard__hint--approved .medcard__hintdot { background: var(--st-approved-fg); }
.medcard__hint--done .medcard__hintdot { background: var(--st-done-fg); }

/* ---------- Product header ---------- */
.prodhead { display: flex; gap: 22px; align-items: flex-start; }
.prodhead__cover { flex: none; }
.prodhead__main { flex: 1; min-width: 0; }
.prodhead__title { font-size: 24px; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.015em; margin: 0; }
.prodhead__author { font-size: 14px; color: var(--fg-muted); margin-top: 3px; }
.prodhead__ids { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; }
.prodhead__id { font-size: 12px; color: var(--fg-subtle); }
.prodhead__id b { font-family: var(--font-mono); color: var(--fg-default); font-weight: 500; margin-left: 6px; white-space: nowrap; }
.prodhead__actions { display: flex; gap: 8px; margin-top: 16px; }
.prodhead__subtitle { font-size: 15px; color: var(--fg-default); margin-top: 4px; font-weight: 500; }

/* Cover als anklickbarer Link (volle Größe öffnen) */
.coverlink { position: relative; display: block; border-radius: 2px; }
.coverlink__hint { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 6px 4px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.62)); opacity: 0; transition: opacity var(--dur-fast); border-radius: 0 0 2px 2px; }
.coverlink:hover .coverlink__hint, .coverlink:focus-visible .coverlink__hint { opacity: 1; }

/* ---------- Über das Buch: Beschreibung, Klappentext, Buchtext ---------- */
.bookprose { font-size: 14px; line-height: 1.62; color: var(--fg-default); }
.bookprose > *:first-child { margin-top: 0; }
.bookprose > *:last-child { margin-bottom: 0; }
.bookprose p { margin: 0 0 12px; }
.bookprose h2 { font-size: 17px; font-weight: 700; color: var(--fg-strong); margin: 22px 0 8px; letter-spacing: -0.01em; }
.bookprose h3 { font-size: 15px; font-weight: 600; color: var(--fg-strong); margin: 18px 0 6px; }
.bookprose h4 { font-size: 13.5px; font-weight: 600; color: var(--fg-default); margin: 14px 0 5px; }
.bookprose ul { margin: 0 0 12px; padding-left: 20px; }
.bookprose li { margin: 2px 0; }

.u4 { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }
.u4__label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 6px; }

.kwchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.kwchips .chip { cursor: default; }

.booktext { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider); }
.booktext__summary { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; color: var(--fg-link); user-select: none; }
.booktext__summary::-webkit-details-marker { display: none; }
.booktext__summary svg { color: var(--fg-muted); }
.booktext[open] > .booktext__summary { margin-bottom: 14px; }
.booktext__body { max-height: 460px; overflow-y: auto; padding: 14px 16px; background: var(--bg-subtle); border: 1px solid var(--divider); border-radius: var(--radius-md); }

/* ---------- Preise (Metadaten) ---------- */
.pricelist { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--divider); }
.pricelist__label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 8px; }
.pricelist__row { display: flex; align-items: baseline; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.pricelist__cc { color: var(--fg-muted); font-weight: 600; }
.pricelist__val { color: var(--fg-strong); font-weight: 500; }

.sourcenote { display: flex; gap: 7px; align-items: flex-start; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--divider); font-size: 12px; line-height: 1.5; color: var(--fg-muted); }
.sourcenote svg { flex: none; margin-top: 2px; color: var(--fg-subtle); }

/* ---------- Login-Seite ---------- */
.authwrap { min-height: 68vh; display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.authcard { width: 100%; max-width: 380px; }
.authcard__brand { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); }
.authcard__title { font-size: 22px; font-weight: 700; color: var(--fg-strong); margin: 6px 0 4px; }
.authcard__sub { font-size: 13px; color: var(--fg-muted); margin: 0 0 18px; }
.authcard__error { font-size: 13px; color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 14px; }
.authcard .field { margin-bottom: 14px; }
.authcard label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-default); margin-bottom: 5px; }
.authcard input[type="text"], .authcard input[type="password"] { width: 100%; box-sizing: border-box; padding: 9px 11px; font-size: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--fg-strong); }
.authcard input:focus { outline: none; border-color: var(--border-focus); }
.authcard__submit { width: 100%; margin-top: 4px; justify-content: center; }

/* ---------- Topbar-Konto / Logout ---------- */
.topbar__account { display: flex; align-items: center; gap: 10px; margin-left: 14px; }
.topbar__user { font-size: 12px; font-weight: 600; color: var(--fg-muted); white-space: nowrap; }

/* ---------- Medium chips (where a product appears) ---------- */
.medlist { display: flex; flex-direction: column; }
.medlist__row { display: flex; align-items: center; gap: 11px; padding: 10px 16px; border-bottom: 1px solid var(--divider); }
.medlist__row:last-child { border-bottom: 0; }
.medlist__ic { width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--gray-100); color: var(--fg-muted); display: flex; align-items: center; justify-content: center; flex: none; }
.medlist__name { font-size: 13px; font-weight: 600; color: var(--fg-strong); flex: none; white-space: nowrap; }
.medlist__hint { font-size: 12px; color: var(--fg-muted); white-space: nowrap; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.medlist__when { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); flex: none; white-space: nowrap; margin-left: auto; padding-left: 8px; }

/* ---------- Ledger / Kontoauszug ---------- */
.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
.ledger th { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted); text-align: left; padding: 9px 14px; background: var(--gray-50); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ledger td { padding: 11px 14px; border-bottom: 1px solid var(--divider); vertical-align: top; }
.ledger tr:last-child td { border-bottom: 0; }
.ledger .ts { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--fg-muted); white-space: nowrap; }
.ledger .medium { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--fg-strong); white-space: nowrap; }
.ledger .medium svg { color: var(--fg-muted); }
.ledger .event { color: var(--fg-strong); font-weight: 500; }
.ledger .desc { color: var(--fg-muted); font-size: 12px; margin-top: 2px; }
.ledger .ref { font-family: var(--font-mono); font-size: 12px; color: var(--fg-link); white-space: nowrap; }
.ledger .ref.none { color: var(--fg-subtle); }

/* product list row cover alignment */
.listrow__cover { flex: none; }

/* --- django app additions --- */

/* Anchors used where the kit used buttons/divs (nav items, cards, rows, chips). */
a.topnav__item, a.mnav__item, a.btn, a.chip, a.medcard, a.listrow,
a.attn__row, a.act-link, a.ref, a.backlink { text-decoration: none; }
a.medcard, a.listrow, a.attn__row { color: inherit; }

/* Generic monospace helper (IDs, ISBN, timestamps, counts). */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Run-code links inside tables. */
.tbl .id a { color: inherit; text-decoration: none; }
.tbl .id a:hover { text-decoration: underline; text-underline-offset: 2px; }
a.ref:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Quiet back link above the page header (_pagehead). */
.backlink { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; padding: 4px 6px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.backlink:hover { background: var(--bg-muted); color: var(--fg-default); }
.backlink svg { flex: none; }

/* Act links outside tables (medium card footer, file rows). */
.medcard__foot .act-link, .filerow .act-link { font-size: 12px; font-weight: 600; color: var(--fg-link); white-space: nowrap; }
.medcard__foot .act-link:hover, .filerow .act-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Form error text (_field). */
.field .error { font-size: 12px; color: var(--danger-fg); margin-top: 5px; }

/* Produkt-Autocomplete (Run-Anlage): Suchfeld + schwebende Trefferliste.
   Ersetzt das <select> über den ganzen Katalog (30k Titel = mehrere MB HTML). */
.ac { position: relative; }
.ac__list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30; background: var(--bg-surface); border: 1px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: var(--shadow-md, 0 8px 24px rgba(16, 24, 40, .08)); max-height: 280px; overflow-y: auto; }
.ac__item { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; padding: 8px 12px; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; color: var(--fg-default); }
.ac__item + .ac__item { border-top: 1px solid var(--divider); }
.ac__item:hover, .ac__item--active { background: var(--bg-muted); }
.ac__item b { font-weight: 500; color: var(--fg-strong); }
.ac__item-ean { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); margin-left: auto; white-space: nowrap; }
.ac__empty { padding: 10px 12px; font-size: 12px; color: var(--fg-subtle); }
.ac__picked { display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-muted); font-size: 13px; }
.ac__picked-title { font-weight: 500; color: var(--fg-strong); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* File row: tinted icon + kind label (Eingabe/Ergebnis/Report). */
.filerow > svg { color: var(--fg-muted); flex: none; }
.filerow .kind { font-size: 12px; color: var(--fg-subtle); white-space: nowrap; }

/* Visually hidden file input for the dropzone. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Chosen file names below the dropzone text. */
.dropzone__files { font-family: var(--font-mono); font-size: 11px; color: var(--fg-default); margin-top: 8px; }
.dropzone__files:empty { display: none; }

/* ---------- Playground studio ---------- */
.pg-section-title { font-size: 13px; font-weight: 700; color: var(--fg-strong); letter-spacing: -0.01em; }

/* Channel toggles (title + platform sub-label). */
.pg-channels { display: flex; flex-wrap: wrap; gap: 12px; }
.pg-channel { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--bg-surface); cursor: pointer; flex: 1 1 200px; transition: border-color var(--dur-fast); }
.pg-channel:hover { border-color: var(--accent); }
.pg-channel input { margin-top: 2px; }
.pg-channel__main { display: flex; flex-direction: column; gap: 2px; }
.pg-channel__name { font-size: 13px; font-weight: 600; color: var(--fg-strong); }
.pg-channel__sub { font-size: 11px; color: var(--fg-subtle); }

/* Chip groups (Steuerung). Chips reuse .chip / .chip--on (hover fix applies). */
.chip-group { display: flex; flex-direction: column; gap: 8px; }
.chip-group__label { font-size: 12px; font-weight: 700; color: var(--fg-strong); }
.chip-group[hidden] { display: none; }

/* Erweitert: collapsible details + responsive control grid. */
.pg-advanced__summary { cursor: pointer; list-style: none; }
.pg-advanced__summary::-webkit-details-marker { display: none; }
.pg-advanced__summary::before { content: "▸"; display: inline-block; margin-right: 7px; color: var(--fg-muted); transition: transform var(--dur-fast); }
details[open] > .pg-advanced__summary::before { transform: rotate(90deg); }
.pg-advanced__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-top: 16px; }
.pg-range-out { font-family: var(--font-mono); font-weight: 500; color: var(--accent); margin-left: 4px; }

/* Live run-log. */
.pg-runlog[hidden] { display: none; }
.log-pre { font-family: var(--font-mono); font-size: 11px; line-height: 1.5; color: var(--fg-muted); background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-top: 10px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; }

/* Cost metric cards (job-wide). */
.pg-costs { display: flex; flex-wrap: wrap; gap: 12px; }
.pg-costs:empty { display: none; }
.pg-cost { flex: 1 1 120px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px 14px; }
.pg-cost__label { font-size: 11px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .04em; }
.pg-cost__value { font-family: var(--font-mono); font-size: 20px; font-weight: 500; color: var(--fg-strong); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Accounts (Registry-Board) ---------- */
.acctgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.acctcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.acctcard--live { border-color: var(--st-approved-bd); box-shadow: inset 3px 0 0 var(--st-approved-fg); }
.acctcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.acctcard__name { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.acctcard__theme { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 2px; }
.acctcard__handle { font-size: 12px; color: var(--fg-muted); margin-top: -2px; }
.acctcard__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.acctcard__kpis { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-muted); border-top: 1px solid var(--divider); padding-top: 9px; }
.acctcard__kpis b { color: var(--fg-strong); font-weight: 600; }
.acctcard__kpis svg { color: var(--st-approved-fg); }
/* ============================================================
   Mindmap -- horizontaler, aufgeraeumter Collapsible-Tree (links -> rechts)
   Netzwerk -> Theme -> Brand -> Channel. Pill-Cards mit Status-Punkt,
   Count-Badge und +/- Toggle-Chip. viewBox fittet auto an den Inhalt.
   ============================================================ */
.mindmap {
  min-height: 440px;
  padding: 10px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 50% 42%, var(--gray-50) 0%, var(--bg-surface) 66%);
}

.mm-svg {
  display: block;
  width: 100%;
  max-width: 1180px;
  height: auto;
  max-height: 620px;
  font-family: var(--font-sans);
}

.mm-empty {
  margin: auto;
  padding: 48px 24px;
  text-align: center;
  font-size: var(--text-sm, 13px);
  color: var(--fg-subtle);
}

/* Verbinder: ruhige, geschwungene Kurven */
.mm-links {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.4px;
  stroke-opacity: 0.85;
}
.mm-link {
  stroke-linecap: round;
}

/* Knoten als Pill-Cards */
.mm-node {
  -webkit-tap-highlight-color: transparent;
}
.mm-pill {
  stroke-width: 1.25px;
  filter: drop-shadow(0 1px 1.5px rgba(24, 27, 31, 0.05));
  transition: filter var(--dur-fast, 120ms) ease, stroke var(--dur-fast, 120ms) ease;
}
.mm-node:hover .mm-pill {
  filter: drop-shadow(0 2px 6px rgba(24, 27, 31, 0.13));
}
.mm-node.is-selected .mm-pill {
  stroke: var(--accent);
  stroke-width: 2px;
}

.mm-dot {
  stroke-width: 1px;
}

.mm-label {
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: -0.005em;
  pointer-events: none;
}
.mm-node--network .mm-label,
.mm-node--theme .mm-label {
  font-weight: 600;
}

/* Count-Badge in eingeklappten Theme-/Brand-Pills */
.mm-badge-bg {
  stroke-width: 1px;
  transition: opacity var(--dur-fast, 120ms) ease;
}
.mm-badge-txt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  pointer-events: none;
}

/* Toggle-Chip (+/-) am linken Pill-Anker */
.mm-toggle {
  stroke-width: 1.25px;
  transition: fill var(--dur-fast, 120ms) ease, stroke var(--dur-fast, 120ms) ease;
}
.mm-toggle-sign {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.mm-node:hover .mm-toggle {
  stroke: var(--accent);
}

/* Detail-Panel: Kicker + Status-Badge-Tints (nutzt die .badge-Optik) */
.mm-detail__kicker {
  font-size: var(--text-2xs, 11px);
  font-weight: 600;
  letter-spacing: var(--tracking-wide, 0.04em);
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.mm-badge--st-upload   { color: var(--st-upload-fg);   background: var(--st-upload-bg);   border-color: var(--st-upload-bd); }
.mm-badge--st-review   { color: var(--st-review-fg);   background: var(--st-review-bg);   border-color: var(--st-review-bd); }
.mm-badge--st-approved { color: var(--st-approved-fg); background: var(--st-approved-bg); border-color: var(--st-approved-bd); }
.mm-badge--st-draft    { color: var(--st-draft-fg);    background: var(--st-draft-bg);    border-color: var(--st-draft-bd); }
.mm-badge--st-rejected { color: var(--st-rejected-fg); background: var(--st-rejected-bg); border-color: var(--st-rejected-bd); }
/* ---------- Run-Detail: zweispaltiges Layout ---------- */
/* Hauptspalte (Lauf-Status/Ergebnisse) + Info-Spalte (Freigabe/Konfiguration/
   Notizen) füllen gemeinsam die .page-Breite, statt als schmaler 760px-Stapel
   links zu kleben. Unter 1100px stapeln die Spalten ganz normal. */
.run-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.run-layout__main, .run-layout__side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (min-width: 1100px) {
  .run-layout { grid-template-columns: minmax(0, 1fr) 380px; }
}

/* ---------- Run-Detail: Feinschliff ---------- */
/* Seitenspalte laeuft beim Scrollen mit (Freigabe/Konfiguration bleiben sichtbar). */
@media (min-width: 1100px) {
  .run-layout__side { position: sticky; top: 20px; }
}
/* Lebenszeichen: pulsierender Punkt neben dem Live-Status, solange der Run aktiv ist. */
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-500, #2563eb); margin-right: 6px; vertical-align: baseline; animation: livepulse 1.4s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.8); } }
/* "Ergebnisse entstehen gerade"-Zustand waehrend queued/running. */
.run-pending { display: flex; align-items: center; gap: 12px; color: var(--fg-muted); padding: 18px 6px; }
.run-pending__spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--blue-500, #2563eb); border-radius: 50%; flex: none; animation: runspin .9s linear infinite; }
@keyframes runspin { to { transform: rotate(360deg); } }
/* Log in der breiten Hauptspalte darf hoeher sein als das 220px-Default. */
.run-layout__main .log-pre { max-height: 360px; }

/* ---------- Autopost-Zeit-Slots (Channel-Formset) ---------- */
.slotlist { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.slotlist__head {
  display: grid; grid-template-columns: 1fr 1fr 32px; gap: 10px;
  padding: 8px 12px; background: var(--gray-50); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-muted);
}
.slotrow {
  display: grid; grid-template-columns: 1fr 1fr 32px; gap: 10px; align-items: start;
  padding: 10px 12px; border-bottom: 1px solid var(--divider); background: var(--bg-surface);
  transition: background var(--dur-fast);
}
/* [hidden] allein reicht nicht: die Author-Regel .slotrow{display:grid} schlaegt
   in der Kaskade immer die UA-Regel [hidden]{display:none}, unabhaengig von
   Spezifitaet. channel-slots.js versteckt ersetzte Zeilen per row.hidden=true
   (DELETE-Checkbox bleibt angehakt, damit Django sie loescht) -- ohne diese
   Regel blieben sie sichtbar. */
.slotrow[hidden] { display: none; }
.slotrow:last-child { border-bottom: 0; }
.slotrow:hover { background: var(--bg-muted); }
.slotrow__cells { display: contents; }
.slotrow__cell { min-width: 0; }
.slotrow__cell--time { display: flex; align-items: center; gap: 7px; color: var(--fg-subtle); }
.slotrow__cell--time .input { flex: 1; }
.slotrow__cell .error { margin-top: 4px; }
.slotrow__del {
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border-radius: var(--radius-sm); color: var(--fg-subtle); cursor: pointer; margin-top: 1px;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.slotrow__del:hover { background: var(--st-rejected-bg); color: var(--st-rejected-fg); }
.slotrow__del input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.slotrow:has(.slotrow__del input:checked) { background: var(--st-rejected-bg); opacity: .65; }
.slotrow:has(.slotrow__del input:checked) .slotrow__del { color: var(--st-rejected-fg); }
@media (max-width: 520px) {
  .slotlist__head { display: none; }
  .slotrow { grid-template-columns: 1fr 32px; row-gap: 8px; }
  .slotrow__cells { display: grid; grid-template-columns: 1fr; gap: 8px; }
}

/* Schnell-Eintrag über der Slot-Liste (Quickfill-Spec 2026-07-10). */
.slotfill {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--radius-md);
}
.slotfill[hidden] { display: none; }
.slotfill__label { font-size: 12px; font-weight: 600; color: var(--fg-strong); }
.slotfill__sep { font-size: 13px; color: var(--fg-muted); }
.slotfill .select, .slotfill .input { width: auto; flex: 0 1 auto; }
/* Mehrere Uhrzeiten pro Muster ("jeden Tag um 12, 18 und 20"). */
.slotfill__times { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.slotfill .error { flex: 1 0 100%; margin-top: 0; }
.slotfill .error[hidden] { display: none; }

/* ---------- Analytics-Board ---------- */
/* Diagramme sind handgeschriebenes Inline-SVG (apps/runs/metrics.py liefert die
   Geometrie) — keine Chart-Bibliothek, kein CDN. Farbe traegt ausschliesslich
   --accent; Gitter und Achsen bleiben neutral, damit die Ein-Akzent-Regel des
   Kits gilt. Kein Gruen/Rot fuer Deltas: bei duennen Daten waere jede Ampel
   Rauschen. */

/* Kanal-Raster: 280px Mindestbreite, damit eine Sparkline lesbar bleibt
   (.acctgrid mit 160px ist dafuer zu schmal). */
.mgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.mcard { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; transition: border-color var(--dur-fast), background var(--dur-fast); }
a.mcard { text-decoration: none; color: inherit; }
.mcard:hover { border-color: var(--border-strong); background: var(--gray-25); }
.mcard__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.mcard__id { min-width: 0; }
.mcard__name { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.mcard__meta { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-subtle); margin-top: 2px; }
.mcard__kpi-label { font-size: 12px; color: var(--fg-muted); }
.mcard__kpi-value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--fg-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.mcard__delta { font-size: 12px; color: var(--fg-muted); }
.mcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid var(--divider); margin-top: auto; }
.mcard__sync { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); }
.mcard .act-link { font-size: 12px; font-weight: 600; color: var(--fg-link); white-space: nowrap; }
.mcard:hover .act-link { text-decoration: underline; text-underline-offset: 2px; }

/* Sparkline */
.spark { display: block; width: 100%; height: 44px; }
.spark--mini { width: 90px; height: 24px; }
.spark__line { fill: none; stroke: var(--accent); stroke-width: 1.5px; stroke-linecap: round; stroke-linejoin: round; }
.spark--mini .spark__line { stroke-width: 1.25px; }
.spark__area { fill: var(--accent-soft); stroke: none; }
.spark__dot { fill: var(--accent); stroke: none; }
/* Leere Sparkline: kein Loch, sondern ein ruhiger Platzhalter mit Erklaerung. */
.spark--empty { position: relative; display: flex; align-items: center; justify-content: center; }
.spark--empty::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--border-strong); }
.spark--empty span { position: relative; background: var(--bg-surface); padding: 0 8px; font-size: 12px; color: var(--fg-subtle); }

/* Grosses Diagramm */
/* Die Seite ist auf 1280px gedeckelt, das Chart-Seitenverhaeltnis 960:264 —
   die natuerliche Hoehe bleibt damit immer unter 340px. Ein niedrigeres
   max-height wuerde das SVG nur seitlich letterboxen statt es zu begrenzen. */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.chart { display: block; width: 100%; height: auto; max-height: 340px; }
.chart text { font-family: var(--font-mono); font-size: 11.5px; fill: var(--fg-subtle); }
.chart__grid { stroke: var(--divider); stroke-width: 1px; }
.chart__zero { stroke: var(--border-strong); stroke-width: 1px; }
.chart__area { fill: var(--accent-soft); stroke: none; }
.chart__line { fill: none; stroke: var(--accent); stroke-width: 1.75px; stroke-linecap: round; stroke-linejoin: round; }
.chart__dot { fill: var(--bg-surface); stroke: var(--accent); stroke-width: 1.5px; }
.chart__bar { fill: var(--accent); }
/* Negative Balken grau statt in einer zweiten Signalfarbe — ein Akzent genuegt. */
.chart__bar--neg { fill: var(--gray-500); }
.chart__empty-line { stroke: var(--border-strong); stroke-width: 1px; stroke-dasharray: 3 4; }
.chart__note { font-size: 12px; color: var(--fg-subtle); margin-top: 8px; }

/* Statuszeile + Zeitraum auf dem Kanalboard */
.anfilter { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

/* KPI-Leiste als Kennzahlen-Auswahl (serverseitig, kein JS) */
.ministats--pick { flex-wrap: wrap; }
a.ministat { text-decoration: none; color: inherit; transition: background var(--dur-fast); }
a.ministat:hover { background: var(--bg-muted); }
.ministat .d { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }
/* Aktive Zelle invertiert wie .chip--on — keine neue Farbe. */
.ministat--on, a.ministat--on:hover { background: var(--gray-900); }
.ministat--on .v, .ministat--on .l { color: #fff; }
.ministat--on .d { color: rgba(255,255,255,.72); }

/* Gesamtstaende */
.kpigrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.kpi__label { font-size: 12px; color: var(--fg-muted); }
.kpi__value { font-family: var(--font-mono); font-size: 26px; font-weight: 500; color: var(--fg-strong); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.kpi__sub { font-size: 11px; color: var(--fg-subtle); margin-top: 2px; }
.kpigrid .spark { height: 32px; margin-top: 8px; }

@media (max-width: 720px) {
  .mgrid { grid-template-columns: 1fr; }
  /* Achsentexte skalieren mit der viewBox — auf 375px waeren sie 4px gross.
     Statt unlesbar zu schrumpfen behaelt das Chart eine Mindestbreite und
     scrollt waagerecht (wie .table-wrap), die Beschriftung wird groesser. */
  .chart { min-width: 640px; max-height: 260px; }
  .chart text { font-size: 15px; }
  /* Der Kartenkopf traegt hier eine lange Einordnung ("Gesamtstand 12.418 ·
     Netto +18"); auf 375px muss sie umbrechen duerfen statt die Seite zu
     verbreitern. Bewusst NUR fuer die Analytics-Koepfe. */
  .anhead { flex-wrap: wrap; row-gap: 2px; }
  .anhead .ds-meta { white-space: normal; }
  .ministats--pick .ministat { flex: 1 1 45%; }
}
