/* Inferi MediaHub – Designsystem
   Ruhige Business-Oberfläche: neutrale Flächen, eine Akzentfarbe (Branding), dichte Tabellen,
   wenige Panels, Status nur über Farbe + Text. Die Akzentfarbe wird serverseitig kontrastgeprüft. */

:root {
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --ink: #1a2130;
  --ink-2: #3a4353;
  --muted: #5d6676;
  --faint: #8a93a3;
  --line: #dfe3e9;
  --line-strong: #c9cfd8;
  --hover: #f0f2f5;
  --accent: #1f5fbf;
  --accent-hover: #1a52a5;
  --accent-subtle: #e9f0fa;
  --accent-border: #a9c2e8;
  --on-accent: #ffffff;
  --ok: #1d7445;      --ok-bg: #e8f4ec;    --ok-line: #b4dbc3;
  --warn: #8f5a00;    --warn-bg: #fdf3e1;  --warn-line: #ecd09b;
  --danger: #b3261e;  --danger-bg: #fbeceb; --danger-line: #efbcb8;
  --info: #2d5a8c;    --info-bg: #eaf1f8;  --info-line: #bcd0e6;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --radius: 4px;
  --radius-lg: 6px;
  --sidebar: 236px;
  --player-h: 0px;
  --font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #13161b; --surface: #1a1e25; --surface-2: #1e232b; --ink: #e5e8ed; --ink-2: #c7ccd5;
    --muted: #9aa3b2; --faint: #747d8c; --line: #2a3039; --line-strong: #3a414d; --hover: #232831;
    --on-accent: #0f1218;
    --ok: #6cc795; --ok-bg: #16281f; --ok-line: #2a4a38;
    --warn: #e4b45f; --warn-bg: #2b2414; --warn-line: #4f4122;
    --danger: #f08f87; --danger-bg: #2e1817; --danger-line: #5a2c28;
    --info: #8fb6e3; --info-bg: #17222f; --info-line: #2c3f56;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #13161b; --surface: #1a1e25; --surface-2: #1e232b; --ink: #e5e8ed; --ink-2: #c7ccd5;
  --muted: #9aa3b2; --faint: #747d8c; --line: #2a3039; --line-strong: #3a414d; --hover: #232831;
  --on-accent: #0f1218;
  --ok: #6cc795; --ok-bg: #16281f; --ok-line: #2a4a38;
  --warn: #e4b45f; --warn-bg: #2b2414; --warn-line: #4f4122;
  --danger: #f08f87; --danger-bg: #2e1817; --danger-line: #5a2c28;
  --info: #8fb6e3; --info-bg: #17222f; --info-line: #2c3f56;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--canvas);
  font-feature-settings: "tnum" 0; -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; color: var(--ink); }
h1 { font-size: 20px; letter-spacing: -0.01em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding-bottom: var(--player-h);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; border-bottom: 1px solid var(--line); min-height: 60px; }
.brand img { max-height: 32px; max-width: 120px; width: auto; }
.brand-mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.brand-name { font-weight: 600; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.brand-name small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.nav { padding: 10px 8px; flex: 1; min-height: 0; overflow-y: auto; }
.nav-section { margin: 16px 8px 4px; font-size: 12px; color: var(--faint); font-weight: 500; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius);
  color: var(--ink-2); font-weight: 500; text-decoration: none; min-height: 32px;
}
.nav a:hover { background: var(--hover); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-subtle); color: var(--accent); }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 400; }
.nav a .badge-count { margin-left: auto; min-width: 20px; padding: 0 6px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 600; }
.nav-sub { margin: 2px 0 6px 18px; border-left: 1px solid var(--line); padding-left: 6px; }
.nav-sub a { font-weight: 400; min-height: 28px; padding: 4px 8px; font-size: 13.5px; }
.nav-sub a.inactive { color: var(--faint); }
.sidebar-foot { border-top: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--hover); color: var(--ink-2); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; border: 1px solid var(--line); }
.sidebar-foot .who { min-width: 0; flex: 1; line-height: 1.25; }
.sidebar-foot .who a { color: var(--ink); font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; padding-bottom: var(--player-h); }
.topbar {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--canvas) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 56px;
}
.topbar .menu-toggle { display: none; }
.topbar-search { margin-left: auto; position: relative; width: min(340px, 40vw); }
.topbar-search input[type=search] { padding-left: 32px; background: var(--surface); }
.topbar-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.content { padding: 24px; width: 100%; max-width: 1280px; }
.content.narrow { max-width: 860px; }

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .titles p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger-line); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--hover); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 34px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn[aria-current="true"] { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent-border); position: relative; z-index: 1; }

/* ---------- Forms ---------- */
label { font-weight: 500; }
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; margin-bottom: 5px; }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.field-error { color: var(--danger); font-size: 12.5px; margin: 4px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=number],
input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { height: auto; min-height: 96px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.is-invalid { border-color: var(--danger) !important; }
input[type=color] { width: 48px; height: 34px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; padding: 6px 0; }
.check input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.check strong { font-weight: 500; display: block; }
.check span.hint { display: block; color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.form-actions { display: flex; gap: 8px; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.segmented a { padding: 6px 14px; color: var(--ink-2); font-weight: 500; border-right: 1px solid var(--line-strong); }
.segmented a:last-child { border-right: 0; }
.segmented a[aria-current="true"] { background: var(--accent-subtle); color: var(--accent); }
.segmented a:hover { text-decoration: none; background: var(--hover); }

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-height: 48px; }
.panel-head h2 { flex: 1; }
.panel-head .meta { color: var(--muted); font-size: 13px; }
.panel-body { padding: 16px; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.section { margin-bottom: 24px; }
.section > h2 { margin-bottom: 10px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cols-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.stack > * + * { margin-top: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table td.actions, .table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table .title-cell { min-width: 220px; }
.table .title-cell a { color: var(--ink); font-weight: 500; }
.table .title-cell .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.table.compact th, .table.compact td { padding: 7px 12px; }
.table .row-muted td { color: var(--muted); }
.panel > .table-wrap > .table th:first-child, .panel > .table-wrap > .table td:first-child { padding-left: 16px; }
.panel > .table-wrap > .table th:last-child, .panel > .table-wrap > .table td:last-child { padding-right: 16px; }
.play-col { width: 44px; padding-right: 0 !important; }

/* Definitionsliste */
dl.meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 16px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Status ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 3px;
  font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); white-space: nowrap; line-height: 1;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.tag.plain::before { display: none; }
.tag-ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); }
.tag-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.tag-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.tag-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.tag-accent { color: var(--accent); background: var(--accent-subtle); border-color: var(--accent-border); }
.tag-muted { color: var(--muted); }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.chip { display: inline-block; padding: 1px 8px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; color: var(--ink-2); background: var(--surface); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); vertical-align: 1px; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-danger { background: var(--danger); }
.prio-critical { color: var(--danger); font-weight: 600; }
.prio-high { color: var(--warn); font-weight: 600; }
.state-ok { color: var(--ok); }
.state-open { color: var(--danger); font-weight: 500; }

progress.bar { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--hover); overflow: hidden; vertical-align: middle; }
progress.bar::-webkit-progress-bar { background: var(--hover); border-radius: 3px; }
progress.bar::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress.bar::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
progress.bar.done::-webkit-progress-value { background: var(--ok); }
progress.bar.done::-moz-progress-bar { background: var(--ok); }
.storage-bar { display: block; margin: 6px 0 4px; max-width: 320px; }
progress.bar.warn::-webkit-progress-value { background: var(--warn); }
progress.bar.warn::-moz-progress-bar { background: var(--warn); }
progress.bar.full::-webkit-progress-value { background: var(--danger); }
progress.bar.full::-moz-progress-bar { background: var(--danger); }
.progress-cell { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.progress-cell progress { flex: 1; }
.progress-cell span { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }

/* ---------- Hinweise ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.alert .icon { margin-top: 2px; }
.alert > div { flex: 1; min-width: 0; }
.alert strong { font-weight: 600; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ink); } .alert-ok .icon { color: var(--ok); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--ink); } .alert-warn .icon { color: var(--warn); }
.alert-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--ink); } .alert-danger .icon { color: var(--danger); }
.alert-info { background: var(--info-bg); border-color: var(--info-line); color: var(--ink); } .alert-info .icon { color: var(--info); }
.alert .alert-actions { margin-left: auto; display: flex; gap: 8px; align-self: center; }
.flash-stack { margin-bottom: 4px; }
.system-banner { display: flex; align-items: center; gap: 10px; padding: 8px 24px; font-size: 13.5px; border-bottom: 1px solid; }
.system-banner.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.system-banner.danger { background: var(--danger-bg); border-color: var(--danger-line); }
.system-banner a { font-weight: 500; }

/* ---------- Leerzustände ---------- */
.empty { padding: 32px 20px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; font-size: 14px; }
.empty p { max-width: 46ch; margin: 0 auto 12px; }
.empty-inline { padding: 14px 16px; color: var(--muted); }

/* ---------- Dashboard ---------- */
.statline { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 20px; }
.statline > div { padding: 10px 18px; border-right: 1px solid var(--line); min-width: 120px; flex: 1; }
.statline > div:last-child { border-right: 0; }
.statline .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; display: block; line-height: 1.3; }
.statline .l { color: var(--muted); font-size: 12.5px; }
.statline a.v { color: var(--ink); }
.statline .v.alarm { color: var(--danger); }
.todo-row td:first-child { width: 4px; padding: 0 !important; }
.todo-row .bar-mark { display: block; width: 3px; height: 100%; min-height: 40px; background: var(--line-strong); }
.todo-row.critical .bar-mark { background: var(--danger); }
.todo-row.high .bar-mark { background: var(--warn); }
.todo-row.normal .bar-mark { background: var(--accent-border); }
.greeting { margin-bottom: 18px; }
.greeting h1 { font-size: 20px; }
.greeting p { color: var(--muted); margin: 2px 0 0; }
.notice-item { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.notice-item:last-child { border-bottom: 0; }
.notice-item a.t { font-weight: 600; color: var(--ink); }
.notice-item .body { color: var(--ink-2); margin-top: 4px; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { padding: 8px 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; }
.activity-list li:last-child { border-bottom: 0; }
.activity-list .what { color: var(--ink); }
.activity-list .when { color: var(--faint); font-size: 12.5px; white-space: nowrap; }
.activity-list .who { color: var(--muted); font-size: 12.5px; }

/* ---------- Mediathek ---------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filterbar .search { position: relative; flex: 1 1 260px; max-width: 420px; }
.filterbar .search input[type=search] { padding-left: 32px; }
.filterbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.filterbar select { width: auto; min-width: 140px; }
.filterbar .result-count { margin-left: auto; color: var(--muted); font-size: 13px; }
.viewtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.viewtabs a { padding: 8px 12px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.viewtabs a:hover { color: var(--ink); text-decoration: none; }
.viewtabs a[aria-current="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.play-btn {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); padding: 0;
}
.play-btn:hover { border-color: var(--accent); color: var(--accent); }
.play-btn .icon { width: 13px; height: 13px; fill: currentColor; stroke: none; }
.play-btn.is-playing { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.type-glyph { width: 30px; height: 30px; display: inline-grid; place-items: center; color: var(--faint); }
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 12px; color: var(--muted); font-size: 13px; }
.media-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.media-header .titles { flex: 1; min-width: 260px; }
.media-header h1 { font-size: 22px; margin: 2px 0 6px; }
.media-header .line { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); }
.obligation-box { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; background: var(--surface); margin-bottom: 16px; }
.obligation-box.open { border-left-color: var(--danger); }
.obligation-box.done { border-left-color: var(--ok); }
.obligation-box h2 { margin-bottom: 6px; }
.obligation-box ul { list-style: none; padding: 0; margin: 0 0 10px; }
.obligation-box li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.obligation-box form { margin-top: 8px; }
.inline-player { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 16px; }
.inline-player .play-btn { width: 40px; height: 40px; }
.inline-player .play-btn .icon { width: 16px; height: 16px; }
.inline-player .info { flex: 1; min-width: 0; }
.inline-player .info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-image { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); padding: 8px; margin-bottom: 16px; text-align: center; }
.preview-image img { max-height: 420px; }
.notice-body { font-size: 15px; line-height: 1.6; max-width: 72ch; }
.description { max-width: 75ch; }

/* ---------- Upload ---------- */
.dropzone { border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 22px; text-align: center; background: var(--surface-2); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-subtle); }
.dropzone p { margin: 4px 0; color: var(--muted); }
.dropzone .picked { color: var(--ink); font-weight: 500; }
.upload-status { margin-top: 10px; display: none; }
.upload-status.active { display: block; }
.upload-status .row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.upload-status.error .row { color: var(--danger); }

/* ---------- Docked Player ---------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 64px; display: none;
  background: var(--surface); border-top: 1px solid var(--line-strong);
  grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: center;
}
.dock.active { display: grid; }
.dock-now { display: flex; align-items: center; gap: 10px; padding: 0 16px; min-width: 0; border-right: 1px solid var(--line); height: 100%; }
.dock-now .onair { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dock.playing .dock-now .onair { background: var(--danger); }
.dock-now .t { min-width: 0; line-height: 1.25; }
.dock-now .t strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.dock-now .t span { font-size: 12px; color: var(--muted); }
.dock-ctrl { display: flex; align-items: center; gap: 14px; padding: 0 24px; min-width: 0; }
.dock-ctrl .play-btn { width: 38px; height: 38px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.dock-ctrl .play-btn .icon { width: 15px; height: 15px; }
.dock-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); min-width: 92px; }
.dock-seek { flex: 1; min-width: 80px; accent-color: var(--accent); height: 4px; }
.dock-vol { width: 90px; accent-color: var(--accent); }
.dock .close { margin-left: 4px; }
body.has-dock { --player-h: 64px; }

/* ---------- Dialog ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(15, 20, 30, .18); }
dialog::backdrop { background: rgba(15, 20, 30, .45); }
dialog .dlg-body { padding: 18px 20px 6px; }
dialog .dlg-body h2 { font-size: 16px; margin-bottom: 8px; }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }

details.disclosure { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
details.disclosure > summary { padding: 10px 14px; cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; gap: 8px; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details.disclosure[open] > summary::before { transform: rotate(45deg); }
details.disclosure > .inner { padding: 4px 14px 14px; }
details.danger-zone { border-color: var(--danger-line); }
details.danger-zone > summary { color: var(--danger); }

.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface-2); }
.codebox { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.secret { display: flex; gap: 8px; align-items: center; }
.secret code { font-family: var(--mono); font-size: 15px; letter-spacing: .03em; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.log { font-family: var(--mono); font-size: 12.5px; max-height: 260px; overflow-y: auto; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.log div { padding: 1px 0; }
.log time { color: var(--faint); margin-right: 8px; }
.steps { list-style: none; padding: 0; margin: 0 0 14px; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--muted); }
.steps li .dot { width: 10px; height: 10px; }
.steps li.done { color: var(--ink); } .steps li.done .dot { background: var(--ok); }
.steps li.current { color: var(--ink); font-weight: 500; } .steps li.current .dot { background: var(--accent); }
.steps li.failed .dot { background: var(--danger); }
.changelog { white-space: pre-wrap; max-width: 75ch; color: var(--ink-2); }

/* ---------- Anmeldung / Installer ---------- */
.plain-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-box { width: min(380px, 100%); }
.auth-box .brand-line { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-box .brand-line img { max-height: 40px; width: auto; }
.auth-box h1 { font-size: 18px; }
.auth-box .panel-body { padding: 22px; }
.auth-foot { text-align: center; margin-top: 16px; color: var(--faint); font-size: 12.5px; }
.install-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.install-side { background: var(--surface); border-right: 1px solid var(--line); padding: 28px 22px; }
.install-side .product { font-weight: 600; margin-bottom: 2px; }
.install-side ol { list-style: none; padding: 0; margin: 24px 0 0; counter-reset: s; }
.install-side li { counter-increment: s; display: flex; gap: 10px; align-items: center; padding: 7px 0; color: var(--muted); }
.install-side li::before { content: counter(s); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.install-side li.done { color: var(--ink); } .install-side li.done::before { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); content: "✓"; }
.install-side li.current { color: var(--ink); font-weight: 600; } .install-side li.current::before { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.install-main { padding: 40px 32px; max-width: 760px; }
.install-main h1 { margin-bottom: 6px; }
.install-main .lead { color: var(--muted); margin-bottom: 22px; max-width: 62ch; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 7px 16px; border-bottom: 1px solid var(--line); align-items: center; }
.checklist li:last-child { border-bottom: 0; }
.checklist .ok { color: var(--ok); } .checklist .bad { color: var(--danger); } .checklist .opt { color: var(--warn); }
.checklist .d { color: var(--muted); font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-main, .form-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 20, 30, .4); }
  .topbar { padding: 0 16px; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 16px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .dock { grid-template-columns: minmax(0, 1fr); height: auto; padding: 8px 0; }
  .dock-now { border-right: 0; height: auto; padding-bottom: 6px; }
  .dock-ctrl { padding: 0 16px; }
  .dock-vol { display: none; }
  body.has-dock { --player-h: 104px; }
  .install-shell { grid-template-columns: minmax(0, 1fr); }
  .install-side { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .install-side ol { display: flex; gap: 14px; overflow-x: auto; margin-top: 10px; }
  .install-side li span { display: none; }
  .install-side li.current span { display: inline; }
  .install-main { padding: 22px 16px; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .topbar-search { width: auto; flex: 1; }
  .page-head .actions { width: 100%; }
  h1 { font-size: 18px; }
  .media-header h1 { font-size: 19px; }
  /* Tabellen werden zu Listen */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--line); padding: 8px 0; position: relative; }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 2px 16px !important; text-align: left !important; }
  .table.responsive td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .table.responsive td.hide-sm { display: none; }
  .table.responsive td.actions { width: auto; padding-top: 6px !important; }
  .table.responsive td.play-col { position: absolute; right: 8px; top: 10px; width: auto; }
  .table.responsive .todo-row td:first-child { display: none; }
  .statline > div { min-width: 50%; border-bottom: 1px solid var(--line); }
  dl.meta { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.meta dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .dock, .actions, .filterbar, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}

/* Ergänzungen */
.w-auto { width: auto !important; }
.logo-preview { max-height: 48px; width: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; background: var(--surface-2); }
.favicon-preview { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: var(--radius); }
.preview-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.brand-preview .btn { pointer-events: none; }
.alert form.filterbar { margin: 8px 0 0; }
.alert form.filterbar input { width: auto; }
.mt { margin-top: 12px; }
.block { display: block; margin-top: 2px; white-space: nowrap; }
.media-header .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.media-header .actions form { margin: 0; }
.cols { margin-bottom: 16px; }
.cols > .panel + .panel, .cols > .panel { margin-top: 0; }
.table td.actions form { display: inline-block; margin-left: 4px; }
.panel + details, details + .panel, .section + details, .panel + .section { margin-top: 16px; }
/* E-Mail-Verwaltung */
.span-2 { grid-column: span 2; }
.grid-2.align-start { align-items: start; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.inline-form .field { margin: 0; flex: 1 1 260px; }
iframe.mail-preview { display: block; width: 100%; height: 460px; border: 0; border-top: 1px solid var(--line); background: #f4f5f7; }
iframe.mail-preview.text { height: 260px; background: var(--surface); }
.page-head .actions .segmented { margin-left: 8px; }
@media (max-width: 640px) {
  .span-2 { grid-column: auto; }
  iframe.mail-preview { height: 380px; }
}

/* ---------- Download (wichtigste Aktion: deutlich, beschriftet, gut bedienbar) ---------- */
.btn-download {
  height: 38px; padding: 0 16px; gap: 8px; font-weight: 600;
  background: var(--accent); border-color: var(--accent); color: var(--on-accent);
}
.btn-download .icon { width: 18px; height: 18px; stroke-width: 2; }
.btn-download:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-download:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: none; }
.btn-download:active { transform: translateY(1px); }
.btn-download.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-download.btn-sm .icon { width: 16px; height: 16px; }
.btn-download.is-ending { background: var(--surface); color: var(--warn); border: 2px solid var(--warn); }
.btn-download.is-ending:hover { background: var(--warn-bg); color: var(--warn); }
.btn-download.is-prerelease { background: var(--surface); color: var(--accent); border: 2px solid var(--accent); }
.btn-download.is-prerelease:hover { background: var(--accent-subtle); color: var(--accent); }
.btn-download:disabled { opacity: 1; background: var(--hover); border-color: var(--line-strong); color: var(--muted); font-weight: 500; }
.table td.actions .btn-download { min-width: 116px; max-width: 170px; height: auto; min-height: 34px; padding: 6px 10px; white-space: normal; line-height: 1.25; text-align: left; justify-content: flex-start; }

/* ---------- Soft-Rollout und Gültigkeit ---------- */
.rollout { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 4px 0; }
.rollout-line { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 8px 14px; }
.rollout-line + .rollout-line { border-top: 1px solid var(--line); }
.rollout-line .icon { margin-top: 2px; }
.rollout-line.tone-ok .icon { color: var(--ok); }
.rollout-line.tone-info .icon { color: var(--info); }
.rollout-line.tone-muted { color: var(--muted); }
.rollout-line.tone-warn { background: var(--warn-bg); }
.rollout-line.tone-warn .icon { color: var(--warn); }
.rollout-line.tone-danger { background: var(--danger-bg); }
.rollout-line.tone-danger .icon { color: var(--danger); }
.validity { display: block; white-space: nowrap; }
.validity + .validity { margin-top: 2px; font-size: 12.5px; }
.validity .icon { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.validity.v-notice { color: var(--ink-2, var(--ink)); }
.validity.v-urgent { color: var(--warn); font-weight: 600; }
.validity.v-final { color: var(--danger); font-weight: 600; }
.validity.v-expired, .validity.v-closed { color: var(--muted); }
.validity.v-prerelease { color: var(--info); font-weight: 600; }

/* ---------- Lizenz: vorläufige Offline-Lizenz und Sperre ---------- */
.license-bar { display: flex; align-items: flex-start; gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--warn-line); background: var(--warn-bg); font-size: 13.5px; }
.license-bar .icon { color: var(--warn); margin-top: 2px; width: 18px; height: 18px; }
.license-bar strong { display: block; font-size: 14px; }
.license-bar .remaining { white-space: nowrap; font-weight: 600; }
.license-bar.urgent { background: var(--danger-bg); border-color: var(--danger-line); }
.license-bar.urgent .icon { color: var(--danger); }
.license-bar a { font-weight: 500; white-space: nowrap; }
.license-bar .bar-text { flex: 1; min-width: 0; }
.locked-page { max-width: 560px; margin: 40px auto; }
.locked-page .icon-lg { width: 32px; height: 32px; color: var(--danger); }
.role-scope { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; margin-top: 8px; }
.perm-group { border: 0; padding: 0; margin: 0 0 16px; }
.perm-group legend { font-weight: 600; margin-bottom: 6px; }
.perm-group .scoped-note { font-weight: 400; color: var(--muted); font-size: 13px; }

@media (max-width: 640px) {
  .btn-download { width: 100%; height: 44px; }
  .media-header .actions { width: 100%; justify-content: flex-start; }
  .media-header .actions, .obligation-box { flex-wrap: wrap; }
  .media-header .actions .btn-download, .obligation-box .btn-download { flex: 1 1 100%; }
  .btn-download.btn-sm { height: 40px; }
  .table.responsive td.actions .btn-download { width: 100%; }
  .license-bar { padding: 10px 16px; flex-wrap: wrap; }
  .validity { white-space: normal; }
}
.w-xs { width: 70px !important; display: inline-block; height: 30px; padding: 0 6px; }
fieldset.field .check input[type="datetime-local"] { width: auto; display: inline-block; height: 30px; margin-left: 6px; }

/* ---------- 1.4: Rückzug, Fristen, Versionswechsel, Favoriten, Pakete, Meldungen ---------- */
.state-warn { color: var(--warn); font-weight: 500; }
.state-danger { color: var(--danger); font-weight: 600; }
.tone-ok { color: var(--ok); }
.tone-info { color: var(--info); }
.tone-warn { color: var(--warn); }
.tone-danger { color: var(--danger); }
.tone-muted { color: var(--muted); }
.ob-status { display: block; font-size: 13px; margin-top: 2px; }
.ob-summary { margin: 0; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.panel-intro { margin: 0; padding: 10px 16px 0; }
.subhead { font-size: 14px; font-weight: 600; margin: 20px 0 4px; }
.validity.v-withdrawn { color: var(--danger); }
.btn.is-fav .icon { fill: currentColor; color: var(--warn); }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); }
.task-list li:first-child { border-top: 0; }
.task-list .task-main { flex: 1 1 auto; min-width: 0; }
.task-list .task-main a.title { font-weight: 600; color: var(--ink); }
.task-list .task-kind { display: block; font-size: 13px; }
.task-list .task-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.task-list li > .icon { margin-top: 2px; flex: 0 0 auto; }
.pick-list { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px 12px; }
.pick-list .check { padding: 6px 0; border-top: 1px solid var(--line); margin: 0; }
.pick-list .check:first-child { border-top: 0; }
.pick-group { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 10px 0 2px; }
.head-form { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.head-form select { width: auto; }
@media (max-width: 640px) {
  .task-list li { flex-wrap: wrap; }
  .task-list .task-actions { width: 100%; }
  .task-list .task-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.field.indent { margin-left: 28px; max-width: 420px; }
@media (max-width: 640px) { .field.indent { margin-left: 0; } }
