/* Marketing-Dashboard — helles Design nach Business-Suite-Vorbild:
   weiße Sidebar links, Karten auf hellem Grund, runde Chips, Marken-Akzentfarben. */

:root {
    --bg: #f8f8f8;
    --karte: #ffffff;
    --text: #161823;
    --muted: #75757f;
    --rand: #e6e6e8;
    --akzent: #fe2c55;          /* aktive Punkte/Badges */
    --gruen: #1d7a3e;
    --rot: #b23a2f;
    --warn-bg: #fff6e0;
    --warn-rand: #e6c976;
    --sidebar-breite: 232px;
}

* { box-sizing: border-box; }

/* Medien dürfen NIE breiter als ihr Container werden (Videos sind intrinsisch 1080px+
   und würden sonst Grid/Flex-Spalten aufsprengen) */
img, video { max-width: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); display: inline-block; flex: none; }

/* ---------- Grund-Layout: Sidebar + Hauptbereich ---------- */

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-breite);
    background: var(--karte);
    border-right: 1px solid var(--rand);
    display: flex;
    flex-direction: column;
    padding: 18px 12px;
    gap: 6px;
    z-index: 20;
}

.sidebar-brand { font-weight: 700; display: flex; align-items: center; gap: 8px; padding: 4px 10px 14px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    color: var(--text);
}
.sidebar-nav a:hover { background: #f2f2f4; }
.sidebar-nav a.aktiv { background: #f2f2f4; color: var(--akzent); font-weight: 700; }

.sidebar-trenner {
    margin: 14px 12px 4px;
    font-size: 11px;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--muted);
}

.marken-punkt { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.badge {
    margin-left: auto;
    background: var(--akzent);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 12px;
    font-weight: 700;
}

.sidebar-logout { padding: 10px 12px; color: var(--muted); text-decoration: none; border-radius: 10px; }
.sidebar-logout:hover { background: #f2f2f4; }

.haupt { margin-left: var(--sidebar-breite); padding: 22px 26px 40px; max-width: 1240px; }

.seiten-titel { margin: 0 0 16px; font-size: 24px; }

/* Topbar nur mobil */
.topbar { display: none; }
.nav-auf { display: none; }

@media (max-width: 900px) {
    .topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: sticky;
        top: 0;
        background: var(--karte);
        border-bottom: 1px solid var(--rand);
        padding: 12px 16px;
        z-index: 30;
    }
    .topbar-menue { font-size: 20px; cursor: pointer; }
    .topbar-titel { font-weight: 700; display: flex; align-items: center; gap: 8px; }

    .sidebar { transform: translateX(-105%); transition: transform .18s ease; top: 0; }
    .nav-auf:checked ~ .app .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.25); }
    .haupt { margin-left: 0; padding: 16px 14px 40px; }
}

/* Checkbox liegt VOR .app → Selektor oben braucht diese Reihenfolge im HTML */

/* ---------- Chips (Zeitraum / Woche) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; align-items: center; }

.chip {
    border: 1px solid var(--rand);
    background: var(--karte);
    border-radius: 999px;
    padding: 7px 16px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: var(--text);
    cursor: pointer;
}
.chip.aktiv { background: var(--text); color: #fff; border-color: var(--text); }
.chip:hover:not(.aktiv) { background: #f2f2f4; }
.chips-rechts { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Karten / Boxen ---------- */

.box {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: 14px;
    padding: 18px;
    margin: 0 0 18px;
    min-width: 0;
}

.box-titel { margin: 0 0 12px; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }

/* ---------- Zeitplaner (Monats-Belegungsplan, Smoobu-Stil) ----------
   Zeilen = Marke×Kanal, Spalten = Tage des Monats (+ Anfang Folgemonat, gedimmt). */

.haupt--voll { max-width: none; }

/* Scroll-Container = Bezugsrahmen für position:sticky — zwischen ihm und den
   Sticky-Elementen darf KEIN overflow liegen. Border/Radius daher HIER. */
.plan-scroll {
    overflow-x: scroll;
    cursor: grab;
    user-select: none;
    border: 1px solid var(--rand);
    border-radius: 12px;
    background: var(--karte);
}
.plan-scroll.greift { cursor: grabbing; }
.plan-scroll.greift .plan-chip { pointer-events: none; }
.plan-chip { -webkit-user-drag: none; }
/* Scrollbalken immer sichtbar und gut greifbar (die „kleine Schiebe" unten) */
.plan-scroll::-webkit-scrollbar { height: 12px; }
.plan-scroll::-webkit-scrollbar-track { background: #ededf0; border-radius: 8px; }
.plan-scroll::-webkit-scrollbar-thumb { background: #b9b9c2; border-radius: 8px; }
.plan-scroll::-webkit-scrollbar-thumb:hover { background: #97979f; }

/* Aufbau: Flex-ZEILEN mit fester Spaltenbreite (48px) statt Grid — nur so
   funktioniert natives position:sticky für die linke Spalte (in CSS-Grids ist
   die Zelle ihr eigener Containing Block und Sticky bleibt wirkungslos). */
.plan { width: max-content; min-width: 100%; }

.plan-zeile { display: flex; width: max-content; min-width: 100%; }
.plan-zeile--kopf  { border-bottom: 1px solid var(--rand); }
.plan-zeile--daten { border-top: 1px solid var(--rand); }

/* Linke Spalte: ECHTES sticky (Compositor) — wackelt nicht, braucht kein JS */
.plan-spacer, .plan-label {
    position: sticky;
    left: 0;
    z-index: 2;
    flex: none;
    width: 172px;
    box-sizing: border-box;
    background: var(--karte);
    border-right: 1px solid var(--rand);
}

.plan-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.plan-label small { color: var(--muted); font-weight: 500; }

.plan-monat {
    flex: none;
    box-sizing: border-box;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 0 2px;
    border-left: 2px solid #d9d9de;
    white-space: nowrap;
}
/* Monatsname bleibt im Blick, solange sein Monat sichtbar ist (sticky im eigenen Feld) */
.plan-monat > span { position: sticky; left: 184px; display: inline-block; padding-left: 10px; }

.plan-kopf {
    flex: none;
    width: 48px;
    box-sizing: border-box;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
    padding: 4px 2px 6px;
    border-left: 1px solid #f0f0f2;
}
.plan-kopf .tag-nr { display: block; font-size: 14px; font-weight: 600; color: var(--text); margin-top: 1px; }
.plan-kopf .tag-nr.heute {
    background: var(--akzent); color: #fff;
    border-radius: 8px; padding: 1px 7px; display: inline-block;
}
.plan-kopf.we { color: var(--akzent); }

.plan-zelle {
    flex: none;
    width: 48px;
    box-sizing: border-box;
    min-height: 46px;
    padding: 3px 2px;
    border-left: 1px solid #f0f0f2;
}
.plan-zelle.we, .plan-kopf.we { background: #f5f6f9; }           /* Wochenende schattiert (Smoobu-Stil) */
.plan-zelle.m-start, .plan-kopf.m-start { border-left: 2px solid #d9d9de; } /* Monatswechsel */
.plan-zelle.heute-spalte { background: #fff5f7; }

.plan-chip {
    display: block;
    text-decoration: none;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    padding: 3px 1px;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Chip-Farbe = Kanal (Status steckt im Symbol: ⏱ geplant · ✓ veröffentlicht) */
.plan-chip--facebook  { background: #1877f2; color: #fff; }
.plan-chip--instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); color: #fff; }
.plan-chip--tiktok    { background: #161823; color: #fff; }

.kanal-mini { border-radius: 6px; padding: 1px 6px; font-weight: 700; color: #fff; font-size: 10px; }
.kanal-mini--facebook  { background: #1877f2; }
.kanal-mini--instagram { background: linear-gradient(45deg, #f58529, #dd2a7b, #8134af); }
.kanal-mini--tiktok    { background: #010101; }

/* Leiste „ohne Termin wartend" */
.warte-leiste { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.warte-leiste a {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--karte); border: 1px solid var(--rand);
    border-radius: 999px; padding: 7px 14px; text-decoration: none; font-weight: 600; font-size: 14px;
}

/* ---------- Startseite: zwei Fenster unter dem Plan (Smoobu-Stil) ---------- */

.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .duo { grid-template-columns: 1fr; } }

.feed { display: flex; flex-direction: column; gap: 10px; max-height: 430px; overflow-y: auto; padding-right: 4px; }

.feed-item {
    display: block;
    border: 1px solid var(--rand);
    border-radius: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: inherit;
}
.feed-item:hover { background: #fafafa; }

.feed-kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.feed-zeit { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.feed-badge { border-radius: 8px; padding: 2px 8px; font-weight: 700; font-size: 12px; }
.feed-badge--geplant  { background: var(--warn-bg); color: #8a6d1a; }
.feed-badge--live     { background: #e2f2e6; color: var(--gruen); }
.feed-badge--fehler   { background: #fbe3e0; color: var(--rot); }
.feed-badge--wartet   { background: #efeff2; color: #666; }

.feed-text { margin: 6px 0 4px; font-size: 14px; }
.feed-fuss { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }

/* ---------- Post-Popup (Dialog) ---------- */

#post-dialog {
    border: 0;
    border-radius: 16px;
    padding: 0;
    width: min(1040px, 94vw);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .25);
}
#post-dialog::backdrop { background: rgba(22, 24, 35, .5); }

.dialog-kopf {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--rand);
}
.dialog-zu {
    border: 0;
    background: #f2f2f4;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
}
.dialog-zu:hover { background: #e4e4e8; }

.dialog-inhalt { padding: 18px; max-height: 80vh; overflow-y: auto; background: var(--bg); }
.dialog-inhalt .duo { grid-template-columns: 1fr 1fr; }
@media (max-width: 760px) { .dialog-inhalt .duo { grid-template-columns: 1fr; } }

/* ---------- Post-Detail-Seite (Smoobu-Buchungsdetail-Stil) ---------- */

.detail-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--rand);
    font-size: 14px;
}
.detail-zeile:last-of-type { border-bottom: 0; }
.detail-label { color: var(--muted); }

.termin-inline { display: flex; gap: 6px; align-items: center; margin: 0; }
.termin-inline input[type="datetime-local"] {
    border: 1px solid var(--rand);
    border-radius: 8px;
    padding: 5px 8px;
    font-size: 13px;
}

.caption-form summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.caption-form form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.caption-form textarea {
    width: 100%;
    min-height: 110px;
    border: 1px solid var(--rand);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    resize: vertical;
}
.caption-form .btn { align-self: flex-start; }

/* ---------- Marken-Seite: Kanal-Abschnitte + Karten-Reihen ---------- */

.marken-kopf { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; }
.marken-avatar {
    width: 54px; height: 54px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 24px; font-weight: 700; flex: none;
}
.marken-kopf h2 { margin: 0; font-size: 20px; }
.marken-kopf .kanal-status { color: var(--muted); font-size: 14px; }

.reihe { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 10px; }
.reihe:empty::after { content: 'keine'; color: var(--muted); }

.karte {
    flex: 0 0 300px;
    max-width: 300px;
    min-width: 0;
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.karte--kompakt { flex-basis: 210px; max-width: 210px; }

.karte-kopf { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

.status { border-radius: 8px; padding: 2px 8px; background: #f2f2f4; color: #6b6154; font-weight: 600; }
.status--fehler          { background: #fbe3e0; color: var(--rot); }
.status--publish_laufend { background: var(--warn-bg); color: #8a6d1a; }
.status--geplant         { background: var(--warn-bg); color: #8a6d1a; }
.status--veroeffentlicht { background: #e2f2e6; color: var(--gruen); }
.status--abgelehnt       { background: #eee; color: #888; }

/* ---------- Kanal-Vorschau (Post im Kanal-Look) ---------- */

.prev { border: 1px solid var(--rand); border-radius: 10px; overflow: hidden; background: #fff; min-width: 0; max-width: 100%; }
.prev-kopf { display: flex; gap: 10px; align-items: center; padding: 9px 11px; }
.prev-kopf small { color: var(--muted); }
.prev-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; flex: none;
}
.prev-text { padding: 0 11px 9px; white-space: pre-line; font-size: 14px; }
.prev--ig .prev-text { padding-top: 9px; }
.prev-media img, .prev-media video { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.prev-media--quadrat { aspect-ratio: 1; background: #f0f0f2; display: flex; align-items: center; justify-content: center; }
.prev-media--quadrat img, .prev-media--quadrat video { height: 100%; }
.prev-leer { color: var(--muted); }

.prev--tt { background: #000; }
.prev-hochkant {
    position: relative;
    aspect-ratio: 9 / 16;
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
    display: flex; align-items: center; justify-content: center;
}
.prev-hochkant video { width: 100%; height: 100%; max-width: 100%; object-fit: contain; }
.prev-tt-caption {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 12px;
    color: #fff; font-size: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,.75));
    pointer-events: none;
}

/* ---------- Aktionen / Buttons / Termin-Formular ---------- */

.karte-aktionen { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.karte-aktionen form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }

.btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--text);
    color: #fff;
}
.btn:disabled { background: #c9c9cf; cursor: not-allowed; }
.btn--gruen { background: var(--gruen); }
.btn--rot   { background: var(--rot); }
.btn--grau  { background: #6f6f78; }
.btn--klein { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }

.termin { position: relative; }
.termin summary {
    list-style: none;
    cursor: pointer;
    background: #6f6f78; color: #fff;
    border-radius: 10px; padding: 9px 13px;
    font-size: 14px; font-weight: 600;
}
.termin summary::-webkit-details-marker { display: none; }
.termin form {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px; padding: 10px;
    border: 1px solid var(--rand); border-radius: 10px; background: #fafafa;
}
.termin input[type="datetime-local"] {
    border: 1px solid var(--rand); border-radius: 8px; padding: 7px 9px; font-size: 14px;
}

.force { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--rot); font-weight: 600; }

.hinweis { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- Meldungen ---------- */

.alert {
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 14px;
    border: 1px solid var(--rand);
    background: var(--karte);
    font-size: 14px;
}
.alert--ok    { border-color: #9ecfab; background: #e9f6ed; color: var(--gruen); }
.alert--error { border-color: #e2a49d; background: #fbe9e7; color: var(--rot); }
.alert--warn  { border-color: var(--warn-rand); background: var(--warn-bg); color: #7a5c10; }
.karte .alert { margin: 0; font-size: 12px; padding: 8px 10px; }

.leer { color: var(--muted); }

/* ---------- Analyse: KPI-Karten + Chart ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 0 0 16px; }

.kpi {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: 12px;
    padding: 14px;
}
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-wert { font-size: 26px; font-weight: 700; margin: 2px 0; }
.kpi-delta { font-size: 13px; font-weight: 600; }
.kpi-delta--plus  { color: var(--gruen); }
.kpi-delta--minus { color: var(--rot); }
.kpi-delta--null  { color: var(--muted); }

.chart { width: 100%; height: auto; }
.chart-balken { fill: #25aae1; }
.chart-balken:hover { fill: var(--akzent); }

details.abgelehnt summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 6px 0; }

/* ---------- Tabelle (CSV-Vorschau etc.) ---------- */

.tabelle { width: 100%; border-collapse: collapse; background: var(--karte); border-radius: 12px; overflow: hidden; }
.tabelle th, .tabelle td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--rand); font-size: 14px; }
.tabelle th { background: #f2f2f4; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.tabelle tr:last-child td { border-bottom: 0; }

/* ---------- Login ---------- */

.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 18px; background: var(--bg); }

.login-card {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: 16px;
    padding: 28px;
    width: 100%;
    max-width: 360px;
}
.login-brand { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.login-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); display: inline-block; }
.login-sub { color: var(--muted); margin: 4px 0 18px; font-size: 14px; }

.login-card label { display: block; margin: 12px 0 4px; font-size: 14px; font-weight: 600; }
.login-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--rand);
    border-radius: 10px;
    font-size: 15px;
}
.login-card .btn { margin-top: 18px; }
