/* ═══════════════════════════════════════════════════════════
   Freyas Studio — Design System
   Mobile-first, warm & feminine aesthetic
   ═══════════════════════════════════════════════════════════ */

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

/* ── Custom Properties ── */
:root {
    /* Brand Colors — offizielle Freya-Bewegen-Palette (Petrol). Default-Brand-
       Fallback; per-Tenant-Overrides kommen via brand.css_root_block (base.html).
       Standalone-Seiten (Studio-Sales, Login) ohne Bridge nutzen diese Defaults. */
    --color-primary: #276378;
    --color-primary-light: #3689a6;
    --color-primary-dark: #1a4352;
    /* Admin-Bereich nutzt dieselbe Brand-Farbe (vereinheitlicht) */
    --color-secondary: #276378;
    --color-secondary-light: #3689a6;
    /* SCORM-Badge Hintergrund (Brand-Creme, war zuvor lila #E1CBF7) */
    --color-accent-light: #e1d9d2;
    /* Warm-Brown für Task-Badges (außerhalb Brand-Guide, beibehalten) */
    --color-accent-warm: #6B3F1E;
    /* Admin-Modus-Indikator — gedämpftes Lila, markenfreundlich (kein Neon).
       Kennzeichnet den Admin-Bereich visuell, brand-unabhängig. */
    --admin-purple: #6d4aa6;
    --admin-purple-soft: #ede7f6;

    /* Brand-Tokens (Brand-Guide aliases) */
    --primary: #276378;
    --primary-light: #3689a6;
    --primary-hover: #1a4352;
    /* Flieder-Akzent (offiziell) — Fallback für Standalone-Seiten ohne Bridge */
    --accent: #E1CBF7;
    --gold: #c39641;
    --cream: #e1d9d2;
    --gray-50: #f2f2f2;

    /* Surfaces */
    --color-bg: #FFFAF5;
    --color-bg-alt: #F5EDE5;
    /* Empty-image / card placeholder tone — brand-overridable (was hardcoded #ede5dd). */
    --color-placeholder: #F5EDE5;
    --color-white: #ffffff;

    /* Text */
    --color-text: #333333;
    --color-text-light: #666666;
    --color-text-muted: #999999;

    /* Borders */
    --color-border: #e8e0d8;
    --color-border-light: #f0e8e0;

    /* Semantic */
    --color-success: #2e7d32;
    --color-success-light: #e8f5e9;
    --color-danger: #c62828;
    --color-danger-light: #ffebee;
    --color-warning: #f57f17;
    --color-warning-light: #fff8e1;
    --color-info: #1565c0;
    --color-info-light: #e3f2fd;

    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);

    /* Typography */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Open Sans', system-ui, -apple-system, sans-serif;

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 60px;
    --topbar-height: 56px;
    --content-max-width: 1200px;
    --content-padding: var(--space-6);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, svg {
    display: block;
    max-width: 100%;
}

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

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

a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

ul, ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

input, textarea, select, button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-primary-dark);
}

h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.375rem); }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p { line-height: 1.7; }

/* ── Accessibility ── */
.skip-link {
    position: absolute;
    left: -9999px;
    top: var(--space-2);
    z-index: 9999;
    padding: var(--space-2) var(--space-4);
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
}

.skip-link:focus {
    left: var(--space-4);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── Layout: Sidebar + Main ── */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Mobile Header ── */
.mobile-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--header-height);
    padding: 0 var(--space-4);
    background: var(--color-primary);
    position: sticky;
    top: 0;
    z-index: 200;
}

.mobile-header-admin {
    background: var(--color-secondary);
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--color-white);
    flex: 1;
    text-decoration: none;
}

.mobile-logo:hover {
    color: var(--color-white);
    text-decoration: none;
}

.mobile-avatar {
    margin-left: auto;
}

.mobile-user-name {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.9);
    margin-left: auto;
}

/* ── Hamburger Button ── */
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-white);
    border-radius: 2px;
    transition: 0.2s;
}

.topbar-hamburger {
    display: none;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-white);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 150;
    overflow-y: auto;
    transition: transform 0.25s ease;
    transform: translateX(0);
}

.sidebar-admin {
    background: #f3f7f8;
    border-right-color: #d6e3e6;
}

/* Admin-Akzent: lila Kante links + lila Untertitel im Logo, damit der
   Admin-Bereich auch in der Seitenleiste sofort erkennbar ist. */
.sidebar-admin {
    border-left: 3px solid var(--admin-purple);
}

.sidebar-admin .sidebar-logo-sub {
    color: var(--admin-purple);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Mobile: hide sidebar by default */
.sidebar:not(.sidebar-open) {
    transform: translateX(-100%);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 140;
}

.sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: inherit;
}

.sidebar-logo:hover { text-decoration: none; }

.sidebar-logo img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.sidebar-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.sidebar-logo-name {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary);
}

.sidebar-admin .sidebar-logo-name {
    color: var(--color-secondary);
}

.sidebar-logo-sub {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Sidebar Navigation ── */
.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--color-text-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    position: relative;
    margin-bottom: var(--space-1);
}

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

.nav-item-active {
    background: rgba(26, 97, 110, 0.1);
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-admin .nav-item-active {
    background: rgba(26, 97, 110, 0.1);
    color: var(--color-secondary);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item-active .nav-icon,
.nav-item:hover .nav-icon {
    opacity: 1;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    background: var(--color-danger);
    color: var(--color-white);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 var(--space-1);
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

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

.nav-divider {
    height: 1px;
    background: var(--color-border-light);
    margin: var(--space-3) var(--space-3);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.sidebar-user {
    position: relative;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-2);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.sidebar-user-btn:hover {
    background: var(--color-bg-alt);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-email {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-user-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--color-text-muted);
    transition: transform 0.2s;
}

.sidebar-user-menu {
    position: absolute;
    bottom: calc(100% + var(--space-2));
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    z-index: 10;
}

.sidebar-user-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text);
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 0.1s;
}

.sidebar-user-menu-item:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
    text-decoration: none;
}

.sidebar-user-menu-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sidebar-user-menu-divider {
    height: 1px;
    background: var(--color-border-light);
}

.sidebar-user-menu-item-danger:hover {
    color: var(--color-danger);
    background: var(--color-danger-light);
}

.nav-logout {
    display: block;
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.nav-logout:hover {
    color: var(--color-danger);
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* ── Top Bar ── */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-white);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: var(--space-4);
}

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

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

.topbar-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: none;
    background: none;
    color: var(--color-text-light);
    cursor: pointer;
    transition: background 0.15s;
}

.topbar-icon-btn:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
}

.topbar-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: var(--color-gold, #c39641);
    color: var(--color-white);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--color-white);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

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

/* Bell-Icon füllen, wenn Badge ungelesene Nachrichten anzeigt */
.topbar-notif:has(.topbar-badge:not(:empty)) .topbar-icon-btn {
    color: var(--color-gold, #c39641);
}

.topbar-notif:has(.topbar-badge:not(:empty)) .topbar-icon-btn svg {
    fill: var(--color-gold, #c39641);
    stroke: var(--color-gold, #c39641);
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.topbar-user-btn:hover {
    background: var(--color-bg-alt);
    border-color: var(--color-primary);
}

.topbar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-dropdown {
    position: absolute;
    top: calc(100% + var(--space-2));
    right: 0;
    min-width: 180px;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.topbar-notif,
.topbar-user {
    position: relative;
}

/* Mobile: hide the topbar user-dropdown — mobile-header already has the avatar.
   Also hide the user-name label on smaller screens to keep the bell readable. */
@media (max-width: 767px) {
    .topbar-user {
        display: none;
    }
    .topbar-user-name {
        display: none;
    }
    .topbar {
        padding: 0 var(--space-4);
        gap: var(--space-2);
    }
    .topbar-left {
        font-size: 0.85rem;
    }
}

.topbar-dropdown-item {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: 0.875rem;
    color: var(--color-text);
    text-decoration: none;
    transition: background 0.1s;
}

.topbar-dropdown-item:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
    text-decoration: none;
}

.topbar-dropdown-divider {
    height: 1px;
    background: var(--color-border-light);
}

.topbar-dropdown-item-danger:hover {
    color: var(--color-danger);
    background: var(--color-danger-light);
}

/* ── Notification Dropdown ── */
.topbar-dropdown-notif {
    min-width: min(320px, calc(100vw - 2rem));
    max-width: min(380px, calc(100vw - 2rem));
    max-height: 480px;
    overflow-y: auto;
}

/* Auf Mobile: Dropdown als Sheet vom Viewport-Rand zu Rand mit Padding */
@media (max-width: 480px) {
    .topbar-dropdown-notif {
        position: fixed;
        top: calc(var(--topbar-height, 56px) + var(--space-2));
        left: var(--space-3);
        right: var(--space-3);
        min-width: 0;
        max-width: none;
    }
}

.notif-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.notif-dropdown-item {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.875rem;
}

.notif-dropdown-item:last-child {
    border-bottom: none;
}

.notif-dropdown-item-unread {
    background: var(--color-bg-alt);
}

.notif-dropdown-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.notif-dropdown-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.notif-dropdown-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.notif-dropdown-body {
    color: var(--color-text-muted);
    font-size: 0.8125rem;
    margin-bottom: 4px;
}

.notif-dropdown-time {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

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

.notif-dropdown-footer {
    padding: var(--space-2) var(--space-4);
    border-top: 1px solid var(--color-border-light);
    text-align: right;
}

.notif-dropdown-mark-all {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 4px 0;
}

.notif-dropdown-mark-all:hover {
    text-decoration: underline;
}

/* ── Admin Topbar ── */
.admin-topbar {
    padding: var(--space-4) var(--content-padding);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-white);
}

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: var(--content-padding);
    max-width: var(--content-max-width);
    width: 100%;
}

/* ── Page Header ── */
.page-header {
    margin-bottom: var(--space-8);
}

.page-header-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.page-heading {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--color-primary-dark);
    margin-bottom: var(--space-2);
}

.page-header-center { text-align: center; }
.page-heading-hero {
    font-size: clamp(2rem, 4vw, 2.75rem);
    margin-bottom: var(--space-3);
}

.page-subtitle {
    color: var(--color-text-light);
    font-size: 0.95rem;
}

.page-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
}

/* ── Breadcrumbs ── */
.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-1);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-4);
}

.breadcrumb-link {
    color: var(--color-text-muted);
    text-decoration: none;
}

.breadcrumb-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.breadcrumb-sep {
    color: var(--color-border);
}

.breadcrumb-current {
    color: var(--color-text-light);
    font-weight: 500;
}

/* ── Dashboard Grid ── */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

/* ── Dashboard Course-Tabs ── */
.dashboard-courses { margin-top: var(--space-6); }

.dashboard-tabs-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-5);
}

.dashboard-tabs {
    display: inline-flex;
    gap: 4px;
    background: var(--color-bg-alt);
    border-radius: var(--radius-full);
    padding: 4px;
}

.dashboard-tab {
    padding: var(--space-2) var(--space-4);
    border: 0;
    background: transparent;
    border-radius: var(--radius-full);
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    line-height: 1.2;
}

.dashboard-tab:hover { color: var(--color-text); }

.dashboard-tab-active,
.dashboard-tab-active:hover {
    background: var(--color-white);
    color: var(--color-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dashboard-tab-count {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-left: 4px;
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
}

/* ── Auth Pages ── */
.auth-page {
    background: var(--color-bg-alt);
    min-height: 100vh;
}

.auth-layout {
    display: flex;
    min-height: 100vh;
}

.auth-layout-centered {
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
}

.auth-brand {
    display: none;
    background: var(--color-primary);
    color: var(--color-white);
    flex: 1;
    align-items: center;
    justify-content: center;
    padding: var(--space-16);
}

.auth-brand-inner {
    text-align: center;
    max-width: 360px;
}

.auth-brand-inner img {
    margin: 0 auto var(--space-6);
}

.auth-brand-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-white);
    margin-bottom: var(--space-3);
}

.auth-brand-tagline {
    color: rgba(255,255,255,0.8);
    font-size: 1rem;
}

.auth-card-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8) var(--space-4);
}

.auth-card {
    background: var(--color-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: var(--space-8);
    width: 100%;
    max-width: 420px;
}

.auth-card-narrow {
    max-width: 380px;
}

.auth-card-confirm {
    text-align: center;
    padding: var(--space-12) var(--space-8);
}

.auth-logo-mobile {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-6);
}

.auth-card-header {
    margin-bottom: var(--space-8);
    text-align: center;
}

.auth-card-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-primary-dark);
    margin-bottom: var(--space-2);
}

.auth-card-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-6) 0;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

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

.auth-card-footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.auth-card-footer a {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-confirm-icon {
    color: var(--color-success);
    margin-bottom: var(--space-6);
    display: flex;
    justify-content: center;
}

.auth-confirm-text {
    font-size: 1rem;
    color: var(--color-text);
    margin-bottom: var(--space-4);
}

.auth-confirm-hint {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

/* ── Course Detail ── */
.course-header {
    display: flex;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
    flex-wrap: wrap;
}

.course-header-text {
    flex: 1 1 320px;
    min-width: 0;
}

.course-header-image {
    width: 320px;
    flex-shrink: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.course-header-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

/* Mobile: stack image ABOVE text so heading + copy aren't squeezed */
@media (max-width: 767px) {
    .course-header {
        flex-direction: column;
        gap: var(--space-4);
        margin-bottom: var(--space-6);
    }
    .course-header-image {
        order: -1;
        width: 100%;
        max-width: 100%;
    }
    .course-header-image img {
        height: 200px;
    }
    .course-header-text {
        flex: 1 1 auto;
        width: 100%;
    }
}

.course-description {
    color: var(--color-text-light);
    margin-top: var(--space-3);
    font-size: 1rem;
}

.course-progress-section {
    margin-bottom: var(--space-8);
}

.course-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-light);
    margin-bottom: var(--space-2);
}

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

.course-modules {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ── Lesson View ── */
.lesson-view {
    max-width: 800px;
}

.lesson-content {
    margin: var(--space-8) 0;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    margin-bottom: var(--space-6);
}

.video-embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.video-facade {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #000;
    cursor: pointer;
    z-index: 2;
}

.video-facade-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    transition: transform 0.2s ease;
}
.video-facade:hover .video-facade-play { transform: translate(-50%, -50%) scale(1.08); }

.audio-wrapper {
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.audio-player {
    width: 100%;
}

.file-wrapper {
    margin-bottom: var(--space-6);
}

.file-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.file-card-icon {
    color: var(--color-primary);
    flex-shrink: 0;
}

.file-card-info {
    flex: 1;
}

.file-card-name {
    font-weight: 600;
    color: var(--color-text);
}

.file-card-size {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.lesson-text-content {
    margin-top: var(--space-6);
}

.lesson-complete-action {
    margin: var(--space-8) 0;
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border-light);
}

.lesson-completed-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-success);
    font-weight: 600;
    font-size: 0.95rem;
}

.lesson-completed-badge svg {
    color: var(--color-success);
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-6);
    flex-wrap: wrap;
}

.lesson-nav-prev,
.lesson-nav-next {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    max-width: calc(50% - var(--space-2));
    min-width: 0;
}

.lesson-nav-next {
    margin-left: auto;
}

.lesson-nav-prev span,
.lesson-nav-next span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.lesson-nav-prev small,
.lesson-nav-next small {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lesson-nav-prev strong,
.lesson-nav-next strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.875rem;
}

/* ── Messages Layout ── */
.messages-layout {
    display: flex;
    height: calc(100vh - var(--header-height) - var(--topbar-height));
    height: calc(100dvh - var(--header-height) - var(--topbar-height));
    overflow: hidden;
    margin: calc(-1 * var(--content-padding));
}

.messages-sidebar {
    width: 320px;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    background: var(--color-white);
    overflow-y: auto;
}

.messages-sidebar-desktop { display: none; }

.messages-sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    flex-shrink: 0;
}

.messages-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.messages-main-empty {
    align-items: center;
    justify-content: center;
}

.messages-placeholder {
    text-align: center;
    color: var(--color-text-muted);
    padding: var(--space-12);
}

.messages-placeholder svg {
    margin: 0 auto var(--space-4);
    color: var(--color-border);
}

.messages-main-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-white);
    flex-shrink: 0;
}

.messages-partner-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.messages-partner-name {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
}

.messages-partner-name:hover { color: var(--color-primary); }

.messages-back-btn {
    padding: var(--space-2);
}

.messages-feed {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.message-date-separator {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin: var(--space-2) 0;
}

.message-date-separator::before,
.message-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border-light);
}

.message {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
    max-width: 75%;
}

.message-own {
    flex-direction: row-reverse;
    align-self: flex-end;
}

.message-other {
    align-self: flex-start;
}

.message-avatar {
    flex-shrink: 0;
}

.message-bubble {
    max-width: 100%;
}

.message-text {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.message-own .message-text {
    background: var(--color-primary);
    color: var(--color-white);
    border-bottom-right-radius: var(--radius-sm);
}

.message-other .message-text {
    background: var(--color-bg-alt);
    color: var(--color-text);
    border-bottom-left-radius: var(--radius-sm);
}

.message-time {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: var(--space-1);
    padding: 0 var(--space-1);
}

.message-own .message-time {
    text-align: right;
}

.message-status {
    display: block;
    font-size: 0.65rem;
    color: var(--color-text-muted);
    margin-top: 2px;
    padding: 0 var(--space-1);
    text-align: right;
    font-style: italic;
}

.messages-input-form {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--color-border-light);
    background: var(--color-white);
    flex-shrink: 0;
}

.messages-textarea {
    flex: 1;
    resize: none;
    border-radius: var(--radius-lg);
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
}

.btn.messages-send-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    flex-shrink: 0;
    color: #fff;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn.messages-send-btn svg {
    color: #fff;
    transform: translateX(1px);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.btn.messages-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26, 97, 110, 0.3);
}
.btn.messages-send-btn:active {
    transform: translateY(0);
}

/* ── Conversation List ── */
.conversation-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    text-decoration: none;
    transition: background 0.1s;
    position: relative;
}

.conversation-item:hover {
    background: var(--color-bg-alt);
    text-decoration: none;
}

.conversation-item-active {
    background: rgba(39, 99, 120, 0.08);
}

.conversation-avatar {
    position: relative;
    flex-shrink: 0;
}

.conversation-unread-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    border: 2px solid var(--color-white);
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-2);
}

.conversation-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation-time {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.conversation-preview {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Community ── */
.community-categories {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.community-category-link {
    text-decoration: none;
    display: block;
}

.community-category-link:hover { text-decoration: none; }

.community-category-body {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

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

.community-category-info {
    flex: 1;
    min-width: 0;
}

.community-category-name {
    font-size: 1.05rem;
    margin-bottom: var(--space-1);
    color: var(--color-primary-dark);
}

.community-category-desc {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.community-category-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    flex-shrink: 0;
}

/* Thread List */
.thread-list {
    display: flex;
    flex-direction: column;
}

.thread-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    position: relative;
}

.thread-row:last-child { border-bottom: none; }

.thread-row-pinned {
    background: rgba(39, 99, 120, 0.03);
}

.thread-pin-badge {
    color: var(--color-secondary);
    flex-shrink: 0;
}

.thread-row-main {
    flex: 1;
    min-width: 0;
}

.thread-title {
    font-weight: 600;
    color: var(--color-text);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: var(--space-1);
}

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

.thread-meta {
    font-size: 0.775rem;
    color: var(--color-text-muted);
    display: flex;
    gap: var(--space-3);
}

.thread-author { color: var(--color-primary); }

.thread-row-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--space-1);
    flex-shrink: 0;
    font-size: 0.775rem;
    color: var(--color-text-muted);
}

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

/* Thread Detail */
.thread-detail {
    max-width: 800px;
}

.reply-card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-4);
}

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

.reply-card-author {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.reply-author-info {
    flex: 1;
}

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

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

.reply-time {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.reply-body { font-size: 0.95rem; }

.reply-delete-btn { margin-left: auto; }

.reply-form-section {
    margin-top: var(--space-8);
}

.reply-form-title {
    font-size: 1.1rem;
    margin-bottom: var(--space-4);
    color: var(--color-text);
}

.reply-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.reply-login-prompt {
    margin-top: var(--space-8);
    padding: var(--space-6);
    background: var(--color-bg-alt);
    border-radius: var(--radius-lg);
    text-align: center;
    color: var(--color-text-light);
}

.admin-thread-actions {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

/* ── Profile ── */
.profile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.profile-avatar-wrap { flex-shrink: 0; }

.profile-header-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.profile-name {
    font-size: 1.75rem;
    color: var(--color-primary-dark);
    margin-bottom: var(--space-3);
}

.profile-bio {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: var(--space-4);
    line-height: 1.7;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.profile-meta-item dd {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.profile-edit-form {
    max-width: 680px;
}

.avatar-upload-row {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.avatar-upload-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* ── Lesson Edit ── */
.lesson-edit-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-6);
    align-items: start;
}

.content-type-selector {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.content-type-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--color-text-light);
    transition: 0.15s;
    min-width: 70px;
}

.content-type-option:hover {
    border-color: var(--color-primary-light);
    color: var(--color-primary);
}

.content-type-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(39, 99, 120, 0.06);
}

/* ── Activity List ── */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.activity-dot {
    width: 8px;
    height: 8px;
    background: var(--color-primary-light);
    border-radius: var(--radius-full);
    flex-shrink: 0;
    margin-top: 6px;
}

.activity-text {
    font-size: 0.875rem;
    color: var(--color-text);
}

.activity-time {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ── Module Edit ── */
.module-edit-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.module-edit-item {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.module-edit-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-alt);
}

.module-edit-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
}

.module-edit-toggle svg {
    transition: transform 0.2s;
}

.module-edit-title {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
}

.module-edit-body {
    padding: var(--space-4);
}

.lesson-edit-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.lesson-edit-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
    row-gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
}

.lesson-edit-type-icon {
    font-size: 0.9rem;
    color: var(--color-primary);
}

.lesson-edit-title {
    flex: 1;
    font-size: 0.875rem;
}

.lesson-edit-sidebar {
    position: sticky;
    top: var(--space-4);
}

/* ── Settings ── */
.settings-form {
    max-width: 600px;
}

/* ── Prose (rendered HTML content) ── */
.prose { line-height: 1.75; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.5em; margin-bottom: 0.5em; }
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { padding-left: 1.5em; margin-bottom: 1em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li { margin-bottom: 0.25em; }
.prose a { color: var(--color-primary); text-decoration: underline; }
.prose blockquote { border-left: 3px solid var(--color-border); padding-left: 1em; color: var(--color-text-muted); }
.prose code { background: var(--color-bg-alt); padding: 0.1em 0.3em; border-radius: var(--radius-sm); font-size: 0.875em; }
.prose img { border-radius: var(--radius); max-width: 100%; margin: 1em 0; }

/* ── Utility Classes ── */
.flex { display: flex; }
.grid { display: grid; }
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-danger { color: var(--color-danger); }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.w-full { width: 100%; }
.required { color: var(--color-danger); }

/* ── Responsive Table Scroll ── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--space-4));
    padding: 0 var(--space-4);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   Mobile-first: styles above are mobile baseline
   ═══════════════════════════════════════════════════════════ */

/* ── Mobile Touch Targets (max-width: 767px) ── */
@media (max-width: 767px) {
    /* Nav items: 44px minimum touch target */
    .nav-item {
        min-height: 44px;
        padding: var(--space-3) var(--space-3);
    }

    /* Pagination: 44x44 minimum */
    .pagination-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 14px;
    }

    .pagination-page {
        width: 44px;
        height: 44px;
    }

    /* Table action buttons: more padding on mobile */
    .table-actions .btn {
        padding: 10px 14px;
    }

    /* Lesson nav: stack vertically on mobile */
    .lesson-nav {
        flex-direction: column;
        gap: 10px;
    }
    .lesson-nav-prev,
    .lesson-nav-next {
        max-width: 100%;
        width: 100%;
        justify-content: center;
    }
    .lesson-nav-prev { order: 2; }
    .lesson-nav-next { order: 1; }

    /* Breadcrumbs: smaller on mobile */
    .breadcrumbs { font-size: 0.8rem; }

    /* Messages: kompakter Composer auf Mobile */
    .messages-feed {
        padding: var(--space-3);
    }
    .messages-input-form {
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }
    .messages-textarea {
        min-height: 36px;
        max-height: 80px;
        font-size: 16px;
    }
    .messages-send-btn {
        width: 40px;
        height: 40px;
    }
}

/* Tablet (768px+) */
@media (min-width: 768px) {
    .mobile-header { display: none; }
    .topbar-hamburger { display: none; }

    .sidebar { transform: translateX(0) !important; }
    .sidebar-backdrop { display: none !important; }

    .main-content {
        margin-left: var(--sidebar-width);
    }

    .messages-sidebar-desktop { display: flex; }
    .messages-back-btn { display: none; }

    .auth-brand { display: flex; }
    .auth-logo-mobile { display: none; }

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

    .course-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .course-grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }

    .page-content {
        padding: var(--space-8) var(--content-padding);
    }

    .thread-detail,
    .lesson-view {
        max-width: 760px;
    }
}

/* SCORM lessons need more horizontal room than the 800px reading column — their
   internal fixed-width layout (content pane + table-of-contents) gets clipped at
   reading width. Declared after the media override above so it wins by source
   order for elements carrying the --wide modifier. */
.lesson-view--wide {
    max-width: 1200px;
}

/* Large Desktop (1280px+) */
@media (min-width: 1280px) {
    :root {
        --content-padding: var(--space-10);
    }
}

/* ═══ Reduced Motion ═══ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ═══ Print Styles ═══ */
@media print {
    .sidebar,
    .mobile-header,
    .toast-container,
    .hamburger,
    .sidebar-backdrop,
    .btn,
    .modal-backdrop { display: none !important; }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    body { background: white !important; color: black !important; }
    * { box-shadow: none !important; }

    a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
    a[href^="#"]::after, a[href^="javascript"]::after { content: ""; }

    h2, h3 { page-break-after: avoid; }
    table, figure, img { page-break-inside: avoid; }
}
/* ═══ Dashboard Hero-CTA Tiles — dynamic count layout (3-6 tiles) ═══
   Overrides the auto-fit default in components.css with explicit grid
   layouts depending on the number of editable tiles. */
.hero-cta-row[data-count] {
    display: grid;
    gap: var(--space-4, 16px);
}

.hero-cta-row[data-count="3"] { grid-template-columns: repeat(3, 1fr); }
.hero-cta-row[data-count="6"] { grid-template-columns: repeat(3, 1fr); }

.hero-cta-row[data-count="4"] { grid-template-columns: repeat(3, 1fr); }
.hero-cta-row[data-count="4"] .hero-cta:nth-child(4) { grid-column: 2 / 3; }

.hero-cta-row[data-count="5"] { grid-template-columns: repeat(6, 1fr); }
.hero-cta-row[data-count="5"] .hero-cta:nth-child(1) { grid-column: 1 / span 2; }
.hero-cta-row[data-count="5"] .hero-cta:nth-child(2) { grid-column: 3 / span 2; }
.hero-cta-row[data-count="5"] .hero-cta:nth-child(3) { grid-column: 5 / span 2; }
.hero-cta-row[data-count="5"] .hero-cta:nth-child(4) { grid-column: 2 / span 2; }
.hero-cta-row[data-count="5"] .hero-cta:nth-child(5) { grid-column: 4 / span 2; }

@media (max-width: 767px) {
    .hero-cta-row[data-count] { grid-template-columns: 1fr; }
    .hero-cta-row[data-count] .hero-cta { grid-column: 1 / -1 !important; }
}

/* ═══ Admin: Dashboard-Tiles Verwaltung ═══ */
.dashboard-tile-card {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-3, 12px) var(--space-4, 16px);
    background: var(--color-white, #fff);
    border: 1px solid var(--color-border, rgba(26, 97, 110, 0.12));
    border-radius: 12px;
    transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.dashboard-tile-card:hover {
    border-color: var(--gold, #c39641);
    box-shadow: 0 4px 12px rgba(26, 97, 110, 0.08);
}

.dashboard-tile-card.sortable-ghost { opacity: 0.4; }
.dashboard-tile-card.sortable-chosen { border-color: var(--gold, #c39641); }

.dashboard-tile-handle {
    cursor: grab;
    color: var(--color-text-muted, #9ca3af);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}
.dashboard-tile-handle:active { cursor: grabbing; }

.dashboard-tile-icon-cell {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface, #f8f4ef);
    border-radius: 10px;
    color: var(--color-primary, #1a616e);
}

.dashboard-tile-body { flex: 1; min-width: 0; }
.dashboard-tile-body strong { display: block; font-weight: 600; color: var(--color-text, #2a2a2a); }
.dashboard-tile-body small { display: block; font-size: 0.85rem; color: var(--color-text-light, #666); margin-top: 2px; }
.dashboard-tile-body .dashboard-tile-link {
    font-size: 0.78rem;
    color: var(--color-primary, #1a616e);
    text-decoration: none;
    margin-top: 4px;
    display: inline-block;
}

.dashboard-tile-actions {
    display: flex;
    gap: var(--space-2, 8px);
    flex-shrink: 0;
}

.dashboard-tile-icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: var(--space-2, 8px);
}

@media (max-width: 600px) {
    .dashboard-tile-icon-grid { grid-template-columns: repeat(4, 1fr); }
}

.dashboard-tile-icon-option {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border: 1.5px solid var(--color-border, rgba(26, 97, 110, 0.12));
    border-radius: 10px;
    background: var(--color-white, #fff);
    color: var(--color-primary, #1a616e);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
}

.dashboard-tile-icon-option:hover {
    border-color: var(--gold, #c39641);
}

.dashboard-tile-icon-option.is-selected {
    border-color: var(--color-primary, #1a616e);
    background: var(--color-surface, #f8f4ef);
}

.dashboard-tile-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-4, 16px);
}

.dashboard-tile-modal {
    background: var(--color-white, #fff);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 92vh;
    overflow: auto;
    padding: var(--space-6, 24px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* ═══════════════════════════════════════════════════════════
   Admin-Modus-Leiste — fixe Footer-Bar (nur Admin-Layout)
   z-index 120: über Content/Topbar (100), unter Sidebar (150),
   Modals (1000+) und Toasts (9999). Spannt auf Desktop nur den
   Content-Bereich (rechts neben der Sidebar).
   ═══════════════════════════════════════════════════════════ */
.admin-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 16px;
    background: var(--admin-purple);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.18);
}

.admin-bar-label {
    font-size: 0.85rem;
    line-height: 1;
}

.admin-bar-text {
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.admin-bar-link {
    margin-left: auto;
    color: var(--admin-purple-soft);
    text-decoration: none;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-bar-link:hover,
.admin-bar-link:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    text-decoration: none;
}

/* Content nicht verdecken: Platz für die 32px-Bar am unteren Rand.
   Strikt auf das Admin-Layout begrenzt (Sidebar-Admin ist Geschwister von
   .main-content im .layout-Container) — Member-Portal bleibt unberührt. */
.sidebar-admin ~ .main-content .page-content {
    padding-bottom: calc(var(--space-8) + 32px);
}

/* Desktop: Bar beginnt rechts neben der Sidebar, damit sie diese nicht überlappt. */
@media (min-width: 768px) {
    .admin-bar {
        left: var(--sidebar-width);
    }
}

/* Mobile: Bar bleibt vollbreit am unteren Rand. Es gibt im Admin keine
   fixe Bottom-Navigation (Navigation läuft über das Sidebar-Drawer +
   Mobile-Header oben), daher keine Überdeckung. Etwas schlanker halten. */
@media (max-width: 767px) {
    .admin-bar {
        height: 30px;
        font-size: 0.72rem;
    }
}
