/* Vereins-CI: Farben kommen aus den Markeneinstellungen (per JS gesetzt), hier nur Startwerte */
@font-face { font-family: "Bebas Neue"; src: url("/ui-fonts/bebas-neue-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bebas Neue"; src: url("/ui-fonts/bebas-neue-latin-ext-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF; }
@font-face { font-family: "Oswald"; src: url("/ui-fonts/oswald-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Oswald"; src: url("/ui-fonts/oswald-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --brand: #4a86c8;
  --brand-dark: #1f4fa8;
  --brand-ink: #ffffff;
  --font-head: "Bebas Neue", "Oswald", "Arial Narrow", sans-serif;
  --font-ui: "Oswald", "Arial Narrow", sans-serif;
  --bg: color-mix(in srgb, var(--brand) 9%, #f6f8fb);
  --surface: #ffffff;
  --text: #15233b;
  --muted: #5d6b80;
  --border: color-mix(in srgb, var(--brand) 22%, #e3e7ee);
  --accent: var(--brand-dark);
  --accent-text: #ffffff;
  --ok: #1f8a4c;
  --warn: #b26b00;
  --err: #c0392b;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: color-mix(in srgb, var(--brand-dark) 30%, #0a111e);
    --surface: color-mix(in srgb, var(--brand-dark) 22%, #121a2b);
    --text: #e8eef8;
    --muted: #9aa8bf;
    --border: color-mix(in srgb, var(--brand) 28%, #26314a);
    --accent: var(--brand);
    --ok: #4cc287;
    --warn: #e5a23a;
    --err: #ef6b5e;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
/* Kopfzeile im Vereins-Look: Markenfarbe, Logo, Navigation in Dunkelblau */
header.brandbar { background: var(--brand); color: var(--brand-ink); box-shadow: 0 2px 10px rgb(0 0 0 / .12); }
.brand-top { display: flex; align-items: center; gap: 16px; padding: 12px 20px 10px; max-width: 1240px; margin: 0 auto; }
.brand-logo { width: 58px; height: 58px; object-fit: contain; background: #fff; border-radius: 50%; padding: 4px; flex: none; }
.brand-title { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand-kicker { font-family: var(--font-ui); font-weight: 500; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; opacity: .9; }
.brand-home { display: flex; align-items: center; gap: 16px; color: inherit; text-decoration: none; min-width: 0; border-radius: 12px; }
.brand-home:hover .brand-logo { transform: scale(1.04); }
.brand-home:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.brand-logo { transition: transform .15s ease; }
.brand-h1 { font-family: var(--font-head); font-weight: 400; font-size: 40px; letter-spacing: .02em; margin: 2px 0 0; text-transform: uppercase; line-height: 1; }
.brand-nav { background: var(--brand-dark); display: flex; gap: 2px; flex-wrap: wrap; padding: 6px 14px; justify-content: center; }
.tab { background: none; border: 0; padding: 7px 14px; border-radius: 6px; color: rgb(255 255 255 / .82); cursor: pointer;
  font-family: var(--font-ui); font-weight: 500; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.tab:hover { color: #fff; background: rgb(255 255 255 / .1); }
.tab.active { background: #fff; color: var(--brand-dark); font-weight: 600; }
.caps { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cap { font-size: 12px; padding: 2px 9px; border-radius: 99px; border: 1px solid rgb(255 255 255 / .5); color: rgb(255 255 255 / .75); font-family: var(--font-ui); letter-spacing: .04em; }
.cap.on { border-color: #fff; color: #fff; background: rgb(255 255 255 / .15); }
.cap.on::before { content: "● "; color: #7dffb0; }


main { max-width: 1200px; margin: 0 auto; padding: 20px 16px 60px; }
.panel { display: none; }
.panel.active { display: block; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
input[type="color"] { padding: 2px; height: 38px; width: 80px; }
textarea { resize: vertical; width: 100%; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; margin: 14px 0; }
.actions { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
button.primary {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
  padding: 10px 20px; font-family: var(--font-ui); font-size: 15px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
}
button.primary:hover:not(:disabled) { filter: brightness(1.12); }
button.primary:disabled { opacity: .5; cursor: wait; }
button.ghost { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); cursor: pointer; font: inherit; }
.msg { font-size: 13px; color: var(--muted); }
.msg.err { color: var(--err); }
.muted { color: var(--muted); }
h3 { margin: 24px 0 8px; font-family: var(--font-head); font-weight: 400; font-size: 23px; letter-spacing: .03em; text-transform: uppercase; color: var(--accent); }
h3 small { font-family: system-ui, sans-serif; font-size: 12px; text-transform: none; letter-spacing: 0; }
h3 small { font-weight: 400; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.tile {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; font-size: 12px;
}
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.tile .audio { aspect-ratio: 1; display: grid; place-items: center; font-size: 28px; color: var(--muted); }
.tile .meta { padding: 6px 8px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.tile .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .tile { cursor: pointer; }
.picker .tile.selected { outline: 3px solid var(--accent); }
.badge {
  position: absolute; top: 6px; left: 6px; background: var(--accent); color: var(--accent-text);
  border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; font-weight: 700;
}

.split { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }
.item-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.item-list li {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer;
}
.item-list li.active { border-color: var(--accent); }
.item-list .title { font-weight: 600; display: block; }
.status { font-size: 12px; }
.status.done { color: var(--ok); }
.status.running, .status.queued { color: var(--warn); }
.status.failed { color: var(--err); }
.detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.detail video { max-width: 100%; max-height: 70vh; border-radius: 8px; background: #000; }
.detail pre { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 13px; overflow-x: auto; }
.detail .media { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.detail .cover { width: 200px; border-radius: 8px; }

.brand-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; max-width: 800px; }
.brand-form .wide { grid-column: 1 / -1; }

/* --- Erweiterungen: Posttypen, Team, Versionen --- */
.small { font-size: 12px; }
.err { color: var(--err); }
.grow { flex: 1 1 260px; }
.wide { grid-column: 1 / -1; width: 100%; }
.kicker { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h2 { margin: 2px 0 10px; font-family: var(--font-head); font-weight: 400; font-size: 34px; letter-spacing: .02em; text-transform: uppercase; line-height: 1; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }
.segmented button { background: none; border: 0; border-radius: 7px; padding: 6px 12px; font: inherit; color: var(--muted); cursor: pointer; }
.segmented button.active { background: var(--accent); color: var(--accent-text); }

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; margin: 14px 0; }
.fields textarea { min-height: 70px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.chip.disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }

.item-list li .title { font-weight: 600; display: block; }
.item-list li.person { display: flex; gap: 10px; align-items: center; }
.item-list li.person.inactive { opacity: .55; }
.item-list li.person img, .avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar { display: grid; place-items: center; background: var(--bg); font-weight: 700; color: var(--muted); }
.item-list li > span:not(.avatar) { min-width: 0; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.person-form textarea { width: 100%; }
.small-tiles { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
.small-tiles .tile .meta { display: none; }

.detail textarea { width: 100%; }
.detail .row label:not(.check) { flex: 1 1 200px; }
.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-radius: 8px; padding: 4px 12px; margin: 10px 0; font-size: 13px; }
.revise { margin-top: 20px; border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; }
.revise > summary { font-weight: 600; cursor: pointer; color: var(--accent); }
.revise details { margin: 10px 0; }
.revise details > summary { cursor: pointer; }
details > summary { cursor: pointer; margin: 8px 0; }
button.danger { color: var(--err); border-color: var(--err); }
a.ghost { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; color: var(--text); text-decoration: none; }
.tile .audio { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 8px; }
.tile .audio audio { width: 100%; }
[hidden] { display: none !important; }
.item-list li.person > span > span { display: block; overflow: hidden; text-overflow: ellipsis; }
.cap.off { border-color: var(--warn); color: var(--warn); cursor: help; }

/* --- Fortschritt, Abbruch, Wiederholung --- */
.status-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 10px 0; }
.status.cancelled { color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 4px; }
.step { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; padding: 7px 10px; border-radius: 8px; background: var(--bg); font-size: 14px; }
.step .icon { font-weight: 700; text-align: center; }
.step .label { display: flex; flex-direction: column; min-width: 0; }
.step .step-detail { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.step .time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.step.pending { opacity: .55; }
.step.running { outline: 2px solid var(--warn); }
.step.running .icon { color: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.step.done .icon { color: var(--ok); }
.step.failed { outline: 2px solid var(--err); }
.step.failed .icon, .step.failed .step-detail { color: var(--err); }
.step.cancelled .icon { color: var(--muted); }
.step.skipped { opacity: .6; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .step.running .icon { animation: none; } }
.error-box { background: color-mix(in srgb, var(--err) 10%, transparent); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
.error-box pre, .warn pre { background: none; padding: 4px 0 0; margin: 0; }

/* --- Spiele, Gegner, Bild-Infos --- */
.picker-toolbar { margin: 6px 0 10px; }
.tile-tags { padding: 0 8px 6px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-thumb { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex: none; }
.logo-preview { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; border: 1px solid var(--border); }
.asset-preview { width: 100%; max-height: 320px; object-fit: contain; background: var(--bg); border-radius: 8px; margin-bottom: 8px; }
.library-split { grid-template-columns: 1fr 340px; align-items: start; }
.library-split .detail { position: sticky; top: 12px; }
@media (max-width: 900px) { .library-split { grid-template-columns: 1fr; } .library-split .detail { position: static; } }
.tagging-status { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; margin: 4px 0 14px; min-height: 20px; }
.warn-text { color: var(--warn); }
.tile.selected { outline: 3px solid var(--accent); }

/* --- handball.net-Import --- */
.import-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.import-info { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 8px; }
.import-info h4 { margin: 14px 0 6px; font-size: 13px; }
.timeline { display: flex; gap: 4px; align-items: flex-end; overflow-x: auto; padding-bottom: 4px; }
.tl-col { display: flex; flex-direction: column; align-items: center; min-width: 38px; font-size: 11px; }
.tl-bars { height: 80px; display: flex; align-items: flex-end; gap: 2px; }
.tl-bars span { width: 10px; border-radius: 3px 3px 0 0; min-height: 2px; }
.tl-own { background: var(--accent); }
.tl-opp { background: var(--muted); opacity: .6; }
.tl-label { color: var(--muted); }
.tl-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.scorers { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; font-size: 13px; }
.scorers li { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--border); padding: 2px 0; }
.report { white-space: pre-wrap; }

/* --- Vorlagen, Schriften, Bildpost --- */
.font-tile { font-size: 42px; font-weight: 700; color: var(--text); }
.image-post { max-width: 360px; max-height: 70vh; border-radius: 8px; border: 1px solid var(--border); }
.ref-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin-bottom: 8px; }
.ref-grid .tile img { aspect-ratio: 4 / 5; object-fit: cover; }
#template-detail textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* --- Kosten --- */
.cost-summary { margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; font-size: 14px; }
.cost-summary summary { margin: 4px 0; }
.cost-box { margin: 8px 0; font-size: 14px; }
.cost-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.cost-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cost-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- Vereins-CI: Feinschliff --- */
.kicker { font-family: var(--font-ui); letter-spacing: .1em; color: var(--accent); }
.item-list li .title { font-family: var(--font-ui); font-weight: 500; letter-spacing: .02em; font-size: 16px; }
.item-list li.active { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.detail, .item-list li, .tile, .import-bar, .cost-summary { box-shadow: 0 1px 3px rgb(21 35 59 / .06); }
.segmented button { font-family: var(--font-ui); letter-spacing: .05em; text-transform: uppercase; font-size: 14px; }
.chip { font-family: var(--font-ui); letter-spacing: .03em; }
a.ghost, button.ghost { font-family: var(--font-ui); letter-spacing: .04em; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.badge { background: var(--brand-dark); }
.tl-own { background: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .tl-own { background: var(--brand); } h3 { color: var(--brand); } }

/* --- Grundstruktur: weiße Karten --- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; box-shadow: 0 1px 3px rgb(21 35 59 / .06); min-width: 0; }
.card > h3:first-child, .subcard > h3:first-child { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
#tab-library > .card { margin-bottom: 16px; }
.card .fields { margin: 8px 0 0; }
.card .row:last-child { margin-bottom: 0; }
.subcard { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 16px 0; background: color-mix(in srgb, var(--surface) 92%, var(--brand) 8%); }
.submit-bar { position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 20px; box-shadow: 0 -4px 16px rgb(21 35 59 / .1); }
.library-split > .card { padding: 14px; }

/* --- Dashboard --- */
.dash-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-dark) 100%); color: var(--brand-ink); border: 0; }
.dash-hero .kicker { color: rgb(255 255 255 / .85); }
.dash-hero h2 { margin: 4px 0 0; color: #fff; }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-hero button.primary { background: #fff; color: var(--brand-dark); }
.dash-hero button.ghost { color: #fff; border-color: rgb(255 255 255 / .6); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--accent); }
.kpi.busy { border-top-color: var(--warn); }
.kpi.warn { border-top-color: var(--warn); }
.kpi-label { font-family: var(--font-ui); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-family: var(--font-head); font-size: 44px; line-height: 1; color: var(--accent); }
.kpi-hint { font-size: 12px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash-wide { grid-column: 1 / -1; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
.dash-list { display: flex; flex-direction: column; gap: 6px; }
.dash-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; font: inherit; color: inherit; }
.dash-row:last-child { border-bottom: 0; }
.link-row { cursor: pointer; border-radius: 8px; }
.link-row:hover { background: var(--bg); }
.dash-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dash-row-title { font-family: var(--font-ui); font-weight: 500; font-size: 16px; letter-spacing: .02em; }
.dash-score { font-family: var(--font-head); font-size: 20px; color: var(--accent); }
.dash-row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
button.primary.small-btn { padding: 6px 12px; font-size: 13px; }
.dash-empty { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dash-posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.dash-post { display: flex; flex-direction: column; gap: 2px; text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; font: inherit; color: inherit; min-width: 0; }
.dash-post:hover { border-color: var(--accent); }
.dash-post img, .dash-post-empty { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 6px; margin-bottom: 4px; background: var(--surface); }
.dash-post-empty { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.dash-post-title { font-family: var(--font-ui); font-weight: 500; font-size: 14px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--err); }
.pulse { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--warn); }
.pulse.running { animation: pulse 1.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse.running { animation: none; } }

/* --- Marke: Karten + Live-Vorschau --- */
.brand-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.brand-layout .submit-bar { grid-column: 1 / -1; }
.brand-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.brand-preview-card { position: sticky; top: 12px; }
@media (max-width: 900px) { .brand-layout { grid-template-columns: 1fr; } .brand-preview-card { position: static; } }
.color-fields { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.color-fields input[type="color"] { width: 100%; }
.logo-preview.big { width: 120px; height: 120px; margin-top: 12px; }
.brand-preview { --bp-bg: #4a86c8; --bp-own: #1f4fa8; --bp-ink: #fff; --bp-head: "Bebas Neue"; --bp-body: "Oswald";
  position: relative; aspect-ratio: 4 / 5; background: var(--bp-bg); color: var(--bp-ink); border-radius: 8px; padding: 18px; overflow: hidden; font-family: var(--bp-body); }
.bp-logo { position: absolute; top: 14px; right: 14px; width: 62px; height: 62px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; }
.bp-head { font-family: var(--bp-head); font-size: 58px; line-height: .9; text-transform: uppercase; }
.bp-league { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.bp-box { position: absolute; left: 18px; right: 18px; top: 120px; bottom: 18px; border: 3px solid var(--bp-ink); text-align: center; padding-top: 22px; font-family: var(--bp-head); text-transform: uppercase; }
.bp-team { font-size: 30px; line-height: 1.05; padding: 0 8px; overflow-wrap: anywhere; }
.bp-vs { font-size: 18px; margin: 4px 0; }
.bp-own { color: var(--bp-own); }
.bp-line { height: 2px; background: var(--bp-ink); opacity: .7; margin: 14px 40px; }
.bp-score { font-size: 72px; line-height: 1; }

/* --- Musik vorhören, Anzeigenamen --- */
.track-pick { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.music-player { height: 36px; max-width: 100%; min-width: 240px; }
.font-sample { font-size: 34px; padding: 16px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; overflow-wrap: anywhere; }

/* Lange Auswahltexte (z. B. Spielnamen) dürfen das Layout nicht sprengen */
select { max-width: 100%; text-overflow: ellipsis; }
.row > label, .fields > label { min-width: 0; max-width: 100%; }


/* --- Smartphone (iPhone) --- */
@media (max-width: 800px) {
  main { padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); }
  .brand-top { padding: calc(8px + env(safe-area-inset-top)) 14px 8px; gap: 10px; }
  .brand-logo { width: 42px; height: 42px; padding: 3px; }
  .brand-h1 { font-size: 28px; }
  .brand-kicker { font-size: 11px; }
  .caps { display: none; }
  /* Navigation als wischbare Leiste, bleibt beim Scrollen oben */
  .brand-nav { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding: 6px 10px; }
  .brand-nav::-webkit-scrollbar { display: none; }
  .tab { flex: none; scroll-snap-align: center; padding: 10px 14px; font-size: 15px; }
  /* Kopf klebt oben, aber um die Höhe der Logo-Zeile nach oben versetzt: beim Scrollen bleibt nur die Navigation sichtbar */
  header.brandbar { position: sticky; top: calc(-1 * var(--brand-top-h, 58px)); z-index: 20; }
  .detail, .card, .item-list { scroll-margin-top: 64px; }
  /* iOS zoomt bei Eingabefeldern < 16 px – deshalb 16 px */
  input, select, textarea, button { font-size: 16px; }
  label > input:not([type="checkbox"]):not([type="color"]):not([type="file"]), label > select, label > textarea { width: 100%; }
  .row { gap: 12px; }
  .row > label:not(.check) { flex: 1 1 100%; }
  button.primary, button.ghost, a.ghost { min-height: 44px; }
  button.ghost, a.ghost { padding: 10px 14px; display: inline-flex; align-items: center; }
  .card { padding: 14px; border-radius: 12px; }
  .detail { padding: 14px; }
  h2 { font-size: 28px; }
  h3 { font-size: 21px; }
  .split { gap: 12px; }
  .item-list li { padding: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 36px; }
  .dash-hero { flex-direction: column; align-items: stretch; }
  .dash-actions { flex-direction: column; }
  .dash-actions button { width: 100%; }
  .dash-row { flex-wrap: wrap; }
  .dash-row-actions { width: 100%; justify-content: flex-start; }
  .dash-posts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .segmented { display: flex; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; max-width: 100%; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: none; padding: 9px 12px; }
  .submit-bar { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); border-radius: 12px 12px 0 0; margin: 0 -12px; }
  .submit-bar button.primary { flex: 1; }
  .media { flex-direction: column; }
  .job-detail video, .detail video, .image-post { width: 100%; max-width: 100%; }
  .cover { width: 60%; }
  .steps .step { grid-template-columns: 20px 1fr; }
  .steps .step .time { grid-column: 2; }
  .cost-table td:nth-child(2) { display: none; }
  .library-split .detail { position: static; }
  .brand-preview-card { order: -1; }
  .music-player { width: 100%; min-width: 0; }
  .timeline { padding-bottom: 8px; }
}

/* --- Anmeldeseite --- */
.login-page { min-height: 100vh; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%); display: grid; place-items: center; padding: 16px; }
.login-wrap { width: 100%; max-width: 400px; padding: 0; }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login-card label input { width: 100%; font-size: 16px; }
.login-card button.primary { width: 100%; min-height: 46px; }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; color: var(--accent); }
.login-brand .brand-logo { width: 64px; height: 64px; border: 1px solid var(--border); }
.login-brand .brand-kicker { color: var(--muted); }
.login-brand .brand-h1 { font-size: 34px; }

/* --- Benutzermenü in der Kopfzeile --- */
.user-menu { display: flex; align-items: center; gap: 6px; margin-left: 12px; flex: none; }
.user-button { display: flex; align-items: center; gap: 8px; background: rgb(255 255 255 / .12); border: 1px solid rgb(255 255 255 / .35); color: #fff;
  border-radius: 99px; padding: 4px 12px 4px 4px; cursor: pointer; font-family: var(--font-ui); font-size: 14px; letter-spacing: .03em; }
.user-button:hover { background: rgb(255 255 255 / .22); }
.user-initials { width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--brand-dark); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.logout-button { background: none; border: 0; color: rgb(255 255 255 / .85); cursor: pointer; font-family: var(--font-ui); font-size: 13px; letter-spacing: .05em; text-transform: uppercase; padding: 6px; }
.logout-button:hover { color: #fff; text-decoration: underline; }

/* --- Einstellungen: Unternavigation --- */
.settings-nav { margin-bottom: 16px; }
.readonly-note { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--text); border-radius: 8px; padding: 6px 10px; }

/* --- Rechte-Tabelle --- */
.perm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.perm-table th { text-align: center; font-family: var(--font-ui); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 6px; }
.perm-table th:first-child { text-align: left; }
.perm-table td { padding: 8px 6px; border-top: 1px solid var(--border); text-align: center; }
.perm-table td:first-child { text-align: left; }
.perm-table td.na { color: var(--muted); }
.perm-table label.radio { display: inline-flex; justify-content: center; }
.perm-table input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); }
.perm-table.compact td { text-align: left; padding: 5px 6px; }
.lvl-edit { color: var(--ok); font-weight: 600; }
.lvl-view { color: var(--accent); }
.lvl-none { color: var(--muted); }

@media (max-width: 800px) {
  .user-menu { margin-left: auto; }
  .user-name, .logout-button { display: none; }
  .user-button { padding: 3px; border-radius: 50%; }
  .perm-table td:first-child .small { display: block; }
  .settings-nav { position: sticky; top: 52px; z-index: 10; }
}
@media (max-width: 800px) {
  .perm-table { table-layout: fixed; font-size: 13px; }
  .perm-table th { font-size: 10px; letter-spacing: .02em; padding: 4px 2px; word-break: break-word; }
  .perm-table th:first-child, .perm-table td:first-child { width: 46%; }
  .perm-table td { padding: 8px 2px; }
  .perm-table td:first-child { overflow-wrap: anywhere; }
}
.voice-preview { display: flex; flex-direction: column; gap: 2px; }

/* Spieleliste: Gruppenüberschriften und „nächstes Spiel“ */
.item-list li.list-heading { background: none; border: 0; box-shadow: none; padding: 10px 4px 2px; cursor: default;
  font-family: var(--font-ui); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.next-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 99px; background: var(--accent); color: var(--accent-text);
  font-family: var(--font-ui); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; vertical-align: middle; }
.roster button.link:disabled { text-decoration: none; cursor: default; color: inherit; }
.consent-missing { color: var(--warn); }
/* Datei-Auswahlfelder dürfen auf schmalen Bildschirmen nicht überstehen */
input[type="file"] { max-width: 100%; min-width: 0; }

/* Icon-Vorschau (Favicon / Home-Bildschirm) */
.icon-previews { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.icon-preview-set { display: flex; flex-direction: column; gap: 8px; }
.tab-mock { display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px 8px 0 0; padding: 4px 10px; font-size: 12px; }
.tab-mock img { width: 16px; height: 16px; object-fit: contain; }
.icon-home { width: 60px; height: 60px; object-fit: contain; background: #fff; border-radius: 14px; padding: 4px; box-shadow: 0 2px 6px rgb(0 0 0 / .2); }

/* Live-Vorschau skaliert mit ihrer Breite (Container-Einheiten) */
.brand-preview { container-type: inline-size; padding: 5cqw; }
.bp-logo { width: 17cqw; height: 17cqw; top: 4cqw; right: 4cqw; }
.bp-head { font-size: 16cqw; padding-right: 20cqw; }
.bp-league { font-size: 3.2cqw; }
.bp-box { left: 5cqw; right: 5cqw; top: 34cqw; bottom: 5cqw; padding-top: 5cqw; border-width: max(2px, .8cqw); }
.bp-team { font-size: 8cqw; }
.bp-vs { font-size: 5cqw; margin: 1cqw 0; }
.bp-line { margin: 4cqw 11cqw; }
.bp-score { font-size: 19cqw; }
@media (max-width: 800px) {
  .brand-h1 { font-size: 26px; white-space: nowrap; }
}

/* --- Abstimmungen (Verwaltung) --- */
.poll-pick { display: flex; flex-direction: column; gap: 10px; }
.poll-pick-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.poll-group { border: 1px solid var(--border); border-radius: 12px; background: var(--bg); overflow: hidden; }
.poll-group[open] > summary { border-bottom: 1px solid var(--border); }
.poll-group > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: 0; cursor: pointer; list-style: none; background: var(--surface); }
.poll-group > summary::-webkit-details-marker { display: none; }
.poll-group > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.poll-group[open] > summary::before { transform: rotate(90deg); }
.poll-group-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.poll-group-title strong { overflow-wrap: anywhere; line-height: 1.25; }
.poll-group-count { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; }
.small-btn { padding: 4px 10px; font-size: 13px; }
.poll-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 10px 12px 12px; }
.poll-tile { display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); }
.poll-tile.selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.poll-tile-thumb { position: relative; display: block; padding: 0; border: 0; border-radius: 6px; overflow: hidden; aspect-ratio: 4 / 5; background: var(--bg); cursor: zoom-in; }
.poll-tile-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.poll-tile-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 24px; }
.poll-tile-play { position: absolute; right: 6px; bottom: 6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 13px; }
.poll-tile-check { display: flex; flex-direction: row; align-items: flex-start; gap: 8px; cursor: pointer; color: var(--text); }
.poll-tile-check > span { display: flex; flex-direction: column; min-width: 0; }
.poll-tile-check input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.poll-tile input:not([type="checkbox"]) { width: 100%; font-size: 14px; }
.poll-tile input:disabled { opacity: .5; }
.preview-dialog { color: var(--text); background: var(--surface); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 14px; overflow: auto; }
.preview-dialog::backdrop { background: rgba(0,0,0,.7); }
.preview-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 1; }
.preview-media { background: #000; }
.preview-media video, .preview-media img { display: block; width: 100%; max-height: 70dvh; object-fit: contain; }
.preview-caption { margin: 0; padding: 12px; white-space: pre-wrap; }
.poll-results { display: flex; flex-direction: column; gap: 10px; }
.poll-result { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: start; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.poll-result.winner { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.poll-result img { width: 64px; height: 80px; object-fit: cover; border-radius: 6px; }
.poll-result-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.poll-result-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.poll-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--bg); }
.poll-bar .seg { display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; min-width: 18px; }
.seg.great { background: var(--ok); }
.seg.ok { background: var(--accent); }
.seg.bad { background: var(--err); }
.poll-voters { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.poll-voters li p { margin: 2px 0 0; }
a.primary.wa-button { background: #25d366; color: #fff; border-radius: 8px; padding: 10px 18px; text-decoration: none; font-family: var(--font-ui); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
@media (max-width: 800px) {
  .poll-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px; gap: 8px; }
}

/* --- Abstimmungsseite (öffentlich) --- */
.vote-page { background: var(--bg); }
.vote-head { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: linear-gradient(120deg, var(--brand), var(--brand-dark)); color: #fff; }
.vote-head .brand-logo { width: 48px; height: 48px; }
.vote-head .brand-h1 { font-size: 30px; }
.vote-main { max-width: 640px; margin: 0 auto; padding: 14px 12px calc(30px + env(safe-area-inset-bottom)); }
.vote-main label input, .vote-main label textarea { width: 100%; font-size: 16px; }
.vote-desc { white-space: pre-wrap; }
.vote-option-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.vote-option-head h3 { margin: 0 0 8px; }
.vote-media video, .vote-media img { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: 8px; display: block; }
.vote-caption { white-space: pre-wrap; font-size: 14px; }
.rate-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.rate { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; min-height: 64px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-family: var(--font-ui); font-size: 14px; letter-spacing: .02em; cursor: pointer; }
.rate-emoji { font-size: 24px; line-height: 1; }
.rate[aria-pressed="true"].rate-bad { border-color: var(--err); background: color-mix(in srgb, var(--err) 14%, var(--surface)); }
.rate[aria-pressed="true"].rate-ok { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.rate[aria-pressed="true"].rate-great { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, var(--surface)); }
.vote-option.rated { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.msg.ok { color: var(--ok); font-weight: 600; }
.vote-page .submit-bar { margin: 0 -12px; border-radius: 12px 12px 0 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.vote-page .submit-bar button.primary { flex: 1; min-height: 48px; font-size: 16px; }
