:root {
  --bg: #f4f6f9; --panel: #fff; --text: #172033; --muted: #66708a; --line: #e2e6ee;
  --side: #0f2a3d; --side-text: #cfe0ea; --accent: #0e7490; --accent-2: #0891b2;
  --danger: #dc2626; --ok: #16a34a; --warn: #d97706; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 18px 0 10px; }
a { color: var(--accent); }
code { background: #eef2f6; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
[hidden] { display: none !important; }

/* Sidebar */
.side { width: 220px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; padding: 18px 16px; display: flex; gap: 8px; align-items: center; color: #fff; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent-2); color: #fff; }
.side nav { display: flex; flex-direction: column; padding: 6px; gap: 2px; }
.side nav button { all: unset; cursor: pointer; padding: 10px 12px; border-radius: 8px; }
.side nav button:hover { background: rgba(255,255,255,.07); }
.side nav button.active { background: rgba(255,255,255,.14); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.side-foot .muted { color: #8fa8b8; }
.side-foot a { color: #9fdcec; }

main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.view-head h1 { margin-right: auto; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h2:first-child { margin-top: 0; }

/* Buttons & Inputs */
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { border-color: #c6cdda; background: #f8fafc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0c6680; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.sm { padding: 3px 8px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #cfd6e2; border-radius: 7px; background: #fff; color: var(--text); min-width: 0; }
input:focus, select:focus { outline: 2px solid #a5e3f0; border-color: var(--accent-2); }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: 13px; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: end; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Übersicht */
.wallrow { display: flex; gap: 12px; align-items: stretch; }
.wallcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wallcard .shot { background: #000; border-radius: 6px; width: 100%; aspect-ratio: var(--ar); object-fit: fill; display: block; }
.wallcard .noshot { background: #0b1220; color: #64748b; border-radius: 6px; aspect-ratio: var(--ar); display: grid; place-items: center; font-size: 12px; }
.wallcard .title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); margin-right: 6px; }
.dot.on { background: var(--ok); }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 99px; background: #e0f2f7; color: #0e5a70; }
.badge.gray { background: #eef1f5; color: var(--muted); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
td input, td select { width: 100%; }

/* Kalender */
#calendar { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.filters { display: flex; gap: 12px; }
.fc .fc-event { cursor: pointer; }
.fc .fc-toolbar-title { font-size: 18px; }

/* Playlists */
.split { display: grid; grid-template-columns: 260px 1fr; gap: 16px; align-items: start; }
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list button { all: unset; display: block; width: 100%; box-sizing: border-box; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list button:hover { background: #f6f8fb; }
.list button.active { background: #e6f5f9; font-weight: 600; }
.list .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.items td.thumb { width: 70px; }
.thumb-sm { width: 64px; height: 36px; object-fit: cover; border-radius: 4px; background: #0b1220; display: grid; place-items: center; color: #9fb3c8; font-size: 11px; }
.items tr.dragging { opacity: .4; }
.items .handle { cursor: grab; color: var(--muted); user-select: none; }

/* Medien */
.upload-row { display: grid; grid-template-columns: 1fr 340px; gap: 16px; margin-bottom: 12px; }
.dropzone { border: 2px dashed #b7c3d4; border-radius: var(--radius); background: #fff; padding: 26px; text-align: center; cursor: pointer; display: block; font-weight: 400; }
.dropzone.over { border-color: var(--accent-2); background: #effafd; }
.dropzone input { display: none; }
.url-form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.upload-item { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: 6px; display: flex; gap: 12px; align-items: center; }
.upload-item .bar { flex: 1; height: 6px; border-radius: 3px; background: #e5e9f0; overflow: hidden; }
.upload-item .bar i { display: block; height: 100%; background: var(--accent-2); width: 0; transition: width .2s; }
.upload-item.err { border-color: #fecaca; color: var(--danger); }
.toolbar { margin: 12px 0; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.mcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.mcard .prev { aspect-ratio: 16/6; background: #0b1220; display: grid; place-items: center; color: #9fb3c8; overflow: hidden; }
.mcard .prev img, .mcard .prev video { width: 100%; height: 100%; object-fit: contain; }
.mcard .body { padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.mcard .name { font-weight: 600; word-break: break-word; }
.mcard .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal-box { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-box h2 { margin-top: 0; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.modal-foot .left { margin-right: auto; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0 0; }
legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 1px solid #cfd6e2; border-radius: 99px; cursor: pointer; font-weight: 400; flex-direction: row; }
.chip:has(input:checked) { background: #e0f4f9; border-color: var(--accent-2); }
.wallpick { display: flex; gap: 4px; margin-top: 8px; }
.wallpick span { height: 26px; border-radius: 4px; background: #e5e9f0; display: grid; place-items: center; font-size: 11px; color: var(--muted); }
.wallpick span.on { background: var(--accent-2); color: #fff; }

#toast { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
#toast div { background: #0f2a3d; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; }
#toast div.err { background: var(--danger); }

/* Login */
body.auth { display: grid; place-items: center; background: linear-gradient(135deg, #0f2a3d, #0e7490); padding: 16px; }
.auth-box { background: #fff; padding: 26px; border-radius: 14px; width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-box .brand { color: var(--text); padding: 0; }
.alert { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; padding: 8px 10px; border-radius: 8px; }

@media (max-width: 900px) {
  body { flex-direction: column; }
  .side { width: auto; height: auto; position: static; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { flex-direction: row; gap: 12px; }
  main { padding: 16px; }
  .wallrow { flex-direction: column; }
  .wallcard { flex: none !important; }
  .split, .upload-row { grid-template-columns: 1fr; }
}
