/* ============================================================================
   Projektmanagement — Dashboard CSS
   Modern, Mobile-First Design
   ============================================================================ */

:root {
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --success: #10B981;
    --success-dark: #059669;
    --warning: #F59E0B;
    --warning-dark: #D97706;
    --danger: #EF4444;
    --danger-dark: #DC2626;
    --info: #3B82F6;

    --bg: #0B1121;
    --bg-card: #151D2E;
    --bg-card-hover: #1A2538;
    --bg-input: #1E293B;
    --bg-hover: #1E293B;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-focus: var(--primary);

    --text: #F1F5F9;
    --text-muted: #94A3B8;
    --text-dim: #64748B;

    --sidebar-width: 260px;
    --topbar-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    --glass-bg: rgba(21, 29, 46, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

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

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform var(--transition-slow);
}
.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-light);
    letter-spacing: -0.02em;
}
.sidebar-version {
    font-size: 0.7rem;
    color: var(--text-dim);
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition);
    margin-bottom: 4px;
    font-weight: 500;
    font-size: 0.9rem;
    min-height: 44px;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.3);
}
.nav-icon { font-size: 1.15rem; width: 24px; text-align: center; flex-shrink: 0; }
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-user { color: var(--text-muted); font-size: 0.85rem; font-weight: 500; }
.sidebar-close {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-hover);
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    font-size: 1.2rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 199;
    opacity: 0;
    transition: opacity var(--transition-slow);
}
.sidebar-backdrop.visible { opacity: 1; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}
.topbar {
    height: var(--topbar-height);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg-hover); }
.sidebar-toggle:active { transform: scale(0.95); }
.topbar-title {
    flex: 1;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.topbar-actions { display: flex; gap: 8px; flex-shrink: 0; }
.content-area { padding: 24px; }

/* ── Mobile Sidebar ── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar-close { display: flex; }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; }

    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
}

@media (max-width: 640px) {
    .sidebar { width: 85vw; max-width: 300px; }
    .content-area { padding: 16px; }
    .topbar { padding: 0 16px; }
    .topbar-title { font-size: 1rem; }
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
    color: #fff;
    transform: translateY(-1px);
}
.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.btn-success:hover { box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35); color: #fff; }
.btn-warning { background: linear-gradient(135deg, var(--warning), var(--warning-dark)); color: #000; }
.btn-warning:hover { box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35); }
.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}
.btn-danger:hover { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35); color: #fff; }
.btn-outline {
    background: transparent;
    border-color: var(--border-light);
    color: var(--text-muted);
}
.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}
.btn-sm { padding: 6px 12px; font-size: 0.8rem; min-height: 34px; }
.btn-xs { padding: 4px 8px; font-size: 0.75rem; min-height: 28px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.inline-form { display: inline; }

@media (max-width: 640px) {
    .btn { padding: 10px 14px; font-size: 0.82rem; min-height: 44px; }
    .btn-sm { padding: 8px 12px; min-height: 40px; }
    .btn-xs { padding: 6px 10px; min-height: 34px; }
    .btn-group { gap: 6px; }
}

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: var(--border-light); }
.card--danger { border-color: rgba(239, 68, 68, 0.3); }
.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}
.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 640px) {
    .card { padding: 16px; border-radius: var(--radius-sm); }
}

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    opacity: 0;
    transition: opacity var(--transition);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card--success::before { background: linear-gradient(90deg, var(--success), var(--success-dark)); opacity: 1; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; font-weight: 500; }

@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 1.5rem; }
    .stat-label { font-size: 0.75rem; }
}

/* ── Project Grid ── */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}
.project-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}
.project-card-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 10px; gap: 8px; }
.project-name a { color: var(--text); font-weight: 600; font-size: 1rem; }
.project-name a:hover { color: var(--primary-light); }
.project-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 14px; line-height: 1.5; }
.project-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.project-port, .project-containers { font-size: 0.8rem; color: var(--text-dim); }
.project-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

@media (max-width: 640px) {
    .project-grid { grid-template-columns: 1fr; gap: 12px; }
    .project-card { padding: 16px; }
    .project-card-actions { width: 100%; }
    .project-card-actions .btn { flex: 1; justify-content: center; min-height: 44px; }
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.badge-success { background: rgba(16, 185, 129, 0.12); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-default { background: var(--bg-hover); color: var(--text-muted); }
.badge-outline { background: transparent; border: 1px solid var(--border-light); color: var(--text-muted); }

/* ── Tables ── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-hover); }
.table-compact td, .table-compact th { padding: 8px 12px; }

/* Mobile Card Layout for Tables */
@media (max-width: 768px) {
    .table-mobile-cards thead { display: none; }
    .table-mobile-cards tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 14px;
        margin-bottom: 10px;
    }
    .table-mobile-cards tbody tr:hover { background: var(--bg-card-hover); }
    .table-mobile-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid var(--border);
    }
    .table-mobile-cards td:last-child { border-bottom: none; }
    .table-mobile-cards td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-right: 12px;
        flex-shrink: 0;
    }
}

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    min-height: 44px;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group small { color: var(--text-dim); font-size: 0.78rem; margin-top: 4px; display: block; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; min-height: auto; accent-color: var(--primary); }

@media (max-width: 640px) {
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; justify-content: center; }
}

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: alertSlideIn 0.3s ease-out;
    gap: 12px;
}
@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.alert-success { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.alert-error { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
    flex-shrink: 0;
}
.alert-close:hover { background: rgba(255, 255, 255, 0.1); }

/* ── Section Header ── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.section-header h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }

@media (max-width: 640px) {
    .section-header { flex-direction: column; align-items: stretch; }
    .section-header .btn-group { display: flex; }
    .section-header .btn-group .btn { flex: 1; justify-content: center; }
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .btn { margin-top: 16px; }

/* ── Project Header ── */
.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.project-header-info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.project-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.project-description { color: var(--text-muted); margin-bottom: 24px; }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
    .project-header { flex-direction: column; align-items: stretch; }
    .project-header-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .project-header-actions .btn { justify-content: center; }
    .action-buttons { display: grid; grid-template-columns: 1fr 1fr; }
    .action-buttons .btn { justify-content: center; }
}

/* ── Log Viewer ── */
.log-viewer {
    background: #0D1117;
    color: #C9D1D9;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    max-height: 400px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid var(--border);
}

/* ── Form Grid (nebeneinander) ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 1.5rem; }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
}

/* ── Gruppen-Filter-Tabs ── */
.group-filter-tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.25rem; }
.group-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.82rem;
    background: var(--bg-card);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all var(--transition);
    min-height: 36px;
    font-weight: 500;
}
.group-tab:hover { border-color: var(--gc, var(--accent)); color: var(--text); }
.group-tab.active { background: var(--gc, var(--accent)); color: #fff; border-color: transparent; }
.group-tab-dot { width: 8px; height: 8px; border-radius: 50%; }
.group-tab-count { font-size: 0.72rem; opacity: .7; }

/* Gruppen-Badges */
.group-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.12);
    color: var(--gc, #4f46e5);
    border: 1px solid rgba(0, 0, 0, 0.15);
    text-decoration: none;
    white-space: nowrap;
}
.group-badge:hover { opacity: 0.85; }
.group-dot-xs { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

/* ── Toggle Switch ── */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-light);
    border-radius: 22px;
    transition: var(--transition);
}
.toggle-slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); }
.toggle-switch input:disabled + .toggle-slider { opacity: .4; cursor: not-allowed; }

/* ── Git Status ── */
.git-status-box { padding: 10px 0; min-height: 28px; }
.git-status-box code { background: var(--bg-hover); padding: 2px 6px; border-radius: var(--radius-xs); font-size: 0.75rem; }

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 600px;
    width: calc(100% - 32px);
    max-height: 85vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease-out;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-content--wide { max-width: 900px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-close {
    background: var(--bg-hover);
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--border-light); color: var(--text); }

@media (max-width: 640px) {
    .modal-content { padding: 20px; width: calc(100% - 24px); max-height: 90vh; }
}

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }

@media (max-width: 768px) {
    .settings-grid { grid-template-columns: 1fr; }
}

/* ── Login Page ── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    padding: 20px;
}
.login-container { width: 100%; max-width: 420px; }
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow-lg);
}
.login-title {
    text-align: center;
    font-size: 1.5rem;
    color: var(--primary-light);
    margin-bottom: 4px;
    font-weight: 700;
}
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 28px; }
.login-hint { text-align: center; color: var(--text-dim); font-size: 0.8rem; margin-top: 16px; }

@media (max-width: 640px) {
    .login-card { padding: 24px; }
}

/* ── File Manager ── */
.filemanager { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-height) - 48px); }
.fm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 8px;
}
.fm-breadcrumb {
    display: flex;
    gap: 4px;
    align-items: center;
    color: var(--text-muted);
    flex-wrap: wrap;
    font-size: 0.85rem;
    min-height: 36px;
}
.fm-breadcrumb a { color: var(--primary-light); }
.fm-breadcrumb span { color: var(--text-dim); }
.fm-toolbar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.fm-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.fm-sidebar {
    width: 220px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg-card);
    flex-shrink: 0;
}
.fm-tree { padding: 8px; }
.fm-tree-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    font-size: 0.85rem;
    min-height: 36px;
    transition: all var(--transition);
}
.fm-tree-item:hover { background: var(--bg-hover); color: var(--text); }
.fm-tree-item.active { background: var(--primary); color: #fff; }
.fm-tree-item.drop-target { background: rgba(99, 102, 241, 0.25); outline: 2px dashed var(--primary); outline-offset: -2px; }
.fm-tree-toggle { width: 16px; text-align: center; font-size: 0.7rem; }
.fm-tree-children { padding-left: 16px; }

.fm-main { flex: 1; overflow-y: auto; background: var(--bg); }
.fm-filelist { min-height: 100%; padding: 4px; }
.fm-filelist.drag-over { background: rgba(99, 102, 241, 0.08); }

.fm-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
    min-height: 44px;
}
.fm-file-item:hover { background: var(--bg-hover); }
.fm-file-item.selected { background: rgba(99, 102, 241, 0.15); }
.fm-file-item[draggable="true"] { cursor: grab; }
.fm-file-item.dragging { opacity: 0.4; }
.fm-file-item.drop-target { background: rgba(99, 102, 241, 0.25); outline: 2px dashed var(--primary); outline-offset: -2px; }
.fm-file-icon { font-size: 1.2rem; width: 24px; text-align: center; flex-shrink: 0; }
.fm-file-name { flex: 1; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-file-size { color: var(--text-dim); font-size: 0.8rem; width: 80px; text-align: right; flex-shrink: 0; }
.fm-file-date { color: var(--text-dim); font-size: 0.8rem; width: 140px; flex-shrink: 0; }

/* Editor */
.fm-editor {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    width: 60%;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    z-index: 90;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
}
.fm-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    gap: 8px;
}
.fm-editor-filename { font-weight: 600; color: var(--text-muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-editor-body { flex: 1; overflow: hidden; }
.fm-editor-body .CodeMirror { height: 100%; font-size: 13px; }

@media (max-width: 1024px) {
    .fm-sidebar { display: none; }
    .fm-editor { width: 100%; left: 0; }
}

@media (max-width: 640px) {
    .filemanager { height: calc(100vh - var(--topbar-height) - 32px); }
    .fm-toolbar { padding: 8px 0; }
    .fm-toolbar-actions { width: 100%; justify-content: flex-end; }
    .fm-file-size { display: none; }
    .fm-file-date { display: none; }
    .fm-file-item { padding: 10px 8px; }
}

/* Context Menu */
.fm-context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 6px 0;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
    animation: contextIn 0.15s ease-out;
}
@keyframes contextIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.fm-context-item {
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text);
    transition: background var(--transition);
    min-height: 40px;
    display: flex;
    align-items: center;
}
.fm-context-item:hover { background: var(--bg-hover); }
.fm-context-item--danger { color: var(--danger); }
.fm-context-separator { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Tickets ── */
.ticket-list { display: flex; flex-direction: column; gap: 6px; }
.ticket-item {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: all var(--transition);
}
.ticket-item:hover { border-color: var(--border-light); background: var(--bg-card); }
.ticket-item-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ticket-item-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ticket-item-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ticket-type-icon { font-size: 1rem; flex-shrink: 0; }
.ticket-title {
    font-size: 0.9rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ticket-done { text-decoration: line-through; color: var(--text-dim); }
.ticket-desc { color: var(--text-muted); font-size: 0.82rem; margin-top: 8px; padding-left: 30px; line-height: 1.5; }
.ticket-detail { padding: 10px 0 0 30px; }
.ticket-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.ticket-filter { min-height: 36px; }
.ticket-filter.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 640px) {
    .ticket-item { padding: 12px; }
    .ticket-item-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .ticket-item-right { width: 100%; justify-content: flex-start; }
    .ticket-desc { padding-left: 0; }
    .ticket-detail { padding-left: 0; }
}

/* ── Notizen ── */
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.note-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    border-left: 4px solid var(--border-light);
    transition: all var(--transition);
}
.note-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: var(--shadow); }
.note-color-yellow { border-left-color: #F59E0B; }
.note-color-green { border-left-color: #10B981; }
.note-color-blue { border-left-color: #3B82F6; }
.note-color-purple { border-left-color: #8B5CF6; }
.note-color-red { border-left-color: #EF4444; }
.note-title { font-weight: 600; font-size: 0.92rem; margin-bottom: 8px; }
.note-content { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; word-break: break-word; }
.note-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.note-actions { display: flex; gap: 4px; }

@media (max-width: 640px) {
    .notes-grid { grid-template-columns: 1fr; gap: 10px; }
}

/* ── System Stats ── */
.stats-grid--3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid--4 { grid-template-columns: repeat(4, 1fr); }
.system-stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}
.system-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.system-stat-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.system-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.system-stat-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.system-stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}
.system-stat-detail {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1024px) {
    .stats-grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .stats-grid--3 { grid-template-columns: 1fr; }
    .stats-grid--4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .stats-grid--4 { grid-template-columns: 1fr; }
}

/* ── Groups Page ── */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.group-card-header { display: flex; align-items: center; gap: 0.6rem; }
.group-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.color-picker { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.color-option input[type=radio] { display: none; }
.color-dot {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color var(--transition), transform var(--transition);
}
.color-option input[type=radio]:checked + .color-dot { border-color: white; transform: scale(1.1); }

@media (max-width: 640px) {
    .groups-grid { grid-template-columns: 1fr; }
    .color-dot { width: 32px; height: 32px; }
}

/* ── Mobile Flex Helpers ── */
.mobile-flex-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.mobile-stack-wrap {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .mobile-flex-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    .mobile-flex-wrap > input,
    .mobile-flex-wrap > select,
    .mobile-flex-wrap > .btn { width: 100%; }
    .mobile-flex-wrap > input { min-width: 0 !important; }

    .mobile-stack-wrap {
        flex-direction: column;
        align-items: stretch;
    }
    .mobile-stack-wrap > .form-group { min-width: 0 !important; flex: none !important; }
    .mobile-stack-wrap > .btn { width: 100%; justify-content: center; }
}

/* ── Utility ── */
.text-muted { color: var(--text-muted); }
code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    font-size: 0.85em;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', monospace;
}

/* ── Touch Helpers ── */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets on touch devices */
    .nav-item { min-height: 48px; }
    .fm-file-item { min-height: 48px; }
    .fm-tree-item { min-height: 42px; }
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
    .ticket-filter { min-height: 40px; }
    .group-tab { min-height: 40px; }
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.card { animation: slideUp 0.3s ease-out; }
.stat-card { animation: slideUp 0.3s ease-out backwards; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.project-card { animation: slideUp 0.3s ease-out backwards; }

/* ── Status / Usage Limits ── */
.card-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.usage-status-line {
    margin-bottom: 1rem;
    font-size: 0.8rem;
}
.usage-updated-info {
    color: var(--text-muted);
}
.usage-limits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.usage-limit-card {
    background: var(--bg-hover);
    border-radius: var(--radius);
    padding: 1rem;
}
.usage-limit-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.usage-limit-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.usage-limit-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.usage-limit-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-card);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.usage-limit-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}
.usage-limit-detail {
    font-size: 0.75rem;
    color: var(--text-dim);
}
@media (max-width: 768px) {
    .usage-limits-grid { grid-template-columns: 1fr; }
}

/* ── Claude Chat ── */
/* Body-Scroll verhindern wenn Claude Chat aktiv */
body:has(.claude-chat) {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}
body:has(.claude-chat) .main-content {
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}
.claude-chat {
    display: flex;
    height: calc(100vh - var(--topbar-height));
    height: calc(100dvh - var(--topbar-height));
    overflow: hidden;
    position: relative;
    max-width: 100%;
    width: 100%;
}
.content-area:has(.claude-chat) {
    padding: 0;
    max-width: none;
    overflow: hidden;
    height: 100%;
}

/* Session Sidebar */
.claude-sessions {
    width: 280px;
    min-width: 280px;
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.claude-sessions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.claude-sessions-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}
.claude-session-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.claude-session-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}
.claude-session-item:hover {
    background: var(--bg-card);
}
.claude-session-item.active {
    background: var(--bg-card);
    border-left-color: var(--primary);
}
.claude-session-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.claude-session-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}
.claude-session-time {
    font-size: 0.65rem;
    color: var(--text-dim, var(--text-muted));
    margin-top: 2px;
}
.claude-session-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 24px 12px;
    font-size: 0.875rem;
}
.claude-pin { font-size: 0.7rem; }
.claude-badge { font-size: 0.6rem; padding: 1px 5px; border-radius: 4px; font-weight: 600; vertical-align: middle; }
.claude-badge--terminal { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }
.claude-msg-meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 6px; opacity: 0.7; }

/* Tool-Anzeige */
.claude-tools { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.claude-tool {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 6px;
    font-size: 0.78rem;
    flex-wrap: wrap;
    overflow: hidden;
}
.claude-tool-icon { font-size: 0.9rem; flex-shrink: 0; }
.claude-tool-name { font-weight: 600; color: var(--primary-light); white-space: nowrap; }
.claude-tool-file { color: var(--text-muted); word-break: break-all; }
.claude-tool-cmd {
    color: var(--text-muted);
    background: rgba(0,0,0,0.2);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.75rem;
    word-break: break-all;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.claude-tool-desc { color: var(--text-muted); font-style: italic; }
.claude-tool-result {
    font-size: 0.72rem;
    color: var(--success);
    margin-left: auto;
    white-space: nowrap;
}

/* Filter Panel */
.claude-filter-panel {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}
.claude-filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.claude-filter-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.claude-filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.claude-filter-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.72rem;
}

/* Write/Edit Content (collapsible) */
.claude-tool-content {
    width: 100%;
    margin-top: 4px;
}
.claude-tool-content summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--primary-light);
    padding: 2px 0;
    user-select: none;
}
.claude-tool-content summary:hover {
    text-decoration: underline;
}
.claude-tool-content-body {
    margin-top: 6px;
    padding: 10px;
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    max-height: 400px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.claude-tool-content-body p { margin: 0 0 6px 0; }
.claude-tool-content-body p:last-child { margin: 0; }
.claude-diff-old pre,
.claude-diff-new pre {
    margin: 0;
    padding: 6px 8px;
    font-size: 0.78rem;
    white-space: pre-wrap;
    word-break: break-word;
    border-radius: 4px;
}
.claude-diff-old {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger);
    margin-bottom: 4px;
}
.claude-diff-new {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid var(--success);
}

/* Status Events (Plan Mode, etc.) */
.claude-events { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.claude-event {
    font-size: 0.8rem;
    color: var(--primary-light);
    padding: 4px 0;
    font-weight: 500;
}
.claude-event-icon { margin-right: 4px; }

/* AskUserQuestion */
.claude-question { margin-top: 10px; }
.claude-question-text {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.88rem;
    color: var(--text);
}
.claude-question-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.claude-question-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    color: var(--text);
    width: 100%;
}
.claude-question-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
}
.claude-question-btn:active {
    transform: scale(0.98);
}
.claude-question-btn-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-light);
}
.claude-question-btn-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.claude-question-btn--secondary {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
}
.claude-question-btn--secondary .claude-question-btn-label {
    color: var(--text-muted);
    font-weight: 500;
}
.claude-question-btn--secondary:hover {
    background: rgba(99, 102, 241, 0.1);
}
.claude-question-btn:disabled,
.claude-question-send:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.claude-question-custom {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.claude-question-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
}
.claude-question-input:focus {
    border-color: var(--primary);
}
.claude-question-input:disabled {
    opacity: 0.4;
}
.claude-question-send {
    padding: 8px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.claude-question-send:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* Session Backdrop (Mobile) */
.claude-sessions-backdrop {
    display: none;
}

/* Chat Main Area */
.claude-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    background: var(--bg);
}

/* Chat Header */
.claude-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    min-height: 48px;
    flex-wrap: wrap;
}
.claude-nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    flex-shrink: 0;
}
.claude-sessions-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
}
.claude-chat-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 60px;
}
.claude-header-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.claude-chat-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.claude-project-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    max-width: 140px;
}
.claude-action-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.claude-action-btn:hover {
    background: var(--bg);
    color: var(--text);
}
.claude-action-btn--danger:hover {
    color: var(--danger);
    border-color: var(--danger);
}

/* Messages */
.claude-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.claude-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.claude-msg--user {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.claude-msg--assistant {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

/* Markdown Content */
.claude-msg--assistant p { margin: 0 0 8px 0; }
.claude-msg--assistant p:last-child { margin-bottom: 0; }
.claude-msg--assistant pre {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    font-size: 0.82rem;
    margin: 8px 0;
    position: relative;
}
.claude-msg--assistant pre code {
    display: block;
    padding: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: #0d1117 !important;
}
.claude-msg--assistant pre code.hljs {
    background: #0d1117 !important;
    padding: 12px;
}
.claude-msg--assistant code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85em;
}
.claude-msg--assistant :not(pre) > code {
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    word-break: break-word;
}
.claude-msg--assistant ul,
.claude-msg--assistant ol {
    margin: 4px 0;
    padding-left: 20px;
}
.claude-msg--assistant h1,
.claude-msg--assistant h2,
.claude-msg--assistant h3 {
    margin: 12px 0 4px 0;
    font-size: 1em;
    font-weight: 700;
}
.claude-msg--assistant h1 { font-size: 1.1em; }
.claude-msg--assistant table {
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 0.85rem;
    width: 100%;
    overflow-x: auto;
    display: block;
}
.claude-msg--assistant th,
.claude-msg--assistant td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
.claude-msg--assistant th {
    background: rgba(99, 102, 241, 0.1);
}

/* Typing Indicator */
.claude-typing span {
    animation: claude-blink 1.4s infinite both;
    font-size: 1.5rem;
    color: var(--text-muted);
}
.claude-typing span:nth-child(2) { animation-delay: 0.2s; }
.claude-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes claude-blink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* Error */
.claude-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
}

/* Welcome */
.claude-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 24px;
}
.claude-welcome-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}
.claude-welcome h3 {
    margin: 0 0 8px 0;
    color: var(--text);
    font-size: 1.2rem;
}
.claude-welcome p {
    margin: 0;
    font-size: 0.9rem;
}

/* Input Area */
.claude-input-area {
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
    position: relative;
}
.claude-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
#messageInput {
    flex: 1;
    resize: none;
    max-height: 150px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s;
}
#messageInput:focus {
    border-color: var(--primary);
}
#messageInput:disabled {
    opacity: 0.5;
}
.claude-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.15s;
    flex-shrink: 0;
}
.claude-send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
}
.claude-send-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.claude-send-btn--stop {
    background: var(--danger);
}
.claude-send-btn--stop:hover:not(:disabled) {
    background: #dc2626;
}

/* Status Bar */
.claude-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    padding-top: 6px;
    min-height: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.claude-status-text {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    align-items: center;
}
.claude-context-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.claude-context-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.4s ease;
    background: var(--primary);
}
.claude-context-fill.warn { background: var(--warning, #f59e0b); }
.claude-context-fill.danger { background: var(--danger); }

/* Slash Commands */
.claude-slash-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
    flex-shrink: 0;
    font-family: monospace;
}
.claude-slash-btn:hover { color: var(--primary-light); }
.claude-slash-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    max-height: 260px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.3);
}
.claude-slash-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.1s;
}
.claude-slash-item:hover {
    background: rgba(99, 102, 241, 0.1);
}
.claude-slash-cmd {
    font-family: monospace;
    font-weight: 600;
    color: var(--primary-light);
    font-size: 0.85rem;
    min-width: 130px;
}
.claude-slash-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Attachments */
.claude-attachments {
    padding: 8px 16px 0;
    flex-wrap: wrap;
    gap: 6px;
}
.claude-attachment {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    font-size: 0.75rem;
}
.claude-attachment-icon { font-size: 0.85rem; }
.claude-attachment-name {
    color: var(--text);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.claude-attachment-size { color: var(--text-muted); }
.claude-attachment-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0 2px;
    line-height: 1;
}
.claude-attachment-remove:hover { color: var(--danger); }
.claude-attach-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
    flex-shrink: 0;
}
.claude-attach-btn:hover { color: var(--primary-light); }
.claude-input-area.drag-over {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.05);
}

/* Streaming Indicator */
.claude-streaming-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--primary-light);
}
.claude-pulse {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: claude-pulse-anim 1.5s ease-in-out infinite;
}
@keyframes claude-pulse-anim {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ── Claude Chat Mobile ── */
@media (max-width: 768px) {
    /* Topbar auf Claude-Seite ausblenden - Chat hat eigenen Header */
    body:has(.claude-chat) .topbar {
        display: none;
    }
    body:has(.claude-chat) .claude-chat {
        height: 100vh;
        height: 100dvh;
    }

    .claude-sessions {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        min-width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 1100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .claude-sessions.open {
        left: 0;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }
    .claude-sessions-backdrop {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1099;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s, visibility 0.3s;
    }
    .claude-sessions-backdrop.open {
        opacity: 1;
        visibility: visible;
    }
    .claude-sessions-toggle {
        display: block;
    }
    .claude-nav-toggle {
        display: block;
    }

    /* Header: zweizeilig auf Mobile */
    .claude-chat-header {
        padding: 8px 10px;
        gap: 4px 6px;
        overflow: hidden;
    }
    .claude-chat-title {
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* Dropdowns in eigene Zeile */
    .claude-chat-actions {
        order: 10;
        width: 100%;
        gap: 4px;
        flex-shrink: 0;
    }
    .claude-project-select {
        flex: 1;
        min-width: 0;
        max-width: none;
        font-size: 0.75rem;
        padding: 5px 6px;
    }
    .claude-action-btn {
        font-size: 0.8rem;
        padding: 5px 6px;
    }
    .claude-header-btns {
        gap: 2px;
        flex-shrink: 0;
    }

    /* Messages */
    .claude-msg {
        max-width: 95%;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .claude-messages {
        padding: 10px;
        gap: 8px;
    }
    .claude-msg--assistant pre code {
        font-size: 0.75rem;
        padding: 8px;
    }
    .claude-tool {
        font-size: 0.72rem;
        padding: 4px 8px;
    }
    .claude-tool-cmd {
        font-size: 0.7rem;
    }

    /* Input Area */
    .claude-input-area {
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
    #messageInput {
        padding: 8px 12px;
        font-size: 16px;
        border-radius: 10px;
    }
    .claude-send-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    /* Filter panel responsive */
    .claude-filter-panel {
        padding: 8px 10px;
    }
    .claude-filter-grid {
        gap: 6px;
    }
    .claude-filter-item {
        gap: 4px;
    }
    .claude-filter-label {
        font-size: 0.7rem;
    }
    .claude-filter-select {
        font-size: 0.68rem;
    }
}

/* ── Print ── */
@media print {
    .sidebar, .topbar, .sidebar-backdrop { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .card { break-inside: avoid; }
}
