: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; }
