:root {
    --bg: #0b1220;
    --bg-soft: #101b2d;
    --panel: #111f33;
    --panel-strong: #16263f;
    --card: #182b46;
    --card-alt: #1c345a;
    --text: #edf4ff;
    --muted: #a7bbd9;
    --primary: #5aa7ff;
    --primary-strong: #3c82f6;
    --success: #29c17b;
    --warning: #f5b942;
    --danger: #ff6f7d;
    --gray: #6e7f9f;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(180deg, #08121d 0%, #0f172a 100%);
    color: var(--text);
}

body {
    min-height: 100vh;
}

img {
    max-width: 100%;
}

.container {
    width: min(1200px, calc(100% - 32px));
    margin: 0 auto;
}

/* =========================================================
   ÖFFENTLICHER BEREICH / NAVIGATION
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(8, 15, 24, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 78px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
}

.site-logo {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 12px;
}

.logo-link {
    display: block;
    line-height: 0;
}

.site-logo.auth-logo,
.site-logo.profile-logo {
    width: 58px;
    height: 58px;
    margin: 0 auto 12px;
    border-radius: 16px;
}

.brand-wrap small {
    display: block;
    color: var(--muted);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-menu a,
.sidebar-nav a,
.sidebar-user a,
.table-actions a,
.link-button,
.button {
    text-decoration: none;
}

.nav-menu a {
    color: var(--muted);
    font-weight: 600;
}

.page-content {
    padding: 42px 0 80px;
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
    padding: 36px;
    background: linear-gradient(
        135deg,
        rgba(90, 167, 255, 0.1),
        rgba(124, 114, 255, 0.12)
    );
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero-panel h1 {
    margin: 10px 0 8px;
    font-size: clamp(2rem, 5vw, 3.2rem);
}

.eyebrow {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(90, 167, 255, 0.12);
    border: 1px solid rgba(90, 167, 255, 0.3);
    border-radius: 999px;
    color: #b6d7ff;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hero-panel p {
    max-width: 620px;
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
}

.card {
    background: linear-gradient(
        180deg,
        rgba(24, 43, 70, 0.94),
        rgba(17, 31, 51, 0.96)
    );
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.post-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    padding: 22px;
}

.post-card h2 {
    margin: 0;
    font-size: 1.65rem;
}

.post-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}

.post-card .link-button {
    align-self: flex-start;
    margin-top: auto;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.badge.success {
    background: rgba(41, 193, 123, 0.15);
    border-color: rgba(41, 193, 123, 0.25);
    color: #aef0ca;
}

.badge.neutral {
    background: rgba(126, 146, 176, 0.14);
    border-color: rgba(126, 146, 176, 0.24);
    color: #d6e1f6;
}

.badge.warning {
    background: rgba(245, 185, 66, 0.15);
    border-color: rgba(245, 185, 66, 0.3);
    color: #ffe3a1;
}

.link-button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    transition: transform 0.2s ease, opacity 0.2s ease;
    cursor: pointer;
}

.button:hover,
.link-button:hover {
    transform: translateY(-1px);
}

.button.primary,
.link-button {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    border-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.button.secondary {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text);
}

.button.danger {
    background: linear-gradient(135deg, #ff6f7d, #d2485d);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.button.block {
    width: 100%;
}

.button.small {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.forum-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.6fr);
    grid-auto-rows: minmax(200px, auto);
    gap: 24px;
    align-items: stretch;
}

.forum-function-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 760px;
    margin: 0 auto;
}

.forum-function-card {
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 92px;
    padding: 20px 24px;
    color: var(--text);
    text-decoration: none;
    transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.forum-function-card:hover {
    transform: translateY(-2px);
    border-color: rgba(90, 167, 255, 0.55);
    background: linear-gradient(135deg, rgba(90, 167, 255, 0.14), rgba(255, 255, 255, 0.03));
}

.forum-function-card strong,
.forum-function-card small {
    display: block;
}

.forum-function-card small {
    margin-top: 5px;
    color: var(--muted);
}

.forum-function-icon {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(90, 167, 255, 0.35);
    border-radius: 12px;
    background: rgba(90, 167, 255, 0.12);
    color: #c9e1ff;
    font-size: 1.5rem;
    font-weight: 700;
}

.forum-view-header {
    max-width: 900px;
    margin: 0 auto 18px;
}

.forum-view-header a {
    color: var(--muted);
    text-decoration: none;
}

.forum-view-header h2 {
    margin: 16px 0 0;
}

.forum-topic-view {
    grid-template-columns: minmax(0, 1fr);
    max-width: 900px;
    margin: 0 auto;
}

.forum-search-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 24px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.safety-modal[hidden] {
    display: none;
}

.safety-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    padding: 20px;
    place-items: center;
    background: rgba(3, 9, 18, 0.82);
}

.safety-modal-card {
    position: relative;
    width: min(620px, 100%);
    max-height: min(720px, calc(100vh - 40px));
    padding: 28px;
    overflow-y: auto;
    background: var(--panel-strong);
    border: 1px solid rgba(245, 185, 66, 0.45);
    border-radius: 18px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.safety-modal-card h2 {
    margin: 12px 0 18px;
}

.safety-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-size: 1.3rem;
}

.safety-help-item {
    margin-top: 12px;
    padding: 14px 16px;
    border-left: 3px solid var(--warning);
    background: rgba(245, 185, 66, 0.08);
}

.safety-help-item h3,
.safety-help-item p {
    margin: 0 0 8px;
}

.safety-help-item p:last-child {
    margin-bottom: 0;
}

.safety-help-item a {
    color: #c9e1ff;
}

.safety-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.partner-hero {
    align-items: flex-end;
}

.partner-price-teaser {
    display: flex;
    flex: 0 1 280px;
    flex-direction: column;
    gap: 5px;
    padding: 16px 18px;
    border: 1px solid rgba(41, 193, 123, 0.45);
    border-radius: 14px;
    background: rgba(41, 193, 123, 0.1);
}

.partner-price-teaser strong {
    color: #83e8b6;
    font-size: 1.05rem;
}

.partner-price-teaser span {
    font-weight: 700;
}

.partner-price-teaser small {
    color: var(--muted);
    line-height: 1.45;
}

.demo-panel {
    margin-bottom: 20px;
    padding: 22px;
    border-color: rgba(201, 225, 255, 0.28);
}

.demo-panel h2 {
    margin: 7px 0 0;
}

.demo-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 18px 0;
}

.demo-step {
    display: flex;
    min-height: 92px;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--muted);
}

.demo-step.active {
    border-color: rgba(131, 232, 182, 0.55);
    background: rgba(41, 193, 123, 0.08);
    color: var(--text);
}

.demo-step strong {
    color: var(--primary);
}

.demo-step span {
    font-weight: 700;
}

.demo-step small {
    line-height: 1.35;
}

.demo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.partner-reminder-notice {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 20px;
}

.partner-reminder-notice form {
    margin-top: 6px;
}

.partner-onboarding-grid,
.partner-checkin-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.partner-invite-panel,
.partner-checkin-layout .panel {
    padding: 22px;
}

.partner-pending-invite {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.partner-pending-invite:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.partner-pending-invite span {
    color: var(--muted);
}

.partner-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.035);
}

.partner-status-row h2 {
    margin: 8px 0 0;
}

.partner-week-status {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 8px;
}

.partner-status-actions {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 10px;
}

.partner-remove-form {
    margin: 0;
}

.partner-checkin-form select,
.partner-checkin-form textarea {
    width: 100%;
}

.checkin-locked {
    padding: 16px;
    border: 1px solid rgba(242, 183, 5, 0.35);
    background: rgba(242, 183, 5, 0.08);
}

.checkin-locked p {
    color: var(--muted);
    line-height: 1.55;
}

.partner-glass {
    color: var(--primary);
    font-size: 2.2rem;
}

.partner-score {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 14px 0 10px;
}

.partner-score strong {
    color: #83e8b6;
    font-size: 3rem;
    line-height: 1;
}

.partner-score span,
.partner-result-panel p {
    color: var(--muted);
    line-height: 1.55;
}

.partner-progress {
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
}

.partner-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--warning), var(--success));
}

.chair-stage {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 22px 0 8px;
    height: 300px;
    max-height: 300px;
    padding: 0;
    background: transparent;
}

.chair-model-viewer {
    position: relative;
    height: 250px;
    max-height: 250px;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.chair-model-viewer:active {
    cursor: grabbing;
}

.chair-model-viewer canvas {
    display: block !important;
    width: 100%;
    height: 250px !important;
    max-height: 250px;
    object-fit: contain;
}

.chair-model-viewer canvas {
    position: absolute;
    inset: 0;
}

.chair-model-status {
    display: block;
    padding-top: 105px;
    color: var(--muted);
    text-align: center;
}

.chair-model-viewer.is-loaded .chair-model-status {
    display: none !important;
}

.chair-caption {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: center;
}

.partner-reward-note {
    margin-top: 20px;
    padding: 12px 14px;
    border-left: 3px solid var(--success);
    background: rgba(41, 193, 123, 0.08);
    color: var(--muted);
    line-height: 1.5;
}

.partner-register-card {
    width: min(560px, 100%);
}

.partner-register-card .auth-header p {
    line-height: 1.55;
}

.partner-invite-banner {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 22px;
    padding: 14px 16px;
    border-left: 3px solid var(--success);
    background: rgba(41, 193, 123, 0.09);
}

.partner-invite-banner span,
.partner-register-login {
    color: var(--muted);
    line-height: 1.5;
}

.partner-register-login {
    margin: 20px 0 0;
    text-align: center;
}

.partner-register-login a {
    color: #c9e1ff;
}

.forum-search-form label {
    font-size: 0.85rem;
}

.forum-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.forum-search-row input {
    flex: 1 1 auto;
}

@media (max-width: 620px) {
    .demo-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .forum-search-row {
        align-items: stretch;
        flex-direction: column;
    }
}

.forum-topics {
    align-self: stretch;
    overflow: hidden;
}

.panel-head,
.forum-entry-header,
.forum-actions,
.forum-row-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-head {
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}

.panel-head h2,
.forum-entry-header h2,
.forum-comments h3 {
    margin: 0;
}

.forum-topic-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
}

.forum-topic-row:hover,
.forum-topic-row.is-active {
    background: rgba(90, 167, 255, 0.1);
}

.forum-topic-row strong,
.forum-topic-row span {
    display: block;
}

.forum-topic-row span,
.forum-entry-header p,
.forum-comment p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.forum-row-stats {
    flex-wrap: wrap;
    justify-content: flex-end;
    color: var(--muted);
    font-size: 0.78rem;
    text-align: right;
}

.forum-detail,
.forum-comments {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.forum-layout > .forum-detail > .empty-state {
    align-self: stretch;
    overflow: hidden;
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    align-items: center;
    flex-direction: column;
    justify-content: center;
}

.forum-entry,
.forum-comment,
.forum-new-topic {
    padding: 24px;
}

.forum-entry-header {
    align-items: flex-start;
    margin-bottom: 20px;
}

.forum-entry-header h2 {
    margin-top: 8px;
}

.forum-content {
    color: var(--text);
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.forum-content p:first-child {
    margin-top: 0;
}

.forum-content p:last-child {
    margin-bottom: 0;
}

.forum-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 22px;
}

.forum-actions form,
.forum-comment .forum-entry-header form,
.table-actions form {
    margin: 0;
}

.forum-comment .forum-entry-header {
    align-items: center;
    margin-bottom: 12px;
}

.forum-comment details {
    margin-top: 16px;
    color: var(--muted);
}

.forum-comment details summary {
    cursor: pointer;
}

.forum-editor-form {
    padding: 20px 22px;
}

.forum-editor-surface {
    min-height: 150px;
    color: var(--text);
    line-height: 1.6;
}

.forum-editor-form [hidden] {
    display: none !important;
}

.forum-editor-surface:focus {
    outline: 2px solid rgba(90, 167, 255, 0.5);
    outline-offset: -2px;
}

@media (max-width: 820px) {
    .forum-layout {
        grid-template-columns: 1fr;
    }

    .forum-topic-row,
    .forum-entry-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .forum-row-stats {
        justify-content: flex-start;
        text-align: left;
    }
}

/* =========================================================
   MITGLIEDER / PROFILE
   ========================================================= */

.member-list-grid,
.member-profile-layout {
    display: grid;
    gap: 24px;
}

.member-list-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.member-card,
.profile-card,
.profile-editor {
    background: linear-gradient(
        180deg,
        rgba(24, 43, 70, 0.94),
        rgba(17, 31, 51, 0.96)
    );
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
}

.member-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
}

.member-card h2,
.profile-card h1 {
    margin: 0;
}

.member-card p,
.profile-bio,
.empty-state,
.profile-meta {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.profile-card,
.profile-editor {
    padding: 24px;
}

.member-profile-layout {
    grid-template-columns: minmax(260px, 0.9fr) minmax(320px, 1.3fr);
    align-items: start;
}

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

.profile-bio {
    white-space: pre-wrap;
}

.empty-state {
    padding: 16px;
    background: rgba(90, 167, 255, 0.04);
    border: 1px dashed rgba(90, 167, 255, 0.4);
    border-radius: 12px;
}

.profile-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-list a {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.profile-editor form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-editor textarea {
    min-height: 180px;
}

/* =========================================================
   NACHRICHTEN / CHAT
   ========================================================= */

.message-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.message-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.message-item.unread {
    background: rgba(90, 167, 255, 0.06);
    border-color: rgba(90, 167, 255, 0.5);
}

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

.message-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
    white-space: pre-wrap;
}

.message-thread {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.chat-thread-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
}

.chat-entry {
    display: flex;
    width: 100%;
}

.chat-entry.is-mine {
    justify-content: flex-end;
}

.chat-entry.is-them {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.chat-entry.is-mine .chat-bubble {
    background: linear-gradient(135deg, #2d6cdf, #5aa7ff);
    border-color: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.chat-entry.is-them .chat-bubble {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.chat-meta {
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 0.8;
}

.chat-bubble p {
    margin: 0;
    color: inherit;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-delete-form {
    margin-top: 10px;
    text-align: right;
}

.message-delete {
    padding: 4px 8px;
    border: 1px solid rgba(255, 111, 125, 0.35);
    border-radius: 7px;
    background: rgba(255, 111, 125, 0.12);
    color: #ffc1c8;
    cursor: pointer;
    font-size: 0.72rem;
}

.message-delete:hover {
    background: rgba(255, 111, 125, 0.24);
}

.reply-form {
    position: sticky;
    bottom: 14px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
    padding: 14px 10px 0;
    background: rgba(11, 18, 32, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.reply-form label {
    font-size: 0.9rem;
}

.reply-form textarea {
    min-height: 100px;
}

.reply-actions {
    display: flex;
    justify-content: flex-end;
}

/* =========================================================
   TOAST / CHAT-OVERLAY
   ========================================================= */

.toast-notification {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: min(340px, calc(100vw - 24px));
    padding: 14px 16px;
    background: linear-gradient(
        135deg,
        rgba(42, 99, 214, 0.96),
        rgba(90, 167, 255, 0.94)
    );
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.toast-notification.ready {
    background: linear-gradient(
        135deg,
        rgba(16, 28, 44, 0.96),
        rgba(19, 38, 60, 0.94)
    );
    border-color: rgba(255, 255, 255, 0.09);
}

.toast-dot {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    font-size: 0.9rem;
}

.toast-notification div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.toast-notification strong,
.toast-notification span,
.toast-notification small {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.toast-notification small {
    opacity: 0.9;
}

.chat-overlay {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 120;
    width: min(360px, calc(100vw - 22px));
    max-height: 440px;
    overflow: hidden;
    background: rgba(12, 21, 34, 0.98);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.2s ease;
}

.chat-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.chat-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.chat-overlay-header strong,
.chat-overlay-header small {
    display: block;
}

.chat-overlay-header small {
    color: var(--muted);
}

.chat-overlay-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
}

.chat-overlay-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 360px;
    padding: 12px;
    overflow-y: auto;
}

.chat-overlay-thread {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    text-decoration: none;
}

.chat-overlay-thread > a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: inherit;
    text-decoration: none;
}

.chat-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
    width: 100%;
    margin-bottom: 8px;
    padding-bottom: 3px;
    background: rgba(12, 21, 34, 0.98);
    overflow-x: auto;
    position: sticky;
    top: -12px;
    z-index: 2;
    scrollbar-width: thin;
}

.chat-tab {
    display: block;
    flex: 0 0 auto;
    max-width: 150px;
    min-height: 34px;
    padding: 8px 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat-tab.is-active,
.chat-tab:hover {
    background: rgba(90, 167, 255, 0.18);
    border-color: rgba(90, 167, 255, 0.55);
    color: var(--text);
}

.chat-panel {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.chat-panel-link {
    display: block;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.chat-panel-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    margin-bottom: 8px;
    overflow: hidden;
    overflow-y: auto;
    padding: 2px;
}

.chat-panel-message {
    display: flex;
    width: 100%;
}

.chat-panel-message.is-mine {
    justify-content: flex-end;
}

.chat-panel-message.is-them {
    justify-content: flex-start;
}

.chat-panel-bubble {
    max-width: 84%;
    padding: 7px 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.chat-panel-message.is-mine .chat-panel-bubble {
    background: rgba(90, 167, 255, 0.2);
    border-color: rgba(90, 167, 255, 0.35);
}

.chat-panel-bubble small {
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 0.68rem;
}

.chat-panel-bubble p {
    margin: 0;
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.chat-overlay-reply-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.chat-overlay-reply-form textarea {
    width: 100%;
    min-height: 54px;
    resize: vertical;
}

.chat-overlay-reply-form .button {
    align-self: flex-start;
}

.chat-overlay-thread strong {
    font-size: 0.97rem;
}

.chat-overlay-thread span {
    color: var(--muted);
    font-size: 0.8rem;
}

.chat-overlay-footer {
    padding: 10px 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--border);
}

/* =========================================================
   AUTHENTIFIZIERUNG / FORMULARE
   ========================================================= */

.site-footer {
    padding: 18px 0 32px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.auth-body {
    display: grid;
    min-height: 100vh;
    padding: 26px;
    place-items: center;
}

.auth-shell {
    width: min(480px, 100%);
}

.auth-card {
    padding: 28px;
}

.auth-header {
    margin-bottom: 22px;
    text-align: center;
}

.auth-header h1 {
    margin: 0;
    font-size: 2rem;
}

.auth-header p {
    margin: 8px 0 0;
    color: var(--muted);
}

.auth-form,
.stack-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    flex: 1;
    height: 1px;
    background: var(--border);
    content: '';
}

.registration-panel {
    margin-bottom: 28px;
    padding: 22px;
}

.registration-panel summary {
    color: var(--text);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
}

.registration-panel[open] summary {
    margin-bottom: 22px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--muted);
    font-weight: 600;
}

input,
textarea,
select,
button {
    font: inherit;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(8, 15, 24, 0.75);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.demo-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    background: rgba(90, 167, 255, 0.05);
    border: 1px dashed rgba(90, 167, 255, 0.4);
    border-radius: 12px;
    color: var(--muted);
}

/* =========================================================
   ADMIN-SIDEBAR
   ========================================================= */

.admin-body {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    min-width: 260px;
    min-height: 100vh;
    padding: 20px 18px;
    background: rgba(8, 15, 24, 0.9);
    border-right: 1px solid var(--border);
}

/* Logo und Markenname */
.sidebar-brand {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    min-width: 0;
    margin-bottom: 32px;
}

/* Logo */
.sidebar-brand .admin-logo {
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    padding: 0;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

/* Text neben dem Logo */
.sidebar-brand .brand-text {
    flex: 1 1 auto;
    min-width: 0;
    padding-top: 4px;
}

.sidebar-brand .brand-text strong,
.sidebar-brand .brand-text small {
    display: block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.sidebar-brand .brand-text strong {
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.25;
}

.sidebar-brand .brand-text small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

/* Navigation direkt unterhalb des Brand-Bereichs */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.admin-body .sidebar .sidebar-nav {
    flex-direction: column;
    align-items: stretch;
}

.sidebar-nav-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-subnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0 0 4px 12px;
    padding-left: 10px;
    border-left: 1px solid rgba(90, 167, 255, 0.3);
}

.sidebar-subnav a {
    padding: 8px 10px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.35;
}

.sidebar-subnav a:hover,
.sidebar-subnav a:focus-visible {
    background: rgba(90, 167, 255, 0.08);
    color: var(--text);
}

.sidebar-nav a {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
    background: rgba(90, 167, 255, 0.08);
    color: var(--text);
}

/* Benutzerbereich am unteren Rand */
.sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}

.sidebar-user span {
    color: var(--muted);
    overflow-wrap: anywhere;
}

.admin-main {
    flex: 1;
    min-width: 0;
    padding: 32px;
}

.admin-header {
    margin-bottom: 24px;
}

.admin-header h1 {
    margin: 10px 0 0;
    font-size: clamp(2rem, 3vw, 2.5rem);
}

.stats-grid,
.panel-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-card {
    padding: 22px 18px;
}

.stat-card span {
    display: block;
    margin-bottom: 14px;
    color: var(--muted);
}

.stat-card strong {
    font-size: clamp(1.5rem, 2vw, 2rem);
}

.panel {
    padding: 20px;
}

.panel-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-head h2 {
    margin: 0;
    font-size: 1.3rem;
}

.panel-head a {
    color: #b9d4ff;
    text-decoration: none;
}

.role-list,
.list-compact {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.role-list li,
.list-compact li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.admin-forum-view-create .table-panel,
.admin-forum-view-create .admin-safety-settings,
.admin-forum-view-posts .form-panel,
.admin-forum-view-posts .admin-safety-settings,
.admin-forum-view-help .form-panel,
.admin-forum-view-help .table-panel {
    display: none;
}

.admin-safety-settings {
    flex: none;
    align-self: flex-start;
    width: auto;
    margin: 0 32px 32px 292px;
}

.admin-safety-settings > .muted-note {
    margin: -4px 0 20px;
    line-height: 1.55;
}

.admin-safety-settings .stack-form {
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.admin-safety-settings .stack-form label {
    gap: 6px;
}

.admin-safety-settings .safety-term-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.admin-safety-settings .safety-term-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}

.admin-safety-settings .safety-term-row strong {
    display: block;
    margin-bottom: 4px;
}

.admin-safety-settings .safety-term-row small {
    display: block;
    color: var(--muted);
    line-height: 1.45;
}

.admin-safety-settings .safety-term-row .button-row {
    flex-shrink: 0;
}

.form-panel,
.table-panel {
    min-height: 100%;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.editor-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.editor-toolbar button,
.editor-toolbar select {
    padding: 8px 10px;
    background: rgba(8, 15, 24, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
}

.editor-surface {
    min-height: 260px;
    padding: 16px 14px;
    background: rgba(8, 15, 24, 0.78);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    line-height: 1.7;
    white-space: normal;
    word-break: break-word;
    direction: ltr;
    text-align: left;
    outline: none;
}

.editor-surface p,
.editor-surface div {
    margin: 0 0 8px;
}

.preview-output {
    direction: ltr;
    text-align: left;
}

.editor-surface:empty::before {
    content: attr(data-placeholder);
    color: var(--muted);
}

.preview-panel {
    overflow: hidden;
    background: rgba(8, 15, 24, 0.48);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.preview-header {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    color: #dfeeff;
    font-weight: 700;
}

.preview-output {
    min-height: 150px;
    padding: 16px 14px;
    color: var(--text);
    line-height: 1.8;
}

.preview-output p,
.preview-output ul,
.preview-output ol,
.preview-output h1,
.preview-output h2,
.preview-output h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions a {
    color: #d7ebff;
    font-size: 0.8rem;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.user-edit-form {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.user-inline-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.user-inline-grid.compact {
    width: auto;
    min-width: 240px;
}

.user-inline-grid input,
.user-inline-grid select {
    min-width: 160px;
}

.muted-note {
    color: var(--muted);
    font-size: 0.8rem;
}

.checkbox-inline {
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.checkbox-inline input {
    width: 16px;
    height: 16px;
}

.db-check-panel {
    margin-top: 20px;
}

.db-check-box {
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.db-check-box.ok {
    background: rgba(41, 193, 123, 0.08);
    border-color: rgba(41, 193, 123, 0.3);
}

.db-check-box.error {
    background: rgba(255, 111, 125, 0.08);
    border-color: rgba(255, 111, 125, 0.35);
}

.db-check-box p {
    margin: 10px 0 0;
    color: var(--muted);
    word-break: break-word;
}

.alert {
    margin-bottom: 20px;
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 600;
}

.alert-success {
    background: rgba(41, 193, 123, 0.12);
    border-color: rgba(41, 193, 123, 0.3);
    color: #b8f3d3;
}

.alert-danger {
    background: rgba(255, 111, 125, 0.12);
    border-color: rgba(255, 111, 125, 0.3);
    color: #ffc2ca;
}

.alert-warning {
    background: rgba(245, 185, 66, 0.12);
    border-color: rgba(245, 185, 66, 0.3);
    color: #ffe3a1;
}

/* =========================================================
   ARTIKEL
   ========================================================= */

.light-page .article-shell {
    padding-top: 48px;
    padding-bottom: 64px;
}

.article {
    padding: 28px;
}

.article-header h1 {
    margin: 16px 0 10px;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
}

.article-content {
    color: #ebf3ff;
    line-height: 1.8;
}

.article-content h1,
.article-content h2,
.article-content h3 {
    margin-top: 1.4em;
}

.article-content table {
    width: 100%;
    margin: 18px 0;
    background: rgba(0, 0, 0, 0.12);
    border-collapse: collapse;
}

.article-content th,
.article-content td {
    padding: 12px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.article-content ul,
.article-content ol {
    padding-left: 22px;
}

.notice {
    margin: 16px 0;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.notice.warning {
    background: rgba(245, 185, 66, 0.08);
    border-color: rgba(245, 185, 66, 0.3);
}

.empty-state {
    margin-top: 32px;
    padding: 34px 22px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
    .admin-body {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-brand {
        margin-bottom: 24px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .partner-onboarding-grid,
    .partner-checkin-layout {
        grid-template-columns: 1fr;
    }

    .admin-safety-settings {
        margin: 0 32px 32px;
    }

    .hero-panel {
        flex-direction: column;
        align-items: flex-start;
    }

    .partner-status-row,
    .partner-status-actions {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .nav-wrap {
        flex-direction: column;
        justify-content: center;
        gap: 12px;
        padding: 16px 0;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .page-content {
        padding-top: 22px;
    }

    .hero-panel {
        padding: 20px 18px;
    }

    .hero-panel h1 {
        font-size: 2rem;
    }

    .message-layout {
        grid-template-columns: 1fr;
    }

    .message-thread,
    .message-item,
    .panel {
        padding: 14px;
    }

    .chat-bubble {
        max-width: 88%;
    }

    .reply-form textarea {
        min-height: 88px;
    }

    .reply-actions {
        justify-content: stretch;
    }

    .reply-actions .button {
        width: 100%;
    }

    .toast-notification {
        right: 12px;
        bottom: 12px;
        width: min(300px, calc(100vw - 18px));
    }
}

@media (max-width: 640px) {
    .nav-wrap {
        flex-direction: column;
        justify-content: center;
        gap: 10px;
        padding: 14px 0;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-main {
        padding: 20px;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        margin-bottom: 12px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: 12px;
    }

    .data-table td {
        padding: 8px 0;
        border-bottom: 0;
    }
}

@media (max-width: 420px) {
    .sidebar {
        padding: 16px 14px;
    }

    .sidebar-brand {
        gap: 12px;
    }

    .sidebar-brand .admin-logo {
        flex-basis: 52px;
        width: 52px;
        min-width: 52px;
        height: 52px;
    }

    .sidebar-brand .brand-text strong {
        font-size: 1rem;
    }

    .sidebar-brand .brand-text small {
        font-size: 0.82rem;
    }
}
