:root {
  --navy: #262C58; --navy-2: #1b2045; --navy-soft: #E9EBF5; --accent: #3F51B5;
  --bg: #F4F5F9; --card: #fff; --text: #1F2233; --muted: #6B7089; --line: #DDE0EC;
  --ok: #2E7D32; --warn: #B26A00; --err: #C62828; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 15px; }
a { color: var(--accent); }
.hidden { display: none !important; }
h1 { font-size: 24px; margin: 0 0 16px; font-weight: 600; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p.hint, .hint { color: var(--muted); font-size: 13px; }
code { background: var(--navy-soft); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- Login ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-card { background: #fff; padding: 36px 40px; border-radius: 14px; width: 380px; max-width: 92vw; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.brand { font-weight: 700; color: var(--navy); font-size: 22px; letter-spacing: -0.01em; }
.brand sup { font-size: .45em; font-weight: 400; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 54px; display: block; }
.brand-powered { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #B8BDD9; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.25); line-height: 1; }
.brand-powered img { height: 13px; display: block; }
.login-logo { width: 200px; display: block; margin: 0 auto 2px; }
.login-sub { color: var(--muted); margin: 0 0 24px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; }
.login-foot img { height: 12px; vertical-align: -2px; }
.foot-logo { height: 14px; vertical-align: -2px; margin-right: 4px; opacity: .85; }
.login-sub { color: var(--muted); margin: -2px 0 26px; }
.login-card label { display: block; text-align: left; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.login-card input { width: 100%; font-size: 24px; padding: 10px 12px; letter-spacing: .3em; text-align: center; }
.login-foot { margin-top: 26px; color: #999; font-size: 12px; }
.error { color: var(--err); font-size: 13px; min-height: 18px; margin: 8px 0; }

/* ---------- Layout ---------- */
.topbar { display: flex; align-items: center; gap: 22px; padding: 0 22px; height: 66px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar .brand { color: #fff; }
.topbar .brand-product { color: #B8BDD9; }
.topbar .device { color: #B8BDD9; font-size: 13px; border-left: 1px solid rgba(255,255,255,.2); padding-left: 16px; }
.topbar nav { display: flex; gap: 2px; margin-left: 10px; }
.topbar nav a { color: #D5D8EA; text-decoration: none; padding: 8px 14px; border-radius: 6px; font-size: 14px; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 8px; }
.banner { padding: 10px 22px; font-size: 14px; }
.banner.warn { background: #FFF4E0; color: #7A4A00; border-bottom: 1px solid #F3DDB0; }
main { padding: 24px 22px 40px; max-width: 1400px; margin: 0 auto; min-height: calc(100vh - 58px - 70px); }
.foot { display: flex; flex-wrap: wrap; gap: 6px 28px; justify-content: center; padding: 18px 22px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); background: #fff; }
.foot a { color: var(--muted); }

/* ---------- Komponenten ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid .card.span { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 8px 14px; border-radius: 7px; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { background: #F7F8FC; border-color: #C9CDE0; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--err); border-color: #F0C8C8; }
.btn.danger:hover { background: #FFF2F2; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #fff; }
.btn.ghost:hover { background: rgba(255,255,255,.1); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; margin-top: 6px; }
.btn.icon { padding: 5px 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=url], input[type=number], input[type=password], input[type=time], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #B9C2F0; border-color: var(--accent); }
textarea { min-height: 110px; resize: vertical; }
input[type=color] { width: 46px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
input[type=range] { width: 100%; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field .hint { margin-top: 4px; }
.field.inline { display: flex; align-items: center; gap: 10px; }
.field.inline label { margin: 0; color: var(--text); font-size: 14px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fields-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; }
.check input { width: 17px; height: 17px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--navy-soft); color: var(--navy); white-space: nowrap; }
.badge.youtube { background: #FFE4E4; color: #B00020; }
.badge.canva { background: #E2F3FF; color: #0B5FA5; }
.badge.slide { background: #E9EBF5; color: #262C58; }
.badge.image { background: #E6F6EA; color: #1D6B2A; }
.badge.video { background: #F1E6FA; color: #5E2A8A; }
.badge.url { background: #FFF1DB; color: #8A5200; }
.badge.ok { background: #E6F6EA; color: var(--ok); }
.badge.warn { background: #FFF4E0; color: var(--warn); }
.badge.err { background: #FFE4E4; color: var(--err); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
tr:hover td { background: #FAFBFE; }
td.actions { text-align: right; white-space: nowrap; }
.thumb { width: 96px; height: 54px; border-radius: 5px; background: #000 center/cover no-repeat; position: relative; overflow: hidden; border: 1px solid var(--line); flex: none; }
.thumb .sl-root { font-size: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }
.log { background: #111633; color: #CFD4EE; font-family: Consolas, monospace; font-size: 12px; padding: 12px; border-radius: 8px; max-height: 360px; overflow: auto; white-space: pre-wrap; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.preview-16-9 { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.preview-16-9 iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-16-9 img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

/* Playlists */
.pl-layout { display: grid; grid-template-columns: 280px 1fr; gap: 18px; }
.pl-list a { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 7px; text-decoration: none; color: var(--text); }
.pl-list a:hover { background: var(--navy-soft); }
.pl-list a.active { background: var(--navy); color: #fff; }
.pl-list .count { color: var(--muted); font-size: 12px; }
.pl-list a.active .count { color: #C9CDE8; }
.entry { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.entry .name { flex: 1; }
.entry .name small { display: block; color: var(--muted); }
.entry input[type=number] { width: 86px; }
.entry.dragover { border-top: 2px solid var(--accent); }

/* Kalender */
.cal-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.fc { --fc-border-color: var(--line); --fc-today-bg-color: #F5F7FF; font-size: 13px; }
.fc .fc-button-primary { background: var(--navy); border-color: var(--navy); }
.fc .fc-button-primary:not(:disabled):hover { background: var(--navy-2); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--accent); border-color: var(--accent); }
.fc .fc-toolbar-title { font-size: 18px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 10px 0; font-size: 13px; }
.legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; font-size: 14px; }
.days label:has(input:checked) { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,24,50,.55); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 720px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.modal.wide { width: 1000px; }
.modal.narrow { width: 460px; }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); font-size: 17px; font-weight: 600; display: flex; align-items: center; }
.modal-head .close { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; background: none; border: 0; }
.modal-body { padding: 18px 22px; overflow: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.modal-foot .left { margin-right: auto; }
.editor-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .editor-2, .pl-layout, .fields-2, .fields-3 { grid-template-columns: 1fr; } .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; } .topbar .device { display: none; } }

/* Planung */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: 0 0 16px; }
.tabs button { background: none; border: 0; padding: 10px 16px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--navy); font-weight: 600; border-bottom-color: #58C2DE; }
.dayline { display: flex; height: 38px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); position: relative; background: #fff; }
.dayline .seg { display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; border-right: 1px solid rgba(255,255,255,.4); }
.dayline .seg.default { background: #9AA3B8; }
.dayline .seg.off { background: #222; }
.dayline .seg.none { background: #E4E6EF; color: var(--muted); }
.dayline .now { position: absolute; top: 0; bottom: 0; width: 2px; background: #E91E63; box-shadow: 0 0 0 1px #fff; }
.dayscale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; padding: 0 1px; }
.brushes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.brush { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 2px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 14px; background: #fff; user-select: none; }
.brush .sw { width: 14px; height: 14px; border-radius: 4px; background: var(--c); }
.brush.active { border-color: var(--navy); background: var(--navy-soft); font-weight: 600; }
.brush.eraser .sw { background: repeating-linear-gradient(45deg, #ccc 0 3px, #fff 3px 6px); }
.brush.off .sw { background: #222; }
.weekgrid { display: grid; grid-template-columns: 56px repeat(7, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; user-select: none; background: #fff; }
.weekgrid .wg-head { background: var(--navy-soft); color: var(--navy); font-size: 12px; font-weight: 600; text-align: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.weekgrid .wg-hour { font-size: 11px; color: var(--muted); text-align: right; padding: 0 6px; height: 22px; line-height: 22px; border-bottom: 1px solid #F0F1F6; }
.weekgrid .wg-hour.full { border-bottom-color: var(--line); }
.weekgrid .cell { height: 22px; border-left: 1px solid #EEF0F6; border-bottom: 1px solid #F3F4F8; background: var(--c, #fff); cursor: crosshair; position: relative; }
.weekgrid .cell.full { border-bottom-color: var(--line); }
.weekgrid .cell:hover { outline: 2px solid #58C2DE; outline-offset: -2px; z-index: 1; }
.weekgrid .cell.off { background: #222; }
.weekgrid .cell.start::after { content: attr(data-label); position: absolute; left: 4px; top: 2px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); white-space: nowrap; pointer-events: none; }
.rules-list .rule { display: grid; grid-template-columns: 16px 1fr auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.rules-list .rule .sw { width: 14px; height: 14px; border-radius: 4px; background: var(--c); }
.rules-list .rule small { display: block; color: var(--muted); }
details.rules { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin: 4px 0 14px; }
details.rules summary { cursor: pointer; font-size: 14px; color: var(--navy); font-weight: 600; }
details.rules .body { padding-top: 10px; }

/* ---------- Kalender (Google-Kalender-Stil) ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 10px; }
.cal-nav { display: flex; gap: 6px; align-items: center; }
.btn.round { width: 38px; height: 38px; padding: 0; justify-content: center; border-radius: 50%; font-size: 22px; line-height: 1; }
.btn.pill { border-radius: 999px; }
.cal-title { font-size: 19px; font-weight: 600; color: var(--navy); flex: 1; min-width: 150px; }
.cal-right { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.cal-right select { width: auto; padding: 7px 10px; }
.fab { position: fixed; right: 18px; bottom: 22px; width: 56px; height: 56px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 32px; line-height: 1; border: 0; box-shadow: 0 6px 20px rgba(0,0,0,.3); z-index: 30; display: none; cursor: pointer; align-items: center; justify-content: center; }
.mobile-only { display: none; }
.fc .fc-timegrid-event { border-radius: 6px; border: 0; border-left: 4px solid rgba(0,0,0,.28); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.fc .fc-timegrid-event .fc-event-main { padding: 3px 5px; }
.fc .fc-event-time { font-weight: 600; opacity: .9; }
.fc .fc-timegrid-now-indicator-line { border-color: #E91E63; border-width: 2px; }
.fc .fc-timegrid-now-indicator-arrow { border-color: #E91E63; border-top-color: transparent; border-bottom-color: transparent; }
.fc .fc-day-today { background: #F2FAFD !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: #E7EAF0; }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; color: var(--navy); }
.fc .fc-timegrid-slot-label-cushion { color: var(--muted); font-size: 12px; }
.fc .fc-daygrid-day-number { color: var(--navy); }
@media (max-width: 700px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block; }
  .fab { display: flex; }
  .cal-wrap { padding: 4px; }
  .cal-title { font-size: 17px; }
  .fc .fc-timegrid-slot { height: 2.6em; }
  .fc .fc-col-header-cell-cushion { padding: 6px 2px; font-size: 12px; }
  .fc .fc-timegrid-slot-label-cushion, .fc .fc-timegrid-axis-cushion { font-size: 11px; }
  .fc .fc-timegrid-event .fc-event-main { padding: 2px 4px; font-size: 12px; }
  .tabs button[data-tab=week] { display: none; }
}

/* ---------- Responsive ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.weekgrid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px 12px; }
  .topbar .brand { order: 0; }
  .topbar .device { display: none; }
  .topbar #playerSwitch { order: 1; flex: 1; min-width: 120px !important; }
  .topbar-right { order: 2; margin-left: auto; }
  .topbar nav { order: 3; width: 100%; margin: 0; overflow-x: auto; white-space: nowrap; display: flex; gap: 2px; padding-bottom: 2px; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { padding: 7px 11px; font-size: 14px; flex: none; }
  .brand-logo { height: 40px; }
  main { padding: 16px 12px 32px; }
  h1 { font-size: 21px; margin-bottom: 12px; }
  .card { padding: 14px 14px; margin-bottom: 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; font-size: 12px; }
  .foot { flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 12px; }
  .banner { padding: 10px 12px; font-size: 13px; }
  .tabs { overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 10px 12px; flex: none; }
  .weekgrid { min-width: 640px; }
  .weekgrid .cell { height: 20px; }
  .modal-back { padding: 0; align-items: flex-end; }
  .modal { width: 100%; max-width: 100%; max-height: 100vh; border-radius: 14px 14px 0 0; }
  .modal.narrow, .modal.wide { width: 100%; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }
  .entry { flex-wrap: wrap; }
  .entry .name { flex: 1 1 60%; }
  .entry input[type=number] { width: 72px; }
  .pl-list a { padding: 12px 12px; }
  .login-card { padding: 28px 22px; }
  .dayline .seg { font-size: 10px; }
}
@media (max-width: 600px) {
  .brand-powered { display: none; }
  .btn { padding: 8px 12px; }
  .row > .btn, .row > a.btn { flex: 1 1 auto; justify-content: center; }
  .row > .spacer { display: none; }
  .legend { gap: 6px 12px; }
  .days label { padding: 6px 8px; font-size: 13px; }
  /* Tabellen als Karten */
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; width: 100%; }
  body { overflow-x: hidden; }
  .hint, td, dd, .rule small { overflow-wrap: anywhere; }
  table.stack tr { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
  table.stack td { display: block; border: 0; padding: 0; min-width: 0; }
  table.stack td:first-child { grid-row: 1 / span 4; }
  table.stack td.actions { grid-column: 1 / -1; text-align: left; white-space: normal; padding-top: 6px; }
  table.stack td.actions .btn { margin: 0 4px 4px 0; }
  table.stack tr:hover td { background: transparent; }
}

/* Toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1F2233; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.3); animation: toastin .2s ease; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--err); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
