/* ═══════════════════════════════════════════════════════════
   Freyas Studio — Component Library
   ═══════════════════════════════════════════════════════════ */

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    user-select: none;
    vertical-align: middle;
}

.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    color: var(--color-white);
    text-decoration: none;
}

.btn-secondary {
    background: var(--color-white);
    color: #4F2678;
    border-color: #4F2678;
}

.btn-secondary:hover {
    background: rgba(79, 38, 120, 0.06);
    color: #3d1d5b;
    border-color: #3d1d5b;
    text-decoration: none;
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #a82020;
    border-color: #a82020;
    color: var(--color-white);
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-light);
    border-color: var(--color-border);
}

.btn-ghost:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
    border-color: var(--color-border);
    text-decoration: none;
}

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

.btn-lg {
    padding: 13px 26px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

/* ── Forms ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
}

.form-group-wide {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.form-label-link {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 400;
}

.form-hint {
    font-size: 0.775rem;
    color: var(--color-text-muted);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-white);
    color: var(--color-text);
    font-size: 0.9rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    min-height: 44px;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(39, 99, 120, 0.12);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23999' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    padding-right: 36px;
}

.form-select-sm {
    padding: 5px 28px 5px 8px;
    font-size: 0.8rem;
}

.form-input-inline {
    display: inline-block;
    width: auto;
    flex: 1;
}

.form-group-checkbox {
    flex-direction: row;
    align-items: flex-start;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--color-text);
    line-height: 1.5;
}

.form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.form-error {
    font-size: 0.8rem;
    color: var(--color-danger);
}

.form-error-banner {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-danger-light);
    border: 1px solid rgba(198, 40, 40, 0.2);
    border-radius: var(--radius);
    color: var(--color-danger);
    font-size: 0.875rem;
    margin-bottom: var(--space-5);
}

.form-error-banner svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding-top: var(--space-4);
}

.form-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: var(--radius-full);
    transition: 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--color-white);
    border-radius: 50%;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--color-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ── Cards ── */
.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--color-primary-dark);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-alt);
}

.card-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.card-image-placeholder {
    background: linear-gradient(135deg, var(--color-bg-alt), var(--color-placeholder));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-border);
}

.card-text {
    color: var(--color-text-light);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

/* ── Course Card ── */
.course-card {
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
    position: relative;
}

.course-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.course-card-image-link {
    position: relative;
    display: block;
}

.course-card-badge {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 1;
}

.course-card-progress-text {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.course-card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    line-height: 1.25;
    text-align: center;
    margin-bottom: var(--space-3);
}

.course-card-title a {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.course-card-title a:hover { text-decoration: underline; }

.course-card .card-text {
    text-align: center;
}

/* ── Stat Cards ── */
.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-card-icon-primary {
    background: rgba(39, 99, 120, 0.1);
    color: var(--color-primary);
}

.stat-card-icon-secondary {
    background: rgba(79, 38, 120, 0.1);
    color: var(--color-secondary);
}

.stat-card-icon-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.stat-card-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-1);
}

.stat-card-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    line-height: 1;
}

/* ── Tables ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-alt);
    white-space: nowrap;
}

.table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    color: var(--color-text);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(39, 99, 120, 0.02); }

.table-link {
    font-weight: 600;
    color: var(--color-primary);
    display: block;
}

.table-link:hover { color: var(--color-primary-dark); }

.table-actions {
    display: flex;
    gap: var(--space-2);
    justify-content: flex-end;
}

.table-empty {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-10) var(--space-4) !important;
}

.table-user-cell {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-primary {
    background: rgba(39, 99, 120, 0.12);
    color: var(--color-primary);
}

.badge-success {
    background: var(--color-success-light);
    color: var(--color-success);
}

.badge-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.badge-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.badge-info {
    background: var(--color-info-light);
    color: var(--color-info);
}

.badge-muted {
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.badge-count {
    background: var(--color-danger);
    color: var(--color-white);
    min-width: 20px;
    height: 20px;
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
}

.badge-count:empty { display: none; }

/* Content type badges */
.badge-video { background: #fef3c7; color: #d97706; }
.badge-audio { background: #e0f2fe; color: #0284c7; }
.badge-text  { background: var(--color-success-light); color: var(--color-success); }
.badge-file  { background: var(--color-bg-alt); color: var(--color-text-muted); }
.badge-pdf   { background: #fee2e2; color: #dc2626; }
.badge-scorm { background: var(--color-accent-light); color: var(--color-secondary); }

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    min-width: 0;
}

/* ── Modals ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-primary-dark);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}

.modal-close:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border-light);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ── Toasts ── */
.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 380px;
    width: calc(100vw - var(--space-12));
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    color: var(--color-text);
}

.toast-success {
    border-left: 3px solid var(--color-success);
}

.toast-success .toast-icon { color: var(--color-success); }

.toast-error {
    border-left: 3px solid var(--color-danger);
}

.toast-error .toast-icon { color: var(--color-danger); }

.toast-warning {
    border-left: 3px solid var(--color-warning);
}

.toast-warning .toast-icon { color: var(--color-warning); }

.toast-info {
    border-left: 3px solid var(--color-info);
}

.toast-info .toast-icon { color: var(--color-info); }

.toast-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.toast-close:hover { color: var(--color-text); }

/* ── Upload Zone (Aufgabe 1: Bild-Upload Widget) ── */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    background: var(--color-bg-alt);
    transition: border-color 0.2s, background 0.2s;
    cursor: default;
}

.upload-zone:hover,
.upload-zone-active {
    border-color: var(--primary, #1a616e);
    background: rgba(39, 99, 120, 0.05);
}

.upload-zone-sm {
    padding: var(--space-4);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.upload-placeholder p { margin: 0; }

.upload-link {
    color: var(--primary, #1a616e);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
}

.upload-preview-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
}

.upload-preview {
    max-width: 100%;
    max-height: 240px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--color-border);
}

.upload-preview-sm {
    max-height: 140px;
}

.upload-remove {
    font-size: 0.8rem;
}

.upload-zone-uploading {
    border-color: var(--primary, #1a616e);
    background: rgba(39, 99, 120, 0.04);
    pointer-events: none;
}

.upload-progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) 0;
}

.upload-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--color-border);
    border-top-color: var(--primary, #1a616e);
    border-radius: 50%;
    animation: upload-spin 0.7s linear infinite;
}

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

.upload-status-text {
    margin: 0;
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ── Drag Handle (Aufgabe 2: SortableJS) ── */
.drag-handle {
    cursor: grab;
    color: var(--color-text-muted);
    padding: 0 var(--space-2);
    font-size: 1rem;
    user-select: none;
    flex-shrink: 0;
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
}

/* ── Modal footer (ergaenzt bestehende Modal-Stile) ── */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--color-border-light);
}

/* Toast transitions */
.toast-enter { transition: all 0.25s ease-out; }
.toast-enter-start { opacity: 0; transform: translateX(100%); }
.toast-enter-end { opacity: 1; transform: translateX(0); }
.toast-leave { transition: all 0.2s ease-in; }
.toast-leave-start { opacity: 1; }
.toast-leave-end { opacity: 0; transform: translateX(100%); }

/* ── Course Card: dual CTA (Mehr erfahren + Jetzt kaufen) ── */
.course-card-cta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* ── Course Detail: Purchase Banner ── */
.course-purchase-banner {
    margin-bottom: var(--space-6);
    border-color: var(--color-primary);
    border-width: 2px;
}

.course-purchase-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.course-purchase-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.course-purchase-lead {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.5;
}

.course-purchase-price {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary-dark);
}

.course-purchase-btn {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .course-purchase-body {
        flex-direction: column;
        align-items: flex-start;
    }
    .course-purchase-btn {
        width: 100%;
    }
}

/* ── badge-neutral (shared across profile pages) ── */
.badge-neutral {
    background: #f3f4f6;
    color: #374151;
}

/* ── Accordion ── */
.accordion-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--color-white);
}

.accordion-item-locked {
    opacity: 0.7;
    background: var(--color-bg-alt);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    width: 100%;
    padding: var(--space-4) var(--space-5);
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.accordion-header:hover:not([disabled]) {
    background: rgba(39, 99, 120, 0.04);
}

.accordion-header[disabled] {
    cursor: default;
}

.accordion-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
    min-width: 0;
}

.accordion-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-shrink: 0;
}

.accordion-chevron {
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.accordion-chevron-open {
    transform: rotate(180deg);
}

.accordion-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.accordion-body {
    border-top: 1px solid var(--color-border-light);
    padding: var(--space-4) var(--space-5);
}

/* Nested child modules */
.accordion-item--child {
    border: 1px solid var(--color-border-light, #e5e7eb);
    border-radius: var(--radius, 6px);
    margin-bottom: var(--space-2, 0.5rem);
    background: var(--color-bg-alt, #f9fafb);
}
.accordion-header--child {
    padding: var(--space-2, 0.5rem) var(--space-3, 0.75rem);
    font-size: 0.9rem;
}

/* SortableJS Drag Ghost */
.sortable-ghost {
    opacity: 0.4;
    border: 2px dashed var(--color-primary, #1a616e) !important;
    background: rgba(39, 99, 120, 0.06) !important;
}

/* Empty lesson list — visible drop target */
.sortable-lessons:empty {
    min-height: 24px;
    border: 1px dashed var(--color-border, #d1d5db);
    border-radius: var(--radius);
}

/* "Als Untermodul einfuegen" Drop-Zone */
.drop-as-child {
    display: none;
    min-height: 36px;
    margin: 0 1rem;
    padding: 0.4rem 0.75rem;
    border: 2px dashed var(--color-primary, #1a616e);
    border-radius: var(--radius, 6px);
    background: rgba(39, 99, 120, 0.06);
    text-align: center;
    transition: background 0.15s;
}
.drop-as-child-label {
    font-size: 0.8rem;
    color: var(--color-primary, #1a616e);
    font-weight: 500;
    pointer-events: none;
}
/* Show during module drag */
.module-drag-active .drop-as-child {
    display: block;
}
/* Hide on the module being dragged itself */
.sortable-ghost .drop-as-child,
.sortable-drag .drop-as-child {
    display: none !important;
}
/* Highlight when hovering with a dragged module */
.drop-as-child.sortable-ghost-parent,
.drop-as-child:has(.module-edit-item) {
    background: rgba(39, 99, 120, 0.15);
    border-color: var(--color-primary, #1a616e);
}
/* Brief flash on a module right after it was moved (nest/un-nest) so the user
   immediately sees where it landed. Toggled via JS class .module-just-moved. */
.module-edit-item.module-just-moved {
    animation: module-moved-flash 2.4s ease-out;
    border-radius: var(--radius, 6px);
}
@keyframes module-moved-flash {
    0%   { box-shadow: 0 0 0 3px var(--color-gold, #c39641); background: rgba(195, 150, 65, 0.18); }
    70%  { box-shadow: 0 0 0 3px rgba(195, 150, 65, 0.40); }
    100% { box-shadow: 0 0 0 0 rgba(195, 150, 65, 0); background: transparent; }
}

.module-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.module-lesson-count {
    font-size: 0.775rem;
    color: var(--color-text-muted);
}

.unlock-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    font-size: 0.775rem;
    color: var(--color-text-muted);
    background: var(--color-bg-alt);
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

.module-empty {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-4);
}

/* ── Lesson Items ── */
.lesson-list {
    display: flex;
    flex-direction: column;
}

.lesson-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2);
    border-radius: var(--radius);
    transition: background 0.1s;
}

.lesson-item:hover:not(.lesson-item-locked) {
    background: rgba(39, 99, 120, 0.04);
}

/* Ganze Zeile klickbar: der Titel-Link legt ein unsichtbares Overlay ueber die
   komplette Zeile (Stretched Link). Kein JS — Cmd-/Mittelklick, Kontextmenue,
   Tastaturfokus und Statusleiste bleiben erhalten. */
.lesson-item--clickable {
    position: relative;
    cursor: pointer;
}

.lesson-item--clickable a.lesson-item-title::after {
    content: "";
    position: absolute;
    inset: 0;
}

/* Interaktive Kinder muessen ueber dem Overlay liegen, sonst sind sie tot. */
.lesson-item--clickable .lesson-item-description-toggle {
    position: relative;
    z-index: 1;
}

.lesson-item--clickable:focus-within {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.lesson-item-locked {
    opacity: 0.6;
}

.lesson-item-completed .lesson-item-title {
    color: var(--color-text-muted);
}

.lesson-item-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-primary);
    border-radius: var(--radius-sm);
    background: rgba(39, 99, 120, 0.08);
}

.lesson-item-completed .lesson-item-icon {
    background: var(--color-success-light);
    color: var(--color-success);
}

.lesson-item-locked .lesson-item-icon {
    background: var(--color-bg-alt);
    color: var(--color-text-muted);
}

.lesson-icon-done { color: var(--color-success); }
.lesson-icon-lock { color: var(--color-text-muted); }

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

.lesson-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lesson-item-title:hover { color: var(--color-primary); }

.lesson-title-locked {
    color: var(--color-text-muted);
}

.lesson-item-description-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.lesson-item-description {
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--color-text-muted, #6b7280);
    margin: 0.15rem 0 0.2rem;
    white-space: normal;
}

.lesson-item-description-clampable {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.lesson-item-description-clampable.lesson-item-description-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.lesson-item-description-toggle {
    align-self: flex-start;
    background: none;
    border: none;
    padding: 0;
    margin-top: 2px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--teal, #1a616e);
    cursor: pointer;
    text-decoration: underline;
}

.lesson-item-description-toggle:hover {
    color: var(--gold, #c39641);
}

.lesson-item-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 2px;
    flex-wrap: wrap;
}

.lesson-duration {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.lesson-unlock-date {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.lesson-item-status {
    flex-shrink: 0;
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
}

.status-done {
    background: var(--color-success-light);
    color: var(--color-success);
}

.status-available {
    color: var(--color-text-muted);
}

/* ── Pills / Tabs ── */
.pills {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.pill {
    padding: var(--space-3) var(--space-5);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
    margin-bottom: -1px;
    text-decoration: none;
}

.pill:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.pill-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* ── Avatar ── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

/* Member search suggest */
.search-suggest-wrap { position: relative; }
.search-suggest-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 30;
    background: #fff;
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    list-style: none;
    padding: 0.25rem 0;
    margin: 0.25rem 0 0;
    max-height: 320px;
    overflow-y: auto;
}
.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: background 0.1s;
}
.search-suggest-item:hover,
.search-suggest-item.active {
    background: var(--color-bg-alt, #f3f4f6);
}
.suggest-initial {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary, #1a616e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}
.suggest-info { display: flex; flex-direction: column; min-width: 0; }
.suggest-name { font-size: 0.85rem; font-weight: 500; }
.suggest-email { font-size: 0.75rem; color: var(--color-text-muted, #6b7280); }

.avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 1.5rem;
}

.avatar-initials {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    color: var(--color-white);
    font-weight: 700;
    font-size: 0.875rem;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-4);
}

.empty-state-sm {
    padding: var(--space-10) var(--space-4);
}

.empty-state-icon {
    color: var(--color-border);
    margin: 0 auto var(--space-6);
    width: fit-content;
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-text-light);
    margin-bottom: var(--space-3);
}

.empty-state-text {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: var(--space-6);
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-8);
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-text);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: 0.15s;
}

.pagination-btn:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
    text-decoration: none;
}

.pagination-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.pagination-page {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-text);
    font-size: 0.875rem;
    text-decoration: none;
    transition: 0.15s;
}

.pagination-page:hover {
    background: var(--color-bg-alt);
    text-decoration: none;
    color: var(--color-primary);
}

.pagination-page-active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
    font-weight: 600;
}

.pagination-ellipsis {
    width: 36px;
    text-align: center;
    color: var(--color-text-muted);
}

/* ── Card Form variant ── */
.card-form .card-body {
    padding: var(--space-6);
}

.card-form .card-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--color-white);
    border-top: 1px solid var(--color-border-light);
}

/* Responsive form grid: single column on mobile */
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-wide {
        grid-column: auto;
    }

    .toast-container {
        bottom: var(--space-4);
        right: var(--space-4);
        left: var(--space-4);
        width: auto;
    }

/* ── Comments ── */
.comments-section { margin-top: var(--space-8); }
.comments-heading { font-size: 1.25rem; margin-bottom: var(--space-4); display: flex; align-items: center; gap: var(--space-2); }
.comments-count { font-size: 0.875rem; color: var(--text-muted); font-weight: 400; }
.comments-empty { color: var(--text-muted); font-style: italic; padding: var(--space-4) 0; }
.comments-loading { color: var(--text-muted); padding: var(--space-4) 0; }

.comment-form { margin-bottom: var(--space-6); }
.comment-form-row { display: flex; gap: var(--space-3); align-items: flex-start; }
.comment-form-row .avatar { flex-shrink: 0; margin-top: 4px; }
.comment-textarea { flex: 1; resize: vertical; min-height: 60px; }
.comment-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--space-2); margin-top: var(--space-2); }

.comment-list { display: flex; flex-direction: column; gap: var(--space-4); }
.comment { background: var(--bg-card); border-radius: var(--radius-lg); padding: var(--space-4); border: 1px solid var(--border-color); }
.comment-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.comment-meta { flex: 1; }
.comment-author { font-size: 0.875rem; }
.comment-time { font-size: 0.75rem; color: var(--text-muted); display: block; }
.comment-body { font-size: 0.9375rem; line-height: 1.6; white-space: pre-wrap; }
.comment-delete { opacity: 0.4; transition: opacity 0.15s; }
.comment-delete:hover { opacity: 1; }
.comment-actions { margin-top: var(--space-2); }

.comment-replies { margin-top: var(--space-3); margin-left: var(--space-6); display: flex; flex-direction: column; gap: var(--space-2); }
.comment-reply { background: var(--bg-subtle); border-color: transparent; padding: var(--space-3); }
.comment-reply-form { margin-top: var(--space-2); }
.comment-reply-form .comment-textarea { min-height: 44px; font-size: 0.875rem; }

    .lesson-edit-grid {
        grid-template-columns: 1fr;
    }

    .lesson-edit-sidebar {
        position: static;
    }
}

/* ── iOS Zoom Prevention (max-width: 767px) ── */
@media (max-width: 767px) {
    /* Prevent iOS from zooming in on input focus by enforcing 16px minimum */
    input, select, textarea { font-size: max(16px, 1em); }
}

/* ── Promo Cards ── */
.promo-card {
    position: relative;
    border: 1px solid var(--color-accent, #e8c4a0);
}

.promo-badge {
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    background: var(--color-primary);
    color: white;
    padding: 2px 10px;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1;
    pointer-events: none;
}

.promo-dismiss {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    z-index: 2;
    padding: 0;
    transition: background 0.15s;
}

.promo-dismiss:hover {
    background: rgba(0, 0, 0, 0.7);
}

.promo-feed {
    margin-top: var(--space-6);
}


/* ── Feed Cards (Facebook-style) ── */

.feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    max-width: 680px;
}

.feed-card {
    background: var(--color-white);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.feed-card-op {
    border-left: 3px solid var(--color-primary);
}

.feed-card-reply {
    border-left: none;
}

.feed-card-nested {
    background: var(--color-bg-alt, #f5ede5);
    border: none;
    box-shadow: none;
}

.feed-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-4, 16px) var(--space-4, 16px) 0;
}

.feed-card-author-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.feed-card-author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: none;
}

.feed-card-author-name:hover {
    color: var(--color-primary);
}

.feed-card-time {
    font-size: 0.75rem;
    color: var(--color-text-muted, #999);
}

.feed-card-badge {
    margin-left: auto;
    color: var(--color-secondary, #1a616e);
}

.feed-card-body {
    padding: var(--space-3, 12px) var(--space-4, 16px);
}

.feed-card-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 var(--space-2, 8px);
    line-height: 1.4;
}

.feed-card-title a {
    color: var(--color-text);
    text-decoration: none;
}

.feed-card-title a:hover {
    color: var(--color-primary);
}

.feed-card-text {
    font-size: 0.925rem;
    line-height: 1.6;
    color: var(--color-text);
}


/* ── Reaction Summary + Actions ── */

.feed-card-stats {
    padding: 0 var(--space-4, 16px);
}

.reaction-summary {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) 0;
    border-bottom: 1px solid var(--color-border, #e8e0d8);
}

.reaction-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.8rem;
    color: var(--color-text-muted, #999);
}

.reaction-summary-count {
    font-weight: 600;
}

.feed-card-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1, 4px);
    padding: var(--space-2, 8px) 0;
}

.reply-action-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 2px;
    padding: 0;
}

.reply-link-btn {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-muted, #888);
    cursor: pointer;
    transition: color 0.15s;
    line-height: 1.2;
}

.reply-link-btn:hover,
.reply-link-btn:focus-visible {
    background: transparent;
    color: #4F2678;
    text-decoration: underline;
    outline: none;
}

.reply-link-btn svg {
    display: none;
}

.feed-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius, 8px);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.feed-action-btn:hover {
    background: var(--color-bg-alt, #f5ede5);
    color: var(--color-text);
}

.feed-action-btn.feed-action-active {
    color: var(--color-primary);
}

.feed-action-btn .reaction-emoji {
    font-size: 1.1rem;
}


/* ── Reaction Picker (Emoji Dropdown) ── */

.reaction-wrapper {
    position: relative;
    display: inline-flex;
}

.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--color-white);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    white-space: nowrap;
}

.reaction-picker-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
    padding: 0;
}

.reaction-picker-emoji:hover {
    transform: scale(1.35);
    background: var(--color-bg-alt, #f5ede5);
}

.reaction-picker-active {
    background: var(--color-bg-alt, #f5ede5);
    box-shadow: 0 0 0 2px var(--color-primary);
}


/* ── Feed Comments Section ── */

.feed-comments-section {
    padding: 0 var(--space-4, 16px) var(--space-3, 12px);
}

.feed-comments-toggle {
    display: block;
    padding: var(--space-2, 8px) 0;
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
    cursor: pointer;
}

.feed-comments-toggle:hover {
    color: var(--color-primary);
}

.feed-comments {
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
    padding-top: var(--space-2, 8px);
}


/* ── Feed Comment (Facebook-style bubble) ── */

.feed-comment {
    display: flex;
    gap: var(--space-2, 8px);
    align-items: flex-start;
}

.feed-comment-avatar {
    flex-shrink: 0;
}

.feed-comment-content {
    min-width: 0;
    flex: 1;
}

.feed-comment-bubble {
    display: inline-block;
    padding: 8px 12px;
    background: var(--color-bg-alt, #f5ede5);
    border-radius: 18px;
    max-width: 100%;
}

.feed-comment-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--color-text);
    text-decoration: none;
    margin-right: 6px;
}

.feed-comment-author:hover {
    color: var(--color-primary);
}

.feed-comment-text {
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--color-text);
    word-wrap: break-word;
}

.feed-comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: 2px 12px;
}

.feed-comment-time {
    font-size: 0.7rem;
    color: var(--color-text-muted, #999);
}

.feed-comment-action {
    border: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
    cursor: pointer;
    padding: 0;
}

.feed-comment-action:hover {
    color: var(--color-primary);
}

.feed-comment-replies {
    padding-left: var(--space-5, 20px);
    margin-top: var(--space-2, 8px);
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
}

.feed-comment-nested {
    font-size: 0.9em;
}


/* ── Feed Comment Input ── */

.feed-comment-input {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding-top: var(--space-3, 12px);
    border-top: 1px solid var(--color-border, #e8e0d8);
    margin-top: var(--space-2, 8px);
}

.feed-comment-form {
    display: flex;
    align-items: center;
    gap: var(--space-2, 8px);
    flex: 1;
}

.feed-comment-field {
    flex: 1;
    padding: 8px 16px;
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--color-bg-alt, #f5ede5);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.feed-comment-field:focus {
    border-color: var(--color-primary);
    background: var(--color-white);
}

.feed-comment-field::placeholder {
    color: var(--color-text-muted, #999);
}

.feed-comment-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.feed-comment-submit:hover {
    background: var(--color-primary-dark, #134a55);
}

.feed-comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ── Thread Replies (detail page) ── */

.thread-replies {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
    margin-top: var(--space-4, 16px);
}


/* ── Mobile: Feed responsive ── */

@media (max-width: 767px) {
    .feed {
        max-width: 100%;
    }

    .feed-card-header {
        padding: var(--space-3, 12px) var(--space-3, 12px) 0;
    }

    .feed-card-body {
        padding: var(--space-2, 8px) var(--space-3, 12px);
    }

    .feed-card-stats {
        padding: 0 var(--space-3, 12px);
    }

    .feed-comments-section {
        padding: 0 var(--space-3, 12px) var(--space-2, 8px);
    }

    .reaction-picker {
        left: -8px;
    }
}


/* ── Message Reactions (DM iMessage-style) ── */

.message-bubble-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: inherit;
}

.message-own .message-bubble-wrapper {
    align-items: flex-end;
}

.message-other .message-bubble-wrapper {
    align-items: flex-start;
}

.msg-picker-trigger {
    position: absolute;
    top: -36px;
    z-index: 40;
}

.message-own .msg-picker-trigger {
    right: 0;
}

.message-other .msg-picker-trigger {
    left: 0;
}

.msg-reaction-picker {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    background: var(--color-white);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
}

.msg-picker-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 1.1rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.12s;
    padding: 0;
}

.msg-picker-emoji:hover {
    transform: scale(1.3);
}

.msg-reactions {
    min-height: 0;
}

.msg-reaction-badges {
    display: flex;
    gap: 3px;
    margin-top: 2px;
}

.msg-reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    background: var(--color-white);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    line-height: 1.4;
}

.msg-reaction-badge-own {
    border-color: var(--color-primary);
    background: rgba(39, 99, 120, 0.08);
}

.msg-reaction-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--color-text-muted, #999);
}

/* ── Member Search Autocomplete ── */

.search-suggest-wrap {
    position: relative;
}

.search-suggest-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    margin: 2px 0 0;
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .12), 0 2px 8px rgba(0, 0, 0, .06);
    max-height: 360px;
    overflow-y: auto;
    list-style: none;
    padding: 6px 0;
}

.search-suggest-list li {
    list-style: none;
}

.search-suggest-list li + li {
    border-top: 1px solid var(--color-border, #e8e0d8);
}

.search-suggest-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    font-size: 0.875rem;
    line-height: 1.4;
    transition: background 0.1s ease;
}

.search-suggest-item:hover,
.search-suggest-item[aria-selected="true"] {
    background: var(--cream, #f8f4ef);
}

.search-suggest-item .suggest-initial {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary, #1a616e);
    color: #fff;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.search-suggest-item .suggest-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.search-suggest-item .suggest-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-suggest-item .suggest-email {
    color: var(--color-text-muted, #999);
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── YouTube Embed — Facade Pattern ── */
.yt-embed-wrap {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
}
.yt-facade {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.yt-facade-thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.yt-facade-play {
    position: relative;
    z-index: 2;
    transition: transform 0.15s, opacity 0.15s;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}
.yt-facade:hover .yt-facade-play {
    transform: scale(1.1);
}
.yt-facade:focus-visible {
    outline: 2px solid var(--color-primary, #1a616e);
    outline-offset: 2px;
}

/* ── Dashboard Hero ── */
.hero {
    position: relative;
    background: linear-gradient(135deg, #134A55 0%, #1a616e 100%);
    border-radius: 20px;
    padding: clamp(1.25rem, 2.5vw, 2rem);
    margin-bottom: var(--space-6, 24px);
    border: 1px solid rgba(195, 150, 65, 0.22);
    overflow: hidden;
}

/* Driftende Lichtpunkte (Bernstein-Gold + Flieder) als ambienter Layer */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle 80px at 12% 22%, rgba(195, 150, 65, 0.28), transparent 70%),
        radial-gradient(circle 110px at 88% 62%, rgba(225, 203, 247, 0.22), transparent 70%),
        radial-gradient(circle 60px at 48% 90%, rgba(195, 150, 65, 0.20), transparent 70%);
    animation: heroDrift 28s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

/* Schwebende Sparkles (gestaffelt) — verteilt über den ganzen Hero */
.hero-spark {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    animation: heroSparkle 5.5s ease-in-out infinite;
    user-select: none;
}
.hero-spark--tl { top: 10%; left: 5%;   color: rgba(195, 150, 65, 0.55); font-size: 1.1rem; animation-delay: 0s; }
.hero-spark--tr { top: 16%; right: 12%; color: rgba(79, 38, 120, 0.45);  font-size: 0.85rem; animation-delay: 1.4s; }
.hero-spark--bl { bottom: 24%; left: 16%; color: rgba(225, 203, 247, 0.85); font-size: 1rem; animation-delay: 2.7s; }
.hero-spark--br { bottom: 12%; right: 7%; color: rgba(195, 150, 65, 0.5); font-size: 0.95rem; animation-delay: 3.9s; }
.hero-spark--c1 { top: 42%; right: 28%; color: rgba(79, 38, 120, 0.35);  font-size: 0.7rem; animation-delay: 4.6s; }
.hero-spark--c2 { top: 70%; left: 38%; color: rgba(195, 150, 65, 0.4);  font-size: 0.8rem; animation-delay: 0.8s; }

.hero > * {
    position: relative;
    z-index: 1;
}

@keyframes heroDrift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(22px, -18px) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
    .hero::after { animation: none; }
}

.hero-shell {
    display: grid;
    grid-template-columns: minmax(260px, 42%) 1fr;
    gap: clamp(24px, 3vw, 40px);
    /* Text-Kasten vertikal mittig zum Foto (Freya-Feedback 10.07) */
    align-items: center;
    margin-bottom: var(--space-5, 20px);
}

/* Text-only hero (brand without a hero photo) — single centered column. */
.hero-shell--solo {
    grid-template-columns: 1fr;
    max-width: 720px;
    margin-inline: auto;
}

.hero-photo {
    position: relative;
    margin: 0;
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(79, 38, 120, 0.16),
                0 2px 8px rgba(79, 38, 120, 0.08);
    background: #d8c4ec;
    max-height: 480px;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

.hero-photo:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 42px rgba(79, 38, 120, 0.22),
                0 4px 12px rgba(79, 38, 120, 0.10);
}

.hero-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    display: block;
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-photo:hover img {
    transform: scale(1.04);
}

.hero-photo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
                transparent 55%,
                rgba(79, 38, 120, 0.22) 100%);
    pointer-events: none;
}

.hero-photo--missing img { display: none; }
.hero-photo--missing::before {
    content: '🌿';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 3rem;
    opacity: 0.4;
}

.hero-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.hero-heading {
    position: relative;
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    color: #FFFAF5;
    margin: 0;
    line-height: 1.05;
    text-wrap: balance;
    display: inline-block;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

/* ✨ Feenstaub: zwei subtile Sparkles, die ums Heading schweben.
   Glyphs werden via data-symbol-l/-r dynamisch gesetzt (Tageszeit/Saison). */
.hero-heading::before,
.hero-heading::after {
    position: absolute;
    color: #c39641;
    font-size: 0.5em;
    opacity: 0;
    animation: heroSparkle 4.5s ease-in-out infinite;
    pointer-events: none;
}
.hero-heading::before {
    content: attr(data-symbol-l);
    top: 0.05em;
    left: -0.6em;
    animation-delay: 0.6s;
}
.hero-heading::after {
    content: attr(data-symbol-r);
    bottom: 0.1em;
    right: -0.55em;
    color: var(--hero-sparkle, #4F2678);
    font-size: 0.42em;
    animation-delay: 2.2s;
}

/* Freitag (weekday=4) = Gold-Bernstein-Sparkles als subtile Akzentfarbe */
.hero-heading[data-weekday="4"]::before,
.hero-heading[data-weekday="4"]::after {
    color: #c39641;
}

@keyframes heroSparkle {
    0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
    25% { opacity: 0.85; transform: scale(1) rotate(90deg); }
    50% { opacity: 0.5; transform: scale(0.8) rotate(180deg); }
    75% { opacity: 0; transform: scale(0.4) rotate(270deg); }
}

.hero-subtitle {
    color: var(--hero-pill-text, #3d1d5b);
    font-size: 1rem;
    line-height: 1.55;
    margin: 0;
    background: var(--hero-pill-bg, #E1CBF7);
    border: 1px solid var(--hero-pill-border, rgba(79, 38, 120, 0.16));
    border-radius: 14px;
    padding: 0.9rem 1.4rem;
    text-align: center;
    text-wrap: pretty;
    box-sizing: border-box;
    max-width: 480px;
}

.hero-subtitle strong,
.hero-subtitle b {
    color: var(--hero-sparkle, #4F2678);
    font-weight: 700;
}

.hero-subtitle p { margin: 0; }
.hero-subtitle p + p { margin-top: 0.5em; }

.hero-subtitle a {
    color: var(--hero-sparkle, #4F2678);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Mobile: stack photo on top, text below, CTAs full-width */
@media (max-width: 720px) {
    .hero-shell {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .hero-photo {
        aspect-ratio: 16 / 10;
        max-height: 260px;
    }
    .hero-photo img { object-position: center 35%; }
    .hero-text {
        align-items: center;
        text-align: center;
    }
}

.hero-cta-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-3, 12px);
}

.hero-cta {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: var(--space-4, 16px);
    background: var(--color-white, #fff);
    border: 1px solid rgba(79, 38, 120, 0.12);
    border-radius: 14px;
    text-decoration: none;
    color: var(--color-text, #2a2a2a);
    overflow: hidden;
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.32s ease;
}

/* Subtle radial glow on hover, behind content */
.hero-cta::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%,
                rgba(225, 203, 247, 0.55) 0%,
                rgba(225, 203, 247, 0) 60%);
    opacity: 0;
    transition: opacity 0.32s ease;
    pointer-events: none;
}

.hero-cta:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(79, 38, 120, 0.18),
                0 4px 10px rgba(79, 38, 120, 0.08);
    border-color: rgba(79, 38, 120, 0.32);
}

.hero-cta:hover::before { opacity: 1; }

.hero-cta:focus-visible {
    outline: 2px solid #4F2678;
    outline-offset: 3px;
}

.hero-cta-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    flex-grow: 0;
    color: #4F2678;
    align-self: center;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hero-cta:hover .hero-cta-icon {
    transform: scale(1.18) rotate(-4deg);
}
.hero-cta > svg {
    /* Defensive: falls .hero-cta-icon nicht greift, deckelt SVG-Direktkind */
    max-width: 28px;
    max-height: 28px;
}

.hero-cta-label {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: #4F2678;
    text-align: center;
    width: 100%;
}

.hero-cta-hint {
    font-size: 0.85rem;
    color: var(--color-text-light, #666);
    line-height: 1.4;
    text-align: center;
    width: 100%;
    text-wrap: pretty;
}

/* Herzschlag: Cards pulsen mit echtem Lub-Dub-Rhythmus + leichter Zoom.
   Signal: "klick mich" — sanft, lebendig, nicht aufdringlich.
   Cycle: ~1.5s (entspannter Ruhepuls, ~40 BPM), je Card eigener Phase-Offset. */
@keyframes ctaIdleViber {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(79, 38, 120, 0.05);
        border-color: rgba(79, 38, 120, 0.12);
    }
    6% {  /* Lub — first beat, kräftiger */
        transform: scale(1.024);
        box-shadow: 0 12px 28px rgba(195, 150, 65, 0.20);
        border-color: rgba(195, 150, 65, 0.36);
    }
    12% {  /* short rest zwischen beats */
        transform: scale(1.008);
        box-shadow: 0 6px 18px rgba(195, 150, 65, 0.10);
    }
    18% {  /* Dub — second beat, weicher */
        transform: scale(1.018);
        box-shadow: 0 9px 22px rgba(195, 150, 65, 0.14);
        border-color: rgba(195, 150, 65, 0.30);
    }
    26% {  /* Release */
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(79, 38, 120, 0.05);
        border-color: rgba(79, 38, 120, 0.12);
    }
}

.hero-cta-row .hero-cta {
    /* Entry-Animation + danach Herzschlag-Idle */
    animation: heroFadeUp 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards,
               ctaIdleViber 1.5s 1.4s ease-in-out infinite;
}
/* Vorhof/Kammer-Rhythmus: äußere Cards synchron, mittlere im Gegentakt
   (halber Cycle versetzt = 0.75s bei 1.5s Cycle). Wirkt wie ein einziges Herz. */
.hero-cta-row .hero-cta:nth-child(1) { animation-delay: 0.40s, 1.4s;  } /* außen links */
.hero-cta-row .hero-cta:nth-child(2) { animation-delay: 0.50s, 2.15s; } /* mitte — Gegentakt */
.hero-cta-row .hero-cta:nth-child(3) { animation-delay: 0.60s, 1.4s;  } /* außen rechts — sync mit links */
.hero-cta-row .hero-cta:nth-child(4) { animation-delay: 0.70s, 2.15s; } /* falls 4. Card vorhanden */

/* Hover pausiert den Idle-Vibe — der Hover-State bekommt volle Aufmerksamkeit */
.hero-cta:hover {
    animation-play-state: paused, paused;
}

@media (prefers-reduced-motion: reduce) {
    .hero-cta-row .hero-cta {
        animation: none !important;
    }
}

/* ── Hero Entry-Animations: gestaffelter Fade-in beim Page-Load ── */
@keyframes heroFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes heroFadeScale {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes heroPillBreath {
    0%, 100% { box-shadow: 0 0 0 rgba(79, 38, 120, 0); }
    50%      { box-shadow: 0 0 28px rgba(79, 38, 120, 0.12); }
}

.hero-photo {
    animation: heroFadeScale 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-heading {
    animation: heroFadeUp 0.6s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-subtitle {
    animation: heroFadeUp 0.6s 0.25s cubic-bezier(0.16, 1, 0.3, 1) both,
               heroPillBreath 5s 1.2s ease-in-out infinite;
}

/* hero-cta entry + idle animations: siehe oben (.hero-cta-row .hero-cta) */

/* Respektiere Reduced-Motion-Präferenz */
@media (prefers-reduced-motion: reduce) {
    .hero-photo,
    .hero-heading,
    .hero-subtitle,
    .hero-cta,
    .hero-heading::before,
    .hero-heading::after {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .hero-photo:hover,
    .hero-photo:hover img,
    .hero-cta:hover,
    .hero-cta:hover .hero-cta-icon {
        transform: none !important;
    }
}

.section-heading {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--color-primary-dark, #134a55);
    margin: var(--space-6, 24px) 0 var(--space-4, 16px) 0;
}

/* ── Module-Beschreibung im Course-Detail ── */
.module-description {
    margin: 0 0 var(--space-3, 12px) 0;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--cream, #e1d9d2);
    border-left: 3px solid var(--gold, #c39641);
    border-radius: 6px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--color-text, #2a2a2a);
}

/* ── Inline-Coach-Chat im Dashboard ── */
.dashboard-coach {
    margin: var(--space-6, 24px) 0;
    background: var(--color-white, #fff);
    border: 1px solid rgba(26, 97, 110, 0.12);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(26, 97, 110, 0.06);
}

.dashboard-coach-head {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-4, 16px) var(--space-5, 20px);
    background: linear-gradient(135deg, var(--cream, #e1d9d2) 0%, #f4eee6 100%);
    border-bottom: 1px solid rgba(195, 150, 65, 0.18);
}

.dashboard-coach-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary, #1a616e);
    border: 2px solid var(--gold, #c39641);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    line-height: 1;
}

.dashboard-coach-title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary-dark, #134a55);
    margin: 0;
    line-height: 1.2;
}

.dashboard-coach-sub {
    font-size: 0.82rem;
    color: var(--color-text-light, #6c6259);
    margin: 2px 0 0 0;
}

.dashboard-coach-body {
    padding: var(--space-4, 16px);
    background: #faf7f2;
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
    min-height: 140px;
    max-height: 360px;
    overflow-y: auto;
}

.dashboard-coach-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.dashboard-coach-msg-bot {
    align-self: flex-start;
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e8e0d8);
    border-bottom-left-radius: 4px;
    color: var(--color-text, #2a2a2a);
}

.dashboard-coach-msg-user {
    align-self: flex-end;
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
    border-bottom-right-radius: 4px;
}

.dashboard-coach-msg a {
    color: inherit;
    text-decoration: underline;
}

.dashboard-coach-typing {
    align-self: flex-start;
    color: var(--color-text-light, #6c6259);
    font-size: 0.85rem;
    font-style: italic;
    padding: 4px 10px;
}

.dashboard-coach-form {
    display: flex;
    gap: 8px;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--color-white, #fff);
    border-top: 1px solid var(--color-border, #e8e0d8);
}

.dashboard-coach-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    outline: none;
    background: var(--color-bg-alt, #f5ede5);
}

.dashboard-coach-input:focus {
    border-color: var(--color-primary, #1a616e);
    background: var(--color-white, #fff);
}

.dashboard-coach-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.dashboard-coach-submit:hover:not(:disabled) {
    background: var(--color-primary-dark, #134a55);
}

.dashboard-coach-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}


/* ── Coach Widget (Floating Button) ── */
.coach-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: var(--font-body);
}

.coach-widget-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
    border: 2px solid rgba(195, 150, 65, 0.4);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    font-size: 22px;
    transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.22s ease;
    padding: 0;
    line-height: 1;
    opacity: 0.85;
}

.coach-widget-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
    opacity: 1;
}

.coach-widget-fab:focus-visible {
    outline: 3px solid var(--gold, #c39641);
    outline-offset: 3px;
}

.coach-widget-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: min(360px, calc(100vw - 40px));
    max-height: 70vh;
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.coach-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
}

.coach-widget-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coach-widget-close {
    background: transparent;
    border: none;
    color: var(--color-white, #fff);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.coach-widget-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

.coach-widget-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3, 12px);
    display: flex;
    flex-direction: column;
    gap: var(--space-2, 8px);
    background: #faf7f2;
    min-height: 240px;
}

.coach-widget-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.coach-widget-msg-bot {
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, #e8e0d8);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    color: var(--color-text, #2a2a2a);
}

.coach-widget-msg-user {
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

.coach-widget-form {
    display: flex;
    gap: 8px;
    padding: var(--space-3, 12px);
    background: var(--color-white, #fff);
    border-top: 1px solid var(--color-border, #e8e0d8);
}

.coach-widget-input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid var(--color-border, #e8e0d8);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    background: var(--color-bg-alt, #f5ede5);
}

.coach-widget-input:focus {
    border-color: var(--color-primary, #1a616e);
    background: var(--color-white, #fff);
}

.coach-widget-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-primary, #1a616e);
    color: var(--color-white, #fff);
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

.coach-widget-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.coach-widget-typing {
    color: var(--color-text-light, #666);
    font-size: 0.85rem;
    font-style: italic;
    padding: 6px 14px;
    align-self: flex-start;
}

@media (max-width: 768px) {
    .coach-widget {
        bottom: 80px; /* avoid mobile bottom-nav overlap */
        right: 12px;
    }
    .coach-widget-fab {
        width: 56px;
        height: 56px;
        font-size: 28px;
    }
    .coach-widget-panel {
        bottom: 70px;
        right: 0;
    }
}

/* ────────────────────────────────────────────────────────────────────────
   Welle C — Welcome-Ritual Overlay
   Erscheint einmal pro Login mit einem tageskonformen Mini-Ritual.
   Mobile: vollflächig. Desktop: zentriertes Modal.
   ──────────────────────────────────────────────────────────────────────── */

.welcome-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

[x-cloak] { display: none !important; }

.welcome-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(225, 203, 247, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    animation: welcomeBackdropFade 0.45s ease-out;
}

.welcome-card {
    position: relative;
    background: #FFFAF5;
    border-radius: 24px;
    padding: clamp(28px, 4vw, 48px);
    max-width: 520px;
    width: 100%;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(79, 38, 120, 0.20),
                0 4px 12px rgba(79, 38, 120, 0.08);
    text-align: center;
    animation: welcomeCardRise 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.welcome-close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: none;
    border: 0;
    font-size: 32px;
    line-height: 1;
    color: #6c6259;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}
.welcome-close:hover,
.welcome-close:focus-visible {
    color: #4F2678;
    background: rgba(225, 203, 247, 0.4);
    outline: none;
}

.welcome-card__hello {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: #6c6259;
    margin: 0 0 6px;
    letter-spacing: 0.01em;
}

.welcome-card__title {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(1.5rem, 3.4vw, 2.1rem);
    margin: 0 0 16px;
    line-height: 1.15;
    text-wrap: balance;
}

.welcome-card__intro {
    color: #6c6259;
    font-size: 1rem;
    margin: 0 0 14px;
    line-height: 1.5;
}

.welcome-card__body {
    color: #2a2a2a;
    margin: 0 0 32px;
    line-height: 1.6;
    text-wrap: pretty;
}

.welcome-card__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.welcome-btn-primary {
    background: #4F2678;
    color: #FFFAF5;
    border: 0;
    padding: 13px 36px;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.22s ease;
}
.welcome-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(79, 38, 120, 0.28);
    background: #3d1d5b;
}
.welcome-btn-primary:focus-visible {
    outline: 2px solid #c39641;
    outline-offset: 3px;
}

.welcome-btn-text {
    background: none;
    border: 0;
    color: #6c6259;
    font-family: inherit;
    font-size: 0.92rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}
.welcome-btn-text:hover { color: #4F2678; background: rgba(225, 203, 247, 0.3); }

/* ── Prepare-Stage (5s Vorbereitungs-Countdown vor dem Ritual) ── */
.prepare-stage {
    padding: 32px 0 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: welcomeDoneFade 0.4s ease-out;
}

.prepare-hint {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(1.1rem, 2.4vw, 1.35rem);
    line-height: 1.5;
    margin: 0;
    text-wrap: balance;
    max-width: 420px;
}

.prepare-countdown {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(4rem, 12vw, 6rem);
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    width: 1.5em;
    height: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #F0E1FB 0%, #E1CBF7 70%);
    box-shadow: 0 0 40px rgba(79, 38, 120, 0.18);
    animation: prepareCountdownPulse 1s ease-in-out infinite;
}

@keyframes prepareCountdownPulse {
    0%, 100% { transform: scale(1);     box-shadow: 0 0 40px rgba(79, 38, 120, 0.18); }
    50%      { transform: scale(1.06);  box-shadow: 0 0 56px rgba(79, 38, 120, 0.28); }
}

@media (prefers-reduced-motion: reduce) {
    .prepare-countdown { animation: none !important; }
}

/* ── Atem-Stage ── */
.breath-stage {
    padding: 24px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.breath-circle {
    width: clamp(180px, 36vw, 240px);
    height: clamp(180px, 36vw, 240px);
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%,
                #F0E1FB 0%,
                #E1CBF7 45%,
                #b489d4 100%);
    box-shadow: 0 0 60px rgba(79, 38, 120, 0.25),
                inset 0 -10px 30px rgba(79, 38, 120, 0.12);
    transform: scale(0.55);
    transition: transform 4s cubic-bezier(0.4, 0, 0.4, 1);
}
.breath-circle.inhale {
    transform: scale(1);
    transition-duration: 4s;
}
.breath-circle.exhale {
    transform: scale(0.55);
    transition-duration: 6s;
}

.breath-label {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: 1.5rem;
    margin: 0;
    min-height: 1.5em;
    transition: opacity 0.3s;
}

.breath-counter {
    color: #6c6259;
    font-size: 0.9rem;
    margin: -8px 0 0;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.breath-stop {
    margin-top: 8px;
}

/* ── Static-Stage (Body-Scan / Schultern / etc.) ── */
.static-stage {
    padding: 24px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

/* Beat: Geführter Mini-Hinweis, wechselt alle ~3-4s mit fade-Übergang */
.static-beat {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(1.2rem, 2.6vw, 1.5rem);
    line-height: 1.55;
    margin: 0;
    text-wrap: balance;
    min-height: 2.4em;
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Alpine x-transition classes für Beat-Wechsel */
.static-beat-enter { opacity: 0; transform: translateY(8px); }
.static-beat-leave { opacity: 0; transform: translateY(-8px); }

/* Visueller Countdown-Ring: conic-gradient für Progress, innen weißer Cutout */
.static-ring {
    --progress: 0%;
    position: relative;
    width: clamp(120px, 22vw, 160px);
    height: clamp(120px, 22vw, 160px);
    border-radius: 50%;
    background:
        conic-gradient(#4F2678 var(--progress), rgba(225, 203, 247, 0.55) 0%);
    box-shadow: 0 0 32px rgba(79, 38, 120, 0.16);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: --progress 0.95s linear;
    animation: staticRingPulse 4s ease-in-out infinite;
}

.static-ring::before {
    content: '';
    position: absolute;
    inset: 8px;
    background: #FFFAF5;
    border-radius: 50%;
    box-shadow: inset 0 2px 6px rgba(79, 38, 120, 0.06);
}

.static-ring-number {
    position: relative;
    z-index: 1;
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(2.5rem, 7vw, 3.4rem);
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

@keyframes staticRingPulse {
    0%, 100% { box-shadow: 0 0 32px rgba(79, 38, 120, 0.16); }
    50%      { box-shadow: 0 0 48px rgba(195, 150, 65, 0.24); }
}

@property --progress {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 0%;
}

@media (prefers-reduced-motion: reduce) {
    .static-beat { transition: none !important; }
    .static-ring { animation: none !important; transition: none !important; }
}

/* ── Prompt-Stage (Intention / Anker-Wort / etc.) ── */
.prompt-stage {
    padding: 24px 0 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.prompt-body {
    color: #2a2a2a;
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
    text-wrap: pretty;
}

.prompt-hint {
    color: #6c6259;
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
}

.prompt-done {
    margin-top: 8px;
}

/* ── Done-Stage ── */
.welcome-done-stage {
    padding: 48px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-done {
    font-family: var(--font-heading, 'Playfair Display', serif);
    color: #4F2678;
    font-size: clamp(1.4rem, 3vw, 1.8rem);
    margin: 0;
    text-align: center;
    text-wrap: balance;
    animation: welcomeDoneFade 0.6s ease-out;
}

/* ── Animations ── */
@keyframes welcomeBackdropFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes welcomeCardRise {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes welcomeDoneFade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Mobile: full-bleed sheet from bottom */
@media (max-width: 600px) {
    .welcome-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .welcome-card {
        max-width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 92vh;
        animation: welcomeSheetUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    }
    @keyframes welcomeSheetUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}

/* Reduced-Motion: kein Pulse, kein Slide — nur statisch */
@media (prefers-reduced-motion: reduce) {
    .welcome-overlay__backdrop,
    .welcome-card,
    .welcome-done {
        animation: none !important;
    }
    .breath-circle {
        transition: none !important;
        transform: scale(0.8) !important;
    }
}
