:root {
    --bg: #f6f3ee; --card: #ffffff; --ink: #24211c; --muted: #7a736a; --line: #e6dfd4;
    --accent: #a8865a; --accent-ink: #ffffff; --accent-soft: #f1e8db; --ok: #3f7a52; --warn: #b5612f; --danger: #a8423c;
    --radius: 14px; --shadow: 0 1px 2px rgba(40,30,20,.06), 0 8px 24px rgba(40,30,20,.05);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;   /* nur Systemschriften */
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; }
h1, h2, h3 { font-weight: 600; margin: 0; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

.brand-mark { width: 5px; height: 38px; border-radius: 3px; background: linear-gradient(180deg, var(--accent), rgba(168,134,90,.2)); }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 34px 30px; display: grid; gap: 14px; }
.login-card h1 { font-size: 26px; font-weight: 400; }
.login-card .brand-mark { height: 30px; }

/* Kopf */
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px max(16px, 3vw); background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-left { display: flex; align-items: center; gap: 14px; }
.top-title { font-size: 19px; font-weight: 600; }
.top-right { display: flex; gap: 10px; align-items: center; }
.tabs { display: flex; gap: 4px; padding: 10px max(16px, 3vw) 0; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 14px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1100px; margin: 0 auto; padding: 24px max(16px, 3vw) 60px; display: grid; gap: 20px; }

/* Bausteine */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: grid; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, textarea, select { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox] { width: auto; }
input[type=range] { padding: 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }

.btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.warn { color: var(--warn); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: #7a5c34; }
.pill.ok { background: #e3efe6; color: var(--ok); }
.pill.off { background: #eee9e2; color: var(--muted); }
.pill.warn { background: #f7e6db; color: var(--warn); }

/* Laufband */
.now { border-left: 4px solid var(--accent); }
.marquee { position: relative; overflow: hidden; background: #1c1a17; color: #f1e9dc; border-radius: 10px; height: 44px; display: flex; align-items: center; }
.marquee span { position: absolute; white-space: nowrap; padding-left: 100%; animation: mq 18s linear infinite; font-size: 17px; letter-spacing: .01em; }
@keyframes mq { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.qitem { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.qitem:first-child { border-top: 0; }
.qitem .text { min-width: 0; overflow-wrap: anywhere; }
.qitem .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.qitem .row { justify-content: flex-end; }
@media (max-width: 720px) { .qitem { grid-template-columns: 1fr; } .qitem .row { justify-content: flex-start; } }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details[open] summary { margin-bottom: 10px; }

/* Listen-Editor */
.ed-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.ed-item.inactive { opacity: .55; }
.ed-tools { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* Bilder */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.img-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: grid; }
.img-prev { aspect-ratio: 16/9; background: #efe9e0 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; max-width: 100%; }
.img-body { padding: 10px 12px 12px; display: grid; gap: 8px; }
.img-body .name { font-weight: 600; }

/* Tabellen */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
td input { padding: 6px 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9c2b8; margin-right: 6px; }
.dot.on { background: var(--ok); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2b2722; color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); z-index: 20; max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); }

/* Vorschau wie am TV */
.tv-prev { position: relative; aspect-ratio: 16/9; max-width: 100%; background: #16171a center/cover no-repeat; overflow: hidden; }
.tv-shade { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: linear-gradient(180deg, rgba(12,12,14,.86), rgba(12,12,14,.74) 35%, rgba(12,12,14,.8) 70%, rgba(12,12,14,.92)); }
.tv-title { position: absolute; left: 7%; top: 8%; color: #eeeae3; font-size: 15px; font-weight: 300; letter-spacing: .02em; }
.tv-empty { position: absolute; left: 0; right: 0; top: 45%; text-align: center; color: #8e8a83; font-size: 12px; }
.tv-now { position: absolute; right: 8px; top: 8px; }

.menu-box { align-items: center; gap: 8px; flex-wrap: wrap; }
.menu-box b { margin-right: 4px; }
tr.inactive td { opacity: .5; }

/* TV-Vorschau (echte TV-Ansicht verkleinert) */
.tvp-wrap { display: grid; gap: 8px; }
.tvp-head { justify-content: space-between; align-items: center; }
.tvp { position: relative; width: 100%; max-width: 900px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #0e0d0c; box-shadow: 0 0 0 6px #24211c; }
.tvp iframe { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; border: 0; transform-origin: 0 0; pointer-events: none; }
/* Laufband-Vorschau im TV-Stil */
.tv-banner { display: flex; align-items: stretch; background: #141311; border-radius: 10px; overflow: hidden; height: 48px; margin: 8px 0; max-width: 900px; }
.tv-banner-label { flex: 0 0 auto; display: flex; align-items: center; padding: 0 16px; font-size: 12px; letter-spacing: .18em; color: #c9a676; background: #1d1b18; }
.tv-banner-win { position: relative; flex: 1; overflow: hidden; }
.tv-banner-win span { position: absolute; top: 50%; white-space: nowrap; padding-left: 100%; color: #f1e9dc; font-size: 18px; transform: translateY(-50%); animation: tvmq 16s linear infinite; }
@keyframes tvmq { from { transform: translate(0, -50%); } to { transform: translate(-100%, -50%); } }
.nm-sum { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin: 6px 0 10px; }
.howto { background: #faf7f2; border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; margin-bottom: 10px; }
.howto summary { cursor: pointer; font-weight: 600; }
.howto ul { margin: 8px 0 4px 18px; padding: 0; }
.tr-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
label.check input[type="datetime-local"] { margin-left: 6px; }
/* Fotos: Ordner */
.folders { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.folder { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; font: inherit; }
.folder.on { background: var(--accent-soft); border-color: var(--accent); }
.drop { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; border: 2px dashed var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
label.opt { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; font-weight: 400; margin: 6px 0; color: var(--ink); }
label.opt input[type="radio"], label.opt input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; }
label.opt input[type="datetime-local"], label.opt input[type="time"] { width: auto; }
.sim-row { align-items: flex-end; flex-wrap: wrap; gap: 12px; }
.sim-row label { min-width: 170px; }
.sim-tvp { max-width: 1200px; margin-top: 12px; }
/* Bilder: Ordnerbaum + Dateien */
.img-browser { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .img-browser { grid-template-columns: 1fr; } }
.tree { border-right: 1px solid var(--line); padding-right: 14px; min-width: 0; }
.tree-list { display: flex; flex-direction: column; max-height: 70vh; overflow: auto; }
.tree-item { text-align: left; border: 0; background: none; font: inherit; padding: 6px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item.top { font-weight: 600; margin-top: 6px; }
.tree-item:hover { background: #f4efe7; }
.tree-item.on { background: var(--accent-soft); }
.files { min-width: 0; display: grid; gap: 10px; align-content: start; }
.img-title { font-weight: 600; border: 1px solid transparent; padding: 2px 4px; margin-left: -4px; background: transparent; }
.img-title:hover, .img-title:focus { border-color: var(--line); background: #fff; }
.img-card select[data-move] { font-size: 13px; padding: 4px 6px; }
.url-box { background: #f4efe7; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px; word-break: break-all; }
