/* ==========================================================================
   Bilddatenbank v1 – Stylesheet
   Farben --brand / --accent / --tint kommen aus der Konfiguration (konfig).
   ========================================================================== */

:root {
  /* KraichgauSport CI */
  --brand: #0800B8;
  --brand-dark: #05008A;
  --accent: #E00000;
  --tint: #E9E9FB;

  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #15202e;
  --muted: #5d6b7d;
  --line: #dde3eb;
  --stage: #10161f;
  --ok: #1f7a4d;
  --err: #b3261e;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1320px;
  color-scheme: light only;
}


*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--font);
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; padding-bottom: 48px; }
img { max-width: 100%; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.2vw, 2rem); }
h2 { font-size: 1.3rem; }
code { font: .86em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
.narrow { max-width: 860px; }

.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; fill: none; }
.ic-xl { width: 44px; height: 44px; opacity: .45; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1.2;
  padding: 10px 16px; border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost.is-on { background: var(--tint); border-color: var(--brand); color: var(--brand); }
.btn-ghost.is-on .ic { fill: currentColor; }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: .88rem; }
.btn-lg { padding: 13px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

.iconbtn {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border-radius: 50%; border: 0; background: transparent; color: var(--muted);
  cursor: pointer; text-decoration: none;
}
.iconbtn:hover { background: var(--surface-2); color: var(--brand); }
.iconbtn.is-on { color: #e0a100; }
.iconbtn.is-on .ic { fill: currentColor; }
.iconbtn.is-disabled { opacity: .4; cursor: default; }
.iconbtn.is-disabled:hover { background: none; color: var(--muted); }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; color: var(--text);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px -14px rgba(8, 0, 120, .35);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: linear-gradient(90deg, var(--brand) 0 62%, var(--accent) 62% 100%); }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.brand img { display: block; height: 40px; width: auto; max-width: 100%; object-fit: contain; }
.brand-sub { font-size: .68rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); font-weight: 700; border-left: 1px solid var(--line); padding-left: 12px; line-height: 1.2; }

.topsearch { position: relative; flex: 1; min-width: 200px; max-width: 420px; }
.topsearch .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.topsearch input {
  width: 100%; font: inherit; color: var(--text);
  padding: 9px 14px 9px 38px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.topsearch input:focus { outline: none; background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px var(--tint); }

.mainnav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.mainnav > a:not(.btn), .nav-user {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem;
  padding: 8px 10px; border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.mainnav > a:not(.btn):hover { color: var(--brand); background: var(--tint); }
.mainnav > a[aria-current="page"]:not(.btn) { color: var(--brand); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav-user { color: var(--muted); font-weight: 500; font-size: .86rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.mainnav .btn { margin-left: 6px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: .75rem; font-weight: 700;
}
.badge.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }
.navtoggle { display: none; margin-left: auto; background: none; border: 0; color: var(--brand); padding: 8px; cursor: pointer; }
.navtoggle .ic { width: 26px; height: 26px; }

@media (max-width: 1560px) and (min-width: 1101px) { .brand-sub { display: none; } }
@media (max-width: 1400px) and (min-width: 1101px) { .nav-user { display: none; } .mainnav > a:not(.btn) { padding: 8px 7px; font-size: .9rem; } .brand img { height: 34px; } }
@media (max-width: 1100px) {
  .topbar-inner { flex-wrap: wrap; gap: 10px 14px; padding-top: 10px; padding-bottom: 12px; min-height: 0; }
  .brand img { height: 32px; }
  .navtoggle { display: block; }
  .topsearch { order: 3; flex-basis: 100%; max-width: none; }
  .mainnav {
    order: 4; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 2px;
    display: none; padding: 6px 0 4px; border-top: 1px solid var(--line);
  }
  .mainnav.is-open { display: flex; }
  .mainnav > a[aria-current="page"]:not(.btn) { box-shadow: inset 3px 0 0 var(--accent); border-radius: 0; }
  .mainnav .btn { margin: 8px 0 0; }
  .nav-user { max-width: none; }
}
@media (max-width: 520px) { .brand-sub { display: none; } }

/* ---------- Hinweise ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-radius: var(--radius-sm); margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand);
}
.notice .ic { margin-top: 2px; color: var(--brand); }
.notice-info { background: color-mix(in srgb, var(--tint) 55%, var(--surface)); }
.notice-ok { border-left-color: var(--ok); }
.notice-ok .ic { color: var(--ok); }
.notice-error { border-left-color: var(--err); color: var(--err); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 36px); box-shadow: var(--shadow); }
.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty p { margin: .4em 0; }

/* ---------- Seitenkopf ---------- */
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 28px 0 18px; }
.pagehead h1 { margin: 0; }
.pagehead p { margin: .35em 0 0; }
.pagehead .hl { color: var(--brand); }
.pagehead-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; font-size: .9rem; font-weight: 600; text-decoration: none; margin-bottom: 6px; }
.inline-filter { display: flex; gap: 8px; }
.inline-filter input, .inline-filter select, .form input, .form select, .form textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px;
}
.inline-filter input:focus, .inline-filter select:focus, .form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 22px; }
.chip {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  font-size: .86rem; text-decoration: none; white-space: nowrap;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Bildraster ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: transparent; }
.tile-img { position: relative; display: block; aspect-ratio: 4 / 3; background: var(--surface-2); }
.tile-img img {
  position: absolute; inset: 0; margin: auto; display: block;
  max-width: calc(100% - 20px); max-height: calc(100% - 20px); width: auto; height: auto;
  border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.tile-body { padding: 10px 12px 6px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.tile-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-id { font-weight: 600; }
.tile-title {
  color: var(--text); text-decoration: none; font-size: .86rem; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em;
}
.tile-title:hover { color: var(--brand); }
.tile-actions { display: flex; justify-content: flex-end; gap: 2px; margin-top: auto; padding-top: 4px; margin-right: -6px; }

/* ---------- Termin-Karten ---------- */
.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
@media (max-width: 520px) { .events { grid-template-columns: 1fr; gap: 12px; } }
.event {
  display: flex; flex-direction: column; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.event:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.event-img { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--surface-2); overflow: hidden; }
.event-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.event:hover .event-img img { transform: scale(1.04); }
.event-body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; flex: 1; }
.event-date, .event-count { font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.event-date .ic, .event-count .ic { width: 14px; height: 14px; }
.event-title { font-weight: 650; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.event-count { margin-top: auto; padding-top: 4px; }
@media (max-width: 520px) {
  .event { flex-direction: row; }
  .event-img { width: 120px; flex: none; aspect-ratio: auto; }
}

/* ---------- Seiten-Navigation ---------- */
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 32px 0 8px; }
.pager a, .pager span {
  display: inline-flex; align-items: center; gap: 4px; min-width: 40px; height: 40px; padding: 0 12px;
  justify-content: center; border-radius: 999px; text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pager a { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .is-current { background: var(--brand); color: #fff; }
.pager .is-disabled { opacity: .4; }
.pager-gap { color: var(--muted); min-width: 20px !important; padding: 0 !important; }
@media (max-width: 520px) { .pager-step span { display: none; } }

/* ---------- Startseite ---------- */
.hero { position: relative; color: #fff; background: var(--stage); overflow: hidden; isolation: isolate; }
@media (min-width: 900px) { .hero { min-height: 650px; display: flex; align-items: center; } .hero-inner { width: 100%; } }
.hero-slides, .hero-slide, .hero-shade { position: absolute; inset: 0; }
.hero-slide { background-size: cover; background-position: center; opacity: 0; animation: heroFade calc(var(--n) * 6s) infinite; }
.hero-slide:only-child { opacity: 1; animation: none; }
@keyframes heroFade {
  0% { opacity: 0; transform: scale(1.03); }
  6% { opacity: 1; }
  33% { opacity: 1; }
  40% { opacity: 0; transform: scale(1.09); }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .hero-slide { animation: none; } .hero-slide:first-child { opacity: 1; } }
.hero-shade { background: linear-gradient(90deg, rgba(4,0,60,.9) 0%, rgba(4,0,60,.66) 45%, rgba(4,0,60,.18) 100%), linear-gradient(0deg, rgba(4,0,40,.6), transparent 40%); }
.hero-inner { position: relative; padding-top: clamp(48px, 8vw, 110px); padding-bottom: clamp(40px, 7vw, 96px); max-width: var(--wrap); }
.hero h1 { font-size: clamp(1.8rem, 1.1rem + 2.6vw, 3.1rem); max-width: 17em; margin-bottom: 26px; letter-spacing: -.02em; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .76rem; font-weight: 700; margin: 0 0 12px; color: #ff4d4d; }
.hero-search { position: relative; display: flex; gap: 8px; max-width: 680px; background: #fff; border-radius: 999px; padding: 6px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); }
.hero-search .ic { position: absolute; left: 22px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.hero-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.05rem; padding: 10px 10px 10px 46px; color: #15202e; }
.hero-search input:focus { outline: none; }
.hero-search .btn { padding: 12px 22px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 14px 0; margin: 30px 0 0; color: rgba(255,255,255,.82); }
.hero-stat { display: flex; flex-direction: column; padding: 0 clamp(18px, 3vw, 36px); border-left: 2px solid rgba(255,255,255,.22); }
.hero-stat:first-child { padding-left: 0; border-left: 0; }
.hero-stat strong { color: #fff; font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero-stat strong small { font-size: .5em; font-weight: 600; letter-spacing: 0; opacity: .85; }
.hero-stat span { font-size: clamp(.85rem, 1.4vw, 1rem); text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }
@media (max-width: 600px) { .hero-stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; } .hero-stat { padding: 0 14px; } .hero-stat strong { font-size: 1.55rem; } .hero-stat span { font-size: .72rem; letter-spacing: .05em; } }
@media (max-width: 520px) {
  .hero-search { flex-direction: column; border-radius: 18px; }
  .hero-search .ic { top: 28px; }
  .hero-search .btn { width: 100%; }
}

.intro { text-align: center; max-width: 760px; margin: 40px auto 8px; color: var(--muted); }
.intro h1, .intro h2 { font-size: 1.35rem; color: var(--text); }
.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.link-more { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.cta { margin-top: 44px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; border-left: 5px solid var(--brand); }
.cta h2 { margin-bottom: .2em; }
.cta p { margin: 0; color: var(--muted); max-width: 46em; }
.cta-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Detailansicht ---------- */
.detail-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 0 14px; }
.detail-nav .crumb { margin: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper-pos { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; min-width: 64px; text-align: center; }
@media (max-width: 520px) { .stepper .btn span { display: none; } }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
@media (max-width: 980px) { .detail { grid-template-columns: 1fr; } }
.detail-stage {
  margin: 0; background: var(--stage); border-radius: var(--radius); padding: clamp(12px, 3vw, 36px);
  display: flex; flex-direction: column; align-items: center; gap: 12px; min-height: 320px; justify-content: center;
}
.detail-stage img { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; border-radius: 4px; box-shadow: 0 18px 50px -12px rgba(0,0,0,.7); }
.detail-stage figcaption { color: rgba(255,255,255,.55); font-size: .8rem; }
.detail-info { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
@media (min-width: 981px) { .detail-info { position: sticky; top: 84px; } }
.detail-info .eyebrow { color: var(--muted); }
.detail-info h1 { font-size: 1.3rem; }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin: 18px 0; }
.detail-actions form { display: contents; }
.detail-actions .btn { width: 100%; }
.detail-caption { font-size: .95rem; margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.facts { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 0 0 18px; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags .chip { font-size: .8rem; padding: 3px 10px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; border-radius: 12px; }

/* ---------- Leuchtkasten ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.toolbar-spacer { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input, .lb-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lb-check { display: grid; place-items: center; }
.lb-thumb { flex: none; width: 96px; height: 72px; display: grid; place-items: center; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.lb-thumb img { max-width: 100%; max-height: 100%; display: block; }
.lb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: .88rem; }
.lb-title { font-weight: 600; color: var(--text); text-decoration: none; }
.lb-title:hover { color: var(--brand); }
.lb-actions { display: flex; gap: 2px; }
.lb-clear { margin-top: 18px; text-align: right; }
@media (max-width: 600px) {
  .lb-item { flex-wrap: wrap; }
  .lb-thumb { width: 72px; height: 54px; }
  .lb-text { flex-basis: calc(100% - 130px); }
  .lb-actions { margin-left: auto; }
}

/* ---------- Formulare & Texte ---------- */
.form { display: grid; gap: 14px; margin-top: 18px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .9rem; }
.form input, .form select, .form textarea { font-weight: 400; width: 100%; }
.form textarea { resize: vertical; min-height: 110px; }
.form-2col { grid-template-columns: 1fr 1fr; }
.form-2col .span-2 { grid-column: 1 / -1; }
@media (max-width: 600px) { .form-2col { grid-template-columns: 1fr; } }
.form-foot { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; }
.form-foot p { margin: 0; max-width: 32em; }
.req { color: var(--err); }
.auth { max-width: 440px; margin: 48px auto 0; }
.auth-links { display: flex; flex-direction: column; gap: 6px; margin: 18px 0 0; font-size: .9rem; }
.card > .wrap, .wrap.narrow > .card { margin-top: 28px; }
.prose { overflow-wrap: anywhere; }
.prose h1 { margin-bottom: .8em; }
.prose h2 { font-size: 1.15rem; margin-top: 1.6em; }
.prose h3 { font-size: 1rem; margin-top: 1.4em; }
.prose p, .prose li { color: var(--text); }
.intro.prose p { color: var(--muted); }

/* ---------- Footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; padding-top: 26px; padding-bottom: 18px; }
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand strong { color: var(--text); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.footer-nav a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.footer-nav a:hover { color: var(--brand); }
.footer-nav .ic { width: 14px; height: 14px; }
.footer-copy { padding-bottom: 24px; font-size: .8rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 600; font-size: .9rem; box-shadow: var(--shadow-lg);
}

/* ---------- Admin ---------- */
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.admin-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; font-size: .92rem; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a[aria-current="page"] { background: var(--brand); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat b { display: block; font-size: 1.7rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .86rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { background: var(--surface-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--tint) 30%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .thumb { width: 64px; }
.table .thumb img { max-width: 56px; max-height: 42px; display: block; border-radius: 3px; }
.table .actions { white-space: nowrap; text-align: right; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 0 0 18px; background: var(--surface); }
.fieldset legend {
  float: left; width: 100%; padding: 0 0 12px; margin: 0 0 16px;
  font-size: 1.05rem; font-weight: 700; color: var(--text);
  border-bottom: 1px solid var(--line);
}
.fieldset legend + * { clear: both; }
.form .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.logbox { max-height: 360px; overflow: auto; background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 16px; font-size: .88rem; columns: 3 200px; }
.logbox div { break-inside: avoid; }
.copyfield { display: flex; gap: 6px; }
.copyfield input { flex: 1; min-width: 0; font: .8rem ui-monospace, monospace; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--text); }

@media print {
  .footer, .detail-actions, .stepper, .tile-actions, .pager { display: none !important; }
  body { background: #fff; }
}

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }

.stagebar { background: repeating-linear-gradient(45deg, #f5b400, #f5b400 12px, #ffcd3c 12px, #ffcd3c 24px); color: #2b2100; text-align: center; font-weight: 700; font-size: .8rem; letter-spacing: .06em; padding: 4px 8px; }

.table th.is-sortable { cursor: pointer; user-select: none; }
.table th.is-sortable::after { content: " ↕"; opacity: .35; font-size: .8em; }
.table th.asc::after { content: " ▲"; opacity: .8; }
.table th.desc::after { content: " ▼"; opacity: .8; }
.table tfoot th { background: var(--surface-2); border-top: 2px solid var(--line); }
.table tr.is-selected td { background: color-mix(in srgb, var(--tint) 60%, transparent); }
.tablefilter, .dateinput { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.table code { white-space: nowrap; word-break: normal; }

.slider-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.slider-item { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.slider-thumb { aspect-ratio: 16 / 9; background: var(--stage); display: grid; place-items: center; overflow: hidden; }
.slider-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider-meta { padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.slider-actions { display: flex; gap: 2px; padding: 4px 8px 8px; justify-content: flex-end; }
.slider-actions form { display: inline; }
.iconbtn:disabled { opacity: .3; cursor: default; }
.hero-credit { margin: 20px 0 0; font-size: clamp(.9rem, 1.3vw, 1.02rem); line-height: 1.6; color: rgba(255,255,255,.78); max-width: 52em; }
.hero-credit a { color: rgba(255,255,255,.9); }

/* Footer mit Logo */
.footer-logo { height: 34px; width: auto; max-width: 100%; object-fit: contain; align-self: flex-start; display: block; margin-bottom: 6px; }

/* Hover-Vorschau im Bildraster */
.hoverpreview {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none;
  background: #fff; border-radius: 10px; padding: 8px; box-shadow: 0 24px 60px -12px rgba(4, 0, 60, .45), 0 0 0 1px rgba(0,0,0,.06);
  opacity: 0; visibility: hidden; transition: opacity .15s ease;
  max-width: calc(100vw - 16px);
}
.hoverpreview.is-on { opacity: 1; visibility: visible; }
.hp-img { background: var(--stage); border-radius: 6px; overflow: hidden; display: grid; place-items: center; }
.hp-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.hp-text { display: flex; flex-direction: column; gap: 2px; padding: 8px 4px 2px; max-width: 570px; }
.hp-text strong { font-size: .92rem; line-height: 1.3; }
.hp-text span { font-size: .8rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .hoverpreview { transition: none; } }

/* Slider-Verwaltung */
.slider-upload h2 { margin-bottom: 12px; }
.slider-upload-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .slider-upload-grid { grid-template-columns: 1fr; } }
.dropzone { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 90px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; color: var(--muted); font-weight: 600; flex-direction: column; gap: 8px; }
.dropzone:hover { border-color: var(--brand); color: var(--brand); }
.dropzone input { max-width: 100%; }
.crop-stage { margin-top: 12px; aspect-ratio: 16 / 9; background: var(--stage); border-radius: 8px; overflow: hidden; }
.crop-stage canvas { width: 100%; height: 100%; display: block; }
.crop-controls { display: flex; flex-direction: column; gap: 12px; }
.crop-controls label:not(.check) { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.crop-controls input[type=range] { accent-color: var(--brand); }
.crop-controls input[type=range]:disabled { opacity: .35; }
.slider-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.slider-item { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.slider-thumb { aspect-ratio: 16 / 9; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.slider-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider-meta { padding: 10px 14px 2px; display: flex; flex-direction: column; gap: 2px; font-size: .9rem; }
.slider-actions { display: flex; gap: 2px; padding: 4px 8px 8px; justify-content: flex-end; }
.slider-actions form { display: inline; }
.iconbtn:disabled { opacity: .3; cursor: default; }

/* Text-Editor (Konfiguration) */
.rte { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; font-weight: 400; }
.rte:focus-within { outline: 2px solid var(--accent); border-color: transparent; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.rte-bar button { font: inherit; font-size: .82rem; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; }
.rte-bar button:hover { border-color: var(--brand); color: var(--brand); }
.rte-bar button.is-on { background: var(--brand); color: #fff; border-color: var(--brand); }
.rte-spacer { flex: 1; }
.rte-area { padding: 12px 14px; outline: none; font-size: .95rem; line-height: 1.55; overflow-y: auto; max-height: 520px; }
.rte-area h1, .rte-area h2 { font-size: 1.2rem; margin: .8em 0 .3em; }
.rte-area h3 { font-size: 1.02rem; margin: .7em 0 .3em; }
.rte-area p { margin: 0 0 .7em; }
.rte textarea[data-richtext] { display: none; }
.rte textarea[data-richtext].rte-html { display: block; width: 100%; border: 0; border-radius: 0; font: .85rem/1.5 ui-monospace, monospace; padding: 12px 14px; min-height: 220px; }
.form .field { display: flex; flex-direction: column; gap: 6px; }
.form .field-label { font-weight: 600; font-size: .9rem; }

/* Kopfzeile kompakt, wenn angemeldet (Name + Beschriftungen nur auf sehr breiten Bildschirmen) */
@media (max-width: 1650px) and (min-width: 1101px) {
  .mainnav .btn .lbl, .mainnav .nav-user .lbl { display: none; }
  .mainnav .btn { padding: 7px 9px; }
  .mainnav span.nav-user { display: none; }
}
@media (max-width: 1100px) { .mainnav .btn .lbl { display: inline; } }
/* Suchzeilen umbrechen statt überstehen */
.inline-filter { flex-wrap: wrap; max-width: 100%; }
.inline-filter input { min-width: 0; flex: 1 1 180px; }
.inline-filter input.wide { flex-basis: 280px; }
.pagehead > div { min-width: 0; }

/* hidden-Attribut immer respektieren (auch bei display-Regeln) */
[hidden] { display: none !important; }

/* Logo mit Claim */
.topbar-inner { min-height: 84px; }
.brand img { height: 56px; }
.footer-logo { height: 44px; }
@media (max-width: 1400px) and (min-width: 1101px) { .brand img { height: 48px; } }
@media (max-width: 1100px) { .topbar-inner { min-height: 0; } .brand img { height: 44px; } }
@media (max-width: 380px) { .brand img { height: 38px; } }
.detail-info { top: 100px; }

/* Detailansicht: große Vorschau (bis 1400 px) */
.detail-stage img { width: auto; max-width: 100%; max-height: min(78vh, 1000px); height: auto; }
.detail { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 980px) { .detail { grid-template-columns: 1fr; } }
.detail-stage { padding: clamp(10px, 2vw, 24px); }

.form .row .span-all { grid-column: 1 / -1; margin: 0; display: flex; align-items: center; gap: 6px; }
.form .row .span-all .ic { width: 15px; height: 15px; }

a.nav-user:hover { color: var(--brand); }
/* Mein Konto */
.account { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 980px) { .account { grid-template-columns: 1fr; } }
.account .card h2 { font-size: 1.05rem; margin-bottom: 12px; }
.account .facts { grid-template-columns: 120px 1fr; }
.account .form { margin-top: 10px; }
.kpis { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 4px 0 14px; color: var(--muted); font-size: .9rem; }
.kpis strong { color: var(--text); font-size: 1.15rem; margin-right: 4px; }
