/* EMH Screen – Portal. Farben und Abstände als Variablen, hell und dunkel. */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f2f4f8;
  --surface-3: #e9edf4;
  --border: #e3e7ef;
  --border-strong: #cfd6e3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  /* EMH-IT-Blau und -Gelb aus dem Logo */
  --accent: #0e5394;
  --accent-hover: #0b4277;
  --accent-text: #ffffff;
  --accent-soft: #e8f0f9;
  --accent-ring: rgba(14, 83, 148, 0.25);
  --brand-yellow: #fab600;
  --ok: #0f9f6e;
  --ok-soft: #e3f8ef;
  --warn: #b45309;
  --warn-soft: #fff4e0;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 20px -6px rgba(15, 23, 42, 0.1);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, 0.28);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar: 248px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Dunkel: per Umschalter (data-theme="dark") oder nach Systemeinstellung, sofern nicht "hell" gewählt ist */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e17;
  --surface: #121624;
  --surface-2: #181d2e;
  --surface-3: #20263a;
  --border: #232a3e;
  --border-strong: #303a54;
  --text: #e8ecf6;
  --text-2: #c3cadb;
  --muted: #8a94ad;
  --accent: #5ea3e8;
  --accent-hover: #8cbdf0;
  --accent-text: #08111d;
  --accent-soft: #11263c;
  --accent-ring: rgba(94, 163, 232, 0.35);
  --ok: #34d399;
  --ok-soft: #0f2d23;
  --warn: #fbbf24;
  --warn-soft: #33270b;
  --danger: #f87171;
  --danger-soft: #3a1717;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0e17;
    --surface: #121624;
    --surface-2: #181d2e;
    --surface-3: #20263a;
    --border: #232a3e;
    --border-strong: #303a54;
    --text: #e8ecf6;
    --text-2: #c3cadb;
    --muted: #8a94ad;
    --accent: #5ea3e8;
    --accent-hover: #8cbdf0;
    --accent-text: #08111d;
    --accent-soft: #11263c;
    --accent-ring: rgba(94, 163, 232, 0.35);
    --ok: #34d399;
    --ok-soft: #0f2d23;
    --warn: #fbbf24;
    --warn-soft: #33270b;
    --danger: #f87171;
    --danger-soft: #3a1717;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  }
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: 0.95rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .muted { color: var(--muted); }
code, kbd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 0.85em; }
kbd { background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
[hidden] { display: none !important; }

.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.lg { width: 22px; height: 22px; }
.icon.xl { width: 34px; height: 34px; stroke-width: 1.5; }

/* ---------------------------------------------------------------- Rahmen */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 750; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #ec4899); box-shadow: 0 6px 14px -4px rgba(99, 102, 241, 0.6); }
.brand-mark .icon { width: 17px; height: 17px; stroke-width: 2.2; }
/* EMH-IT-Logo mit Produktname daneben */
.brand-logo { height: 28px; width: auto; display: block; }
.brand-product { font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em; padding-left: 10px; border-left: 2px solid var(--border-strong); line-height: 1.1; }
.brand-product small { display: block; font-size: 0.68rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.login-art .brand-product { border-left-color: rgba(255, 255, 255, 0.35); }
.login-art .brand-product small { color: rgba(255, 255, 255, 0.65); }
.nav-label { padding: 12px 12px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px;
  color: var(--text-2); font-weight: 520; text-decoration: none; transition: background 0.12s, color 0.12s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.nav a .count { margin-left: auto; font-size: 0.72rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); }
.nav a .count.warn { color: var(--warn); background: var(--warn-soft); }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.8rem; }
.user-chip .who { min-width: 0; line-height: 1.3; }
.user-chip .who strong, .user-chip .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { color: var(--muted); font-size: 0.8rem; }
.segmented.theme-switch { display: flex; margin: 0 0 10px; }
.theme-switch button { flex: 1 1 0; min-width: 0; justify-content: center; padding: 0 4px; gap: 4px; font-size: 0.78rem; }
.theme-switch .icon { width: 15px; height: 15px; }

.main { min-width: 0; padding: 28px clamp(16px, 3.2vw, 44px) 80px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .sub { margin-top: 4px; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; color: var(--muted); font-weight: 500; }
.crumb:hover { color: var(--text); text-decoration: none; }

.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .shell.menu-open .sidebar { display: flex; position: fixed; inset: 0 auto 0 0; width: 272px; z-index: 40; box-shadow: var(--shadow-lg); }
  .shell.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 11, 20, 0.45); z-index: 30; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
  .topbar .brand { padding: 0; }
  .main { padding-top: 20px; }
}

/* ---------------------------------------------------------------- Bausteine */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.cols-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.kpi { padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.kpi .kpi-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.kpi .kpi-icon.ok { background: var(--ok-soft); color: var(--ok); }
.kpi .kpi-icon.warn { background: var(--warn-soft); color: var(--warn); }
.kpi .label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.kpi .value { font-size: 1.55rem; font-weight: 720; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi .value small { font-size: 0.95rem; font-weight: 500; }
.kpi .hint { color: var(--muted); font-size: 0.8rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 560; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 4px 12px -4px var(--accent-ring); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 0.85rem; border-radius: 8px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn.danger-text { color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 0.75rem; font-weight: 620; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; } }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 220px; flex: 0 1 320px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; gap: 2px; }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-weight: 560; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button .n { font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 620; white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tbody tr { transition: background 0.1s; }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
tfoot td { font-weight: 650; background: var(--surface-2); }

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty h3 { color: var(--text); font-size: 1.05rem; }
.empty p { max-width: 420px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s; }
.meter.warn > i { background: var(--warn); }
.meter.danger > i { background: var(--danger); }

/* ---------------------------------------------------------------- Formulare */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 0.85rem; color: var(--text-2); }
.field small { font-size: 0.8rem; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 0 12px; height: 38px; width: 100%; transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { padding: 10px 12px; height: auto; resize: vertical; line-height: 1.45; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; padding: 0; flex: none; accent-color: var(--accent); }
input[type="color"] { padding: 3px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-error { color: var(--danger); margin: 0 0 10px; font-weight: 550; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 150px; }
.inline-select { width: auto; height: 32px; max-width: 100%; padding: 0 8px; }
.inline-input { height: 30px; width: 70px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.title-input { height: 44px; max-width: 420px; font-size: 1.35rem; font-weight: 700; border-color: transparent; background: transparent; padding: 0 10px; margin-left: -10px; }
.title-input:hover { border-color: var(--border); }

/* ---------------------------------------------------------------- Dialoge, Menüs, Meldungen */
dialog { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); padding: 24px; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); }
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog.xwide { width: min(1100px, calc(100vw - 32px)); }
dialog[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
dialog::backdrop { background: rgba(8, 11, 20, 0.5); backdrop-filter: blur(2px); }
dialog h2 { margin-bottom: 16px; font-size: 1.15rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.menu { position: fixed; z-index: 90; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); animation: pop 0.12s ease-out; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 36px); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); font-weight: 550; animation: pop 0.18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }

/* Drag & Drop */
.drop-overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; pointer-events: none;
  background: color-mix(in srgb, var(--accent) 12%, transparent); border: 3px dashed var(--accent); border-radius: 18px; margin: 10px;
}
.drop-overlay div { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 34px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); font-weight: 650; }
.drag-ghost { opacity: 0.4; }
.drop-line { height: 3px; border-radius: 3px; background: var(--accent); margin: -2px 0; box-shadow: 0 0 0 3px var(--accent-ring); }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 3px; background: var(--accent-soft) !important; }
[draggable="true"] { -webkit-user-drag: element; }

/* ---------------------------------------------------------------- Anmeldung */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: radial-gradient(circle at 18% 22%, rgba(30, 110, 190, 0.95), transparent 55%), radial-gradient(circle at 85% 80%, rgba(250, 182, 0, 0.55), transparent 45%), #06182b; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: 2.4rem; max-width: 460px; line-height: 1.12; }
.login-art p { opacity: 0.8; max-width: 420px; margin-top: 14px; font-size: 1.05rem; }
.login-form { display: grid; place-items: center; padding: 24px; }
.login-form form { width: min(380px, 100%); }
.login-form h2 { font-size: 1.5rem; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); margin-bottom: 24px; }
.login-form > div { width: min(380px, 100%); }
.login-links { margin: 16px 0 0; text-align: center; font-size: 0.9rem; }

/* Zwei-Faktor-Anmeldung */
.code-input { font-size: 1.4rem !important; letter-spacing: 0.25em; text-align: center; font-variant-numeric: tabular-nums; max-width: 240px; }
.login-form .code-input { max-width: none; }
.mfa-forced { width: min(460px, 100%); }
.mfa-steps { margin: 0 0 14px; padding-left: 20px; display: grid; gap: 14px; line-height: 1.45; }
.mfa-qr { margin: 10px 0 6px; display: inline-block; padding: 8px; background: #fff; border-radius: 12px; border: 1px solid var(--border); }
.mfa-qr img { display: block; width: 200px; height: 200px; }
.mfa-secret { display: inline-block; padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 1rem; letter-spacing: 0.08em; overflow-wrap: anywhere; }
.mfa-state { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border); }
.mfa-state .icon { width: 26px; height: 26px; flex: none; }
.mfa-state.on { background: color-mix(in srgb, var(--ok, #16a34a) 10%, transparent); }
.mfa-state.on .icon { color: var(--ok, #16a34a); }
.mfa-state.off .icon { color: var(--warn, #d97706); }
.backup-code-list { columns: 2; column-gap: 24px; margin: 12px 0; padding-left: 24px; font-size: 1.05rem; }
.backup-code-list li { margin: 4px 0; break-inside: avoid; }
.backup-code-list code { letter-spacing: 0.06em; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } }

/* Plattform-Administrator im Konto eines Kunden */
.impersonation-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -28px calc(-1 * clamp(16px, 3.2vw, 44px)) 22px; padding: 10px clamp(16px, 3.2vw, 44px); background: var(--brand-yellow, #fab600); color: #1f1600; font-weight: 550; }
.impersonation-bar .btn { margin-left: auto; background: rgba(255, 255, 255, 0.85); border-color: transparent; color: #1f1600; }
.shell.impersonating .sidebar { box-shadow: inset 4px 0 0 #fab600; }
@media (max-width: 900px) { .impersonation-bar { margin-top: -20px; } }

/* ---------------------------------------------------------------- Screen-Detail */
.screen-face.clickable { cursor: pointer; }
.screen-face .badge.live-badge { left: auto; right: 10px; background: rgba(220, 38, 38, 0.9); color: #fff; }
.screen-face .live-badge .icon { width: 12px; height: 12px; }
.screen-name { color: inherit; display: block; }
.screen-name:hover { text-decoration: none; }
.screen-name:hover strong { color: var(--accent); }
.screen-detail { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .screen-detail { grid-template-columns: minmax(0, 1fr); } }
.live-frame { background: #05070d; border-radius: 12px; padding: 10px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.live-frame.portrait { max-width: 360px; margin: 0 auto; }
.live-shot { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 6px; background: #000; }
.live-frame.portrait .live-shot { aspect-ratio: 9 / 16; }
.live-shot.empty { display: grid; place-content: center; justify-items: center; gap: 8px; color: rgba(255, 255, 255, 0.7); text-align: center; padding: 20px; }
.live-shot.empty small { color: rgba(255, 255, 255, 0.5); max-width: 380px; }
.now-playing { display: flex; align-items: center; gap: 14px; }
.now-playing strong { display: block; font-size: 1.05rem; }
.now-playing span { color: var(--muted); font-size: 0.85rem; }
.now-playing .tl-thumb { width: 96px; height: 54px; }
.run-list { list-style: none; margin: 0; padding: 0 0 8px; }
.run-list li { display: flex; align-items: center; gap: 12px; padding: 8px 20px; border-top: 1px solid var(--border); }
.run-list li strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-list li .muted { font-size: 0.8rem; }
.run-list li.current { background: var(--ok-soft); }
.run-list li.hidden-item { opacity: 0.5; }
.run-no { width: 20px; text-align: right; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Zoom für Webseiten */
.zoom-control { display: flex; flex-direction: column; gap: 8px; }
.zoom-value { min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.zoom-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.zoom-presets .btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.web-preview { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #0d1020; border: 1px solid var(--border); margin-bottom: 4px; }
.web-preview iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: #fff; pointer-events: none; }
.web-preview-empty { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.6); font-size: 0.85rem; text-align: center; padding: 12px; }

/* ---------------------------------------------------------------- Testkunden */
.trial-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px; margin-bottom: 18px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.trial-banner > .icon { color: var(--accent); }
.trial-banner strong { display: block; }
.trial-banner span { color: var(--text-2); font-size: 0.9rem; }
.trial-banner.expired { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.trial-banner.expired > .icon { color: var(--danger); }

/* ---------------------------------------------------------------- Mitarbeiter */
.perm-list { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); margin-bottom: 8px; }
.perm { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.perm input { margin-top: 2px; }
.perm strong { display: block; font-size: 0.9rem; }
.perm small { display: block; font-size: 0.8rem; line-height: 1.35; }
.perm:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.perm-full { margin-bottom: 8px; }
.perm-list.is-full .perm { opacity: 0.6; cursor: default; }

/* ---------------------------------------------------------------- Systemstatus */
.status-banner { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin-bottom: 18px; border-radius: var(--radius); border: 1px solid var(--border); }
.status-banner strong { display: block; font-size: 1.05rem; }
.status-banner span { color: var(--text-2); }
.status-banner.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.status-banner.ok > .icon { color: var(--ok); }
.status-banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.status-banner.warn > .icon { color: var(--warn); }
.status-banner.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.status-banner.error > .icon { color: var(--danger); }
.issue-list { list-style: none; margin: 0; padding: 6px 0; }
.issue-list li { display: flex; align-items: center; gap: 10px; padding: 8px 18px; }
.issue-list li + li { border-top: 1px solid var(--border); }
.status-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
/* Changelog */
.changelog { display: grid; gap: 16px; max-width: 900px; }
.changelog-release { padding: 18px 22px; }
.changelog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.changelog-head h2 { margin: 0 0 4px; font-size: 1.1rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.changelog-version { color: var(--accent); font-variant-numeric: tabular-nums; }
.changelog-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.changelog-items li { display: grid; grid-template-columns: 118px 1fr; gap: 10px; align-items: baseline; line-height: 1.45; }
.changelog-items .badge { justify-self: start; }
@media (max-width: 640px) { .changelog-items li { grid-template-columns: 1fr; gap: 2px; } }
/* Admin-Log */
.log-details { margin-top: 4px; font-size: 0.8rem; }
.log-details summary { cursor: pointer; color: var(--muted); }
.settings-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.stat-list { display: flex; flex-direction: column; gap: 2px; }
.stat-row { display: grid; grid-template-columns: minmax(130px, 40%) 1fr; gap: 4px 14px; padding: 7px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.stat-row:last-child { border-bottom: 0; }
.stat-row > :nth-child(3) { grid-column: 2; }
.stat-meter { display: flex; flex-direction: column; gap: 4px; max-width: 320px; }
.net { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.net .icon { width: 15px; height: 15px; color: var(--muted); }
.net .bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.net .bars i { width: 4px; border-radius: 1px; background: var(--surface-3); }
.net .bars i:nth-child(1) { height: 25%; } .net .bars i:nth-child(2) { height: 50%; } .net .bars i:nth-child(3) { height: 75%; } .net .bars i:nth-child(4) { height: 100%; }
.net .bars i.on { background: var(--ok); }
.net.weak .bars i.on { background: var(--warn); }
.warn-text { color: var(--warn); font-weight: 650; }

/* ---------------------------------------------------------------- Übersicht */
.ok-text { color: var(--ok); font-weight: 600; }
.live-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); color: var(--text); }
.live-banner strong { color: var(--danger); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: none; animation: live 1.4s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 18%, transparent); } }
.onboarding { margin-bottom: 18px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.steps li { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding: 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); }
.steps li strong { display: block; }
.steps li .muted { font-size: 0.82rem; }
.steps li.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.steps li.done { opacity: 0.6; }
.steps li.done strong { text-decoration: line-through; }
.step-no { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; background: var(--surface-2); color: var(--muted); }
.steps li.current .step-no { background: var(--accent); color: var(--accent-text); }
.steps li.done .step-no { background: var(--ok-soft); color: var(--ok); }
.steps li.done .step-no .icon { width: 14px; height: 14px; stroke-width: 3; }
.steps li .btn { margin-left: 38px; }
.cols-2 { align-items: start; }

/* ---------------------------------------------------------------- Screens */
.screen-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.screen-card { display: flex; flex-direction: column; overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; }
.screen-card:hover { box-shadow: var(--shadow); }
.screen-face { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1e2235, #0d1020); display: grid; place-items: center; color: rgba(255, 255, 255, 0.55); }
.screen-face.portrait .screen-shape { aspect-ratio: 9 / 16; height: 76%; width: auto; }
.screen-shape { width: 62%; aspect-ratio: 16 / 9; border-radius: 6px; border: 2px solid rgba(255, 255, 255, 0.25); display: grid; place-items: center; font-size: 0.8rem; text-align: center; padding: 6px; overflow: hidden; }
.screen-shape.has-preview { position: relative; padding: 0; border-color: rgba(255, 255, 255, 0.35); box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6); }
.screen-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.screen-caption { position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; max-width: 100%; color: #fff; font-weight: 600; font-size: 0.78rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.has-preview .screen-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 6px; justify-content: center; background: linear-gradient(transparent, rgba(0, 0, 0, 0.75)); }
.screen-caption .icon { width: 14px; height: 14px; }
.screen-card.is-offline .screen-shape { filter: grayscale(0.7) brightness(0.8); }
.screen-edit { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: rgba(15, 18, 32, 0.75); color: #fff; font-size: 0.75rem; font-weight: 600; opacity: 0; transition: opacity 0.15s; backdrop-filter: blur(4px); }
.screen-edit:hover { text-decoration: none; background: rgba(15, 18, 32, 0.9); }
.screen-edit .icon { width: 13px; height: 13px; }
.screen-card:hover .screen-edit, .screen-edit:focus-visible { opacity: 1; }
@media (hover: none) { .screen-edit { opacity: 1; } }
.screen-face .badge { position: absolute; top: 10px; left: 10px; background: rgba(15, 18, 32, 0.75); color: #fff; backdrop-filter: blur(4px); }
.screen-face .badge.ok { background: rgba(15, 159, 110, 0.9); }
.screen-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.screen-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.screen-title strong { font-size: 1rem; display: block; }
.screen-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 0.8rem; }
.screen-meta span { display: inline-flex; align-items: center; gap: 5px; }
.screen-meta .icon { width: 14px; height: 14px; }
.screen-meta .group-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); text-decoration: none; }
.screen-meta .group-chip:hover { background: var(--accent-soft, var(--surface-2)); color: var(--accent); }
/* Leiste einer gewählten Screen-Gruppe: Playlist für alle, neu laden, bearbeiten */
.group-bar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 16px; }
.group-bar-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-bar-field { display: flex; align-items: center; gap: 8px; }
.group-bar-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
@media (max-width: 640px) { .group-bar-actions { margin-left: 0; } }
.playlist-strip { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; padding: 10px 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: 0.85rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 560; cursor: grab; user-select: none; }
.chip:active { cursor: grabbing; }
.chip .icon { width: 14px; height: 14px; color: var(--accent); }

/* ---------------------------------------------------------------- Medien */
.media-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.media-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); transition: box-shadow 0.15s, border-color 0.15s; cursor: pointer; }
.media-card:hover { box-shadow: var(--shadow); }
.media-card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.media-card .thumb { position: relative; aspect-ratio: 16 / 10; background: #0d1020; display: grid; place-items: center; overflow: hidden; }
.media-card .thumb img, .media-card .thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-card .kind-tag { position: absolute; bottom: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; background: rgba(10, 12, 22, 0.7); color: #fff; font-size: 0.72rem; font-weight: 600; }
.media-card .kind-tag .icon { width: 12px; height: 12px; }
.media-card .select-box { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 7px; border: 2px solid #fff; background: rgba(10, 12, 22, 0.35); display: grid; place-items: center; opacity: 0; transition: opacity 0.12s; }
.media-card:hover .select-box, .media-card.selected .select-box, .selecting .media-card .select-box { opacity: 1; }
.media-card.selected .select-box { background: var(--accent); border-color: var(--accent); }
.media-card .select-box .icon { width: 13px; height: 13px; color: #fff; stroke-width: 3; }
.media-card .meta { padding: 10px 12px; min-width: 0; }
.media-card .meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
.media-card .meta span { color: var(--muted); font-size: 0.78rem; }
.media-card .uses { position: absolute; top: 8px; right: 8px; }
.folder-card .thumb { background: var(--accent-soft); color: var(--accent); }
.folder-card .thumb .icon { width: 54px; height: 54px; stroke-width: 1.3; }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; font-weight: 600; }
.crumbs button { border: 1px solid transparent; background: none; color: var(--muted); font: inherit; padding: 4px 8px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.crumbs button:hover { color: var(--text); background: var(--surface-2); }
.crumbs button.current { color: var(--text); cursor: default; }
.crumbs .sep { color: var(--muted); }
.section-label { margin: 6px 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
.folder-tree { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.folder-tree label { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.folder-tree label:hover { background: var(--surface-2); }
.folder-tree label:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.selection-bar { position: sticky; bottom: 16px; z-index: 10; margin: 18px auto 0; width: fit-content; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--text); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 600; }
.upload-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.upload-item { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 14px; }
.upload-item .meter { grid-column: 1 / -1; height: 6px; }
.lightbox-media { width: 100%; max-height: 60vh; object-fit: contain; background: #0d1020; border-radius: 10px; display: block; }

/* ---------------------------------------------------------------- Playlists */
.playlist-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.playlist-card { overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.playlist-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.playlist-card .mosaic { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; aspect-ratio: 16 / 6; background: var(--surface-3); }
.playlist-card .mosaic > div { background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.playlist-card .body { padding: 14px 16px; display: flex; justify-content: space-between; gap: 10px; align-items: center; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (min-width: 1700px) { .editor { grid-template-columns: minmax(0, 1fr) 420px; } .lib-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1100px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .library { position: static; max-height: none; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .lib-media .add { opacity: 1; }
}
.editor-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 0; margin: -12px 0 10px; background: var(--bg); }
.editor-bar .grow { flex: 1; }
.editor-title { display: flex; flex-direction: column; min-width: 0; flex: 0 1 460px; }
.editor-bar .title-input { width: 100%; max-width: none; height: 40px; }
.editor-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); }
.editor-meta .badge { border: 0; cursor: default; font: inherit; font-size: 0.75rem; font-weight: 620; }
.editor-meta button.badge { cursor: pointer; }
.spinner { width: 11px; height: 11px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.editor-bar .status { color: var(--muted); font-size: 0.85rem; display: inline-flex; align-items: center; gap: 6px; }
.timeline { display: flex; flex-direction: column; gap: 8px; min-height: 160px; padding: 10px; border-radius: var(--radius); border: 1px dashed transparent; transition: border-color 0.12s, background 0.12s; }
.timeline.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.tl-item { display: grid; grid-template-columns: 22px 64px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); transition: box-shadow 0.12s, border-color 0.12s; }
.tl-item:hover { border-color: var(--border-strong); }
.tl-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tl-item.inactive { opacity: 0.55; }
.tl-item.hidden-item { border-style: dashed; background: var(--surface-2); }
.tl-item.hidden-item .tl-thumb { filter: grayscale(1); }.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; height: 100%; }
.grip:active { cursor: grabbing; }
.tl-thumb { width: 64px; height: 40px; border-radius: 7px; overflow: hidden; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.tl-thumb img, .tl-thumb video { width: 100%; height: 100%; object-fit: cover; }
.tl-main { min-width: 0; cursor: pointer; }
.tl-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-main span { color: var(--muted); font-size: 0.8rem; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl-tools { display: flex; align-items: center; gap: 6px; }
.tl-index { font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.library { position: sticky; top: 70px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; overflow: hidden; }
.library .tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--border); }
.library .tabs button { flex: 1; padding: 9px 6px; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.library .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.library .lib-body { overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lib-media { position: relative; border-radius: 9px; overflow: hidden; aspect-ratio: 16 / 10; background: #0d1020; cursor: grab; border: 1px solid var(--border); }
.lib-media img, .lib-media video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.lib-media .add { position: absolute; right: 5px; bottom: 5px; opacity: 0; transition: opacity 0.12s; }
.lib-media:hover .add { opacity: 1; }
.lib-media .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 6px 4px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #fff; font-size: 0.7rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); cursor: grab; transition: border-color 0.12s, background 0.12s; }
.template:hover { border-color: var(--accent); background: var(--accent-soft); }
.template .t-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.template strong { display: block; }
.template span { color: var(--muted); font-size: 0.8rem; }
.hint-box { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 0.82rem; }

/* Folien-Editor */
.slide-editor { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; margin-bottom: 14px; }
@media (max-width: 900px) { .slide-editor { grid-template-columns: 1fr; } }
.slide-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
/* Anleitung „Raspberry Pi“ */
.guide { display: grid; gap: 10px; line-height: 1.5; }
.guide p { margin: 0; }
.guide ol, .guide ul { margin: 0; padding-left: 22px; display: grid; gap: 5px; }
.guide pre { margin: 6px 0; padding: 8px 10px; background: var(--surface-2); border-radius: 8px; font-size: 0.8rem; overflow-x: auto; }
.guide summary { cursor: pointer; font-weight: 600; }
.guide-table { overflow-x: auto; }
.guide-table table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.guide-table th, .guide-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.guide-table th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.guide-table td:first-child { white-space: nowrap; font-weight: 550; }
@media (max-width: 640px) { .guide-table td:first-child { white-space: normal; } }

/* Layout-Editor: Bereiche frei anordnen */
.layout-editor { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .layout-editor { grid-template-columns: minmax(0, 1fr); } }
.layout-stage { display: grid; place-items: center; background: var(--surface-3); border-radius: 12px; padding: 10px; }
.layout-canvas { position: relative; aspect-ratio: 16 / 9; width: 100%; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); user-select: none; touch-action: none; outline: none; }
.layout-canvas.portrait { aspect-ratio: 9 / 16; width: auto; height: min(62vh, 560px); }
.layout-canvas:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.layout-zone { position: absolute; box-sizing: border-box; background: color-mix(in srgb, var(--accent) 22%, #1e293b); border: 1px solid rgba(255, 255, 255, .35); color: #fff; cursor: move; }
.layout-zone.with-gap { border: 4px solid transparent; background-clip: padding-box; border-radius: 10px; }
.layout-zone.is-selected { outline: 2px solid var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 45%, #1e293b); }
.layout-zone-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .75rem; font-weight: 600; text-align: center; overflow: hidden; padding: 4px; pointer-events: none; }
.layout-zone-label small { font-weight: 500; opacity: .75; }
.layout-handle { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--accent); border-radius: 3px; z-index: 2; }
.layout-handle.h-n, .layout-handle.h-s { left: calc(50% - 6px); cursor: ns-resize; }
.layout-handle.h-e, .layout-handle.h-w { top: calc(50% - 6px); cursor: ew-resize; }
.layout-handle.h-n, .layout-handle.h-ne, .layout-handle.h-nw { top: -2px; }
.layout-handle.h-s, .layout-handle.h-se, .layout-handle.h-sw { bottom: -2px; }
.layout-handle.h-e, .layout-handle.h-ne, .layout-handle.h-se { right: -2px; }
.layout-handle.h-w, .layout-handle.h-nw, .layout-handle.h-sw { left: -2px; }
.layout-handle.h-ne, .layout-handle.h-sw { cursor: nesw-resize; }
.layout-handle.h-nw, .layout-handle.h-se { cursor: nwse-resize; }
.layout-geom { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, var(--surface)); }
.layout-geom:empty { display: none; }
.layout-geom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.layout-geom-row input { width: 100%; }
.zone-no { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff; font-size: .72rem; font-weight: 700; }
.zone-card.is-selected { outline: 2px solid var(--accent); }
.layout-preset { padding: 8px; cursor: pointer; text-align: center; font: inherit; color: inherit; }
.layout-preset:hover { outline: 2px solid var(--accent); }
.layout-preset-mini { position: relative; height: 44px; aspect-ratio: 16 / 9; margin: 0 auto; }
.layout-preset-mini div { position: absolute; box-sizing: border-box; border: 1px solid var(--surface); background: var(--accent); border-radius: 2px; }
.slide-stage { position: relative; }
.slide-canvas { position: relative; aspect-ratio: 16 / 9; width: 100%; container-type: size; overflow: hidden; border-radius: 10px; box-shadow: var(--shadow); user-select: none; touch-action: none; outline: none; }
.slide-canvas:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.slide-sel { position: absolute; outline: 2px solid var(--accent); cursor: move; z-index: 5; }
.slide-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--accent); border-radius: 4px; cursor: nwse-resize; }
.slide-guide { position: absolute; background: #ec4899; pointer-events: none; z-index: 6; }
.slide-props { display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow: auto; padding-right: 4px; }
.slide-props .field { margin-bottom: 10px; }
.slide-props .row > * { flex: 1 1 60px; }
.slide-thumb { position: relative; width: 100%; height: 100%; container-type: size; overflow: hidden; }
.preview-frame { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; display: block; }

/* ---------------------------------------------------------------- Handy */
@media (max-width: 600px) {
  h1 { font-size: 1.4rem; }
  .page-head { margin-bottom: 16px; }
  .page-head .actions, .page-head .actions .btn { flex: 1 1 auto; }
  .search { min-width: 0; flex: 1 1 100%; }
  .card-head { padding: 14px 16px; }
  .card-pad { padding: 14px 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; gap: 10px; }
  .kpi .kpi-icon { width: 34px; height: 34px; }
  .kpi .value { font-size: 1.25rem; }
  .screen-grid, .playlist-grid { grid-template-columns: minmax(0, 1fr); }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .media-card .select-box { opacity: 1; }
  /* Zeitleiste: Werkzeuge in eine zweite Zeile, damit der Titel lesbar bleibt */
  .tl-item { grid-template-columns: 18px 52px minmax(0, 1fr); gap: 6px 10px; padding: 10px; }
  .tl-thumb { width: 52px; height: 34px; }
  .tl-tools { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 6px; }
  .editor-bar .grow { flex-basis: 100%; }
  .title-input { font-size: 1.15rem; }
  dialog { padding: 18px 16px; width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  dialog.wide, dialog.xwide { width: calc(100vw - 16px); }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .btn { flex: 1 1 auto; }
  .selection-bar { flex-wrap: wrap; justify-content: center; width: auto; }
  th, td { padding: 10px 12px; }
}

.weekday-row { display: flex; gap: 6px; flex-wrap: wrap; }
.weekday-row label { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 99px; cursor: pointer; font-weight: 560; font-size: 0.85rem; }
.weekday-row label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.weekday-row input { display: none; }
.section-title { margin: 6px 0 10px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 650; }
