/* Grundlagen und ältere Seitenbausteine. Wird vor ui.css geladen; ui.css ist die Quelle für Tokens, Gerüst und
   Bausteine (Knöpfe, Chips, Aufklapper, Tabellen), die Seiten-CSS (heute.css, stock.css, system.css, …) danach.
   Hier steht nur, was dort nicht schon gesetzt oder überschrieben wird (aufgeräumt 26.11.). */
* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body, system-ui, sans-serif); /* Schrift der Marke (ui/tokens.css); Größe usw.: ui.css */
}

a { color: var(--link); }

/* Seitenrand ohne Gerüst (Login); mit Seitenleiste setzt ui.css .shell > main. Fließtext behält eine Lesebreite */
main { padding: 24px clamp(16px, 3vw, 48px); }
main p { max-width: 90ch; }
.muted { color: var(--text-2); }

.login { max-width: 420px; margin: 8vh auto 0; display: grid; gap: 16px; }
.login label { display: grid; gap: 6px; font-size: 16px; }
.login label.check { display: flex; align-items: center; gap: 10px; }
input {
  font: inherit;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
/* Größe, Farbe, Hover und Fokus der Knöpfe: ui.css */
button {
  font: inherit;
  border: 0;
  cursor: pointer;
}
.error { margin: 0; padding: 10px 12px; border-radius: 6px; }
.htmx-error { margin: 6px 0 0; padding: 6px 10px; border-radius: 6px; color: var(--text); }

h1 { margin: 0 0 16px; }

/* Seite „Heute“: Reste, die heute.css nicht überschreibt */
.channels { display: grid; align-items: start; }
.channel { min-width: 0; }
.section-head { flex-wrap: wrap; }
.card video { aspect-ratio: 9 / 16; }
.answer { padding: 8px 12px; border-radius: 6px; }
.crosspost { overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions form { margin: 0; }
button[disabled] { opacity: 0.6; cursor: progress; }
.htmx-indicator { display: none; font-size: 16px; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }
form.htmx-request ~ .htmx-indicator { display: inline; }
details summary { font-weight: 600; }
details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: 16px;
  margin: 8px 0;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
}
details form { display: grid; gap: 8px; margin: 0; }
details label { display: grid; gap: 6px; font-size: 16px; }
textarea {
  font: inherit;
  font-size: 16px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  resize: vertical;
}
.sources ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 16px; overflow-wrap: anywhere; }
button.quiet.now:hover { background: var(--action-hover); }
.confirm .ask { font-weight: 600; color: var(--attention-text); }
.discard summary { padding: 6px 12px; border-radius: 6px; list-style: none; }
.discard summary::-webkit-details-marker { display: none; }
.discard .confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.pending { display: grid; gap: 8px; }
.pending p, .pending form { margin: 0; }

/* Chat */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.chat-list { display: grid; gap: 12px; }
.chat-list form { margin: 0; }
.chat-list ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.chat-list a { display: block; padding: 6px 10px; border-radius: 6px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.chat-list a:hover { background: var(--surface); }

.chat { display: grid; gap: 12px; min-width: 0; }
.chat h1 { margin: 0; overflow-wrap: anywhere; }
.chat p { margin: 0; }
.messages { display: grid; gap: 10px; }
.msg { display: grid; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--surface); }
.msg .who { font-size: 16px; font-weight: 600; color: var(--attention-text); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user { background: var(--action-hover); }
.msg-tool { padding: 2px 12px; background: transparent; font-size: 16px; opacity: 0.9; }

.chat-status { min-height: 1.5em; font-size: 16px; color: var(--attention-text); }
.chat-form { display: grid; gap: 8px; margin: 0; }
.chat-form label { display: grid; gap: 6px; font-size: 16px; }
.chat-form .quick { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-form .quick button { padding: 6px 12px; }
.chat .hint { font-size: 16px; }
.chat-edit { margin: 0; }
@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; }
}

/* Werkbank */
.wb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.wb-actions form { margin: 0; }
.wb-job { border-radius: 6px; padding: 8px 12px; }
.werkbank { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(260px, 340px); gap: 24px; align-items: start; }
.werkbank h2 { margin-top: 0; }
.wb-warnings { margin: 0 0 12px; padding: 8px 12px 8px 32px; border-radius: 6px; }
.tracks-scroll { overflow-x: auto; padding-bottom: 8px; }
.tracks { display: grid; gap: 6px; width: max-content; }
.track { display: flex; align-items: center; gap: 8px; }
.track-name { position: sticky; left: 0; z-index: 1; flex: 0 0 84px; margin: 0; padding: 4px 8px 4px 0;
  background: var(--bg); font-size: 16px; font-weight: 600; color: var(--attention-text); }
.track svg { display: block; background: var(--surface); border-radius: 4px; }
.seg { fill: var(--action); stroke: var(--text); stroke-opacity: 0.35; }
.seg.track-1 { fill: var(--action-hover); }
.seg.warn { fill: var(--bg); stroke: var(--attention); stroke-opacity: 1; stroke-width: 2; }
.seg.playable { stroke: var(--attention); stroke-opacity: 0.8; }
.seg-text { fill: var(--text); font-size: 16px; pointer-events: none; }
.tick { stroke: var(--text); stroke-opacity: 0.9; }
.tick-text { fill: var(--text); font-size: 16px; }
.storyboard { display: none; list-style: none; margin: 0; padding: 0; gap: 10px; }
.storyboard .scene { padding: 10px 12px; background: var(--surface); border-radius: 8px; overflow-wrap: anywhere; }

.storyboard h3, .storyboard p { margin: 0 0 4px; }
.storyboard h3 { font-size: 18px; }
.storyboard .scene-duration { font-size: 16px; font-weight: 400; opacity: 0.75; }
.storyboard .scene-thumb { display: block; width: 100%; max-width: 200px; aspect-ratio: 4 / 5; object-fit: cover;
  margin: 6px 0; border-radius: 6px; background: var(--bg); }
.storyboard .scene-thumb-none { font-size: 16px; }
.storyboard .scene-text, .storyboard .scene-say { font-size: 16px; }
.storyboard .scene.warn .scene-source { color: var(--attention-text); font-weight: 600; }
.wb-chat .chat { gap: 8px; }
/* Geändertes Segment (Ereignis tracks, data-changed="1"): 1,5 s mustard-Umrandung */
.tracks g[data-changed="1"] .seg { animation: wb-changed 1.5s ease-out; }
@keyframes wb-changed {
  0%, 70% { stroke: var(--attention); stroke-opacity: 1; stroke-width: 4; }
  100% { stroke-width: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tracks g[data-changed="1"] .seg { animation: none; stroke: var(--attention); stroke-opacity: 1; stroke-width: 3; }
}
/* Vorschau (iframe 9:16) und Steuerung */
.preview-frame { position: relative; width: 100%; max-width: 360px; aspect-ratio: 9 / 16; background: #000; border-radius: 8px; overflow: hidden; }
.preview-frame iframe, .preview-frame video { display: block; width: 100%; height: 100%; border: 0; }
.preview-frame [hidden] { display: none; }
.preview-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.preview-controls button { padding: 6px 10px; font-size: 16px; }
.preview-status { min-height: 1.5em; margin: 6px 0 0; font-size: 16px; color: var(--attention-text); }
.preview-toggle { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.preview-toggle input { width: 20px; height: 20px; accent-color: var(--attention); }
.preview-note { font-size: 16px; margin: 6px 0 0; }
/* Bau-Protokoll */
.buildlog { list-style: none; margin: 0; padding: 12px; display: grid; gap: 2px; max-height: 360px; overflow-y: auto; border-radius: 6px; font-size: 16px; overflow-wrap: anywhere; }
.buildlog .log-step { font-weight: 600; margin-top: 6px; }
.buildlog .log-step:first-child { margin-top: 0; }
.buildlog .log-mark { display: inline-block; width: 1.2em; color: var(--attention-text); }
.buildlog .log-step[data-status="done"] .log-mark { color: var(--text); }
.buildlog .log-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.buildlog .log-tool { padding-left: 1.2em; font-family: ui-monospace, monospace; font-size: 16px; opacity: 0.9; }
.buildlog .log-out { padding-left: 1.2em; opacity: 0.9; }
.buildlog-status { min-height: 1.5em; margin: 6px 0 0; font-size: 16px; }
#buildlog { margin-top: 24px; }
@media (max-width: 1200px) {
  .werkbank { grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); }
  .wb-chat { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .werkbank { grid-template-columns: minmax(0, 1fr); }
}
/* Unter 700 px (Handy): Storyboard statt Spuren, alle Bereiche in einer Spalte, große Bedienelemente */
@media (max-width: 699px) {
  .werkbank { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .tracks-scroll { overflow: visible; }
  .tracks { display: none; }
  .storyboard { display: grid; gap: 12px; }
  .wb-actions form, .wb-actions button { width: 100%; }
  .wb-actions button { min-height: 48px; font-size: 18px; }
  .preview-controls button { flex: 1 1 calc(50% - 6px); min-height: 48px; font-size: 18px; }
  .preview-toggle input { width: 24px; height: 24px; }
  .chat-form textarea { width: 100%; min-width: 0; }
  .chat-form button { min-height: 48px; font-size: 18px; }
  .buildlog { max-height: 280px; }
}

/* Test-Runde (Heute, DE): Liste der Reels in der Rückfrage */
.trial-files { margin: 0; padding-left: 20px; font-size: 16px; overflow-wrap: anywhere; }

/* Spracheingabe im Chat (mic.js): Knopf und Statuszeile in einer Reihe, Fehler deutlich sichtbar */
.mic-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mic-row #mic-status { font-size: 16px; }
.mic-row #mic-status.mic-error { color: var(--attention-text); opacity: 1; }
.mic-row button[aria-pressed="true"] { border-color: var(--attention); color: var(--attention-text); }
/* Veröffentlicht (Heute): Hinweis ohne Zahlen bleibt in Fließtextgröße */
.pub-nonums { font-size: 16px; }

/* Übernommene Trial-Reels auf „Heute“ (Form und Pfeil: .panel und details.fold aus ui.css) */
.graduation > summary { flex-wrap: wrap; }
.grad-title { font-weight: 700; }
.grad-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.grad-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 2px; }
.grad-row { display: grid; gap: 12px; align-items: baseline; padding: 5px 8px; border-radius: 6px; }
.grad-row:nth-child(odd) { background: color-mix(in srgb, var(--text) 4%, transparent); }
.grad-status { font-size: 13px; color: var(--attention-text); }
.grad-failed .grad-status { color: var(--down); }
.grad-skipped .grad-status, .grad-past .grad-status { color: var(--text-2); }
.grad-id { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.grad-detail { color: color-mix(in srgb, var(--text) 90%, transparent); }
@media (max-width: 700px) { .grad-row { gap: 0; } }
.graduation .vorschlag { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }

.strategie { margin-bottom: 1rem; }
.strategie h3, .strategie h4 { margin: 1rem 0 .25rem; }
.strategie .warn { color: var(--attention-text); }
.strategie .lauf { border-top: 1px solid var(--line, rgba(255,255,255,.15)); padding-top: .5rem; overflow-wrap: anywhere; }
.strategie details { margin: .5rem 0; }
.strategie summary { font-weight: 700; }

/* Heute: Lagebild-Abstand und Terminzeile (Knopf-Innenabstände schlagen bewusst .btn-s aus ui.css) */
.lagebild { gap: 10px; }
.card .actions button { padding: 6px 12px; }
.card details.video summary { font-weight: 600; }
.card-more form.time input[type="time"] { width: 110px; padding: 4px 6px; }
.card-more form.time button { padding: 4px 10px; }
.card-more button.quiet { padding: 4px 10px; }
