/* ─── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Design Tokens ─────────────────────────────────────────────── */
:root {
    --primary:        #7c3aed;
    --primary-hover:  #6d28d9;
    --primary-light:  #ede9fe;
    --primary-ring:   rgba(124,58,237,.2);

    --bg:             #f8f7ff;
    --card:           #ffffff;
    --border:         #e4e2f0;
    --border-light:   #f0eef8;

    --text:           #0f0720;
    --text-secondary: #3d3558;
    --muted:          #7c748f;

    --success:        #059669;
    --success-bg:     #d1fae5;
    --success-border: #6ee7b7;
    --warning:        #b45309;
    --warning-bg:     #fef3c7;
    --warning-border: #fcd34d;
    --danger:         #dc2626;
    --danger-bg:      #fee2e2;
    --danger-border:  #fca5a5;

    --header-bg:      #0f0720;
    --header-border:  rgba(255,255,255,.08);

    --radius-xs:  4px;
    --radius-sm:  6px;
    --radius:     12px;
    --radius-lg:  16px;
    --radius-xl:  20px;

    --shadow-xs:  0 1px 2px rgba(15,7,32,.06);
    --shadow-sm:  0 1px 3px rgba(15,7,32,.08), 0 1px 2px rgba(15,7,32,.04);
    --shadow:     0 4px 6px rgba(15,7,32,.06), 0 2px 4px rgba(15,7,32,.04);
    --shadow-md:  0 10px 15px rgba(15,7,32,.08), 0 4px 6px rgba(15,7,32,.04);

    --transition: 150ms cubic-bezier(.4,0,.2,1);
}

/* ─── Base ───────────────────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Header ─────────────────────────────────────────────────────── */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(15,7,32,.06);
    padding: 0 1.5rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-logo-img {
    height: 44px;
    width: auto;
    display: block;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
}

.header-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-badge {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 500;
    padding: 0 0.5rem;
    white-space: nowrap;
}

/* ─── Content ────────────────────────────────────────────────────── */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 1.75rem 1.25rem;
}

section {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

section h2 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 1rem;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                box-shadow var(--transition), border-color var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(124,58,237,.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 6px rgba(124,58,237,.35);
}

.btn-small {
    padding: 0.3rem 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--radius-xs);
}

/* Default (secondary) button */
.btn:not(.btn-primary):not(.btn-danger):not(.btn-accept):not(.btn-full) {
    background: var(--card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}
.btn:not(.btn-primary):not(.btn-danger):not(.btn-accept):not(.btn-full):hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-full { width: 100%; padding: 0.75rem; font-size: 1rem; }

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}
.btn-danger:hover { background: #fca5a5; }

.btn-accept {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}
.btn-accept:hover { background: #a7f3d0; }

/* Push-button active */
.push-active {
    background: var(--success-bg) !important;
    color: var(--success) !important;
    border: 1px solid var(--success-border) !important;
}

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.125rem; }

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-select,
.pw-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    color: var(--text);
    background: var(--card);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-select:focus,
.pw-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-group input[type=checkbox] { width: auto; }
.form-group input[type=file] {
    padding: 0.4rem;
    font-size: 0.875rem;
    background: var(--bg);
}

.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.25rem; }
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--text-secondary);
}
.checkbox-label input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
}

/* ─── Alerts ─────────────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-error   { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-border); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.alert-info    { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* ─── Login ──────────────────────────────────────────────────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--header-bg);
    background-image: radial-gradient(ellipse at 20% 50%, rgba(124,58,237,.15) 0%, transparent 60%),
                      radial-gradient(ellipse at 80% 20%, rgba(196,181,253,.08) 0%, transparent 50%);
}

.login-card {
    background: var(--card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    margin: 1.5rem;
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.375rem;
}

.subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* ─── Task List ──────────────────────────────────────────────────── */
.task-list { list-style: none; }

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition);
}
.task-item:last-child { border-bottom: none; }

.proposal-info { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.proposal-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.proposal-meta  { font-size: 0.75rem; color: var(--muted); }

/* ─── Todo Check States ──────────────────────────────────────────── */
.todo-check {
    width: 28px; min-width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.875rem; font-weight: 700;
    flex-shrink: 0;
    text-decoration: none;
    transition: all var(--transition);
}
.todo-check.open {
    border: 2px solid var(--border);
    color: var(--muted);
    background: transparent;
}
.todo-check.open:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.1);
}
.todo-check.done    { background: var(--success-bg); color: var(--success); border: 2px solid var(--success-border); }
.todo-check.pending { background: var(--warning-bg); color: var(--warning); border: 2px solid var(--warning-border); font-size: 0.75rem; }
.todo-check.expired { background: #f3f4f6; color: #9ca3af; border: 2px solid var(--border); }

.task-done .proposal-title { opacity: 0.4; text-decoration: line-through; }
.task-done .proposal-meta,
.task-done .points-chip,
.task-done .badge-icon,
.task-done .todo-check { opacity: 0.4; }

/* ─── Chips & Badges ─────────────────────────────────────────────── */
.points-chip {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.recurrence-chip {
    background: #f3f4f6;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.badge-proposed   { background: var(--warning-bg);  color: var(--warning);  font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; }
.badge-accepted   { background: var(--success-bg);  color: var(--success);  font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.badge-sync       { background: #dbeafe; color: #1e40af; font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: var(--radius-xs); }
.badge-icon       { font-size: 0.875rem; flex-shrink: 0; }

.badge-deadline         { background: var(--warning-bg); color: var(--warning); font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.badge-deadline-expired { background: var(--danger-bg);  color: var(--danger);  font-size: 0.68rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }

.badge-level       { font-size: 0.68rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: var(--radius-xs); }
.badge-level-info  { background: #dbeafe; color: #1e40af; }
.badge-level-warn  { background: var(--warning-bg); color: var(--warning); }
.badge-level-error { background: var(--danger-bg);  color: var(--danger); }

/* ─── Avatar ─────────────────────────────────────────────────────── */
.avatar-small {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    transition: opacity var(--transition);
}
.avatar-small:hover { opacity: .85; }
.avatar-initials {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.875rem;
    text-decoration: none;
}
.avatar-large {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.avatar-placeholder {
    width: 80px; height: 80px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
    box-shadow: var(--shadow);
}
.avatar-preview  { display: flex; align-items: center; gap: 1.25rem; }
.avatar-name     { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.avatar-role     { color: var(--muted); font-size: 0.85rem; margin-top: 0.15rem; }

.avatar-tiny {
    width: 18px; height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-tiny-initials {
    background: var(--primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.58rem; font-weight: 700;
}
.avatar-small-round {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-initials-sm {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem;
}

/* ─── Projekte ───────────────────────────────────────────────────── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}
.project-card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.project-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.project-img         { width: 100%; height: 130px; object-fit: cover; }
.project-body        { padding: 1rem; }
.project-title-link  { font-size: 0.9375rem; font-weight: 700; color: var(--text); text-decoration: none; }
.project-title-link:hover { color: var(--primary); }
.project-desc        { font-size: 0.8rem; color: var(--muted); margin: 0.35rem 0 0.85rem; line-height: 1.5; }

.progress-bar  { background: var(--border-light); border-radius: 999px; height: 6px; overflow: hidden; margin-bottom: 0.35rem; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #a78bfa); border-radius: 999px; transition: width .4s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }

/* ─── Contribute Form ────────────────────────────────────────────── */
.contribute-form { display: flex; gap: 0.5rem; margin-top: 0.875rem; }
.contribute-form input[type=number] {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    min-width: 0;
}

/* ─── Completion Chips ───────────────────────────────────────────── */
.completion-row  { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.completion-chip {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.7rem; color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: 999px;
    padding: 0.1rem 0.5rem 0.1rem 0.15rem;
}
.completion-photo-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }
.approval-photo { width: 52px; height: 52px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); flex-shrink: 0; }

/* ─── Rangliste ──────────────────────────────────────────────────── */
.lb-row-self { background: #f5f0ff; }
.lb-row-self td:nth-child(2) span:last-child { color: var(--primary); font-weight: 700; }

/* ─── Member Rows ────────────────────────────────────────────────── */
.member-row      { gap: 0.75rem; padding: 0.875rem 0; }
.pw-form-row     { padding: 0.5rem 0 0.75rem; border-bottom: 1px solid var(--border-light); }
.pw-inline-form  { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; width: 100%; }
.pw-input {
    flex: 1; min-width: 140px;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    width: auto;
}

/* ─── Stacked Bar & Contributors ─────────────────────────────────── */
.stacked-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--border-light); margin-bottom: 1.25rem; }
.stacked-segment { height: 100%; min-width: 2px; transition: width .3s; }

.contributor-list  { list-style: none; display: flex; flex-direction: column; gap: 0.65rem; }
.contributor-item  { display: flex; align-items: center; gap: 0.75rem; }
.contributor-left  { display: flex; align-items: center; gap: 0.4rem; min-width: 90px; }
.contributor-name  { font-size: 0.875rem; font-weight: 600; }
.contributor-bar-wrap  { flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.contributor-bar-bg    { flex: 1; background: var(--border-light); border-radius: 999px; height: 8px; overflow: hidden; }
.contributor-bar-fill  { height: 100%; border-radius: 999px; transition: width .3s; }
.contributor-amount { font-size: 0.8rem; font-weight: 600; color: var(--text); min-width: 55px; text-align: right; }
.contributor-pct    { font-size: 0.72rem; color: var(--muted); min-width: 35px; text-align: right; }

.contributor-color-0 { background: var(--primary); }
.contributor-color-1 { background: #f59e0b; }
.contributor-color-2 { background: #10b981; }
.contributor-color-3 { background: #ef4444; }
.contributor-color-4 { background: #8b5cf6; }

/* ─── TodoList Admin ─────────────────────────────────────────────── */
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.list-actions { display: flex; gap: 0.5rem; }
.member-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.75rem; }
.member-chip  { background: var(--primary-light); color: var(--primary); font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0.6rem; border-radius: 999px; }

/* ─── Project Detail ─────────────────────────────────────────────── */
.project-detail-header { display: flex; gap: 1.25rem; align-items: flex-start; }
.project-detail-img    { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; transition: opacity var(--transition); }
.project-detail-img:hover { opacity: .85; }
.project-detail-info   { flex: 1; }

/* ─── Log Rows ───────────────────────────────────────────────────── */
.log-row-error { background: #fff5f5; }
.log-row-warn  { background: #fffbeb; }

/* ─── Empty State ────────────────────────────────────────────────── */
.empty-state {
    color: var(--muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
}

/* ─── Settings ───────────────────────────────────────────────────── */
section + section { margin-top: 0; }

/* ─── Admin Grid ─────────────────────────────────────────────────── */
.admin-family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}
.admin-family-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: box-shadow var(--transition);
}
.admin-family-card:hover { box-shadow: var(--shadow); }

.family-code-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-family: monospace;
    font-size: 0.9rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-xs);
    letter-spacing: .05em;
}

/* ─── Lightbox ───────────────────────────────────────────────────── */
#ql-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.88);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
#ql-lightbox.is-open {
    display: flex;
    animation: lbFadeIn .15s ease;
}
@keyframes lbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
#ql-lb-img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    cursor: default;
    animation: lbZoomIn .15s ease;
}
@keyframes lbZoomIn {
    from { transform: scale(.92); }
    to   { transform: scale(1); }
}
#ql-lb-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.3);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    backdrop-filter: blur(4px);
}
#ql-lb-close:hover { background: rgba(255,255,255,.28); }

.lightbox-trigger { cursor: zoom-in; display: inline-flex; }
.lightbox-trigger img { display: block; }

/* ─── Streak Badge ───────────────────────────────────────────────── */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #b45309;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    border: 1px solid #fcd34d;
    white-space: nowrap;
}

/* ─── Hamburger Button ───────────────────────────────────────────── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background var(--transition), border-color var(--transition);
}
.nav-toggle:hover { background: var(--bg); border-color: var(--primary); }
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    /* ── Hamburger sichtbar ── */
    .nav-toggle { display: flex; }

    /* ── Header-Nav als Dropdown ── */
    .app-header { position: relative; }

    .header-right {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 24px rgba(15,7,32,.13);
        padding: 0.75rem 1rem 1rem;
        flex-direction: column;
        gap: 0.375rem;
        z-index: 48;
        animation: navSlideDown 0.15s ease;
    }
    @keyframes navSlideDown {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .app-header.nav-open .header-right { display: flex; }

    /* Alle Buttons im Menü full-width */
    .header-right .btn {
        width: 100%;
        justify-content: flex-start;
        padding: 0.65rem 0.875rem;
        font-size: 0.875rem;
        border-radius: var(--radius-sm);
    }
    .header-right form { width: 100%; }
    .header-right form .btn { width: 100%; }

    /* Punkte-Badge als Trennlinie oben */
    .header-right .points-badge {
        display: block;
        padding: 0.5rem 0.875rem;
        border-bottom: 1px solid var(--border-light);
        margin-bottom: 0.25rem;
        font-size: 0.875rem;
        color: var(--text-secondary);
    }

    /* Avatar-Link bleibt normal */
    .header-right > a:first-child .avatar-small { border: 2px solid var(--primary); }
}

@media (max-width: 600px) {
    .container { padding: 1rem 0.875rem; }
    section { padding: 1rem; border-radius: var(--radius); }
    .app-header { padding: 0 1rem; }
    .project-grid { grid-template-columns: 1fr; }
    .project-detail-header { flex-direction: column; }

    /* Task items: Buttons umbrechen auf eigene Zeile */
    .task-item { flex-wrap: wrap; }
    .task-item .proposal-info { min-width: calc(100% - 80px); }

    /* Rangliste: horizontal scrollbar */
    .leaderboard-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .leaderboard-wrap table { min-width: 480px; }

    /* Formulare */
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }

    /* Approval-Buttons nebeneinander auf kleinen Screens */
    .task-item .btn-accept,
    .task-item .btn-danger { flex: 1; }

    /* List-Header stapeln */
    .list-header { flex-direction: column; align-items: flex-start; }
    .list-actions { flex-wrap: wrap; }
}
