/* ═══════════════════════════════════════════════════════════════════
   KOMMUNALPOLITIK BEELEN · Theme "Beelen-Grün"
   Orientiert am Grundlagen-Design von Bündnis 90/Die Grünen:
   Hauptfarbe „Tanne" (#005437 / #00432C / #002216), Akzentblau,
   Sonnenblume als Bildmarke. Geteiltes Stylesheet für alle Seiten.
   ═══════════════════════════════════════════════════════════════════ */

@font-face {
    font-family: 'Archivo';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('fonts/archivo-var.woff2') format('woff2');
}

:root {
    /* Palette – Bündnis 90/Die Grünen */
    --bg: #F2F6F1;
    --surface: #FFFFFF;
    --surface-hover: #EEF4EE;
    --surface-dim: #F7FAF7;
    --border: #DCE5DA;
    --border-strong: #C7D4C6;
    --primary: #005437;        /* Tanne */
    --primary-strong: #00432C; /* Tanne dunkel */
    --primary-deep: #002216;   /* Tanne sehr dunkel */
    --primary-solid: #005437;  /* Füllungen mit weißem Text (Dark: heller) */
    --primary-solid-strong: #00432C;
    --primary-dim: #0A6B47;    /* Tanne hell */
    --primary-bg: rgba(0, 84, 55, 0.08);
    --accent: #0BA1DD;         /* Akzentblau */
    --accent-strong: #0678A6;
    --accent-bg: rgba(11, 161, 221, 0.10);
    --warning: #B45309;
    --danger: #C0392B;
    --social: #A8186B;
    --sun: #F2B705;
    --text: #1C2B22;
    --text-dim: #4E5F55;
    --text-muted: #808F86;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(0, 34, 22, 0.04), 0 6px 20px rgba(0, 34, 22, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 34, 22, 0.16);
    --header-grad: linear-gradient(115deg, #002216 0%, #00432C 55%, #006B45 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background:
        radial-gradient(1100px 420px at 50% -120px, rgba(0, 84, 55, 0.07), transparent 60%),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(0, 84, 55, 0.16); }

* { scrollbar-width: thin; scrollbar-color: #C9D6CA transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #C9D6CA; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid rgba(11, 161, 221, 0.65); outline-offset: 2px; }

/* ── Header ─────────────────────────────────────────────────────── */
.header {
    background: var(--header-grad);
    border-bottom: 1px solid rgba(0, 34, 22, 0.35);
    box-shadow: 0 2px 14px rgba(0, 34, 22, 0.18);
    padding: 18px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.header-titles {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    color: #FFFFFF;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 34, 22, 0.35));
}

.header h1 {
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #FFFFFF;
    line-height: 1.25;
}

.header-sub {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 1px;
    letter-spacing: 0.01em;
}

/* ── Nav-Tabs ────────────────────────────────────────────────────── */
.nav-tabs { display: flex; gap: 4px; flex-wrap: wrap; }

.nav-tab {
    padding: 7px 14px;
    border-radius: 999px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.18s, color 0.18s;
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    white-space: nowrap;
}

.nav-tab:hover { background: rgba(255, 255, 255, 0.14); color: #FFFFFF; }
.nav-tab.active { background: #FFFFFF; color: var(--primary); box-shadow: 0 1px 4px rgba(0, 34, 22, 0.25); }

/* ── Suchleiste (nur Tagesbericht) ───────────────────────────────── */
.search-bar {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 20px 0;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 10px 16px;
    font-size: 0.92rem;
    font-family: inherit;
    box-shadow: var(--shadow);
    transition: border-color 0.18s, box-shadow 0.18s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 55, 0.12);
}

.search-input::placeholder { color: var(--text-muted); }

/* ── Layouts ────────────────────────────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 30px;
    display: grid;
    /* minmax(0,…) verhindert, dass Track-Minimums (min-content
       der Kinder, z.B. lange nowrap-Titel) die Spalte aufblähen */
    grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
    gap: 24px;
    min-height: calc(100vh - 80px);
}

.layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 24px;
    min-height: calc(100vh - 80px);
}

.admin-container {
    max-width: 840px;
    margin: 0 auto;
    padding: 24px 30px;
}

.main { min-width: 0; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-deep);
    letter-spacing: -0.01em;
}

/* ── Abschnitts-Tags ─────────────────────────────────────────────── */
.section-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 9px;
    border-radius: 999px;
    margin-right: 6px;
    vertical-align: middle;
}

.tag-politik  { background: rgba(0, 84, 55, 0.10);   color: #00432C; border: 1px solid rgba(0, 84, 55, 0.25); }
.tag-sitzung  { background: rgba(11, 161, 221, 0.10); color: #0678A6; border: 1px solid rgba(11, 161, 221, 0.30); }
.tag-presse   { background: rgba(217, 119, 6, 0.12); color: #92400E; border: 1px solid rgba(217, 119, 6, 0.30); }
.tag-social   { background: rgba(168, 24, 107, 0.10); color: #8B1460; border: 1px solid rgba(168, 24, 107, 0.28); }
.tag-allgemein{ background: rgba(78, 95, 85, 0.10);  color: #4E5F55; border: 1px solid rgba(78, 95, 85, 0.25); }

/* ── Tagesbericht: Sektionen & Items ────────────────────────────── */
.summary-section { margin-bottom: 24px; }
.summary-section:last-child { margin-bottom: 0; }

.section-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-deep);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon { font-size: 1.05rem; }

.item {
    padding: 12px 16px;
    background: var(--surface-dim);
    border: 1px solid rgba(220, 229, 218, 0.6);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    border-left: 3px solid transparent;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.item:hover { background: var(--surface-hover); box-shadow: 0 1px 4px rgba(0, 34, 22, 0.05); }
.item.priority-high   { border-left-color: var(--primary); }
.item.priority-medium { border-left-color: var(--accent); }
.item.priority-low   { border-left-color: var(--border-strong); }

/* Auf-/Zuklappbare Items */
.item.collapsible .item-title {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
}

.item.collapsible .toggle-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.item.collapsed .toggle-arrow { transform: rotate(-90deg); }

.item.collapsible .item-detail {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease, margin 0.2s ease;
    opacity: 1;
}

.item.collapsed .item-detail {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.item-title {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: var(--primary-deep);
}

.item-content-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.item-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.item-text { flex: 1; min-width: 0; }

.item-body {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.7;
    white-space: pre-wrap;
}

.item-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.item-meta a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color 0.15s;
}
.item-meta a:hover { text-decoration: underline; color: var(--primary); }

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 9px;
    background: var(--accent-bg);
    border-radius: 999px;
    color: var(--accent-strong) !important;
    text-decoration: none;
    transition: background 0.15s;
}

.source-link:hover { background: rgba(11, 161, 221, 0.2); }

/* ── Stats-Leiste ────────────────────────────────────────────────── */
.stats-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.stat-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 1px 2px rgba(0, 34, 22, 0.04);
}

.stat-chip strong { color: var(--primary); font-weight: 800; }
.stat-chip .icon { font-size: 1rem; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(0, 34, 22, 0.05);
}

.btn:hover { background: var(--surface-hover); border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary-solid);
    border-color: var(--primary-solid);
    color: #FFFFFF;
}

.btn-primary:hover { background: var(--primary-solid-strong); border-color: var(--primary-solid-strong); color: #FFFFFF; }

.btn-danger {
    background: rgba(192, 57, 43, 0.08);
    color: var(--danger);
    border: 1px solid rgba(192, 57, 43, 0.3);
}

.btn-danger:hover { background: rgba(192, 57, 43, 0.16); color: var(--danger); border-color: var(--danger); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.btn-create {
    background: var(--primary-solid);
    color: #FFFFFF;
    border: none;
    font-weight: 700;
    padding: 10px 24px;
    font-size: 0.9rem;
    font-family: inherit;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.18s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(0, 84, 55, 0.25);
}

.btn-create:hover:not(:disabled) { background: var(--primary-solid-strong); }
.btn-create:active:not(:disabled) { transform: translateY(1px); }
.btn-create:disabled { opacity: 0.4; cursor: not-allowed; }

.new-topic-btn {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--primary-solid);
    color: #FFFFFF;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.18s;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 84, 55, 0.22);
}

.new-topic-btn:hover { background: var(--primary-solid-strong); }

.antrag-finalize-btn {
    margin-top: 8px;
    padding: 7px 16px;
    background: var(--primary-solid);
    border: none;
    border-radius: var(--radius-sm);
    color: #FFFFFF;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: inherit;
    transition: background 0.18s;
}

.antrag-finalize-btn:hover { background: var(--primary-solid-strong); }

/* ── Leerer Zustand ──────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
}

.empty-state .big-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.35; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: 8px; color: var(--primary-deep); font-weight: 800; }
.empty-state p { margin-bottom: 20px; }

/* ── Spinner ─────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 84, 55, 0.18);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Kalender ────────────────────────────────────────────────────── */
.calendar-sidebar {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cal-month-label {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--primary-deep);
    letter-spacing: -0.01em;
}

.cal-nav-btn {
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 2px 10px;
    line-height: 1.5;
    transition: all 0.15s;
}

.cal-nav-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 12px;
}

.cal-day-header {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 4px 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.76rem;
    border-radius: 9px;
    position: relative;
    color: var(--text-dim);
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
}

.cal-day:hover { background: var(--surface-hover); }
.cal-day.other-month { opacity: 0.3; }

.cal-day.today {
    color: var(--primary);
    font-weight: 800;
    box-shadow: inset 0 0 0 1.5px rgba(0, 84, 55, 0.55);
}

/* SessionNet-Termine: höchste Priorität, Tanne-Grün */
.cal-day.has-sn {
    background: rgba(0, 84, 55, 0.13);
    color: var(--primary-strong);
    font-weight: 700;
    cursor: pointer;
}

.cal-day.has-sn:hover { background: rgba(0, 84, 55, 0.22); }

/* Glocke-/sonstige Termine: Akzentblau */
.cal-day.has-events {
    background: rgba(11, 161, 221, 0.13);
    color: var(--accent-strong);
    font-weight: 700;
    cursor: pointer;
}

.cal-day.has-events:hover { background: rgba(11, 161, 221, 0.24); }

/* beelen.de-Veranstaltungen: Akzentblau */
.cal-day.has-beelen {
    background: rgba(11, 161, 221, 0.13);
    color: var(--accent-strong);
    font-weight: 700;
    cursor: pointer;
}
.cal-day.has-beelen:hover { background: rgba(11, 161, 221, 0.24); }
.cal-day.has-beelen .cal-event-dot { background: var(--accent-strong); }
.cal-bd-link {
    color: var(--accent-strong);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
}
.cal-bd-link:hover { text-decoration-style: solid; }

/* Nur Inhalte (Bericht/Artikel), keine Termine */
.cal-day.has-content {
    color: var(--text-dim);
    font-weight: 500;
    cursor: pointer;
}

.cal-day.has-content:hover { background: var(--surface-hover); }
.cal-day.has-content .cal-event-dot { background: var(--text-muted); }
.cal-day.has-events .cal-event-dot { background: var(--accent-strong); }

.cal-day.selected {
    background: var(--primary-solid);
    color: #FFFFFF;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(0, 84, 55, 0.35);
}

.cal-event-dot {
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--primary);
}

.cal-events-list {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.cal-events-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 700;
}

.cal-event {
    padding: 7px 10px;
    background: var(--surface-dim);
    border: 1px solid rgba(220, 229, 218, 0.7);
    border-radius: 8px;
    margin-bottom: 6px;
    border-left: 3px solid var(--primary);
    font-size: 0.8rem;
}

.cal-event-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 600;
}

.cal-event-title { color: var(--text); line-height: 1.4; }

.cal-empty-msg {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

/* ── Chat-Seiten: Sidebar & Themen ───────────────────────────────── */
.sidebar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    height: fit-content;
    position: sticky;
    top: 100px;
    /* Grid-Kind: darf unter die Inhaltsbreite schrumpfen,
       sonst drücken lange nowrap-Thementitel die Seite auseinander */
    min-width: 0;
}

.sidebar-section { margin-bottom: 20px; min-width: 0; }
.sidebar-section:last-child { margin-bottom: 0; }

.sidebar-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.topic-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; min-width: 0; }

.topic-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dim);
}

.topic-item:hover { background: var(--surface-hover); color: var(--text); }

.topic-item.active {
    background: var(--primary-bg);
    border-color: rgba(0, 84, 55, 0.35);
    color: var(--primary-strong);
    font-weight: 600;
}

.topic-item .topic-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-strong);
    flex-shrink: 0;
}

.topic-item.active .topic-dot { background: var(--primary); }
.topic-item .topic-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.topic-delete {
    opacity: 0;
    transition: opacity 0.15s;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 2px;
}

.topic-item:hover .topic-delete { opacity: 0.55; }
.topic-delete:hover { opacity: 1 !important; }
.empty-themes { font-size: 0.8rem; color: var(--text-muted); padding: 8px 4px; }

/* Gremium-Auswahl */
.gremium-option {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border);
    margin-bottom: 4px;
    transition: all 0.15s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    color: var(--text-dim);
}

.gremium-option:hover { background: var(--surface-hover); border-color: var(--border-strong); }

.gremium-option.selected {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary-strong);
    font-weight: 600;
}

.gremium-option .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-strong);
}

.gremium-option.selected .dot { background: var(--primary); }

/* ── Chat-Bereich ────────────────────────────────────────────────── */
.chat-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 160px);
    min-height: 480px;
}

.chat-window {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-title-bar {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-deep);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Lange Thementitel kürzen statt umbrechen */
.chat-title-bar > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-context-badge {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background:
        radial-gradient(600px 240px at 100% 0%, rgba(0, 84, 55, 0.03), transparent 60%),
        var(--surface);
}

.chat-msg {
    max-width: 82%;
    padding: 11px 15px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-msg.bot {
    background: var(--surface-dim);
    border: 1px solid var(--border);
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-msg.user {
    background: var(--primary-solid);
    color: #FFFFFF;
    border: 1px solid var(--primary-solid-strong);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.system {
    background: var(--primary-bg);
    border: 1px solid rgba(0, 84, 55, 0.3);
    align-self: center;
    text-align: center;
    font-size: 0.85rem;
    color: var(--primary-strong);
    font-weight: 600;
    max-width: 90%;
}

.chat-msg.loading {
    background: var(--surface-hover);
    align-self: center;
    color: var(--text-dim);
    max-width: 92%;
}

/* Denk-Boxen (Recherche) */
.think-box {
    margin-top: 8px;
    background: rgba(11, 161, 221, 0.05);
    border: 1px solid rgba(11, 161, 221, 0.22);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    text-align: left;
}

.think-box .think-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-strong);
    margin-bottom: 4px;
}

.think-box.ans { background: rgba(0, 84, 55, 0.05); border-color: rgba(0, 84, 55, 0.22); }
.think-box.ans .think-label { color: var(--primary-strong); }

.think-text {
    font-size: 0.8rem;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 170px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Cascadia Mono', 'Consolas', monospace;
    line-height: 1.45;
}

.chat-input-row {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    background: var(--surface);
}

.chat-input-row textarea {
    flex: 1;
    background: var(--surface-dim);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
    max-height: 120px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.chat-input-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 55, 0.12);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
    gap: 10px;
    flex-wrap: wrap;
}

.action-info { font-size: 0.8rem; color: var(--text-dim); }

/* ── Quellen-Boxen (Recherche) ───────────────────────────────────── */
.quellen-box {
    margin-top: 12px;
    padding: 12px 14px;
    background: rgba(11, 161, 221, 0.06);
    border: 1px solid rgba(11, 161, 221, 0.25);
    border-radius: var(--radius-sm);
}

.quellen-box .quellen-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-strong);
    margin-bottom: 8px;
}

.quellen-box ol { margin: 0; padding-left: 20px; }

.quellen-box li {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.quellen-box a {
    color: var(--accent-strong);
    text-decoration: none;
    transition: color 0.15s;
    word-break: break-all;
}

.quellen-box a:hover { color: var(--primary); text-decoration: underline; }

/* ── Chat-FAB & Panel (Tagesbericht) ────────────────────────────── */
.chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-solid);
    border: none;
    color: #FFFFFF;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 150;
    box-shadow: 0 6px 20px rgba(0, 84, 55, 0.4);
    transition: transform 0.15s, background 0.15s;
}

.chat-fab:hover { transform: scale(1.08); background: var(--primary-solid-strong); }

.chat-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 500px;
    max-height: calc(100vh - 40px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    z-index: 160;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.chat-header {
    padding: 12px 16px;
    background: var(--header-grad);
    color: #FFFFFF;
    border-bottom: 1px solid rgba(0, 34, 22, 0.3);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.chat-body { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-panel .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface);
}

.chat-input-area {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: var(--surface);
}

.chat-input-area textarea {
    flex: 1;
    background: var(--surface-dim);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 8px 10px;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 55, 0.12);
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 22px;
    z-index: 300;
    transition: opacity 0.3s, transform 0.3s;
    opacity: 0;
    box-shadow: var(--shadow-lg);
    pointer-events: none;
    font-weight: 600;
    color: var(--text);
    max-width: calc(100vw - 40px);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { border-color: var(--primary); color: var(--primary-strong); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.warning { border-color: var(--warning); color: var(--warning); }

/* ── Formulare & Inputs ─────────────────────────────────────────── */
.date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

input[type="date"] {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 6px 10px;
    font-size: 0.9rem;
    font-family: inherit;
    color-scheme: light;
}

input[type="date"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 55, 0.12);
}

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}

.field input {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.92rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 84, 55, 0.12);
}

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.checkbox-row label { margin: 0; font-size: 0.92rem; color: var(--text); }
.checkbox-row input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── Live-Dot ────────────────────────────────────────────────────── */
.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    animation: live-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

/* ── Admin ───────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

th {
    color: var(--text-dim);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-dim); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-admin { background: rgba(0, 84, 55, 0.12); color: var(--primary-strong); }
.badge-user  { background: rgba(11, 161, 221, 0.12); color: var(--accent-strong); }
.badge-warn  { background: rgba(217, 119, 6, 0.14); color: var(--warning); }

.msg-ok {
    background: rgba(0, 84, 55, 0.07);
    border: 1px solid rgba(0, 84, 55, 0.3);
    color: var(--primary-strong);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.msg-err, .error {
    background: rgba(192, 57, 43, 0.07);
    border: 1px solid rgba(192, 57, 43, 0.3);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.88rem;
    margin-bottom: 18px;
}

.warning-box {
    background: rgba(217, 119, 6, 0.09);
    border: 1px solid rgba(217, 119, 6, 0.35);
    color: var(--warning);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.empty { color: var(--text-muted); font-size: 0.9rem; padding: 12px 0; }
.inline-form { display: inline; }
.user-row { display: flex; align-items: center; gap: 8px; }

/* ── Login ───────────────────────────────────────────────────────── */
body.login-page {
    background:
        radial-gradient(1000px 600px at 85% 115%, rgba(11, 161, 221, 0.22), transparent 60%),
        url('sunflower-white.svg?v=4') no-repeat right -80px bottom -80px / 560px 560px,
        var(--header-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    line-height: 1.6;
    background-attachment: fixed;
}

.login-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 40px 36px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg), 0 2px 8px rgba(0, 34, 22, 0.2);
}

.login-mark {
    width: 46px;
    height: 46px;
    color: var(--primary);
    margin-bottom: 14px;
}

.login-card h1 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--primary-deep);
    letter-spacing: -0.01em;
}

.login-card .subtitle {
    color: var(--text-dim);
    font-size: 0.92rem;
    margin-bottom: 26px;
    font-weight: 500;
}

.login-card .btn {
    width: 100%;
    padding: 12px;
    background: var(--primary-solid);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s;
    box-shadow: 0 2px 10px rgba(0, 84, 55, 0.3);
}

.login-card .btn:hover { background: var(--primary-solid-strong); }

.hint { text-align: center; margin-top: 20px; font-size: 0.75rem; color: var(--text-muted); }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .container { grid-template-columns: 1fr; }
    .calendar-sidebar { display: none; }
}

/* Mobile Chat-Seiten: Chat-Fenster zuerst und bildschirmhoch,
   Themenliste darunter kompakt — Eingabefeld ist sofort erreichbar. */
@media (max-width: 900px) {
    .layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px;
        padding: 14px 16px;
    }
    .chat-main {
        order: 1;
        height: auto;
        min-height: 0;
        gap: 10px;
    }
    .chat-window {
        height: calc(100vh - 118px);
        height: calc(100dvh - 118px);
        min-height: 420px;
    }
    .action-bar { order: 2; padding: 0 2px; }
    .sidebar { order: 3; position: static; padding: 14px; }
    .sidebar-section { margin-bottom: 10px; }
    .sidebar-label { margin-bottom: 6px; }
    .topic-list { max-height: 150px; }
    .new-topic-btn { margin-bottom: 10px; }
}

@media (max-width: 768px) {
    .container { grid-template-columns: 1fr; padding: 16px; }
    .calendar-sidebar { display: none; }
    .layout { padding: 12px 14px; }
    .header { padding: 12px 14px; }
    .header h1 { font-size: 1.02rem; }
    .header-sub { font-size: 0.75rem; }
    .brand-mark { width: 28px; height: 28px; }
    .header-titles { gap: 10px; }
    /* Nav-Leiste: eine Zeile, horizontal scrollbar statt 3 Zeilen hoch */
    .header-inner { gap: 10px; }
    .nav-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: 100%;
    }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tab { padding: 6px 12px; font-size: 0.82rem; }
    .chat-window { min-height: 380px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══ Dark Mode ═══
   Aktivierung: Klasse html.dark — gesetzt durch den Anti-Flash-Snippet
   im <head> jeder Seite (folgt localStorage 'beelen-theme' bzw.
   prefers-color-scheme) + Toggle-Button (theme.js). */
html.dark {
    --bg: #0B1310;
    --surface: #15211B;
    --surface-hover: #1C2B23;
    --surface-dim: #111C16;
    --border: #263730;
    --border-strong: #3A5044;
    --primary: #45B881;        /* Text-Akzente: helles Tanne-Grün */
    --primary-strong: #5FCB96;
    --primary-deep: #DFF0E6;   /* Überschriften (semantisch: Kopf-Farbe) */
    --primary-dim: #2FA574;
    --primary-solid: #0E6B48;      /* Füllungen mit weißem Text */
    --primary-solid-strong: #12855C;
    --primary-bg: rgba(69, 184, 129, 0.13);
    --accent: #4CC3F5;
    --accent-strong: #62C8EC;
    --accent-bg: rgba(76, 195, 245, 0.13);
    --warning: #E8A860;
    --danger: #E8736A;
    --social: #E38BC0;
    --text: #E2EBE4;
    --text-dim: #A3B5AB;
    --text-muted: #74867B;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.55);
}

html.dark * { scrollbar-color: #2E3F36 transparent; }
html.dark ::selection { background: rgba(69, 184, 129, 0.25); }
html.dark :focus-visible { outline-color: rgba(76, 195, 245, 0.6); }
html.dark input[type="date"] { color-scheme: dark; }
html.dark .header { box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); }
html.dark .item { border-color: rgba(38, 55, 48, 0.9); }
html.dark .cal-event { border-color: rgba(38, 55, 48, 0.9); }
html.dark .spinner { border-color: rgba(69, 184, 129, 0.25); border-top-color: var(--primary); }
html.dark .login-mark { filter: brightness(0) invert(1); }

/* Tags in dunkel */
html.dark .tag-politik   { background: rgba(69, 184, 129, 0.13); color: #7ED9A8; border-color: rgba(69, 184, 129, 0.4); }
html.dark .tag-sitzung   { background: rgba(76, 195, 245, 0.12); color: #62C8EC; border-color: rgba(76, 195, 245, 0.4); }
html.dark .tag-presse    { background: rgba(232, 168, 96, 0.12); color: #EFC186; border-color: rgba(232, 168, 96, 0.4); }
html.dark .tag-social    { background: rgba(227, 139, 192, 0.12); color: #E9A6D1; border-color: rgba(227, 139, 192, 0.38); }
html.dark .tag-allgemein { background: rgba(163, 181, 171, 0.12); color: #A3B5AB; border-color: rgba(163, 181, 171, 0.35); }

/* Kalender in dunkel */
html.dark .cal-day.today { color: #7ED9A8; box-shadow: inset 0 0 0 1.5px rgba(69, 184, 129, 0.6); }
html.dark .cal-day.has-beelen { background: rgba(56, 152, 236, 0.16); color: #6FC3F2; }
html.dark .cal-day.has-beelen:hover { background: rgba(56, 152, 236, 0.26); }
html.dark .cal-bd-link { color: #6FC3F2; }
html.dark .cal-day.has-sn { background: rgba(69, 184, 129, 0.14); color: #7ED9A8; }
html.dark .cal-day.has-sn:hover { background: rgba(69, 184, 129, 0.24); }
html.dark .cal-day.has-events { background: rgba(76, 195, 245, 0.13); color: #62C8EC; }
html.dark .cal-day.has-events:hover { background: rgba(76, 195, 245, 0.22); }

/* Toggle-Button (Login-Seite, liegt auf dem Tanne-Verlauf) */
.theme-toggle-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    font-size: 1.1rem;
    cursor: pointer;
    backdrop-filter: blur(6px);
    transition: background 0.18s;
    z-index: 50;
}

.theme-toggle-float:hover { background: rgba(255, 255, 255, 0.22); }
