/**
 * ============================================================
 * css/style.css – Design des Heartwood Roleplay Team-Portals
 *
 * Abschnitte (von oben nach unten):
 *  1. CSS-Variablen & Basis (body, animierter Hintergrund)
 *  2. Login-Seite (.login-body, .login-box)
 *  3. App-Shell: Header, Sidebar (Icons), Content, Orbs/Partikel
 *  4. Komponenten: Cards, Tabellen, Formulare, Buttons, Badges
 *  5. Responsive Anpassungen (Tablet / Smartphone)
 *
 * Layout-Variablen (--header-h, --sidebar-w) stehen in der App-Shell-Sektion.
 * ============================================================
 */
:root {
    --bg: #111214;
    --panel: #1c1e21;
    --panel-alt: #25272b;
    --border: #393c41;
    --accent: #f58220;
    --accent-dark: #c75b0c;
    --text: #e6e9f0;
    --text-dim: #9aa3b5;
    --danger: #ff6b6b;
    --success: #4caf7d;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--text);
    min-height: 100vh;
    /* Gleicher animierter Hintergrund wie auf der Login-Seite */
    background:
        radial-gradient(ellipse 80% 60% at 20% 10%, rgba(245, 130, 32, 0.22) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 80%, rgba(245, 130, 32, 0.12) 0%, transparent 50%),
        radial-gradient(circle at top, #24262a 0%, #0d0e10 100%);
    background-size: 120% 120%, 120% 120%, 100% 100%;
    animation: bgShift 18s ease-in-out infinite alternate;
}

@keyframes bgShift {
    0%   { background-position: 0% 0%, 100% 100%, center; }
    100% { background-position: 30% 20%, 70% 60%, center; }
}

@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        background-position: center;
    }
}

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Hintergrund kommt bereits von body – hier nur Layout */
    background: transparent;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    text-align: center;
}

.login-box h1 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.login-box .subtitle {
    margin: 4px 0 28px;
    color: var(--text-dim);
    font-size: 14px;
}

.login-box form {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 6px;
}

.login-box label {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 10px;
}

.login-box input {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text);
    font-size: 14px;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-box button {
    margin-top: 22px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}

.login-box button:hover { background: var(--accent-dark); }

.alert-error {
    background: rgba(255,107,107,0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 10px;
}

.alert-success {
    background: rgba(76,175,125,0.12);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* ---------- App Shell: Header + Sidebar + Content ---------- */
/* Layout-Variablen */
:root {
    --header-h: 56px;
    --sidebar-w: 240px;
    --sidebar-collapsed-w: 64px;
}

.app-body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
}

/* Animierter Hintergrund (Orbs + Partikel) – wie Login */
.app-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.app-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(48px);
    opacity: 0.35;
    animation: appOrbFloat 14s ease-in-out infinite;
}

.app-orb--1 {
    width: 320px;
    height: 320px;
    background: rgba(245, 130, 32, 0.32);
    top: -80px;
    left: -60px;
    animation-duration: 16s;
}

.app-orb--2 {
    width: 260px;
    height: 260px;
    background: rgba(199, 91, 12, 0.28);
    bottom: 5%;
    right: -40px;
    animation-duration: 18s;
    animation-delay: -5s;
}

.app-orb--3 {
    width: 180px;
    height: 180px;
    background: rgba(170, 176, 185, 0.18);
    top: 40%;
    left: 25%;
    animation-duration: 13s;
    animation-delay: -3s;
}

@keyframes appOrbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(28px, -22px) scale(1.06); }
    66%      { transform: translate(-18px, 14px) scale(0.96); }
}

.app-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.app-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(230, 233, 240, 0.45);
    animation: appParticleRise linear infinite;
}

@keyframes appParticleRise {
    0%   { transform: translateY(100vh) scale(0.6); opacity: 0; }
    10%  { opacity: 0.5; }
    90%  { opacity: 0.35; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .app-orb,
    .app-particle {
        animation: none !important;
    }
}

/* ===== TOP-HEADER ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 16px 0 12px;
    background: rgba(23, 27, 36, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
    white-space: nowrap;
}

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

.header-brand-text {
    background: linear-gradient(120deg, #ffb56b, #f58220, #c75b0c);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Benutzer-Dropdown */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 4px 10px 4px 12px;
    color: var(--text);
    cursor: pointer;
    text-align: right;
    line-height: 1.25;
    transition: border-color .15s, background .15s;
}

.user-menu-btn:hover,
.user-menu.open .user-menu-btn {
    border-color: var(--border);
    background: var(--panel-alt);
}

.user-menu-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.user-menu-role {
    font-size: 11px;
    color: var(--text-dim);
}

.user-menu-caret {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-dim);
    pointer-events: none;
}

.user-menu-btn {
    padding-right: 22px;
    position: relative;
}

/* Benachrichtigungs-Badge am Benutzer-Menü (offene Meldungen) */
.user-menu-badge {
    position: absolute;
    top: -10px;
    right: -12px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--danger, #ff6b6b);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--panel, #161a22);
    pointer-events: none;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    padding: 6px;
    z-index: 130;
}

.user-dropdown a {
    display: block;
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}

.user-dropdown a:hover {
    background: var(--panel-alt);
    color: var(--accent);
}

.header-logout {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: border-color .15s, color .15s, background .15s;
}

.header-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(255, 107, 107, 0.08);
}

/* Sidebar-Toggle im Header */
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, color .15s;
}

.sidebar-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Globaler Serverstatus (im Header) */
.global-server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    max-width: min(220px, 28vw);
    transition: border-color .15s, box-shadow .15s;
}

.global-server-status:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(245, 130, 32, 0.15);
}

.gss-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #6b7280;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.25);
}

.global-server-status--online .gss-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(76, 175, 125, 0.3);
    animation: gssPulse 2s ease-in-out infinite;
}

.global-server-status--offline .gss-dot {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.3);
}

.global-server-status--loading .gss-dot {
    background: var(--accent);
    box-shadow: 0 0 0 3px rgba(245, 130, 32, 0.25);
}

@keyframes gssPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

.gss-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.gss-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.gss-detail {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    background: rgba(23, 27, 36, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: hidden;
    transition: width .2s ease, transform .2s ease;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 10px;
    flex: 1 1 auto;
    min-height: 0;            /* erlaubt Scrollen statt Stauchen in der Flex-Spalte */
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* Einträge dürfen bei wenig Platz nie zusammengedrückt (und dadurch abgeschnitten) werden –
   stattdessen scrollt die Navigation. */
.sidebar-nav > * {
    flex-shrink: 0;
}

.sidebar-nav-group {
    margin: 9px 12px 3px;
    padding: 0 4px;
    font-size: 10px;
    line-height: 1.5;         /* verhindert abgeschnittene Unterlängen/Buchstaben */
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f58220;
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-nav-group:first-child {
    margin-top: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13.5px;
    padding: 6px 12px;
    line-height: 1.4;
    border-radius: 7px;
    transition: background .15s, color .15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link:hover {
    background: var(--panel-alt);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.sidebar-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dropdown „Nützliches“ */
.sidebar-dropdown > summary {
    list-style: none;
    cursor: pointer;
}
.sidebar-dropdown > summary::-webkit-details-marker { display: none; }
.sidebar-chevron {
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform .15s;
    flex-shrink: 0;
}
.sidebar-dropdown[open] > summary .sidebar-chevron { transform: rotate(45deg); }
.sidebar-dropdown-items { margin: 2px 0 4px 14px; padding-left: 6px; border-left: 1px solid var(--border, rgba(255,255,255,.12)); }
body.sidebar-collapsed .sidebar-dropdown-items { margin-left: 0; padding-left: 0; border-left: 0; }

/* Footer in der Sidebar ganz unten */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding: 8px 12px 10px;
    flex-shrink: 0;
}

.sidebar-footer-text {
    font-size: 10.5px;
    line-height: 1.35;
    color: var(--text-dim);
    text-align: center;
}

.sidebar-footer-credit {
    color: var(--accent);
    opacity: 0.85;
    text-decoration: none;
}

a.sidebar-footer-credit:hover,
a.sidebar-footer-credit:focus-visible {
    opacity: 1;
    text-decoration: underline;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0, 0, 0, .45);
    z-index: 90;
}

/* ===== CONTENT ===== */
.content {
    position: relative;
    z-index: 1;
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    padding: 28px 32px 40px;
    width: calc(100% - var(--sidebar-w));
    flex: 1;
    box-sizing: border-box;
    transition: margin-left .2s ease, width .2s ease;
    min-height: calc(100vh - var(--header-h));
}

/* Alter .footer (außerhalb Sidebar) – ausgeblendet, da Footer jetzt in Sidebar */
.footer {
    display: none;
}

/* ===== Desktop: eingeklappt → schmale Icon-Leiste ===== */
@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar {
        width: var(--sidebar-collapsed-w);
    }

    body.sidebar-collapsed .sidebar-label,
    body.sidebar-collapsed .sidebar-nav-group,
    body.sidebar-collapsed .sidebar-footer-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
        pointer-events: none;
    }

    body.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }

    body.sidebar-collapsed .sidebar-footer {
        padding: 10px 4px;
    }

    body.sidebar-collapsed .content {
        margin-left: var(--sidebar-collapsed-w);
        width: calc(100% - var(--sidebar-collapsed-w));
    }
}

/* ===== Mobil: Drawer ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: min(280px, 86vw);
        top: var(--header-h);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .content {
        margin-left: 0;
        width: 100%;
        padding: 20px 16px 28px;
    }

    .header-brand-text {
        display: none; /* Platz sparen auf Mobil */
    }

    .global-server-status {
        max-width: 140px;
        padding: 5px 8px;
    }

    .gss-label { display: none; }

    .user-menu-role {
        display: none;
    }

    .header-logout {
        padding: 7px 10px;
        font-size: 12px;
    }
}

/* Legacy topbar (falls irgendwo noch referenziert) */
.topbar { display: none; }
.brand { font-weight: 700; font-size: 18px; color: var(--accent); }
.user-info { font-size: 13px; color: var(--text-dim); }
.user-info a { color: var(--accent); text-decoration: none; }

.content h1 {
    font-size: 22px;
    margin-bottom: 4px;
}
.content .lead {
    color: var(--text-dim);
    margin-bottom: 24px;
    font-size: 14px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 22px;
    margin-bottom: 18px;
}

.card h2 {
    margin-top: 0;
    font-size: 16px;
    color: var(--accent);
}

.paragraph-item {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
    font-size: 14px;
    line-height: 1.5;
}
.paragraph-item:last-child { border-bottom: none; }
.paragraph-item .num { color: var(--accent); font-weight: 600; margin-right: 6px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

/* ---------- Team-Tabelle: feste Spaltenbreiten, egal wie lang der Name ---------- */
.team-table {
    table-layout: fixed;
}
.team-table td, .team-table th {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-rang-row td {
    padding-top: 20px;
    padding-bottom: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    white-space: normal;
}
.team-rang-row:first-child td {
    padding-top: 4px;
}
th, td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
}
th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
tr:hover td { background: var(--panel-alt); }

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-ok { background: rgba(76,175,125,0.15); color: var(--success); }
.badge-pending { background: rgba(255,193,86,0.15); color: #ffc156; }
.badge-danger { background: rgba(255,107,107,0.15); color: var(--danger); }
.badge-info { background: rgba(245, 130, 32,0.15); color: var(--accent); }

.grid-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.member-role {
    color: var(--text-dim);
    font-size: 12.5px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.dashboard-tile {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: transform .15s, border-color .15s;
    position: relative;
}
.dashboard-tile:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.dashboard-tile .num { font-size: 26px; font-weight: 700; color: var(--accent); min-height: 32px; }
.dashboard-tile .label { font-size: 13px; color: var(--text-dim); margin-top: 4px; }

/* Tooltip "Wer ist aktuell abgemeldet" auf der Abmeldungen-Dashboard-Kachel */
.dashboard-tile-tooltip {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
    text-align: left;
    white-space: normal;
}
.dashboard-tile-tooltip strong { color: var(--text); font-size: 13px; }
.dashboard-tile-tooltip ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}
.dashboard-tile-tooltip li {
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-dim);
    padding: 6px 0;
    border-top: 1px solid var(--border);
}
.dashboard-tile-tooltip li:first-child { border-top: none; padding-top: 0; }
.dashboard-tile-tooltip li strong { color: var(--text); font-size: 12.5px; }
.dashboard-tile--abmeldungen:hover .dashboard-tile-tooltip,
.dashboard-tile--abmeldungen:focus-within .dashboard-tile-tooltip {
    display: block;
}

/* Footer liegt in der Sidebar – siehe .sidebar-footer */

/* ---------- Formulare (allgemein) ---------- */
.form-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
}
.form-field label {
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.form-field input[type="text"],
.form-field input[type="date"],
.form-field input[type="url"],
.form-field input[type="file"],
.form-field input[type="password"],
.form-field select,
.form-field textarea {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 10px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
.form-field textarea { resize: vertical; }

/* ---------- Ankündigungen & Meeting-Protokolle (Übersicht) ---------- */
.post-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
    background: var(--panel-alt);
}
.post-item:last-child { margin-bottom: 0; }
.post-item h3 { margin: 0 0 6px 0; font-size: 15px; }
.post-item .post-meta { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.post-item .post-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.post-item .post-body.md-body { white-space: normal; }

/* ---------- Passwortfeld mit "Passwort anzeigen"-Button ---------- */
.password-field {
    display: flex;
    gap: 8px;
    align-items: center;
}
.password-field input {
    flex: 1;
    font-family: 'Courier New', monospace;
}
.btn-toggle-password {
    flex-shrink: 0;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text-dim);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s;
}
.btn-toggle-password:hover { border-color: var(--accent); color: var(--text); }

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

.btn-primary {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    transition: border-color .15s;
}
.btn-secondary:hover { border-color: var(--accent); }

.btn-danger {
    background: rgba(255,107,107,0.12);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.btn-danger:hover { background: rgba(255,107,107,0.24); }

/* Bearbeiten / Löschen – gleicher Look wie „+ Neue Ankündigung“ (btn-secondary) */
.edit-link,
a.edit-link,
button.edit-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    margin: 0;
    transition: border-color .15s, background .15s;
}
.edit-link:hover,
a.edit-link:hover,
button.edit-link:hover {
    border-color: var(--accent);
    color: var(--text);
    text-decoration: none;
}

.delete-link,
a.delete-link,
button.delete-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.3;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    margin: 0;
    transition: border-color .15s, background .15s;
}
.delete-link:hover,
a.delete-link:hover,
button.delete-link:hover {
    border-color: var(--danger);
    background: rgba(255, 107, 107, 0.12);
    text-decoration: none;
}

/* Einheitliche Aktionszeile: Bearbeiten | Löschen in einer Reihe */
.row-actions {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.row-actions form {
    display: inline-flex;
    margin: 0;
    padding: 0;
}
.row-actions .btn-secondary,
.row-actions .btn-danger,
.row-actions .btn-primary,
.row-actions .edit-link,
.row-actions .delete-link {
    margin-top: 0;
    width: auto;
}

/* ---------- Link-Zeilen (dynamisch) ---------- */
.link-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr auto;
    gap: 8px;
    margin-bottom: 8px;
}
.link-row input {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    font-size: 13.5px;
}
.btn-remove-link {
    background: rgba(255,107,107,0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
    border-radius: 8px;
    width: 36px;
    cursor: pointer;
    font-size: 14px;
}
.btn-remove-link:hover { background: rgba(255,107,107,0.22); }

/* ---------- Supportfall-Karten ---------- */
.case-item {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}
.case-item:last-child { border-bottom: none; }

.case-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.case-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.case-text {
    font-size: 14px;
    color: var(--text);
    margin: 8px 0;
    line-height: 1.5;
}

.case-images {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0;
}
.case-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: transform .15s;
}
.case-thumb:hover { transform: scale(1.05); border-color: var(--accent); }

.case-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.case-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 13.5px;
}
.case-links a:hover { text-decoration: underline; }

/* .edit-link Basis-Styles siehe oben bei .delete-link (Button-Look) */

.back-link {
    display: inline-block;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
}

/* Individuelle Mitglieder-Rechte */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.permission-group {
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.permission-group h4 {
    margin: 0 0 8px;
}
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    cursor: pointer;
}
.switch-row:first-of-type { border-top: 0; }
.switch-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.switch {
    width: 42px;
    height: 23px;
    flex: 0 0 42px;
    border-radius: 999px;
    background: #555;
    border: 1px solid var(--border);
    padding: 2px;
    transition: .15s ease;
}
.switch span {
    display: block;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #fff;
    transition: .15s ease;
}
.switch-row input:checked + .switch {
    background: var(--accent);
}
.switch-row input:checked + .switch span {
    transform: translateX(19px);
}
.switch-row input:focus-visible + .switch {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Markdown-Darstellung */
.md-body { line-height: 1.65; }
.md-body p { margin: 0.6em 0; }
.md-body ul.md-ul, .md-body ol.md-ol { margin: 0.6em 0; padding-left: 1.4em; }
.md-body li { margin: 0.25em 0; }
.md-body li.md-sub { margin-left: 1.4em; list-style: circle; }
.md-body h1.md-h, .md-body h2.md-h, .md-body h3.md-h,
.md-body h4.md-h, .md-body h5.md-h, .md-body h6.md-h {
    margin: 1em 0 0.4em; font-weight: 600; line-height: 1.3;
}
.md-body h1.md-h { font-size: 1.4rem; }
.md-body h2.md-h { font-size: 1.25rem; }
.md-body h3.md-h { font-size: 1.1rem; }
.md-body h4.md-h { font-size: 1.05rem; margin: 1.5em 0 0.5em; padding-bottom: 0.3em; border-bottom: 1px solid rgba(255,255,255,.12); }
.md-body h4.md-h:first-child { margin-top: 0.6em; }
.md-body h5.md-h { font-size: 0.95rem; margin: 1.1em 0 0.3em; opacity: 0.85; }
.md-body code.md-inline {
    background: rgba(255,255,255,.08);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.9em;
}
.md-body pre.md-code {
    background: rgba(0,0,0,.35);
    border: 1px solid var(--border, rgba(255,255,255,.1));
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    margin: 0.8em 0;
}
.md-body pre.md-code code { background: none; padding: 0; }
.md-body blockquote.md-quote {
    margin: 0.8em 0;
    padding: 0.4em 0 0.4em 1em;
    border-left: 3px solid var(--accent, #6b8cff);
    color: rgba(255,255,255,.75);
}
.md-body hr.md-hr {
    border: none;
    border-top: 1px solid var(--border, rgba(255,255,255,.12));
    margin: 1.2em 0;
}
.md-body a { color: var(--accent, #6b8cff); }
.md-body img.md-img { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }
.md-body del { opacity: 0.7; }
.md-hint {
    font-size: 0.85rem;
    color: rgba(255,255,255,.55);
    margin: 4px 0 8px;
}
textarea.md-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}


.create-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 14px;
}

/* ============================================================
   Responsive: Smartphone & Tablet
   ============================================================ */

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

body {
    overflow-x: hidden;
}

img, video {
    max-width: 100%;
    height: auto;
}

/* Tabellen horizontal scrollbar statt Layout-Bruch */
.table-wrap,
div:has(> table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table {
    min-width: 480px;
}

/* Touch-freundliche Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.sidebar-toggle,
.delete-link,
.edit-link {
    min-height: 40px;
    touch-action: manipulation;
}

.form-field input,
.form-field select,
.form-field textarea {
    max-width: 100%;
    width: 100%;
    min-height: 42px; /* bessere Tippleiste auf iOS */
}

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

/* Tablet */
@media (max-width: 1024px) {
    .content {
        padding: 22px 18px 28px;
    }
    .card {
        padding: 16px 16px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 12px;
    }
}

/* Smartphone & kleines Tablet – Layout-Padding kommt aus der App-Shell-Sektion */
@media (max-width: 900px) {
    .content h1 {
        font-size: 1.25rem;
    }

    .card {
        padding: 14px 12px;
        border-radius: 10px;
        margin-bottom: 14px;
    }

    .card h2 {
        font-size: 15px;
    }

    /* Formulare: eine Spalte */
    .create-form-grid,
    form[style*="grid-template-columns"],
    .permission-grid {
        grid-template-columns: 1fr !important;
    }

    .permission-grid {
        gap: 10px;
    }

    .link-row {
        grid-template-columns: 1fr;
    }

    .password-field {
        flex-direction: column;
        align-items: stretch;
    }

    .password-field .btn-toggle-password {
        width: 100%;
    }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .dashboard-tile {
        padding: 14px 12px;
    }

    .dashboard-tile .num {
        font-size: 22px;
    }

    /* Tabellen kompakter */
    table {
        font-size: 12.5px;
        min-width: 520px;
    }

    th, td {
        padding: 8px 8px;
    }

    /* Supportfälle */
    .case-item {
        padding: 14px 0;
    }

    .case-images {
        flex-wrap: wrap;
    }

    .case-thumb {
        max-width: 100%;
    }

    .post-item {
        padding: 12px;
    }

    /* Buttons stapeln */
    .btn-primary,
    .btn-secondary,
    .btn-danger {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    form .btn-primary,
    form .btn-secondary,
    form .btn-danger {
        display: block;
        margin-top: 8px;
    }

    /* Inline-Aktionen in Tabellen nicht auf 100% Breite */
    td .btn-secondary,
    td .btn-danger,
    td .edit-link,
    td .delete-link,
    td form {
        width: auto;
        display: inline-block;
    }
    td .row-actions {
        display: inline-flex;
        width: auto;
        flex-wrap: wrap;
    }
    td .row-actions form {
        display: inline;
        width: auto;
    }
    td .row-actions .btn-secondary,
    td .row-actions .btn-danger {
        width: auto;
        display: inline-block;
    }

    .login-box {
        margin: 16px;
        padding: 28px 20px;
        max-width: calc(100% - 32px);
    }
}

/* Sehr schmale Smartphones */
@media (max-width: 480px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 16px 10px 20px;
    }

    .content h1 {
        font-size: 1.15rem;
    }

    table {
        min-width: 460px;
        font-size: 12px;
    }
}

/* Verhindert Zoom-Sprünge bei Fokus auf iOS (16px+) */
@media (max-width: 900px) {
    .form-field input[type="text"],
    .form-field input[type="date"],
    .form-field input[type="url"],
    .form-field input[type="password"],
    .form-field input[type="email"],
    .form-field select,
    .form-field textarea,
    .login-box input {
        font-size: 16px !important;
    }
}

/* ===== Persönlicher Bereich (profile.php) ===== */
.profile-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.profile-actions .btn-danger {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(255, 107, 107, 0.12);
    border: 1px solid var(--danger);
    color: var(--danger);
    font-weight: 600;
}
.profile-actions .btn-danger:hover {
    background: rgba(255, 107, 107, 0.22);
}
.profile-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 20px;
    margin-bottom: 18px;
}
.profile-split > .card {
    margin: 0;
    height: 100%;
}
@media (max-width: 860px) {
    .profile-split {
        grid-template-columns: 1fr;
    }
}
.todo-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.todo-item {
    border-bottom: 1px solid var(--border);
    padding: 10px 0;
}
.todo-item:last-child { border-bottom: none; }
.todo-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.todo-toggle-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}
.todo-check {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    line-height: 1.2;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    width: 1.4em;
    height: 1.4em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.todo-check.static {
    color: var(--text-dim);
    font-size: 18px;
}
.todo-body {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    line-height: 1.4;
    font-size: 14px;
}
/* Markdown-Ausgabe in einer Zeile mit dem Kästchen halten */
.todo-body.md-body p,
.todo-body.md-body > * {
    margin: 0;
    display: inline;
}
.todo-body.md-body br {
    display: none;
}
.todo-done .todo-body {
    opacity: 0.55;
    text-decoration: line-through;
}
.todo-actions {
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
    margin-left: auto;
}
.profile-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.profile-inline-form .form-field { flex: 1; min-width: 200px; margin-bottom: 0; }
.profile-note {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.profile-note:last-child { border-bottom: none; }
.profile-member-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.profile-member-links a {
    display: block;
    padding: 10px 12px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
}
.profile-member-links a:hover {
    border-color: var(--accent);
}
.profile-member-links a.profile-member-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(245, 130, 32, 0.35);
}
.profile-member-links .member-role {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 2px;
}
.badge-warn {
    background: rgba(255, 180, 80, 0.15);
    color: #ffb450;
    border: 1px solid rgba(255, 180, 80, 0.35);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 12px;
}


/* Benutzermenü: Button-Eintrag und Abmelden im Dropdown */
.user-dropdown button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s;
}
.user-dropdown button:hover { background: var(--panel-alt); color: var(--accent); }
.user-dropdown .user-dropdown-logout {
    margin-top: 4px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 7px 7px;
    color: var(--text-dim);
}
.user-dropdown .user-dropdown-logout:hover { color: var(--danger); background: rgba(255, 107, 107, 0.08); }

/* Einführungs-Tutorial: geführte Tour mit Hervorhebung des jeweiligen Seitenbereichs */
.tutorial-root[hidden] { display: none; }
.tutorial-blocker { position: fixed; inset: 0; z-index: 900; background: transparent; }   /* blockiert Klicks auf die Seite */
.tutorial-dim { position: fixed; inset: 0; z-index: 901; background: rgba(6, 8, 14, 0.78); pointer-events: none; }
.tutorial-ring {
    position: fixed;
    z-index: 902;
    pointer-events: none;
    border: 2px solid var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 0 4px rgba(245, 130, 32, 0.25), 0 0 24px rgba(245, 130, 32, 0.45);
    display: none;
}
.tutorial-card {
    position: fixed;
    z-index: 903;
    right: 24px;
    bottom: 24px;
    width: min(440px, calc(100vw - 32px));
    background: var(--panel);
    border: 1px solid var(--accent);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
    padding: 20px 22px;
}
.tutorial-card h2 { margin: 4px 0 8px; font-size: 20px; color: var(--text); }
.tutorial-card p { color: var(--text); opacity: .92; font-size: 15px; line-height: 1.6; margin: 0 0 18px; }
.tutorial-progress { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.tutorial-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tutorial-spacer { flex: 1; }
.tutorial-actions [hidden] { display: none; }
body.tutorial-open { overflow: hidden; }
@media (max-width: 900px) {
    .tutorial-card { right: 16px; left: 16px; bottom: 16px; width: auto; }
}


/* Pflicht-Einstieg (Passwort ändern, Regelwerk akzeptieren): keine Navigation, Inhalt in voller Breite */
body.onboarding .content { margin-left: 0; width: 100%; max-width: 980px; margin-right: auto; margin-left: auto; }
body.onboarding .global-server-status,
body.onboarding .sidebar-toggle,
body.onboarding .sidebar-overlay { display: none; }

/* Gruppen-Mehrfachauswahl (Mitglieder anlegen/bearbeiten) */
.gruppen-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gruppen-chip { position: relative; margin: 0; font-weight: 500; cursor: pointer; }
.gruppen-chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.gruppen-chip span {
  display: inline-block;
  padding: 7px 14px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gruppen-chip:hover span { border-color: var(--accent); }
.gruppen-chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.gruppen-chip input:checked + span::before { content: "✓ "; }
.gruppen-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Gruppen: Umbenennen aufklappbar */
.gruppe-umbenennen { display: inline-block; vertical-align: top; }
.gruppe-umbenennen > summary { cursor: pointer; list-style: none; display: inline; }
.gruppe-umbenennen > summary::-webkit-details-marker { display: none; }

/* Heartwood Roleplay identity; shared by all portal modules. */
:root { color-scheme: dark; }
.header-logo { width: auto; height: 58px; object-fit: contain; }
.login-box { border-top: 3px solid var(--accent); }
.btn-primary, button[type="submit"] { color: #151515; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #f58220; color: #111214; }
