:root {
    --color-bg: #eef2f6;
    --color-surface: #ffffff;
    --color-border: #dfe5ec;
    --color-text: #1c2024;
    --color-muted: #6b7580;
    --color-primary: #1d4f3f;
    --color-primary-dark: #163d31;
    --color-primary-light: #e7f0ea;
    --color-accent: #c8901e;
    --color-info: #2c5f8a;
    --color-success: #1d4f3f;
    --color-error: #b3541e;
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(28, 32, 36, 0.05);
    --shadow: 0 2px 8px rgba(28, 32, 36, 0.06);
    --shadow-lg: 0 8px 24px rgba(28, 32, 36, 0.12);
    font-size: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.9em; }

/* ==================== Topbar / Navigation ==================== */
.topbar {
    background: var(--color-primary);
    background-image: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%);
    color: #fff;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.75rem;
    min-height: 60px;
}
.brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; opacity: 0.92; }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    margin-left: auto;
}

.mainnav-shared { display: flex; gap: 0.35rem; flex: 1; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.mainnav-shared a {
    color: rgba(255,255,255,0.82);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
}
.mainnav-shared a:hover { color: #fff; background: rgba(255,255,255,0.12); text-decoration: none; }
.mainnav-shared a.active { color: #fff; background: rgba(255,255,255,0.18); }

.topbar-user { display: flex; align-items: center; gap: 0.85rem; font-size: 0.88rem; margin-left: 0.5rem; }

.changelog-bubble {
    display: inline-flex; align-items: center; gap: 0.35rem; position: relative;
    background: #fef3c7; color: #92400e; border: 1px solid #fde68a;
    padding: 0.3rem 0.75rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
    text-decoration: none; white-space: nowrap; transition: background 0.15s ease;
}
.changelog-bubble:hover { background: #fde68a; }
.changelog-bubble-unseen { background: #fde047; border-color: #facc15; color: #713f12; }
.changelog-bubble-unseen:hover { background: #facc15; }
.changelog-bubble-dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: #dc2626; flex-shrink: 0;
}
.user-name { color: #fff; font-weight: 500; }
.link-button {
    background: none; border: none; color: rgba(255,255,255,0.75); cursor: pointer;
    font-size: 0.85rem; padding: 0; font-family: inherit;
}
.link-button:hover { color: #fff; text-decoration: underline; }

.nav-badge {
    display: inline-block; background: #e5533d; color: #fff; border-radius: 999px;
    font-size: 0.68rem; padding: 0.05rem 0.4rem; margin-left: 0.25rem; font-weight: 700;
}

/* ==================== Layout ==================== */
.app-shell { max-width: 1280px; margin: 0 auto; display: flex; align-items: flex-start; }
.sidebar {
    width: 210px; flex-shrink: 0; padding: 1.75rem 1rem 2rem 1.5rem;
    display: flex; flex-direction: column; gap: 0.15rem; position: sticky; top: 60px;
}
.area-link {
    display: block; padding: 0.55rem 0.8rem; border-radius: var(--radius-sm);
    font-size: 0.92rem; font-weight: 700; color: var(--color-text); margin-bottom: 0.1rem;
}
.area-link:hover { background: var(--color-primary-light); text-decoration: none; }
.area-link.active { background: var(--color-primary); color: #fff; }
.area-link-locked, .area-subnav a.area-subnav-locked {
    display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
    color: var(--color-muted); cursor: pointer;
}
.area-link-locked span, .area-subnav a.area-subnav-locked span { flex-shrink: 0; opacity: 0.7; }
.area-subnav { display: flex; flex-direction: column; gap: 0.05rem; margin: 0.15rem 0 0.75rem 0.6rem; }
.area-subnav a {
    padding: 0.42rem 0.7rem; border-radius: var(--radius-sm); font-size: 0.85rem;
    font-weight: 500; color: var(--color-muted); border-left: 2px solid transparent;
}
.area-subnav a:hover { color: var(--color-text); background: var(--color-primary-light); text-decoration: none; }
.area-subnav a.active { color: var(--color-primary); border-left-color: var(--color-primary); font-weight: 700; background: var(--color-primary-light); }

.mobile-menu { display: none; }

.content { flex: 1; min-width: 0; padding: 2rem 1.5rem 3.5rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.3rem; }
.muted { color: var(--color-muted); margin: 0; }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.card h2 { margin-top: 0; }

/* ==================== Alerts ==================== */
.alert { padding: 0.85rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: 0.92rem; border: 1px solid transparent; }
.alert-error { background: #fdecec; color: #9a2c2c; border-color: #f6c9c9; }
.alert-success { background: #eaf8f1; color: #146c43; border-color: #bfe8d3; }
.alert-info { background: #eaf1fe; color: #1e4fa8; border-color: #c6dafb; }

/* ==================== Forms ==================== */
label { display: block; font-size: 0.84rem; font-weight: 600; margin: 0.8rem 0 0.3rem; color: #374057; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=color], input[type=file], select, textarea {
    width: 100%; padding: 0.6rem 0.75rem; border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm); font-size: 0.95rem; background: #fff; color: var(--color-text);
    font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    padding-right: 2.2rem; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23566076' d='M5.5 7.5L10 12l4.5-4.5H5.5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 18px;
}
select:hover { border-color: #b7bfd6; }
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(47, 61, 138, 0.12);
}
textarea { resize: vertical; }

.multi-person-select { display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
.multi-person-row { display: flex; align-items: center; gap: 0.4rem; width: 100%; }
.multi-person-row select { flex: 1; margin: 0; }
.multi-person-remove {
    flex-shrink: 0; width: 30px; height: 30px; padding: 0; line-height: 1;
    color: var(--color-danger, #b3261e); font-size: 1.1rem;
}
.multi-person-add { margin-top: 0.1rem; }

.rich-text-editor { border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.rich-text-toolbar { display: flex; gap: 0.3rem; padding: 0.4rem; background: #f6f7f9; border-bottom: 1px solid var(--color-border); }
.rich-text-toolbar button {
    width: 30px; height: 28px; border: 1px solid var(--color-border); border-radius: 4px;
    background: #fff; cursor: pointer; font-size: 0.85rem;
}
.rich-text-toolbar button:hover { background: var(--color-primary-light); }
.rich-text-editable {
    min-height: 110px; padding: 0.65rem 0.75rem; font-size: 0.95rem; line-height: 1.5;
    outline: none; background: #fff;
}
.rich-text-editable:focus { background: #fffef8; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.5rem 1.5rem; align-items: end; }
.inline-form { display: inline; }

/* Bereichsrollen je Benutzer (Benutzerverwaltung): drei Zeilen untereinander statt nebeneinander */
.area-role-form { display: flex; flex-direction: column; gap: 0.4rem; min-width: 170px; }
.area-role-row { display: flex; align-items: center; gap: 0.5rem; }
.area-role-label { font-size: 0.8rem; font-weight: 600; color: var(--color-muted); width: 78px; flex-shrink: 0; }
.area-role-row select { width: 150px; flex: 0 0 auto; font-size: 0.82rem; padding: 0.35rem 1.8rem 0.35rem 0.55rem; background-size: 15px; background-position: right 0.45rem center; }

/* ==================== Buttons ==================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
    padding: 0.6rem 1.15rem; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
    background: #fff; color: var(--color-text); cursor: pointer; font-size: 0.88rem; font-weight: 600;
    font-family: inherit; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: #c7cbe0; background: #f7f9fb; text-decoration: none; }
.btn:disabled, .btn:disabled:hover {
    background: #eef0f3; color: var(--color-muted); border-color: var(--color-border);
    cursor: not-allowed; opacity: 0.75;
}
.btn-primary { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.btn-primary:hover { background: var(--color-primary-dark); border-color: var(--color-primary-dark); color: #fff; }
.btn-block { width: 100%; margin-top: 1.1rem; }
.btn-small { padding: 0.38rem 0.75rem; font-size: 0.8rem; }
.btn-danger { background: var(--color-error); color: #fff; border-color: var(--color-error); }
.btn-danger:hover { background: #94420f; border-color: #94420f; color: #fff; }
.danger-zone { border: 1.5px solid var(--color-error); border-radius: var(--radius-lg); padding: 1.25rem 1.5rem; margin-top: 2rem; background: #fdf1ea; }
.danger-zone h3 { color: var(--color-error); margin-top: 0; }

/* ==================== Table ==================== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th, .data-table td { text-align: left; padding: 0.65rem 0.7rem; border-bottom: 1px solid var(--color-border); }
.data-table th { color: var(--color-muted); font-weight: 600; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.03em; }
.deadline-checkbox {
    width: 20px; height: 20px; margin: 0; cursor: pointer;
    accent-color: var(--color-primary);
}
.compact-table td, .compact-table th { padding: 0.5rem 0.55rem; }
.user-actions-menu { position: relative; }
.user-actions-menu summary { cursor: pointer; list-style: none; }
.user-actions-menu summary::-webkit-details-marker { display: none; }
.user-actions-panel {
    position: absolute; right: 0; top: calc(100% + 4px); z-index: 40;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 0.6rem; min-width: 220px;
    display: flex; flex-direction: column; gap: 0.35rem;
}
.view-as-banner {
    display: flex; align-items: center; justify-content: center; gap: 1rem;
    flex-wrap: wrap; background: #7a4a12; color: #fff; padding: 0.55rem 1rem;
    font-size: 0.85rem; font-weight: 600; text-align: center;
    position: sticky; top: 0; z-index: 100;
}
.view-as-banner .btn-small { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.4); }
.view-as-banner .btn-small:hover { background: rgba(255,255,255,0.28); }
.data-table tbody tr:hover { background: #fafbff; }

/* ==================== Bestätigungs-Dialoge (native <dialog>) ==================== */
.confirm-dialog {
    border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    padding: 1.5rem; max-width: 440px; width: calc(100% - 2rem);
}
.confirm-dialog::backdrop { background: rgba(20, 24, 40, 0.55); }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.25rem; flex-wrap: wrap; }
.confirm-dialog-actions form { margin: 0; }

/* ==================== Förderungs-Logos ====================
   object-fit:contain statt cover: ein rechteckiges (nicht-quadratisches)
   Logo wird dadurch NIE beschnitten, sondern vollständig innerhalb des
   quadratischen Rahmens eingepasst (ggf. mit etwas Weißraum links/rechts
   oder oben/unten) – ein heller Hintergrund sorgt dafür, dass das immer
   sauber aussieht, unabhängig vom Seitenverhältnis des Originalbilds. */
.funding-icon-thumb {
    width: 28px; height: 28px; border-radius: 6px; object-fit: contain;
    background: #fff; border: 1px solid var(--color-border);
    vertical-align: middle; margin-right: 0.5rem; padding: 2px; flex-shrink: 0;
}
.funding-icon-thumb.funding-icon-md { width: 48px; height: 48px; border-radius: 10px; padding: 4px; }
.funding-icon-thumb.funding-icon-lg { width: 64px; height: 64px; border-radius: 10px; padding: 5px; }

/* ==================== Badges ==================== */
.badge { display: inline-block; padding: 0.18rem 0.65rem; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge-success { background: #dcf5e8; color: #146c43; }
.badge-muted { background: #eef0f4; color: #6b7280; }
.badge-important { background: #fef3c7; color: #92400e; }

/* ==================== Activity / notification lists ==================== */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem; }
.activity-time { color: var(--color-muted); }

/* ==================== Login ==================== */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-info) 100%); }
.login-box {
    background: #fff; padding: 2.75rem 2.5rem; border-radius: var(--radius-lg); width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.login-box h1 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.login-subtitle { color: var(--color-muted); margin: 0 0 1.25rem; font-size: 0.9rem; }

/* ==================== Season accordion ==================== */
.season-block {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-lg); margin-bottom: 0.85rem; overflow: hidden; box-shadow: var(--shadow-sm);
}
.season-block summary {
    cursor: pointer; padding: 1rem 1.4rem; display: flex; justify-content: space-between;
    align-items: center; list-style: none; font-weight: 600;
}
.season-block summary::-webkit-details-marker { display: none; }
.season-toggle-label { display: flex; align-items: center; gap: 0.6rem; }
.season-block-body { padding: 0 1.4rem 1.4rem; border-top: 1px solid var(--color-border); padding-top: 1rem; }
.status-form select { display: inline-block; width: auto; }

/* ==================== Copy candidates ==================== */
.copy-candidate-list { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.copy-candidate { display: flex; align-items: center; gap: 0.5rem; font-size: 0.92rem; font-weight: normal; }

/* ==================== Dashboard stat cards ==================== */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    padding: 1.4rem 1.5rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--stat-accent, var(--color-primary));
}
.stat-card-label { font-size: 0.78rem; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.5rem; }
.stat-card-value { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-card-sub { font-size: 0.82rem; color: var(--color-muted); margin-top: 0.35rem; }

/* ==================== Cockpit ==================== */
.cockpit-season-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.1rem; }
.status-summary-grid { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.status-chip {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem;
    border-radius: 999px; border: 1.5px solid var(--chip-color, var(--color-border));
    color: var(--color-text); font-size: 0.85rem; font-weight: 500;
}
.status-chip:hover { background: color-mix(in srgb, var(--chip-color) 10%, white); text-decoration: none; }
.status-chip-count { font-weight: 800; }

/* ==================== Deadline badges ==================== */
.deadline-badge { padding: 0.18rem 0.55rem; border-radius: var(--radius-sm); font-size: 0.8rem; white-space: nowrap; font-weight: 600; }
.deadline-overdue { background: #fde3e1; color: #9a2c2c; }
.deadline-soon { background: #fdedd0; color: #92590a; }
.deadline-month { background: #dbe7fd; color: #1e4fa8; }
.deadline-later { background: #eef0f4; color: #4b5563; }
.deadline-none { color: var(--color-muted); }

/* ==================== Funding detail ==================== */
.funding-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 0.75rem; }
.funding-summary { display: flex; flex-wrap: wrap; gap: 2rem; }
.funding-summary-item { display: flex; flex-direction: column; gap: 0.3rem; min-width: 140px; }
.funding-summary-item select { width: auto; }
.release-banner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }

/* ==================== Tabs ==================== */
.tab-nav { display: flex; gap: 0.2rem; border-bottom: 1.5px solid var(--color-border); margin: 1.5rem 0 0; flex-wrap: wrap; }
.tab-nav a {
    padding: 0.65rem 1.05rem; color: var(--color-muted); border-bottom: 2px solid transparent;
    font-size: 0.88rem; font-weight: 500;
}
.tab-nav a:hover { text-decoration: none; color: var(--color-text); }
.tab-nav a.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 700; }

.checkbox-inline { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 500; font-size: 0.9rem; color: var(--color-text); }
.status-edit-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.75rem; flex-wrap: wrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.filter-form { align-items: end; }

/* ==================== Comments ==================== */
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.65rem; }
.comment-item { padding: 0.8rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: #fafbfd; }
.comment-important { border-left: 3px solid var(--color-accent); background: #fdf6ec; }
.comment-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }

/* ==================== Notifications ==================== */
.notif-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.notification-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.55rem; }
.notification-item {
    display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.85rem 1.1rem;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
.notification-unread { border-left: 3px solid var(--color-primary); background: #f6f7ff; }
.notification-body { flex: 1; }
.notification-body p { margin: 0; }

/* ==================== Backup codes ==================== */
.backup-codes-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.75rem;
}
.backup-codes-grid code {
    display: block; text-align: center; padding: 0.65rem; background: var(--color-primary-light);
    border-radius: var(--radius-sm); font-size: 1rem; letter-spacing: 0.03em;
}

/* ==================== Calendar (Fristen) ==================== */
.calendar-nav { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-weekday { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--color-muted); text-transform: uppercase; padding-bottom: 0.35rem; }
.calendar-day {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
    min-height: 92px; padding: 0.4rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.calendar-day-muted { background: #fafbfc; opacity: 0.55; }
.calendar-day-today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary) inset; }
.calendar-day-number { font-size: 0.78rem; font-weight: 700; color: var(--color-muted); }
.calendar-item {
    display: block; font-size: 0.7rem; padding: 0.15rem 0.35rem; border-radius: 4px; background: var(--color-primary-light);
    border-left: 3px solid var(--color-primary); color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.calendar-more { font-size: 0.68rem; color: var(--color-muted); }

/* ==================== Responsive / Mobile ==================== */
@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .mainnav-shared { display: none; }
    .sidebar { display: none; }
    .app-shell { display: block; }
    .mobile-menu {
        display: none; flex-direction: column; align-items: stretch; width: 100%;
        gap: 0.15rem; padding: 0.75rem 1rem 1.25rem; background: rgba(0,0,0,0.08);
        max-height: calc(100vh - 60px); overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    .mobile-menu.open { display: flex; }
    .mobile-menu .area-link { color: #fff; }
    .mobile-menu .area-link.active { background: rgba(255,255,255,0.2); }
    .mobile-menu .area-link:hover { background: rgba(255,255,255,0.12); }
    .mobile-menu-shared { display: flex; flex-direction: column; gap: 0.15rem; }
    .mobile-menu-shared a {
        display: block; padding: 0.55rem 0.8rem; border-radius: var(--radius-sm);
        font-size: 0.92rem; font-weight: 700; color: #fff;
    }
    .mobile-menu-shared a.active { background: rgba(255,255,255,0.2); }
    .mobile-menu-shared a:hover { background: rgba(255,255,255,0.12); }
    .mobile-menu .area-subnav a { color: rgba(255,255,255,0.8); }
    .mobile-menu .area-subnav a:hover, .mobile-menu .area-subnav a.active { color: #fff; background: rgba(255,255,255,0.12); }
    .mobile-menu .mainnav-shared { display: flex; flex-direction: column; align-items: stretch; }
    .topbar-inner { flex-wrap: wrap; padding: 0.65rem 1rem; }
    .topbar-user { width: 100%; justify-content: space-between; order: 3; }
    .content { padding: 1.25rem 1rem 2.5rem; }
    .card { padding: 1.15rem 1.15rem; }
    .form-grid { grid-template-columns: 1fr; }
    .funding-summary { gap: 1.1rem; }
    .calendar-day { min-height: 64px; }
    .calendar-item { font-size: 0.62rem; }
    .stat-card-value { font-size: 1.6rem; }

    /* Tabellen: statt zusammengequetscht/überlappend darzustellen (siehe
       gemeldeter Fall "Nächste Fristen" auf dem Dashboard), scrollen sie
       jetzt horizontal innerhalb ihres eigenen schlanken Wrapper-Elements.
       Das erhält die Spaltenausrichtung 1:1 und verhindert überlappenden/
       umgebrochenen Text, auf Kosten eines Seitwärts-Wischens bei vielen
       Spalten – ein etablierter, robuster Kompromiss. Auf Desktop-Breite
       hat der Wrapper keinerlei sichtbaren Effekt. */
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -0.1rem; }
    .table-scroll .data-table { min-width: 560px; }

    /* Buttons/Formulare, die auf Desktop nebeneinander stehen, sollen auf
       schmalen Bildschirmen nicht aus dem Rahmen laufen. */
    .btn { white-space: normal; }
    p > .btn, p > .btn-primary { margin-bottom: 0.4rem; display: inline-block; }
    .season-block-body p { display: flex; flex-wrap: wrap; gap: 0.4rem; }

    /* Detailseiten-Kacheln (z.B. Beantragt/Bewilligt/Zuständig) sollen bei
       wenig Platz umbrechen statt sich zu überlappen. */
    .funding-summary { flex-wrap: wrap; }
}

/* ==========================================================================
   Hilfe-Seite (/hilfe) und Hilfe-Sprechblase — siehe HelpController.php
   ========================================================================== */

.help-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.75rem; align-items: start; }
/* Ohne dies bleiben Grid-Elemente mindestens so breit wie ihr längster
   unumbrochener Inhalt (hier: lange Menüpunkt-Titel) — auch wenn die
   Spalte selbst schmaler ist. Bekannte CSS-Grid-Falle, siehe
   https://defensivecss.dev/tip/grid-min-content-size/ */
.help-layout > * { min-width: 0; }

.help-sidebar {
    /* top passend zur oberen Menüleiste (.topbar, position:sticky, top:0)
       gesetzt — genau wie beim bestehenden .sidebar (Hauptnavigation)
       oben mit top:60px, sonst rutscht die Seitenleiste beim Scrollen
       unter die Menüleiste. */
    position: sticky; top: 60px;
    max-height: calc(100vh - 60px - 1rem);
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.9rem;
}
.help-search input {
    width: 100%; padding: 0.5rem 0.65rem; border: 1px solid var(--color-border);
    border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 0.75rem; box-sizing: border-box;
}
.help-toc-chapter { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted); margin: 0.9rem 0 0.3rem; }
.help-toc-chapter:first-child { margin-top: 0; }
.help-toc-link { display: block; padding: 0.28rem 0.4rem; border-radius: 6px; font-size: 0.85rem; color: var(--color-text); text-decoration: none; }
.help-toc-link:hover { background: var(--color-primary-light); }
.help-toc-link.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

.help-chapter-title { margin: 2rem 0 1rem; color: var(--color-primary); }
.help-chapter-title:first-child { margin-top: 0; }
/* scroll-margin-top passend zur oberen Menüleiste (60px hoch, siehe
   .topbar/.sidebar oben) + etwas Luft — sonst verschwindet die
   Abschnitts-Überschrift beim Ankersprung unter der Menüleiste. Gilt für
   den ganzen Abschnitt UND für die Reiter-Unterüberschriften (h4) darin,
   da Letztere bei reitergenauen Hilfe-Sprüngen (z.B. "?tab=dokumente")
   selbst das eigentliche Sprungziel sind. */
.help-section { scroll-margin-top: 76px; margin-bottom: 1.1rem; }
/* Ist ein Abschnitt der ERSTE seines Kapitels, steht direkt darüber noch
   die Kapitel-Überschrift (.help-chapter-title) — die braucht beim
   Ankersprung zusätzlichen Platz, sonst rutscht ihr oberer Rand unter die
   Menüleiste (live gemessen: Kapitel-Überschrift ca. 28px hoch + 16px
   Abstand darunter). 110px deckt das am Desktop (60px hohe Menüleiste)
   mit Sicherheitsmarge ab, die mobile Variante steht weiter unten. */
.help-chapter-title + .help-section { scroll-margin-top: 110px; }
.help-section h4[id] { scroll-margin-top: 76px; }
.help-section h3 { margin-top: 0; }
.help-section h4 { margin: 1.1rem 0 0.4rem; font-size: 0.95rem; }
.help-section table.data-table { margin: 0.75rem 0; }

.help-box { border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0.9rem 0; border: 1px solid transparent; font-size: 0.88rem; }
.help-box p { margin: 0.3rem 0 0; }
.help-box p:first-of-type { margin-top: 0.2rem; }
.help-box strong { display: block; margin-bottom: 0.15rem; }
.help-box-admin { background: #fdf6e6; border-color: #f0dfa6; color: #7a5b06; }
.help-box-warn { background: #fdecec; border-color: #f6c9c9; color: #9a2c2c; }
.help-box-tip { background: #eaf8f1; border-color: #bfe8d3; color: #146c43; }

@media (max-width: 860px) {
    .help-layout { grid-template-columns: 1fr; }
    .help-sidebar { position: static; max-height: none; }
    /* Die Kopfzeile bricht ab hier auf zwei Zeilen um (siehe .topbar-inner
       weiter oben) und wird dadurch deutlich höher als die 60px auf
       Desktop — live gemessen 115px (bis 375px Breite) bis 127px (ab
       320px Breite, dort umbricht zusätzlich die Nutzer-Zeile). 145px
       deckt beide Fälle mit Sicherheitsmarge ab. */
    .help-section { scroll-margin-top: 145px; }
    .help-section h4[id] { scroll-margin-top: 145px; }
    /* Wie oben (Desktop-Variante), aber mit der höheren mobilen
       Menüleiste (bis 127px) gerechnet: 127 + 28 (Kapitel-Überschrift)
       + 16 (Abstand) + Sicherheitsmarge ≈ 190px. */
    .help-chapter-title + .help-section { scroll-margin-top: 190px; }
}

/* Hilfe-Sprechblase, unten rechts auf jeder Seite (siehe layout/app.php) */
.help-bubble {
    position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 500;
    width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: 700; text-decoration: none;
    box-shadow: 0 4px 14px rgba(29, 79, 63, 0.35);
    transition: transform 0.15s ease, background 0.15s ease;
}
.help-bubble:hover { background: var(--color-primary-dark); transform: scale(1.06); color: #fff; }
@media (max-width: 640px) {
    .help-bubble { right: 0.9rem; bottom: 0.9rem; width: 2.7rem; height: 2.7rem; font-size: 1.15rem; }
}

/* ==========================================================================
   Backup-Statusanzeige (Systemweite Einstellungen, nur Administratoren)
   ========================================================================== */
.backup-indicator {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.9rem 1.1rem; border-radius: var(--radius);
    border: 1px solid transparent; font-size: 0.9rem;
}
.backup-indicator-dot {
    width: 0.85rem; height: 0.85rem; border-radius: 50%; flex-shrink: 0;
    margin-top: 0.25rem;
}
.backup-indicator-ok { background: #eaf8f1; border-color: #bfe8d3; color: #146c43; }
.backup-indicator-ok .backup-indicator-dot { background: #1d9a5c; box-shadow: 0 0 0 4px rgba(29, 154, 92, 0.18); }
.backup-indicator-warn { background: #fdecec; border-color: #f6c9c9; color: #9a2c2c; }
.backup-indicator-warn .backup-indicator-dot { background: #c93a3a; box-shadow: 0 0 0 4px rgba(201, 58, 58, 0.18); }

/* ==========================================================================
   Spenden: Spender-Live-Suche im Anlege-Formular
   ========================================================================== */
.donor-search-results {
    position: absolute; z-index: 20; top: 100%; left: 0; right: 0;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    max-height: 220px; overflow-y: auto; margin-top: 0.2rem;
}
.donor-search-result { padding: 0.5rem 0.75rem; cursor: pointer; font-size: 0.88rem; }
.donor-search-result:hover { background: var(--color-primary-light); }

/* ==========================================================================
   Schwebende Statusbox für laufende Hintergrund-Aufträge (Freikarten,
   Spenden-Dokumente) — erscheint auf JEDER Seite, solange etwas läuft
   (siehe public/assets/js/background-jobs.js). Die AUSSENBOX selbst ist nur
   ein Positionierungs-Rahmen ohne eigene Farbe — die eigentliche Farbe
   (gelb = läuft noch, grün = fertig) sitzt auf jedem einzelnen Eintrag
   (.bg-jobs-box-item), damit bei mehreren gleichzeitig laufenden Aufträgen
   jeder für sich seinen eigenen, korrekten Zustand anzeigt.
   ========================================================================== */
.bg-jobs-box {
    position: fixed;
    right: 1.25rem;
    bottom: 5.5rem; /* oberhalb des Hilfe-Knopfs (.help-bubble), der dieselbe Ecke belegt */
    z-index: 500;
    width: 320px;
    max-width: calc(100vw - 2.5rem); /* verhindert Überlauf über den rechten Bildschirmrand auf schmaleren Desktop-Fenstern */
    display: none;
}
@media (max-width: 640px) {
    .bg-jobs-box { right: 0.9rem; bottom: 4.4rem; width: auto; max-width: calc(100vw - 1.8rem); }
}
.bg-jobs-box.visible { display: block; }

.bg-jobs-box-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    font-size: 0.85rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.85rem 1rem;
}
.bg-jobs-box-item + .bg-jobs-box-item { margin-top: 0.6rem; }
.bg-jobs-box-item a { color: inherit; text-decoration: none; }
.bg-jobs-box-item a:hover { text-decoration: underline; }
/* WICHTIG gegen den Überlauf-Fehler: Flex-Kindelemente schrumpfen per
   Voreinstellung NICHT unter ihre natürliche (nicht umgebrochene) Breite
   (CSS-Standardverhalten "min-width: auto") — ohne "min-width: 0" hier
   läuft langer Text einfach über den rechten Rand hinaus, statt
   umzubrechen (real beobachtet, per Screenshot vom Nutzer bestätigt). */
.bg-jobs-box-text { flex: 1 1 auto; min-width: 0; line-height: 1.4; }

/* Zustand "läuft noch" -- gelb, dieselben Töne wie die "Was ist neu"-Blase */
.bg-jobs-box-item.pending {
    background: #fef3c7; border: 1px solid #fde68a; color: #713f12;
}
.bg-jobs-icon {
    flex-shrink: 0;
    width: 1.15rem; height: 1.15rem;
    margin-top: 0.1rem;
}
.bg-jobs-box-item.pending .bg-jobs-icon {
    border: 2px solid #fde68a;
    border-top-color: #92400e;
    border-radius: 50%;
    animation: bg-jobs-spin 0.8s linear infinite;
}
@keyframes bg-jobs-spin { to { transform: rotate(360deg); } }

/* Zustand "fertig" -- die GESAMTE Karte wird grün, mit großem weißen Haken
   (nicht nur eine kleine Farbänderung) -- soll klar als "geschafft!"-Moment
   erkennbar sein, per Rücksprache mit dem Nutzer bewusst so deutlich. */
.bg-jobs-box-item.done {
    background: #1d9a5c; border: 1px solid #157a48; color: #ffffff;
    animation: bg-jobs-done-pulse 0.5s ease-out;
}
.bg-jobs-box-item.done a { color: #ffffff; }
@keyframes bg-jobs-done-pulse {
    0% { transform: scale(0.96); }
    55% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
.bg-jobs-box-item.done .bg-jobs-icon {
    width: 1.5rem; height: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
    animation: bg-jobs-check-pop 0.4s ease-out;
}
@keyframes bg-jobs-check-pop {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.25); opacity: 1; }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Grün/Gelb-getrennte Status-Blöcke bei Benachrichtigungen (Spenden-Workflow) —
   dieselben Grün-/Gelbtöne wie an anderen Stellen im Portal bereits verwendet
   (Backup-Indikator bzw. "Was ist neu"-Blase/Statusbox), damit es einheitlich
   wirkt. Analoges Gegenstück in HTML-E-Mails: EmailTemplate::renderHtmlStatusUpdate().
   ========================================================================== */
.status-block {
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.5rem;
}
.status-block-happened { background: #eaf8f1; border: 1px solid #bfe8d3; }
.status-block-todo { background: #fef3c7; border: 1px solid #fde68a; }
.status-block-label {
    margin: 0 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.status-block-happened .status-block-label { color: #146c43; }
.status-block-todo .status-block-label { color: #92400e; }
.status-block-text { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--color-text); }

/* ==========================================================================
   Dokumenten-Massenaktionen (Checkbox-Auswahl, Kopieren-Suche, Drag & Drop)
   — gemeinsam für Förderungen/Sponsoring/Spenden, siehe document-manager.js
   ========================================================================== */
.doc-bulk-toolbar {
    display: none;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
}
.doc-copy-picker {
    position: relative;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.doc-copy-search { min-width: 240px; }
.doc-copy-results {
    display: none;
    position: absolute;
    top: 100%; left: 0.85rem;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 220px;
    overflow-y: auto;
    min-width: 260px;
}
.doc-copy-result:hover { background: var(--color-bg); }
.doc-table .doc-row { cursor: grab; }
.doc-row-dragging { opacity: 0.4; }
.doc-folder-dropzone { transition: background-color 0.15s ease, outline 0.15s ease; border-radius: var(--radius); }
.doc-folder-dropzone-active { background-color: rgba(29, 79, 63, 0.08); outline: 2px dashed var(--color-primary); }
.doc-root-dropzone { border: 1px dashed var(--color-border); border-radius: var(--radius); }

/* ==========================================================================
   "Bug melden"-Knopf (Insekt-Symbol), gleicher Stil wie .help-bubble,
   direkt daneben platziert — siehe layout/app.php + bug-report.js
   ========================================================================== */
.bug-bubble {
    position: fixed; right: 4.75rem; bottom: 1.25rem; z-index: 500;
    width: 3rem; height: 3rem; border-radius: 50%;
    background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; text-decoration: none;
    border: none; cursor: pointer; padding: 0;
    box-shadow: 0 4px 14px rgba(29, 79, 63, 0.35);
    transition: transform 0.15s ease, background 0.15s ease;
}
.bug-bubble:hover { background: var(--color-primary-dark); transform: scale(1.06); }
@media (max-width: 640px) {
    .bug-bubble { right: 4.1rem; bottom: 0.9rem; width: 2.7rem; height: 2.7rem; font-size: 1.1rem; }
}

.bug-modal-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(15, 23, 42, 0.45);
    align-items: center; justify-content: center;
    padding: 1rem;
}
.bug-modal {
    background: #fff; border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.25rem; width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto;
}

/* ==========================================================================
   Textkasten mit Kopier-Knopf oben rechts (z.B. fertiges Anschreiben bei
   Spenden) — siehe copy-to-clipboard.js für das Klick-Verhalten
   ========================================================================== */
.copy-box { position: relative; margin-top: 0.75rem; }
.copy-box textarea {
    width: 100%; font-family: inherit; font-size: 0.9rem; line-height: 1.5;
    padding: 1rem; padding-top: 2.6rem; border: 1px solid var(--color-border);
    border-radius: var(--radius-sm); background: #fafbfc; color: var(--color-text);
    resize: vertical; white-space: pre-wrap;
}
.copy-box-btn {
    position: absolute; top: 0.6rem; right: 0.6rem; z-index: 2;
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.35rem 0.65rem; border-radius: var(--radius-sm);
    border: 1px solid var(--color-border); background: #fff; color: var(--color-text);
    cursor: pointer; font-size: 0.78rem; font-weight: 600; font-family: inherit;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.copy-box-btn:hover { background: #f7f9fb; border-color: #c7cbe0; }
.copy-box-btn.copied { background: var(--color-primary-light); border-color: var(--color-primary); color: var(--color-primary-dark); }

/* ==========================================================================
   Schiebeknopf (Toggle-Switch) — z.B. "Nur meine / Alle Fristen" bei
   Meine Aufgaben. Technisch ein normaler Link (echter Seitenaufruf beim
   Umschalten), aber optisch als iOS-artiger Schiebeknopf mit grünem Kreis.
   ========================================================================== */
.toggle-switch {
    display: inline-flex; align-items: center; gap: 0.65rem;
    text-decoration: none; cursor: pointer; user-select: none;
}
.toggle-switch-track {
    position: relative; width: 46px; height: 25px; border-radius: 999px;
    background: #dfe3ea; flex-shrink: 0; transition: background 0.2s ease;
    border: 1px solid #d3d8e0;
}
.toggle-switch-thumb {
    position: absolute; top: 2px; left: 2px; width: 19px; height: 19px;
    border-radius: 50%; background: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s ease;
}
.toggle-switch-on .toggle-switch-track { background: var(--color-primary-light); border-color: var(--color-primary); }
.toggle-switch-on .toggle-switch-thumb { transform: translateX(21px); }
.toggle-switch-label { font-size: 0.9rem; font-weight: 600; color: var(--color-text); }
.toggle-switch:hover .toggle-switch-track { border-color: var(--color-primary); }

/* ==========================================================================
   Client-seitige Seitennavigation (Pagination) — z.B. "Wofür ich
   zuständig bin" bei Meine Aufgaben. Ohne Seiten-Neuaufruf, per JS.
   ========================================================================== */
.pager {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap; margin-top: 0.9rem; padding-top: 0.9rem;
    border-top: 1px solid var(--color-border);
}
.pager-nav { display: flex; align-items: center; gap: 0.5rem; }
.pager-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--color-border);
    background: #fff; color: var(--color-text); cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease;
}
.pager-btn:hover:not(:disabled) { background: #f7f9fb; border-color: #c7cbe0; }
.pager-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pager-status { font-size: 0.85rem; color: var(--color-muted); min-width: 6.5rem; text-align: center; }
.pager-size { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--color-muted); }
.pager-size select { padding: 0.3rem 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--color-border); font-family: inherit; font-size: 0.85rem; }

/* ==========================================================================
   Kleines, inline sitzendes Fragezeichen mit aufklappbarer Mini-Anleitung
   (z.B. Kalender-Abo bei Meine Aufgaben) — bewusst NICHT die grosse,
   schwebende Hilfe-Sprechblase (.help-bubble), sondern direkt neben der
   Überschrift, wo die Frage tatsächlich auftaucht.
   ========================================================================== */
.help-inline-wrap { position: relative; display: inline-flex; }
.help-inline-btn {
    width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px solid var(--color-primary);
    background: #fff; color: var(--color-primary); font-size: 0.85rem; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
}
.help-inline-btn:hover { background: var(--color-primary-light); }
.help-inline-box {
    display: none; position: absolute; top: calc(100% + 0.5rem); left: 0; z-index: 30;
    width: min(360px, 85vw); background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; font-weight: 400; font-size: 0.85rem; line-height: 1.4;
}
.help-inline-box.help-inline-box-open { display: block; }
.help-inline-box p { margin: 0 0 0.75rem; }
.help-inline-box p:last-child { margin-bottom: 0; }
.help-inline-close {
    position: absolute; top: 0.5rem; right: 0.6rem; background: none; border: none; cursor: pointer;
    font-size: 1.2rem; line-height: 1; color: var(--color-muted); padding: 0.2rem;
}
.help-inline-close:hover { color: var(--color-text); }
