/* ScreenHub – Verwaltungsoberfläche */
:root {
  --brand: #1f6feb;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #18202b;
  --muted: #677386;
  --line: #e3e6eb;
  --soft: #f8f9fb;
  --ok: #1a7f4b;
  --ok-bg: #e6f5ec;
  --warn: #9a6200;
  --warn-bg: #fff4dc;
  --err: #b42318;
  --err-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 1.12rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* Layout */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: #111827; color: #cdd3dd; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 650; }
.brand img { max-height: 30px; max-width: 120px; border-radius: 4px; background: #fff; padding: 2px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.brand small { display: block; font-weight: 400; color: #8b95a7; font-size: .75rem; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6b7487; padding: 14px 10px 4px; }
.sidebar a { color: #cdd3dd; padding: 8px 10px; border-radius: 8px; display: flex; align-items: center; gap: 10px; }
.sidebar a:hover { background: #1f2937; text-decoration: none; color: #fff; }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar .spacer { flex: 1; }
.userbox { border-top: 1px solid #1f2937; padding: 12px 10px 0; font-size: .85rem; }
.userbox form { margin-top: 6px; }
.userbox button { background: none; border: 0; color: #9aa4b5; cursor: pointer; padding: 0; font: inherit; }
.userbox button:hover { color: #fff; }
.main { padding: 26px 34px 60px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }

/* Bausteine */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--soft); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: #eef1f5; color: #475467; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: #f1f2f4; color: #8a94a6; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.brand { background: color-mix(in srgb, var(--brand) 14%, white); color: var(--brand); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .8rem; margin-top: 3px; font-weight: 400; }
input[type=text], input[type=password], input[type=email], input[type=url], input[type=number], input[type=date],
input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid #cfd5dd; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { width: 52px; height: 36px; padding: 2px; border: 1px solid #cfd5dd; border-radius: 8px; background: #fff; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 8px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; background: var(--soft); border: 1px solid var(--line); padding: 4px 9px; border-radius: 7px; cursor: pointer; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 6px; margin: 0 0 16px; }
legend { font-weight: 650; padding: 0 6px; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px; border-radius: 8px; border: 1px solid #cfd5dd; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { background: var(--soft); text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(.94); }
.btn.danger { color: var(--err); border-color: #f1c4bf; }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 4px 10px; font-size: .84rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn svg { width: 16px; height: 16px; }
.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #b9e2c9; color: #0f5132; }
.flash.error { background: var(--err-bg); border-color: #f3c2bd; color: #7a1a12; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 4px; }

/* Medien */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.media-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.media-card .thumb { aspect-ratio: 16/10; background: #0f172a center/cover no-repeat; display: grid; place-items: center; color: #94a3b8; font-weight: 700; position: relative; }
.media-card .thumb .kind { position: absolute; left: 8px; top: 8px; }
.media-card .meta { padding: 9px 11px; font-size: .84rem; flex: 1; }
.media-card .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .foot { padding: 0 11px 10px; display: flex; gap: 6px; }
.dropzone { border: 2px dashed #c3cad5; border-radius: var(--radius); padding: 22px; text-align: center; background: var(--soft); transition: .15s; }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, white); }

/* Playlist */
.items { list-style: none; margin: 0; padding: 0; }
.items li { display: grid; grid-template-columns: 26px 72px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fff; }
.items li:last-child { border-bottom: 0; }
.items li.disabled { opacity: .5; }
.items li.dragging { opacity: .4; }
.items .handle { cursor: grab; color: #9aa4b5; user-select: none; text-align: center; font-size: 1.1rem; }
.items .pv { width: 72px; height: 45px; border-radius: 6px; background: #0f172a center/cover; display: grid; place-items: center; color: #fff; font-size: .7rem; font-weight: 700; overflow: hidden; }
.items .info b { display: block; }
.type-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.type-pick a { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; color: var(--ink); font-weight: 600; display: flex; flex-direction: column; gap: 6px; }
.type-pick a:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow); }
.type-pick svg { width: 26px; height: 26px; color: var(--brand); }
.media-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 360px; overflow: auto; padding: 2px; }
.media-pick label { border: 2px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; margin: 0; font-weight: 500; font-size: .78rem; background: #fff; }
.media-pick label:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.media-pick input { position: absolute; opacity: 0; }
.media-pick .thumb { aspect-ratio: 16/10; background: #0f172a center/cover; }
.media-pick span { display: block; padding: 4px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-frame { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: 8px; background: #000; display: block; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }

.alert-box { border-left: 4px solid var(--warn); }
.alert-live { background: var(--warn-bg); border: 1px solid #f5d48a; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent), var(--bg); }
.login { width: 100%; max-width: 390px; }
.login .card { padding: 28px; }
.login h1 { margin-bottom: 2px; }
.login .sso { width: 100%; justify-content: center; margin-bottom: 6px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .sidebar .nav-label, .sidebar .spacer { display: none; }
  .main { padding: 18px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .items li { grid-template-columns: 20px 56px 1fr; }
  .items li > .actions { grid-column: 1 / -1; text-align: left; }
}
details > summary { list-style: none; cursor: pointer; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary { display: block; }
h1 svg, h2 svg, h3 svg { width: 20px; height: 20px; vertical-align: -3px; color: var(--brand); }
summary svg { width: 16px; height: 16px; }
