/* Admin-Portal – eigenes, schlankes Design (gleiche Palette wie öffentlich). */

:root {
    --brand:        #c23a33;
    --brand-dark:   #9e2c26;
    --brand-darker: #7c221d;
    --brand-tint:   #f8ece4;
    --brand-grad:       linear-gradient(135deg, #d55d54 0%, #c23a33 50%, #9a2a24 100%);
    --brand-grad-hover: linear-gradient(135deg, #c94b43 0%, #a8302a 50%, #7f2019 100%);
    --header-grad:      linear-gradient(120deg, #c9463e 0%, #b5352e 46%, #922620 100%);
    --accent:      #d99a17;
    --accent-ink:  #4a3200;
    --accent-grad: linear-gradient(135deg, #e6ad30 0%, #d99a17 55%, #b47e11 100%);
    --cream:  #f6f1ec;
    --paper:  #ffffff;
    --ink:    #241d1b;
    --ink-soft:#4a403c;
    --muted:  #8a7b74;
    --border: #e7ddd6;
    --border-strong: #dcccc1;
    --danger: #c0392b;
    --ok: #2f855a;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 4px 18px rgba(60,30,25,.08);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); color: var(--ink); background: var(--cream); line-height: 1.55; font-size: 16px; }
a { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; }
.muted { color: var(--muted); }
img { max-width: 100%; }

/* Top-Bar */
.admin-top { background: var(--header-grad); color: #fff; box-shadow: 0 2px 16px rgba(120,34,29,.28); position: sticky; top: 0; z-index: 100; }
.admin-top__inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .55rem clamp(14px,3vw,24px); flex-wrap: wrap; }
.admin-brand { display: flex; align-items: center; gap: .55rem; color: #fff; text-decoration: none; font-weight: 800; font-size: 1.1rem; margin-right: auto; }
.admin-brand img { height: 34px; width: 34px; border-radius: 50%; background: #fff; padding: 2px; box-shadow: 0 2px 6px rgba(0,0,0,.22); }
.admin-brand small { font-weight: 500; opacity: .8; font-size: .72rem; display: block; }
.admin-nav { display: flex; gap: .2rem .95rem; flex-wrap: wrap; align-items: center; }
.admin-nav a { color: rgba(255,255,255,.86); text-decoration: none; font-weight: 600; font-size: .92rem; padding: .25rem 0; }
.admin-nav a:hover, .admin-nav a.is-active { color: #fff; }
.admin-nav a.is-active { border-bottom: 2px solid #fff; }
.admin-nav .sep { width: 1px; height: 18px; background: rgba(255,255,255,.3); }
.admin-view { color: rgba(255,255,255,.9); text-decoration: none; font-size: .88rem; }
.admin-view:hover { color: #fff; }

/* Layout */
.admin-main { max-width: 1180px; margin: 0 auto; padding: clamp(16px,3vw,28px); }
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.page-head h1 { margin: 0; font-size: 1.6rem; color: var(--brand-dark); }
.page-head .actions { margin-left: auto; display: flex; gap: .6rem; flex-wrap: wrap; }

.card, .panel { background: var(--paper); border: 1px solid rgba(120,60,50,.06); border-radius: 18px; box-shadow: 0 12px 34px rgba(60,30,25,.07); padding: 1.4rem 1.5rem; }
.card + .card, .panel + .panel { margin-top: 1.2rem; }
.grid { display: grid; gap: 1.2rem; }
.grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 780px) { .grid--2 { grid-template-columns: 1fr; } }

/* Kennzahlen */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.stat-card { background: var(--paper); border: 1px solid rgba(120,60,50,.06); border-radius: 16px; padding: 1.1rem 1.2rem; box-shadow: 0 10px 26px rgba(60,30,25,.06); }
.stat-card__num { font-size: 1.9rem; font-weight: 800; color: var(--brand-dark); line-height: 1; }
.stat-card__lbl { color: var(--ink-soft); font-size: .9rem; margin-top: .3rem; }
.stat-card__sub { color: var(--muted); font-size: .78rem; margin-top: .15rem; }
.stat-bar { display: grid; grid-template-columns: 8.5rem 1fr auto; align-items: center; gap: .6rem; margin: .3rem 0; font-size: .9rem; }
.stat-bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-bar__track { background: var(--border); height: .55rem; border-radius: 999px; overflow: hidden; }
.stat-bar__fill { display: block; height: 100%; background: var(--brand-grad); border-radius: 999px; }
.stat-bar__val { font-variant-numeric: tabular-nums; color: var(--ink-soft); white-space: nowrap; }
.stat-cols { display: flex; align-items: flex-end; gap: 2px; height: 120px; padding: .4rem; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stat-cols__col { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; opacity: .85; min-height: 2px; }
.stat-cols__col:hover { opacity: 1; }
.stat-range { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.layout-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; }
@media (max-width: 720px) { .layout-2col { grid-template-columns: 1fr; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; background: var(--brand-grad); color: #fff; border: 0; border-radius: 999px; padding: .6rem 1.2rem; font: inherit; font-weight: 700; text-decoration: none; box-shadow: 0 5px 14px rgba(158,44,38,.3); transition: transform .12s, box-shadow .12s, background .12s; }
.btn:hover { background: var(--brand-grad-hover); color: #fff; transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--brand-dark); border: 1.5px solid var(--border-strong); box-shadow: none; }
.btn--ghost:hover { background: var(--brand-tint); }
.btn--gold { background: var(--accent-grad); color: var(--accent-ink); box-shadow: 0 5px 14px rgba(180,126,17,.3); }
.btn--danger { background: linear-gradient(135deg,#d9534f,#c0392b); }
.btn--sm { padding: .4rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Formulare – schlanke Inputs mit rotem Fokus-Glow */
.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .4rem; color: var(--ink-soft); letter-spacing: .01em; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: .35rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search],
input[type=datetime-local], input[type=date], input[type=time], textarea, select {
    width: 100%; font: inherit; padding: .74rem .95rem; color: var(--ink); background: #fdfbfa;
    border: 1px solid #e7ddd4; border-radius: 12px;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(194,58,51,.13); background-color: #fff; }
input::placeholder, textarea::placeholder { color: #b9aaa1; }
textarea { min-height: 8rem; resize: vertical; }
select {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c23a33' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .95rem center;
}
input[type=datetime-local], input[type=date], input[type=time] { color-scheme: light; }
.input-code { letter-spacing: .5em; text-align: center; font-size: 1.4rem; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Tabellen */
.admin-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: var(--brand); color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: #fbf7f4; }

/* Status-Badges */
.badge { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.badge--pub { background: #e9f6ee; color: var(--ok); }
.badge--draft { background: #f1ece8; color: var(--muted); }
.badge--warn { background: #fdf4df; color: #b7791f; }

/* Flash */
.flash { border-radius: var(--radius-sm); padding: .8rem 1.05rem; margin-bottom: 1.1rem; border: 1px solid var(--border-strong); background: var(--paper); }
.flash--success { background: #e9f6ee; border-color: rgba(47,133,90,.3); }
.flash--error { background: var(--brand-tint); border-color: rgba(194,58,51,.35); }
.flash--info { background: #eef4fb; border-color: rgba(43,108,176,.3); }

/* Login / Setup */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(80% 60% at 50% -10%, rgba(194,58,51,.14), transparent 70%), var(--cream); }
.auth-card { width: min(30rem, 100%); background: var(--paper); border: 1px solid rgba(120,60,50,.06); border-radius: 22px; box-shadow: 0 24px 60px rgba(60,30,25,.15); padding: 2.2rem 2.2rem 1.8rem; }
.auth-card__logo { text-align: center; margin-bottom: 1rem; }
.auth-card__logo img { height: 66px; }
.auth-card h1 { text-align: center; font-size: 1.4rem; margin: 0 0 .3rem; color: var(--brand-dark); }
.auth-card p.sub { text-align: center; color: var(--muted); margin: 0 0 1.4rem; font-size: .92rem; }
.steps { display: flex; gap: .5rem; justify-content: center; margin-bottom: 1.3rem; }
.step { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.step__no { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; background: var(--border); color: var(--ink-soft); font-weight: 700; }
.step.is-active .step__no { background: var(--brand); color: #fff; }
.step.is-done .step__no { background: var(--ok); color: #fff; }

/* Editor-Layout */
.editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.4rem; align-items: start; }
@media (max-width: 900px) { .editor-layout { grid-template-columns: 1fr; } }
.editor-main { min-width: 0; }
.editor-main input.title-input { width: 100%; font-size: 1.7rem; font-weight: 800; border: 0; border-bottom: 2px solid var(--border); border-radius: 0; background: transparent; padding: .3rem 0 .5rem; margin-bottom: .8rem; color: var(--ink); }
.editor-main input.title-input:focus { outline: none; border-bottom-color: var(--brand); box-shadow: none; }
.editor-holder { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.2rem 2rem; min-height: 420px; }
.editor-side { display: flex; flex-direction: column; gap: 1rem; }
.editor-side .card { padding: 1rem 1.1rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .92rem; margin: .25rem 0; cursor: pointer; }
.check input { width: auto; }
.check-list { display: flex; flex-direction: column; gap: .1rem; max-height: 12rem; overflow: auto; }
.cover-preview { border-radius: var(--radius-sm); overflow: hidden; margin-bottom: .6rem; border: 1px solid var(--border); }
.cover-preview img { display: block; width: 100%; }
.cover-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Infobox-Block im Editor */
/* Alt-Text-Feld im Bild-Block (assets/bild-alt.js). Bewusst unauffaellig:
   Es gehoert zum Bild, soll den Textfluss im Editor aber nicht zerreissen. */
.ce-bild-alt { display: flex; align-items: center; gap: .5rem; margin-top: .45rem; }
.ce-bild-alt label { font-size: .78rem; color: var(--muted); flex: none; }
.ce-bild-alt input {
    flex: 1; min-width: 0; font: inherit; font-size: .85rem;
    padding: .3rem .5rem; border: 1px solid var(--border-strong);
    border-radius: 6px; background: #fff;
}
.ce-bild-alt input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

.ce-infobox { border: 1px solid var(--border-strong); border-left: 5px solid var(--brand); background: var(--brand-tint); border-radius: 10px; padding: .7rem .9rem; }
.ce-infobox--info    { background: #eaf2fb; border-left-color: #2b6cb0; }
.ce-infobox--success { background: #e9f6ee; border-left-color: #2f855a; }
.ce-infobox--warning { background: #fdf4df; border-left-color: #b7791f; }
.ce-infobox--tip     { background: var(--brand-tint); border-left-color: var(--brand); }
.ce-infobox__bar { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .5rem; }
.ce-infobox__type { border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; cursor: pointer; }
.ce-infobox__type.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ce-infobox__title { font-weight: 800; outline: none; margin-bottom: .2rem; }
.ce-infobox__msg { outline: none; }
[contenteditable][data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }

/* Medien-Galerie */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.media-item { background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.media-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--brand-tint); }
.media-item__meta { padding: .5rem .6rem; display: flex; flex-direction: column; gap: .45rem; font-size: .78rem; }
.media-item__actions { display: flex; gap: .4rem; align-items: center; }

/* TOTP-Einrichtung */
.totp-qr { display: grid; place-items: center; padding: 1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); width: max-content; margin: 0 auto 1rem; }
.totp-secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; font-weight: 700; letter-spacing: .06em; background: var(--brand-tint); color: var(--brand-darker); padding: .6rem .8rem; border-radius: 8px; text-align: center; word-break: break-all; }

/* === Poststelle (Graph-Mailversand) =================================== */
.status-list { list-style: none; padding: 0; margin: .8rem 0 1rem; }
.status-list li { padding: .3rem 0; font-size: .92rem; }
.status-list code { font-size: .85em; }

.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .4rem; }
.inline-form label { font-weight: 600; font-size: .85rem; color: var(--ink-soft); }
.inline-form input[type="email"] { flex: 1 1 16rem; min-width: 0; margin: 0; }

.callout {
    margin: 1.1rem 0;
    padding: .9rem 1.1rem;
    background: var(--brand-tint);
    border-left: 3px solid var(--brand);
    border-radius: 0 10px 10px 0;
    font-size: .88rem; line-height: 1.6;
}
.callout code { font-size: .85em; }
.form-actions { margin-top: 1.3rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* === Seitenleisten-Editor ============================================== */
.sidebar-editor { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1.1rem; }
.sb-block { background: var(--paper); border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden; }
.sb-block--off { opacity: .62; }
.sb-block__head { display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; background: var(--brand-tint); border-bottom: 1px solid var(--border-strong); }
.sb-block__grip { color: var(--muted); cursor: default; letter-spacing: -2px; }
.sb-block__type { flex: 1; color: var(--brand-dark); }
.sb-block__move { display: inline-flex; gap: .25rem; }
.sb-block__move .btn { padding: .2rem .55rem; }
.sb-block__toggle { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--ink-soft); white-space: nowrap; }
.sb-block__body { padding: .9rem; display: flex; flex-wrap: wrap; gap: .9rem; }
.sb-block__body .field { flex: 1 1 100%; margin: 0; }
.sb-block__body .field--narrow { flex: 0 0 8rem; }
.sb-add { margin-bottom: 1.1rem; }

/* === Statistik-Filter ================================================== */
.stat-filter { display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end; margin-bottom: 1.1rem; padding: 1rem 1.1rem; }
.stat-filter__f { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.stat-filter__f span { font-weight: 600; }
.stat-filter__f select, .stat-filter__f input { margin: 0; font-size: .88rem; padding: .4rem .6rem; min-width: 8rem; }
.stat-filter__actions { display: flex; gap: .5rem; margin-left: auto; }

.stat-trend { font-weight: 700; font-size: .8rem; }
.stat-trend--up   { color: #2f855a; }
.stat-trend--down { color: #a4231d; }

/* Testbereich unter den Amazon-Zugangsdaten deutlich absetzen. */
.amazon-test {
    margin-top: 1.4rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--border-strong);
}
.amazon-test .inline-form { gap: .9rem; }
.amazon-test .muted { font-size: .85rem; line-height: 1.4; }
/* Die Status-Liste braucht unten Luft zum Formular. */
.card > .status-list { margin-bottom: 1.2rem; }

/* Im Raster nebeneinander stehende Karten NICHT versetzen: Die Regel
   `.card + .card { margin-top }` ist für gestapelte Karten gedacht und ließ
   die zweite Spalte sonst um 1,2rem tiefer beginnen. */
.grid > .card + .card,
.grid > .panel + .panel { margin-top: 0; }

/* === Wochentag-x-Stunde-Raster ========================================= */
.heat { display: flex; flex-direction: column; gap: 3px; margin: .6rem 0 .4rem; }
.heat__row { display: grid; grid-template-columns: 2.2rem repeat(24, 1fr); gap: 3px; align-items: center; }
.heat__day { font-size: .72rem; color: var(--muted); font-weight: 600; }
.heat__hh { font-size: .68rem; color: var(--muted); text-align: left; }
.heat__cell { height: 15px; border-radius: 3px; }
.heat__row--head { margin-bottom: 1px; }

/* Karten im Raster nur so hoch wie ihr Inhalt. Grid streckt Kinder sonst auf
   die volle Zeilenhöhe – neben einem langen Formular stand rechts dadurch ein
   großer leerer weißer Kasten. */
.grid { align-items: start; }

/* Abstand zwischen Raster und nachfolgender/vorheriger Karte. `.card + .card`
   greift hier nicht, weil der Nachbar kein .card ist, sondern der .grid-Kasten –
   dadurch klebten die Blöcke direkt aneinander. */
.grid + .card, .grid + .panel,
.card + .grid, .panel + .grid,
.grid + .grid { margin-top: 1.2rem; }

/* === Statistik: Kopfbereich, Navigation, Filter ========================= */
.stat-hero { margin-bottom: 1rem; }
.stat-hero__top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stat-hero__top h1 { margin: 0; }
.stat-hero__live {
    display: inline-flex; align-items: center; gap: .45rem;
    background: #eef6ef; border: 1px solid var(--border);
    border-radius: 999px; padding: .3rem .85rem; font-size: .88rem;
}
.stat-hero__dot {
    width: .55rem; height: .55rem; border-radius: 50%; background: #3faa4b;
    box-shadow: 0 0 0 3px rgba(63,170,75,.25);
}
.stat-hero__live-sub { color: var(--muted); font-size: .82rem; }
.stat-hero__sub { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: .5rem 0 0; max-width: 62rem; }

/* Sprungmarken zu den Abschnitten */
.stat-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.stat-nav a {
    text-decoration: none; font-size: .85rem; font-weight: 600;
    color: var(--brand-dark); background: var(--paper);
    border: 1px solid var(--border-strong); border-radius: 999px;
    padding: .3rem .8rem;
}
.stat-nav a:hover { background: var(--brand-tint); border-color: var(--brand-light); }

/* Zeitraum als zusammenhängende Segment-Wahl */
.stat-range { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .9rem; }
.stat-range__label { font-size: .85rem; color: var(--muted); font-weight: 600; }
.stat-range__seg {
    display: inline-flex; background: var(--paper);
    border: 1px solid var(--border-strong); border-radius: 999px; overflow: hidden;
}
.stat-range__seg a {
    text-decoration: none; font-size: .85rem; font-weight: 600;
    color: var(--ink-soft); padding: .38rem .95rem;
    border-right: 1px solid var(--border);
}
.stat-range__seg a:last-child { border-right: 0; }
.stat-range__seg a:hover { background: var(--brand-tint); }
.stat-range__seg a.is-active { background: var(--brand-grad); color: #fff; }

/* Filter als aufklappbarer Kasten */
.statfilter { margin-bottom: 1.1rem; }
.statfilter__wrap {
    background: var(--paper); border: 1px solid var(--border-strong);
    border-radius: 14px; overflow: hidden;
}
.statfilter__head {
    display: flex; align-items: center; gap: .7rem; cursor: pointer;
    padding: .7rem 1rem; font-weight: 700; font-size: .9rem; list-style: none;
}
.statfilter__head::-webkit-details-marker { display: none; }
.statfilter__head .muted { font-weight: 400; font-size: .84rem; }
.statfilter__chev { margin-left: auto; transition: transform .18s; color: var(--muted); }
.statfilter__wrap[open] .statfilter__chev { transform: rotate(180deg); }
.statfilter__body {
    display: flex; flex-wrap: wrap; gap: .8rem 1rem; align-items: flex-end;
    padding: .2rem 1rem 1rem; border-top: 1px solid var(--border);
}
.statfilter__foot {
    display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
    padding: .7rem 1rem; background: var(--bg-soft, #faf6f2); border-top: 1px solid var(--border);
}

.fl { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.fl span { font-weight: 600; }
.fl select { margin: 0; font-size: .88rem; padding: .4rem .6rem; min-width: 8.5rem; }
.fl--set select { border-color: var(--brand); background: var(--brand-tint); }

.daterange { display: flex; align-items: flex-end; gap: .5rem; flex-wrap: wrap; }
.daterange__ico { font-size: 1.1rem; padding-bottom: .35rem; }
.daterange__f { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--muted); }
.daterange__f span { font-weight: 600; }
.daterange__f input { margin: 0; font-size: .88rem; padding: .4rem .6rem; }
.daterange__f.is-set input { border-color: var(--brand); background: var(--brand-tint); }
.daterange__sep { color: var(--muted); padding-bottom: .5rem; }
.daterange__hint { font-size: .75rem; color: var(--muted); padding-bottom: .45rem; }

/* Aktive Filter als einzeln entfernbare Marken */
.fchips { display: flex; flex-wrap: wrap; gap: .4rem; }
.fchip {
    display: inline-flex; align-items: center; gap: .4rem;
    background: var(--brand-tint); color: var(--brand-dark);
    border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
    border-radius: 999px; padding: .2rem .3rem .2rem .7rem; font-size: .8rem; font-weight: 600;
}
.fchip a {
    text-decoration: none; color: var(--brand-dark); font-weight: 700;
    width: 1.15rem; height: 1.15rem; display: grid; place-items: center;
    border-radius: 50%; background: rgba(255,255,255,.7);
}
.fchip a:hover { background: var(--brand); color: #fff; }

/* Veränderung gegenüber der Vorperiode */
.delta { font-size: .78rem; font-weight: 700; margin-top: .2rem; }
.delta--up   { color: #2f855a; }
.delta--down { color: #a4231d; }
.delta--flat { color: var(--muted); font-weight: 400; }

/* === Statistik: Erscheinungsbild wie camping-check ====================== */
/* Kopf als farbiger Kasten statt Text auf dem Seitenhintergrund. */
.stat-hero {
    background: var(--brand-grad);
    color: #fff;
    border-radius: 18px;
    padding: 1.5rem 1.7rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 10px 30px rgba(158,44,38,.22);
}
.stat-hero__top { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.stat-hero__top h1 { margin: 0; color: #fff; font-size: 1.9rem; }
.stat-hero__live {
    margin-left: auto;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.32);
    color: #fff;
    backdrop-filter: blur(2px);
}
.stat-hero__live-sub { color: rgba(255,255,255,.8); }
.stat-hero__sub { color: rgba(255,255,255,.92); margin: .7rem 0 0; font-size: .9rem; }
.stat-hero__sub strong { color: #fff; }
.stat-hero a { color: #fff; text-decoration: underline; }

/* Filterleiste ebenfalls farbig, damit sie als Bedienelement lesbar ist. */
.statfilter__wrap { border: 0; box-shadow: var(--shadow); }
.statfilter__head {
    background: var(--brand-grad);
    color: #fff;
    padding: .85rem 1.2rem;
    font-size: .95rem;
}
.statfilter__head .muted { color: rgba(255,255,255,.85); margin-left: auto; }
.statfilter__chev { color: #fff; margin-left: .5rem; }
.statfilter__body { background: var(--paper); border-top: 0; padding: 1.1rem 1.2rem; }
.statfilter__foot { background: var(--brand-tint); border-top: 1px solid var(--border); }

/* Abschnitts-Überschriften in der Markenfarbe. */
#msec-besucher, #msec-sitzungen, #msec-herkunft,
#msec-wege, #msec-crawler, #msec-magic, #msec-inhalte {
    color: var(--brand-dark);
    font-size: 1.5rem;
}

/* Kennzahlen-Karten mit farbiger Oberkante. */
.stat-card { border-top: 3px solid var(--brand); }

/* `hidden` muss auch auf Elementen greifen, die selbst ein display setzen.
   Ohne diese Regel schlägt `.btn { display:inline-flex }` die Browser-Vorgabe
   `[hidden] { display:none }` – der Knopf blieb trotz hidden sichtbar. */
[hidden] { display: none !important; }

/* Editor-Seitenleiste hat einen eigenen gap – die Stapel-Regel würde sich
   addieren (1rem + 1.2rem) und die Karten doppelt so weit auseinanderziehen. */
.editor-side > .card + .card { margin-top: 0; }

/* ===== Werbe-Verwaltung ================================================= */

/* Schemazeichnung: zeigt, wo der Platz auf der Seite sitzt. */
.ad-schema { width: 100%; height: auto; display: block; border: 1px solid var(--border);
    border-radius: 8px; background: #fff; margin-bottom: .7rem; }

/* Übersicht: Kachel je Werbeplatz */
.ad-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: .9rem; margin-bottom: 1.2rem; }
.ad-slot-card { display: block; padding: .9rem 1rem; border: 1px solid var(--border);
    border-radius: 12px; background: #fff; text-decoration: none; color: var(--ink);
    transition: border-color .12s, box-shadow .12s, transform .12s; }
.ad-slot-card:hover { border-color: var(--brand);
    box-shadow: 0 4px 14px rgba(194,58,51,.15); transform: translateY(-1px); }
.ad-slot-card__head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .15rem; }
.ad-slot-card__head strong { font-size: .9rem; line-height: 1.3; color: var(--brand-dark); }
.ad-slot-card__count { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.ad-slot-card__size { font-size: .75rem; color: var(--muted); margin: 0 0 .5rem; }
.ad-slot-card__more { font-size: .8rem; font-weight: 600; color: var(--brand-dark); }

/* Kopf der Unterseite: Zeichnung links, Kennzahlen rechts */
.ad-head { display: flex; gap: 1.2rem; align-items: flex-start; }
.ad-head__schema { flex: 0 0 200px; }
.ad-head__schema .ad-schema { margin: 0; }
.ad-head__body { flex: 1; min-width: 0; }
@media (max-width: 640px) { .ad-head { flex-direction: column; } .ad-head__schema { flex: none; width: 100%; } }

/* Verteilungsbalken je Platzierung */
.ad-ratio { display: flex; width: 100%; height: 14px; border-radius: 999px;
    overflow: hidden; background: #ece7e3; margin: .1rem 0 .4rem; }
.ad-ratio__seg { height: 100%; background: var(--brand); }
/* „Leer" = keine Werbung: schraffiert, damit es klar als Lücke lesbar ist. */
.ad-ratio__seg--none { background: repeating-linear-gradient(45deg,
    #e8e2dd, #e8e2dd 4px, #d3c9c2 4px, #d3c9c2 8px); }
.ad-ratio__legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem;
    font-size: .76rem; color: var(--muted); margin-bottom: .5rem; }
.ad-ratio__key { display: inline-flex; align-items: center; gap: .3rem; }
.ad-ratio__chip { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--brand); }
.ad-ratio__chip--none { background: repeating-linear-gradient(45deg,
    #e8e2dd, #e8e2dd 3px, #d3c9c2 3px, #d3c9c2 6px); }

/* Zustand und Kennzeichen einer Anzeige */
.ad-dot { width: 9px; height: 9px; border-radius: 50%; background: #d3c9c2; flex: none; }
.ad-dot.is-on { background: #3faa4b; }
.ad-tag { font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: .1rem .45rem; border-radius: 20px; background: #ece7e3; color: #6b5c55; }
.ad-tag--amz { background: var(--accent, #d99a17); color: #4a3200; }
.ad-tag--consent { background: #d9f2ee; color: #1c6b60; }
.ad-tag--none { background: #ece7e3; color: #7a6f68; }
.ad-tag--pages { background: #e8eef7; color: #2c5580; text-transform: none; letter-spacing: 0; }
.ad-tag--zeit { background: #f8eed6; color: #6b4e00; text-transform: none; letter-spacing: 0; }

/* Anzeige mit Vorschau */
.ad-item { position: relative; }
.ad-item--tinted { border-width: 2px; border-style: solid; }
.ad-item__swatch { position: absolute; top: -1px; left: 1.1rem;
    width: 34px; height: 4px; border-radius: 0 0 3px 3px; }
.ad-item__bar { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ad-prev { border: 1px dashed var(--border); border-radius: 10px; padding: .8rem;
    background: #faf8f6; overflow: auto; text-align: center; }
.ad-prev__none { color: var(--muted); font-size: .82rem; font-style: italic; padding: .6rem 0; }
.ad-prev-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--brand-dark); margin: .9rem 0 .3rem; }
.ad-prev-label:first-of-type { margin-top: 0; }
.ad-code { overflow: auto; background: #faf8f6; border: 1px solid var(--border);
    padding: .6rem; border-radius: 8px; font-size: .75rem; }

/* Fester Werbefrei-Block – passend zur Schraffur im Balken */
.ad-none-block { border: 2px dashed #d3c9c2; }
.ad-none-form { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }

textarea.mono { min-height: 7rem; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }

/* ===== Struktur-Blöcke im Editor (Einleitung, Inhaltsverzeichnis) ======== */

/* Einleitung: sieht schon im Editor aus wie später im Beitrag. */
.ce-lead { border-left: 3px solid var(--brand); background: var(--brand-tint, #f8ece4);
    border-radius: 0 10px 10px 0; padding: .7rem .9rem; margin: .2rem 0; }
.ce-lead__kopf { font-size: .68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: var(--brand-dark); margin-bottom: .3rem; }
.ce-lead__text { font-size: 1.05rem; line-height: 1.6; outline: none; min-height: 1.6em; }
.ce-lead__text:empty::before { content: attr(data-platzhalter); color: var(--muted); }

/* Inhaltsverzeichnis: bewusst flach – der Block hat keinen eigenen Inhalt,
   er wird beim Anzeigen aus den Überschriften gebaut. */
.ce-toc { border: 1px dashed var(--border); border-radius: 10px; background: #faf8f6;
    padding: .7rem .9rem; margin: .2rem 0; }
.ce-toc__kopf { font-size: .8rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .45rem; }
.ce-toc__symbol { margin-right: .2rem; }
.ce-toc__titel { width: 100%; max-width: 16rem; font-size: .85rem; padding: .3rem .5rem;
    border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.ce-toc__hinweis { font-size: .76rem; color: var(--muted); margin: .45rem 0 0; line-height: 1.45; }

/* Aktiver Reiter in der Bereichsauswahl (Seitenleiste, Statistik). */
.stat-nav a.is-active {
    background: var(--brand-grad);
    border-color: transparent;
    color: #fff;
    font-weight: 700;
}
.stat-nav a.is-active:hover { background: var(--brand-grad-hover); border-color: transparent; color: #fff; }

/* Video-Block im Editor */
.ce-video { border: 1px dashed var(--border); border-radius: 10px; background: #faf8f6;
    padding: .7rem .9rem; margin: .2rem 0; }
.ce-video__kopf { font-size: .8rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .3rem; }
.ce-video__hinweis { font-size: .78rem; color: var(--muted); margin: 0; line-height: 1.45; word-break: break-all; }

/* Werbe-Block im Editor */
.ce-ad { border: 1px dashed var(--border); border-radius: 10px; background: #faf8f6;
    padding: .7rem .9rem; margin: .2rem 0; }
.ce-ad__kopf { font-size: .8rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .4rem; }
.ce-ad__slot { width: 100%; max-width: 26rem; font-size: .85rem; padding: .35rem .5rem;
    border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.ce-ad__hinweis { font-size: .78rem; color: var(--muted); margin: .45rem 0 0; line-height: 1.45; }

/* Status eines Seitenleisten-Blocks: zeigt, ob er gerade etwas anzeigen würde. */
.sb-block__status { margin: .6rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.sb-block__status--leer { color: #8a5a12; background: #fdf4df; border-radius: 8px;
    padding: .45rem .6rem; }

/* Speichern-Leiste oben – klebt beim Scrollen mit. */
.form-actions--oben { position: sticky; top: var(--admin-kopf, 56px); z-index: 20; display: flex; gap: .6rem;
    padding: .7rem 0; margin-bottom: .4rem; background: var(--cream);
    box-shadow: 0 6px 12px -10px rgba(0,0,0,.4); }

/* Griff zum Verschieben – sieht jetzt nicht nur so aus, sondern greift auch. */
.sb-block__grip { cursor: grab; user-select: none; touch-action: none; border-radius: 6px; }
.sb-block__grip:active { cursor: grabbing; }
.sb-block__grip:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sb-block.is-dragging { opacity: .55; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.sidebar-editor { position: relative; }

.sb-ungespeichert {
    display: inline-flex; align-items: center; margin-left: .3rem;
    background: #fdf4df; color: #8a5a12; border-radius: 999px;
    padding: .25rem .7rem; font-size: .78rem; font-weight: 700;
}
kbd {
    font: inherit; font-size: .8em; background: #fff; border: 1px solid var(--border);
    border-bottom-width: 2px; border-radius: 5px; padding: .05em .35em;
}

/* Blöcke im Editor verschieben: Einfügemarke ober-/unterhalb des Zielblocks. */
.mcs-sortiert .ce-block { transition: none; }
.ce-block.mcs-drop-oben  { box-shadow: 0 -3px 0 0 var(--brand); }
.ce-block.mcs-drop-unten { box-shadow: 0  3px 0 0 var(--brand); }
.ce-toolbar__settings-btn[draggable="true"] { cursor: grab; }
.ce-toolbar__settings-btn[draggable="true"]:active { cursor: grabbing; }

/* Anhänge im Editor */
.datei-liste { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .4rem; }
.datei-liste li { display: flex; align-items: center; gap: .5rem;
    background: #faf8f6; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .55rem; }
.datei-liste__typ { flex: none; min-width: 2.6rem; text-align: center; background: var(--brand);
    color: #fff; border-radius: 5px; font-size: .6rem; font-weight: 800; padding: .2rem .3rem; }
.datei-liste__text { display: flex; flex-direction: column; min-width: 0; flex: 1; font-size: .84rem; }
.datei-liste__text .muted { font-size: .74rem; }

.ce-files { border: 1px dashed var(--border); border-radius: 10px; background: #faf8f6;
    padding: .7rem .9rem; margin: .2rem 0; }
.ce-files__kopf { font-size: .8rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .45rem; }
.ce-files__zeile { display: flex; align-items: flex-start; gap: .5rem; padding: .18rem 0; font-size: .88rem; }
.ce-files__meta { color: var(--muted); font-size: .78rem; }
.ce-files__hinweis { font-size: .78rem; color: var(--muted); margin: .5rem 0 0; line-height: 1.45; }
.datei-liste__url { width: 100%; margin-top: .25rem; font-size: .72rem; padding: .2rem .35rem;
    border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--muted);
    font-family: ui-monospace, Menlo, monospace; }

/* Ablagefläche für Dateien */
.datei-ablage { border: 2px dashed var(--border-strong); border-radius: 10px;
    padding: .9rem; text-align: center; margin-top: .8rem; transition: border-color .12s, background .12s; }
.datei-ablage.is-over { border-color: var(--brand); background: var(--brand-tint); }

/* Fortschritts-Fenster */
body.hat-fenster { overflow: hidden; }
.datei-fenster { position: fixed; inset: 0; z-index: 200; background: rgba(36,29,27,.55);
    display: flex; align-items: center; justify-content: center; padding: 1rem; }
.datei-fenster__kasten { background: #fff; border-radius: 14px; padding: 1.4rem;
    width: min(640px, 100%); max-height: 85vh; overflow: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.datei-fenster__kasten h2 { margin: 0 0 1rem; font-size: 1.15rem; }

.dz { border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; margin-bottom: .7rem; }
.dz__kopf { display: flex; align-items: baseline; gap: .6rem; }
.dz__datei { font-size: .9rem; word-break: break-all; }
.dz__status { margin-left: auto; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.dz__balken { height: 6px; border-radius: 999px; background: #ece7e3; overflow: hidden; margin-top: .5rem; }
.dz__fuellung { display: block; height: 100%; width: 0; background: var(--brand-grad); transition: width .15s; }
.dz--fertig { border-color: rgba(63,170,75,.5); background: #f4fbf5; }
.dz--fertig .dz__status { color: #2f7d3a; font-weight: 700; }
.dz--fehler { border-color: rgba(194,58,51,.5); background: var(--brand-tint); }
.dz__grund { margin: .5rem 0 0; font-size: .84rem; color: var(--brand-dark); line-height: 1.45; }
.dz__felder { display: grid; gap: .4rem; margin-top: .6rem; }
.dz__felder input { font-size: .86rem; padding: .4rem .55rem; }
.dz__url { font-family: ui-monospace, Menlo, monospace; font-size: .74rem; color: var(--muted); }
.dz__gespeichert { font-size: .76rem; color: #2f7d3a; min-height: 1em; }

/* ===== Verlinken-Fenster in der Auswahlleiste ============================ */
.mcs-link { padding: .85rem .9rem; min-width: 22rem; max-width: 26rem; }
.mcs-link__label { display: block; font-weight: 700; font-size: .8rem; margin-bottom: .3rem; }
.mcs-link__feld {
    width: 100%; font: inherit; font-size: .9rem; padding: .5rem .65rem;
    border: 1px solid var(--border-strong, #e2d5cb); border-radius: 8px; background: #fff;
}
.mcs-link__feld:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.mcs-link__fehler {
    margin: .45rem 0 0; font-size: .8rem; font-weight: 700; color: var(--brand-dark);
    background: var(--brand-tint); border-radius: 6px; padding: .35rem .5rem;
}
.mcs-link__hinweis { margin: .45rem 0 0; font-size: .76rem; color: var(--muted); line-height: 1.4; }
.mcs-link__leiste { display: flex; gap: .45rem; margin-top: .7rem; }
.mcs-link__btn {
    font: inherit; font-size: .84rem; font-weight: 700; cursor: pointer;
    padding: .42rem .8rem; border-radius: 999px;
    border: 1px solid var(--border-strong, #e2d5cb); background: #fff; color: var(--ink);
}
.mcs-link__btn:hover { background: var(--brand-tint); }
.mcs-link__btn--haupt { background: var(--brand-grad); color: #fff; border-color: transparent; }
.mcs-link__btn--haupt:hover { background: var(--brand-grad-hover); color: #fff; }

/* ===== Feste Werkzeugleiste über dem Editor ============================== */
.ed-leiste {
    /* Unter der klebenden Kopfzeile einrasten – deren Höhe misst admin.js.
       Bei top:0 läge die Leiste dahinter und wäre beim Scrollen unsichtbar. */
    position: sticky; top: var(--admin-kopf, 56px); z-index: 30;
    display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    padding: .45rem .55rem; margin-bottom: .7rem;
    box-shadow: 0 4px 14px -8px rgba(0,0,0,.35);
}
.ed-leiste__gruppe { display: flex; flex-wrap: wrap; gap: .25rem; }
/* Trennstrich zwischen den Gruppen – ohne eigenes Element. */
.ed-leiste__gruppe + .ed-leiste__gruppe {
    border-left: 1px solid var(--border); padding-left: .6rem;
}
.ed-knopf {
    font: inherit; font-size: .82rem; line-height: 1.1; cursor: pointer;
    min-width: 2rem; height: 2rem; padding: 0 .45rem;
    display: inline-flex; align-items: center; justify-content: center; gap: .25rem;
    background: #faf8f6; color: var(--ink);
    border: 1px solid var(--border); border-radius: 7px;
    transition: background .1s, border-color .1s, color .1s;
}
.ed-knopf:hover { background: var(--brand-tint); border-color: var(--brand-light); color: var(--brand-dark); }
.ed-knopf:active { transform: translateY(1px); }
.ed-knopf:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.ed-knopf--text { padding: 0 .6rem; white-space: nowrap; }
.ed-knopf mark { background: #ffe9a8; padding: 0 .15rem; border-radius: 2px; }
.ed-knopf code { font-size: .78rem; }

/* Link-Fenster der Leiste */
.ed-link { position: fixed; inset: 0; z-index: 210; background: rgba(36,29,27,.5);
    display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ed-link__kasten { background: #fff; border-radius: 14px; padding: 1.3rem;
    width: min(520px, 100%); box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.ed-link__kasten h3 { margin: 0 0 .9rem; font-size: 1.1rem; }
.ed-link__label { display: block; font-weight: 700; font-size: .84rem; margin-bottom: .3rem; }
.ed-link__feld { width: 100%; font: inherit; font-size: .95rem; padding: .6rem .75rem;
    border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; }
.ed-link__feld:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.ed-link__fehler { margin: .5rem 0 0; font-size: .84rem; font-weight: 700;
    color: var(--brand-dark); background: var(--brand-tint); border-radius: 7px; padding: .4rem .6rem; }
.ed-link__hinweis { margin: .5rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.45; }
.ed-link__leiste { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
