/* Studio-UI (seit 26.11., Spec docs/superpowers/specs/2026-11-26-studio-redesign-design.md).
   Wird nach studio.css geladen: Tokens, Gerüst (Seitenleiste, Unterreiter, Chat-Panel) und die gemeinsamen
   Bausteine (Tabellen, Kacheln, Chips, Knöpfe, Aufklapper). Leitlinien: Höhe ist auf 1080 px knapp, Breite nicht;
   Senf nur für „hier ist etwas zu tun“; Zahlen rechtsbündig mit gleich breiten Ziffern; Status nie nur über Farbe. */

/* Themen (seit 30.11., Spec 2026-11-30-studio-neu): hell „Papier“ ist Standard, dunkel „Pflaume“ per Umschalter
   (html[data-theme], Cookie studio_theme). Seiten-CSS nutzt nur diese Tokens, keine festen Farben. */
:root {
  /* neutrales Plattform-Thema; jede Marke überschreibt die Farben in ui/tokens.css (Route /marke/tokens.css) */
  --bg: #F4F4F2;
  --surface: #E9E9E6;     /* ruhige Tönung: aktive Navigation, Umschalter, Hinweise – nie als Kasten ums Layout */
  --surface-2: #DEDED9;
  --line: rgba(28, 28, 32, 0.16);
  --line-strong: rgba(28, 28, 32, 0.36);
  --text: #1C1C20;
  --text-2: #4A4A50;
  --text-3: #5A5A60;
  --attention: #E5B93A;   /* nur „braucht dich“ */
  --focus: #1C1C20;
  --attention-text: #6B4E08;
  --attention-ink: #1C1C20;
  --action: #2F5D8A;
  --action-ink: #FFFFFF;
  --action-hover: #244A6E;
  --link: #244A6E;
  --up: #245C3A;
  --down: #9A3A27;
  --p-ig: #A87412; --p-fb: #2E8650; --p-yt: #6B55D1; --p-tt: #C8502F;
  --c-follow: #1C1C20;    /* Kanalfarben --c-<kanal>: /kanalfarben.css aus config/channels.json */
  --chart-1: #2F5D8A; --chart-2: #B07A1A;  /* Linien in Grafiken (Aufrufe, Follower) */
  --shade: rgba(28, 28, 32, 0.16);
  --card: #FFFFFF;
  --card-line: #DDDDD8;
  --bar: #1C1C20;         /* Kopfleiste */
  --bar-ink: #F4F4F2;
  --rail-focus: #E5B93A;  /* Fokus-Ring auf der dunklen Leiste */
  --font-body: system-ui, sans-serif;
  --font-mark: inherit;   /* Wortmarke der Seitenleiste */
  --radius: 10px;
  --radius-s: 6px;
  --rail: 208px;
  --panel: 460px;
  --fs-xs: 13px;
  --fs-s: 14px;
  --fs-m: 16px;
  --fs-l: 20px;
  --fs-xl: 34px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #18181B;
  --surface: #303036;
  --surface-2: #3A3A41;
  --line: rgba(244, 244, 242, 0.16);
  --line-strong: rgba(244, 244, 242, 0.34);
  --text: #F4F4F2;
  --text-2: rgba(244, 244, 242, 0.72);
  --text-3: rgba(244, 244, 242, 0.62);
  --attention-text: #E5B93A;
  --attention-ink: #18181B;
  --focus: #E5B93A;
  --action: #3A6A96;
  --action-hover: #4679A8;
  --link: #9CC3E6;
  --up: #7FD19A;
  --down: #F08C78;
  --p-ig: #BD8A1F; --p-fb: #3E9F62; --p-yt: #8F7AE6; --p-tt: #DD6648;
  --c-follow: #F4F4F2;
  --chart-1: #6FA3D6; --chart-2: #E5B93A;
  --shade: rgba(0, 0, 0, 0.45);
  --card: #232327;
  --card-line: rgba(244, 244, 242, 0.12);
  --bar: #111113;
  color-scheme: dark;
}

body { font-size: var(--fs-m); line-height: 1.45; background: var(--bg); }
/* Sprunglink für die Tastatur (seit 02.12.): erst beim Fokus sichtbar, überspringt die Navigation */
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 8px;
  background: var(--action); color: var(--action-ink); font-weight: 650; text-decoration: none; }
.skip:focus { top: 8px; }
main:focus { outline: none; }
#diff { scroll-margin-top: 16px; }
[aria-invalid="true"] { outline: 2px solid var(--down); outline-offset: 1px; }
#diff:focus { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
:where(button, a, summary, select, input, textarea):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* dunkle Leiste in beiden Themen: dort Senf */
.rail { --focus: var(--rail-focus); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ------------------------------------------------------------------ Gerüst */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.shell.chat-open { grid-template-columns: var(--rail) minmax(0, 1fr) var(--panel); }
.shell > main { min-width: 0; }
.shell main h1:first-child, .shell main > .page-head:first-child { margin-top: 0; }

.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 26px 14px 16px; }
.rail-brand { display: block; padding: 2px 10px 18px; font-weight: 750; font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; text-decoration: none; }
.rail-brand b { font-weight: inherit; }
.rail-nav { display: grid; gap: 2px; }
.rail-link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px;
  font: inherit; font-size: 15px; font-weight: 500; text-decoration: none; background: none;
  border: 0; cursor: pointer; text-align: left; }

.rail-link.is-active { font-weight: 700; }
.rail-label { flex: 1; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; }
.badge { white-space: nowrap; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--attention); color: var(--attention-ink);
  font-size: 12px; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
.badge-soft { margin-left: 6px; background: color-mix(in srgb, var(--attention) 20%, transparent); color: var(--attention-text); }
.rail-foot { margin-top: auto; display: grid; gap: 8px; }

.rail-sys { margin: 0; padding: 0 10px; font-size: var(--fs-xs); line-height: 1.5; }
.rail-other { padding: 0 10px; font-size: var(--fs-xs); color: var(--text-3); text-decoration: none; }
.rail-other:hover { color: var(--text); text-decoration: underline; }
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.dot-busy { background: var(--attention); }
.rail-tools { display: flex; gap: 4px; padding: 0 4px; }
.rail-tools form { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 8px;
  background: transparent; border: 0; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[hidden] { display: none; }
.push-toggle[aria-pressed="true"] { color: var(--attention-text); }

.subtabs { display: flex; flex-wrap: wrap; gap: 2px 4px; }
.subtabs a { padding: 8px 12px; color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 550;
  border-radius: 8px; }
.subtabs a:hover { color: var(--text); }
.subtabs a.is-active { color: var(--text); font-weight: 700; }

.chat-panel { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.chat-panel[hidden] { display: none; }
.chat-panel-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--line); font-weight: 700; }
.chat-panel-head span { flex: 1; }
.chat-panel iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }

/* Chat im Panel: kompakt, eine Spalte */
.is-panel main { padding: 12px 14px 20px; }
.chat-layout-panel { grid-template-columns: 1fr; gap: 10px; }
.chat-layout-panel .chat-list { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chat-layout-panel .chat h1 { font-size: 17px; }
.chat-pick summary { font-weight: 500; color: var(--text-2); font-size: var(--fs-s); }
.chat-pick ul { max-height: 40vh; overflow: auto; margin-top: 6px; }
.chat-send { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.chat-layout-panel .quick button { padding: 4px 10px; font-size: var(--fs-s); }

/* Handy/Tablet: Leiste oben als scrollbare Reihe, kein Panel (Chat = ganze Seite) */
@media (max-width: 899px) {
  .shell, .shell.chat-open { grid-template-columns: 1fr; }
  .rail { position: sticky; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .rail-brand { font-size: 16px; }
  .rail-nav { display: flex; gap: 2px; }
  .rail-link { width: auto; white-space: nowrap; }
  .rail-foot { margin: 0 0 0 auto; display: flex; align-items: center; gap: 2px; }
  .rail-chat .rail-label, .rail-sys, .rail-other { display: none; }
    .chat-panel { display: none !important; }
}
@media (max-width: 520px) { .rail-label { display: none; } .rail-link.is-active .rail-label { display: inline; } }

/* ------------------------------------------------------------------ Typo + Seitenkopf */
.shell main h1 { font-size: var(--fs-xl); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; margin: 0 0 14px; }
.page-head { display: grid; gap: 6px; margin: 0 0 28px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; color: var(--text-2); font-size: var(--fs-m); max-width: 64ch; }
h2 { letter-spacing: -0.01em; font-size: var(--fs-l); font-weight: 700; }
main a { text-underline-offset: 2px; text-decoration-thickness: 1px; }

/* ------------------------------------------------------------------ Knöpfe: primär · leise · Symbol */
button, .btn { min-height: 34px; padding: 6px 14px; font-size: 15px; font-weight: 600; border-radius: 8px;
  line-height: 1.2; background: var(--action); color: var(--action-ink); transition: background-color .12s; }
button:hover, .btn:hover { background: var(--action-hover); }
button.quiet, .btn.quiet, .btn-quiet { background: var(--surface); color: var(--text); }
button.quiet:hover, .btn.quiet:hover, .btn-quiet:hover { background: var(--surface-2); }
button.now { background: var(--attention); color: var(--attention-ink); }
button.danger { background: color-mix(in srgb, var(--down) 10%, transparent); color: var(--down); }
button.danger:hover { background: color-mix(in srgb, var(--down) 18%, transparent); }
.btn-s, .actions .btn-s, button.btn-s { min-height: 28px; padding: 3px 10px; font-size: var(--fs-s); }

/* ------------------------------------------------------------------ Aufklapper */
details > summary { cursor: pointer; }
/* Rückfrage vor einem Klick mit Folgen (seit 02.12.): der Knopf ist ein summary, die Bestätigung klappt darunter auf */
details.frage > summary { list-style: none; display: inline-flex; align-items: center; }
details.frage > summary::-webkit-details-marker { display: none; }
details.frage[open] > summary { box-shadow: inset 0 0 0 2px var(--line-strong); }
details.frage > .confirm { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 8px; font-size: var(--fs-s); }
details.frage > .confirm form { margin: 0; }
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 8px; font-weight: 600; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--text-2);
  border-bottom: 2px solid var(--text-2); transform: rotate(-45deg); transition: transform .15s; flex: none; }
details.fold[open] > summary::before { transform: rotate(45deg); }

/* ------------------------------------------------------------------ Chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600;
  padding: 2px 9px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text-2);
  white-space: nowrap; line-height: 1.5; }
.chip-attn { background: var(--attention); color: var(--attention-ink); }
.chip-go, .chip-ok { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.chip-warn, .chip-err { background: color-mix(in srgb, var(--down) 16%, transparent); color: var(--down); }
.chip-muted { background: transparent; padding-left: 0; padding-right: 0; color: var(--text-3); font-weight: 500; }
/* Serien-Kennzeichen „Serie: Titel · Teil n/m“ (Heute, Queue, Vorrat): lange Titel kürzen, ganzer Text im title */
.chip-series { display: inline-block; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }

/* ------------------------------------------------------------------ Kacheln */

/* ------------------------------------------------------------------ Tabellen: eine Basis für alle */
.tbl-wrap { overflow-x: auto; max-width: 100%; }
.tbl { border-collapse: separate; border-spacing: 0; font-size: 15px; }
.tbl.full { width: 100%; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; vertical-align: baseline; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--bg); font-size: var(--fs-xs);
  font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--text) 3.5%, transparent); }
.tbl td.dim, .tbl .dim { color: var(--text-3); }
.tbl td.title { max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl tr.is-current td { background: color-mix(in srgb, var(--attention) 7%, transparent); }
.tbl-compact th, .tbl-compact td { padding: 4px 10px; }
.cellbar { display: inline-block; height: 6px; border-radius: 3px; background: var(--attention); opacity: .8;
  vertical-align: middle; margin-right: 8px; }

/* ------------------------------------------------------------------ Panels/Karten-Grundform */
  /* seit 30.11. kein Kasten mehr: Abschnitt durch Abstand und Überschrift */
.panel > h2:first-child, .panel > header h2 { margin: 0 0 8px; font-size: var(--fs-l); }
.empty { padding: 20px 0; color: var(--text-2); }

/* Suche (Strg+K) – Dialog templates/_search.html, Verhalten static/search.js, Treffer GET /suche */
.rail-search { margin-bottom: 10px; }

.rail-kbd { font: inherit; font-size: 12px; padding: 0 5px; border: 1px solid var(--line-strong);
  border-radius: 4px; white-space: nowrap; }
.search-dlg { width: min(680px, calc(100vw - 32px)); max-height: min(72vh, 720px); margin: 10vh auto auto; padding: 0;
  border: 0; border-radius: 14px; background: var(--bg); color: var(--text);
  box-shadow: 0 24px 60px var(--shade); overflow: hidden; }
.search-dlg[open] { display: flex; flex-direction: column; }
.search-dlg::backdrop { background: rgba(15, 12, 20, 0.62); }
.search-form { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--line); }
.search-form > .ico { width: 20px; height: 20px; color: var(--text-3); }
.search-form input { flex: 1; min-width: 0; padding: 8px 0; font: inherit; font-size: 17px; color: var(--text);
  background: transparent; border: 0; outline: none; }
.search-form input::placeholder { color: var(--text-3); }
.search-form input::-webkit-search-cancel-button { display: none; }
.search-results { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 8px; }
.search-results:empty { display: none; }
.search-group + .search-group { margin-top: 6px; }
.search-gh { margin: 0; padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); }
.search-hit { display: grid; gap: 1px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.search-hit.is-active { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--attention); }
.search-title { font-size: 15px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-comments .search-title { font-weight: 450; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; }
.search-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: var(--fs-xs); color: var(--text-2); }
.search-file { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.search-hit mark { background: color-mix(in srgb, var(--attention) 22%, transparent); color: var(--text); border-radius: 2px; padding: 0 1px; }
.search-none { margin: 0; padding: 18px 12px; text-align: center; color: var(--text-2); }
.search-foot { margin: 0; padding: 7px 16px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--text-3); }
.search-foot kbd { font: inherit; padding: 0 5px; margin-right: 2px; border: 1px solid var(--line-strong); border-radius: 4px; }
@media (max-width: 899px) {
  .rail-search { width: auto; margin: 0; border: 0; padding: 7px 9px; }
  .rail-kbd { display: none; }
  .search-dlg { margin-top: 8px; max-height: calc(100vh - 16px); }
  .search-foot { display: none; }
}

/* Auto-Freigabe: Reizthema-/Nicht-prüfbar-Hinweis bzw. „automatisch freigegeben“ in der Terminzeile */
.sens { margin: 0.25rem 0 0; padding-left: 0.5rem; border-left: 3px solid var(--attention); font-size: 0.85rem; color: var(--text); }
.sens-auto { border-left-color: var(--up); }

/* ------------------------------------------------------------------ Alarm-Banner (seit 30.11., studio/alarms.py) */
.alarms { margin: 0 0 28px; padding: 14px 18px; border-radius: var(--radius); color: var(--text);
  background: color-mix(in srgb, var(--down) 13%, var(--bg)); }
.alarms-h { margin: 0 0 4px; font-size: var(--fs-m); font-weight: 750; color: var(--down); }
.alarms-list { list-style: none; margin: 0; padding: 0; }
.alarms-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 2px 16px; align-items: center;
  padding: 6px 0; border-top: 1px solid color-mix(in srgb, var(--down) 22%, transparent); }
.alarms-list li:first-child { border-top: 0; }
.alarms-title { font-weight: 650; overflow-wrap: anywhere; }
.alarms-when { font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; }
.alarms-head { grid-column: 1; grid-row: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 10px; }
.alarms-detail { display: block; font-size: var(--fs-s); color: var(--text-2); overflow-wrap: anywhere; max-width: 90ch; }
.alarms-acts { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 12px; font-size: var(--fs-s); }
/* Erklärung und Rat je Alarm aufklappbar (seit 02.12., Audit 2): zugeklappt steht „Was tun?“ in der Zeile des Alarms,
   aufgeklappt bekommt der Text die Zeile darunter über die ganze Breite; die Knöpfe sind immer erreichbar */
.alarms-mehr { grid-column: 2; grid-row: 1; min-width: 0; font-size: var(--fs-s); }
.alarms-mehr[open] { grid-column: 1 / -1; grid-row: 2; }
.alarms-mehr > summary { display: inline-flex; align-items: center; min-height: 24px; cursor: pointer; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.alarms-mehr[open] > summary { margin-bottom: 2px; }
@media (max-width: 699px) {
  .alarms-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .alarms-head { grid-column: 1 / -1; }
  .alarms-acts { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .alarms-mehr { grid-column: 2; grid-row: 2; }
  .alarms-mehr[open] { grid-column: 1 / -1; grid-row: 3; }
  .alarms-mehr > summary { min-height: 44px; }
}
.alarms-acts form, .alarms-all { margin: 0; }
.alarms-all { margin-top: 8px; }
.alarms-more { margin: 4px 0 0; font-size: var(--fs-s); color: var(--text-2); }
.alarms button.quiet { background: color-mix(in srgb, var(--text) 9%, transparent); }
.alarms-advice { display: block; font-size: var(--fs-s); color: var(--text); overflow-wrap: anywhere; max-width: 90ch; }
.alarms-fix { background: var(--action); color: var(--action-ink); border-color: transparent; font-weight: 700; }
/* eine Zeile auf allen Seiten außer „Heute“ (seit 02.12.) */
.alarms-line { display: flex; align-items: baseline; gap: 4px 12px; margin: 0 0 18px; padding: 8px 14px; max-width: none; font-size: var(--fs-s); }
.alarms-line .alarms-h { flex: none; margin: 0; font-size: var(--fs-s); }
.alarms-line-what { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.alarms-line-go { flex: none; font-weight: 650; }
@media (max-width: 899px) { .alarms-line { align-items: center; padding-block: 0; } .alarms-line-go { display: inline-flex; align-items: center; min-height: 44px; } }

/* ------------------------------------------------------------------ Fehlerseite (studio/app.py http_error) */
.error-page { max-width: 62ch; }
.error-page-detail { margin: 0 0 18px; color: var(--text-2); overflow-wrap: anywhere; }
.error-page-acts { margin: 0 0 14px; }
.error-page-acts .btn { display: inline-block; text-decoration: none; }
.error-page-code { margin: 0; font-size: var(--fs-xs); color: var(--text-3); }
.bare .error-page { margin: 12vh auto 0; padding: 22px 24px; border: 1px solid var(--card-line); border-radius: var(--radius); background: var(--card); }
.bare .error-page h1 { font-size: 26px; margin: 0 0 10px; }
