/* ============================================
   Team Portal — Dark Industrial UI
   ============================================ */

:root {
    --bg-base:    #0A0A0F;
    --bg-surface: #111118;
    --bg-card:    #16161F;
    --bg-hover:   #1E1E2A;
    --border:     #2A2A3A;
    --border-accent: #2a3a6a;
    --text-primary:  #E8E8F0;
    --text-secondary: #8888AA;
    --text-muted:    #555570;
    --accent:     #2e4edb;
    --accent-glow: rgba(46,78,219,0.3);
    --accent-hover: #3d5fe5;
    --danger:     #EF4444;
    --warning:    #F59E0B;
    --success:    #22C55E;
    --info:       #3B82F6;
    --radius:     8px;
    --radius-lg:  12px;
    --font-mono:  'Space Mono', monospace;
    --font-sans:  'DM Sans', sans-serif;
    --sidebar-w:  220px;
    --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---- App Shell ---- */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: -1px; bottom: 0; width: 1px;
    background: linear-gradient(180deg, transparent, var(--accent) 40%, var(--accent) 70%, transparent);
    opacity: 0.35;
}

.sidebar-header {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo-mark {
    font-size: 24px;
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent));
    line-height: 1;
}

.logo-text {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid transparent;
}

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

.nav-item.active {
    background: rgba(46,78,219,0.12);
    color: var(--accent);
    border-color: rgba(46,78,219,0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 8px var(--accent);
}

.nav-icon { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-label { flex: 1; }

/* ---- Sidebar Footer ---- */
.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-chip-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    padding: 6px 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
    border: 1px solid transparent;
}

.user-chip-link:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.user-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-avatar-img {
    width: 34px; height: 34px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.logout-btn {
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition);
    padding: 6px;
    flex-shrink: 0;
    border-radius: 6px;
}
.logout-btn:hover { color: var(--danger); background: rgba(239,68,68,0.08); }

/* ---- Main Content ---- */
.main-content { flex: 1; overflow-y: auto; background: var(--bg-base); }
.content-inner { max-width: 1200px; padding: 32px 40px; margin: 0 auto; }

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-title .icon { color: var(--accent); font-size: 18px; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 3px; }

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-accent); }

.card-title {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 28px; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
    opacity: 0.7;
}

.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 7px; text-transform: uppercase; letter-spacing: 0.06em; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }

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

thead tr { background: var(--bg-hover); border-bottom: 1px solid var(--border); }

thead th {
    padding: 11px 14px;
    text-align: left;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(46,78,219,0.04); }
tbody td { padding: 11px 14px; color: var(--text-primary); vertical-align: middle; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
    font-family: var(--font-sans);
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 0 18px var(--accent-glow); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-accent); }

.btn-danger { background: transparent; color: var(--danger); border-color: rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.5); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #16a34a; }

.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; justify-content: center; border-radius: 6px; }

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: var(--font-mono);
}

.form-input, .form-textarea {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 13px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 80px; }

/* ---- Custom Select ---- */
.form-select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 9px 36px 9px 13px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888AA' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option {
    background: #1a1a28;
    color: var(--text-primary);
    padding: 8px;
}

/* Inline compact selects in filter bars */
.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 30px 7px 11px;
    font-size: 13px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238888AA' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--accent); outline: none; }
.filter-select option { background: #1a1a28; color: var(--text-primary); }

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.priority-low, .aw-niedrig    { background: rgba(34,197,94,0.12); color: #22C55E; }
.priority-medium, .aw-mittel  { background: rgba(59,130,246,0.12); color: #60A5FA; }
.priority-high, .aw-hoch      { background: rgba(245,158,11,0.12); color: #F59E0B; }
.priority-critical, .aw-kritisch { background: rgba(239,68,68,0.12); color: #EF4444; }

.status-open       { background: rgba(107,114,128,0.12); color: #9CA3AF; }
.status-in_progress{ background: rgba(46,78,219,0.12); color: #7B95FF; }
.status-done       { background: rgba(34,197,94,0.12); color: #22C55E; }
.status-aktiv      { background: rgba(34,197,94,0.12); color: #22C55E; }
.status-archiviert { background: rgba(107,114,128,0.12); color: #9CA3AF; }
.status-ausstehend { background: rgba(245,158,11,0.12); color: #F59E0B; }

/* ---- Search Bar ---- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 7px 13px;
    transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.search-bar input { background: none; border: none; outline: none; color: var(--text-primary); font-size: 13px; flex: 1; font-family: var(--font-sans); }
.search-bar input::placeholder { color: var(--text-muted); }
.search-icon { color: var(--text-muted); font-size: 14px; }

/* ---- Modal ---- */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 26px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
    box-shadow: 0 30px 70px rgba(0,0,0,0.6);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.03em;
}

.modal-close {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    transition: all var(--transition);
    line-height: 1;
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ---- Alerts ---- */
.alert {
    padding: 11px 15px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
    border-left: 3px solid;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.alert-error   { background: rgba(239,68,68,0.08);  border-color: var(--danger);  color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,0.08);  border-color: var(--success); color: #86EFAC; }
.alert-info    { background: rgba(46,78,219,0.08);  border-color: var(--accent);  color: #93C5FD; }
.alert-warning { background: rgba(245,158,11,0.08); border-color: var(--warning); color: #FCD34D; }

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    background: var(--bg-base);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(46,78,219,0.07) 0%, transparent 65%);
    top: -150px; left: -150px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(46,78,219,0.05) 0%, transparent 65%);
    bottom: -80px; right: -80px;
    pointer-events: none;
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px 38px;
    width: 100%;
    max-width: 390px;
    position: relative;
    z-index: 1;
    box-shadow: 0 40px 80px rgba(0,0,0,0.5);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .mark { font-size: 38px; color: var(--accent); filter: drop-shadow(0 0 14px var(--accent)); display: block; margin-bottom: 10px; }
.login-logo h1 { font-family: var(--font-mono); font-size: 17px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.login-logo p { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- Toolbar ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 10px;
    flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 3px; background: var(--bg-surface); padding: 3px; border-radius: var(--radius); margin-bottom: 20px; }
.tab-btn {
    flex: 1; padding: 7px 10px; border: none; border-radius: 5px;
    font-size: 12px; font-weight: 500; cursor: pointer;
    transition: all var(--transition); background: transparent;
    color: var(--text-secondary); font-family: var(--font-sans);
}
.tab-btn.active { background: var(--accent); color: #fff; }

/* ---- TOTP Input ---- */
.totp-input { font-family: var(--font-mono); font-size: 26px; letter-spacing: 0.4em; text-align: center; }

/* ---- Tag ---- */
.tag {
    display: inline-flex; align-items: center;
    padding: 2px 7px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px; color: var(--text-secondary); gap: 4px;
}

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.3; }
.empty-state p { font-size: 13px; }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* ---- Root Badge ---- */
.root-badge {
    background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(249,115,22,0.15));
    border: 1px solid rgba(239,68,68,0.25);
    color: #FCA5A5;
    padding: 3px 9px; border-radius: 4px;
    font-family: var(--font-mono); font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
}

/* ---- Dropdown Menu ---- */
.dropdown { position: relative; display: inline-block; }

/* table-wrap clips overflow - lift dropdowns above it */
.table-wrap { overflow: visible !important; }
.table-wrap table { overflow: visible; }

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    min-width: 170px;
    z-index: 9999;
    box-shadow: 0 16px 40px rgba(0,0,0,0.65), 0 0 0 1px rgba(255,255,255,0.04);
    overflow: hidden;
    animation: modalIn 0.15s ease;
}

/* If near bottom of screen, open upward */
.dropdown-menu.open { display: block; }
.dropdown-menu.open-up { top: auto; bottom: calc(100% + 6px); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 15px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-family: var(--font-sans);
    white-space: nowrap;
}

.dropdown-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: rgba(239,68,68,0.1); }
.dropdown-divider { height: 1px; background: var(--border); margin: 3px 0; }

/* ---- Media Preview ---- */
.media-thumb {
    width: 50px; height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform var(--transition);
}
.media-thumb:hover { transform: scale(1.05); }

/* ---- File Upload Area ---- */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(46,78,219,0.05);
    color: var(--text-secondary);
}
.upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- Lightbox ---- */
#lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}
#lightbox.open { display: flex; }
#lightbox img, #lightbox video {
    max-width: 90vw; max-height: 88vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 60px rgba(0,0,0,0.8);
}
#lightbox-close {
    position: absolute; top: 20px; right: 24px;
    color: #fff; font-size: 28px; cursor: pointer;
    background: rgba(0,0,0,0.4); border: none;
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition);
}
#lightbox-close:hover { background: rgba(255,255,255,0.1); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a80; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    /* FAQ: stack sidebar on top */
    .faq-layout {
        flex-direction: column;
        height: auto;
        margin: -20px -20px;
    }
    .faq-sidebar {
        width: 100%;
        height: auto;
        max-height: 220px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
        overflow-y: hidden;
        padding: 8px 0;
        display: flex;
        flex-wrap: wrap;
    }
    .faq-cat-header { min-width: 0; }
    .faq-article-link { white-space: normal; }
    .faq-main { padding: 20px; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 56px; }
    .logo-text, .nav-label, .user-info { display: none; }
    .sidebar-header { justify-content: center; padding: 16px 8px; }
    .content-inner { padding: 20px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { width: 100%; }
    .search-bar { max-width: 100% !important; }
    .table-wrap { font-size: 12px; }
    thead th { padding: 8px 10px; }
    tbody td { padding: 8px 10px; }
    .modal { padding: 18px; }
    .grid-2 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    /* FAQ mobile */
    .faq-layout {
        flex-direction: column;
        height: auto;
        margin: -20px -16px;
    }
    .faq-sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: auto;
    }
    .faq-main { padding: 16px; }
    .faq-gallery-img { width: 80px; height: 60px; }
    .editor-toolbar { gap: 2px; }
    .editor-toolbar button { padding: 3px 6px; font-size: 12px; }
}

/* ---- Nav Section Labels ---- */
.nav-section-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 14px 11px 5px;
    pointer-events: none;
    user-select: none;
}

/* ---- FAQ / Article ---- */
.faq-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 8px 0 24px;
    height: 100%;
}

.faq-layout {
    display: flex;
    gap: 0;
    /* Escape the content-inner padding */
    margin: -32px -40px;
    height: calc(100vh - 0px);
    min-height: 500px;
}

.faq-main {
    flex: 1;
    padding: 28px 36px;
    overflow-y: auto;
    min-width: 0;
    height: 100%;
}

.faq-cat-header {
    padding: 8px 16px 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.faq-cat-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    border-left: 2px solid transparent;
}

.faq-cat-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.faq-cat-link.active { color: var(--accent); border-left-color: var(--accent); background: rgba(46,78,219,0.06); }

.faq-article-link {
    display: block;
    padding: 6px 16px 6px 36px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition);
    border-left: 2px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.faq-article-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.faq-article-link.active { color: var(--accent); border-left-color: var(--accent); background: rgba(46,78,219,0.06); }

/* FAQ article content */
.article-body { line-height: 1.8; color: var(--text-primary); }
.article-body h1, .article-body h2, .article-body h3 { font-family: var(--font-mono); margin: 1.4em 0 0.5em; color: var(--text-primary); }
.article-body h1 { font-size: 20px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.article-body h2 { font-size: 16px; color: var(--accent); }
.article-body h3 { font-size: 14px; }
.article-body p { margin-bottom: 0.9em; }
.article-body ul, .article-body ol { margin: 0.5em 0 0.9em 1.5em; }
.article-body li { margin-bottom: 0.3em; }
.article-body strong { color: var(--text-primary); font-weight: 600; }
.article-body em { color: var(--text-secondary); font-style: italic; }
.article-body code { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.article-body pre { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; overflow-x: auto; margin-bottom: 0.9em; }
.article-body pre code { background: none; border: none; padding: 0; color: var(--text-primary); }
.article-body blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-secondary); margin: 0.9em 0; font-style: italic; }
.article-body img { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin: 8px 0; cursor: pointer; transition: opacity var(--transition); }
.article-body img:hover { opacity: 0.9; }
.article-body a { color: var(--accent); text-decoration: underline; }
.article-body hr { border: none; border-top: 1px solid var(--border); margin: 1.4em 0; }
.article-body table { width: 100%; border-collapse: collapse; margin-bottom: 0.9em; }
.article-body table th, .article-body table td { padding: 8px 12px; border: 1px solid var(--border); text-align: left; }
.article-body table th { background: var(--bg-hover); font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; }

/* FAQ image gallery */
.faq-gallery { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.faq-gallery-img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); cursor: pointer; transition: transform var(--transition), border-color var(--transition); }
.faq-gallery-img:hover { transform: scale(1.04); border-color: var(--accent); }

/* ---- Simple richtext editor toolbar ---- */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}
.editor-toolbar button {
    padding: 4px 9px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all var(--transition);
    line-height: 1.4;
}
.editor-toolbar button:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.editor-toolbar .sep { width: 1px; background: var(--border); margin: 2px 4px; }
.editor-content {
    width: 100%;
    min-height: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.7;
    outline: none;
    resize: vertical;
    overflow: auto;
}
.editor-content:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.editor-content:empty::before { content: attr(data-placeholder); color: var(--text-muted); pointer-events: none; }

/* ---- Application status badges ---- */
.app-ausstehend  { background: rgba(245,158,11,0.12); color: #F59E0B; }
.app-angenommen  { background: rgba(34,197,94,0.12);  color: #22C55E; }
.app-abgelehnt   { background: rgba(239,68,68,0.12);  color: #EF4444; }
.app-warteliste  { background: rgba(59,130,246,0.12); color: #60A5FA; }

/* ---- Application card ---- */
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 12px;
    transition: border-color var(--transition);
}
.app-card:hover { border-color: var(--border-accent); }
.app-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.app-card-name { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.app-card-meta { font-size: 12px; color: var(--text-secondary); margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.app-card-meta span { display: flex; align-items: center; gap: 5px; }
.app-card-body { font-size: 13px; color: var(--text-secondary); line-height: 1.65; max-height: 80px; overflow: hidden; position: relative; }
.app-card-body::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 30px; background: linear-gradient(transparent, var(--bg-card)); }
