/**
 * Zammad Kanban - Stylesheet
 * 
 * Modernes, minimalistisches Design mit:
 * - Dark/Light Theme Support
 * - Glasmorphism-Effekten
 * - Smooth Animations
 * - Drag & Drop Feedback
 */

/* ============================================
   CSS VARIABLEN / DESIGN TOKENS - DARK THEME
   ============================================ */
:root {
    /* Farbpalette - Dark */
    --color-bg-primary: #0f0f12;
    --color-bg-secondary: #16161a;
    --color-bg-tertiary: #1e1e24;
    --color-bg-elevated: #232329;
    --color-bg-hover: #2a2a32;
    
    --color-surface: rgba(255, 255, 255, 0.03);
    --color-surface-hover: rgba(255, 255, 255, 0.06);
    --color-surface-active: rgba(255, 255, 255, 0.08);
    
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-strong: rgba(255, 255, 255, 0.15);
    
    --color-text-primary: #ffffff;
    --color-text-secondary: #a1a1aa;
    --color-text-tertiary: #71717a;
    --color-text-muted: #52525b;
    
    /* Akzentfarben */
    --color-primary: #6366f1;
    --color-primary-hover: #818cf8;
    --color-primary-glow: rgba(99, 102, 241, 0.25);
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    
    /* Kanban-Spalten Farben */
    --color-backlog: #6b7280;
    --color-todo: #3b82f6;
    --color-progress: #f59e0b;
    --color-review: #8b5cf6;
    --color-done: #10b981;
    
    /* Typografie */
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    
    /* Abstände */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    
    /* Radien */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    
    /* Schatten */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px var(--color-primary-glow);
    
    /* Transitionen */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --header-height: 64px;
    --sidebar-width: 280px;
    --kanban-column-width: 320px;
    --kanban-gap: 20px;
}

/* ============================================
   LIGHT THEME
   ============================================ */
[data-theme="light"] {
    --color-bg-primary: #f8fafc;
    --color-bg-secondary: #ffffff;
    --color-bg-tertiary: #f1f5f9;
    --color-bg-elevated: #ffffff;
    --color-bg-hover: #e2e8f0;
    
    --color-surface: rgba(0, 0, 0, 0.02);
    --color-surface-hover: rgba(0, 0, 0, 0.04);
    --color-surface-active: rgba(0, 0, 0, 0.06);
    
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-strong: rgba(0, 0, 0, 0.15);
    
    --color-text-primary: #0f172a;
    --color-text-secondary: #475569;
    --color-text-tertiary: #64748b;
    --color-text-muted: #94a3b8;
    
    --color-primary: #4f46e5;
    --color-primary-hover: #6366f1;
    --color-primary-glow: rgba(79, 70, 229, 0.2);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ============================================
   RESET & BASIS
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.5;
    color: var(--color-text-primary);
    background: var(--color-bg-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }

.hidden { display: none !important; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-container {
    width: 100%;
    max-width: 400px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
}

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

.logo { display: inline-flex; margin-bottom: var(--space-4); }
.login-header h1 { font-size: var(--text-2xl); font-weight: 600; margin-bottom: var(--space-2); }
.login-header p { color: var(--color-text-secondary); font-size: var(--text-sm); }
.login-form { display: flex; flex-direction: column; gap: var(--space-5); }

/* ============================================
   FORM ELEMENTE
   ============================================ */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group label { font-size: var(--text-sm); font-weight: 500; color: var(--color-text-secondary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.input-styled,
.select-styled,
.textarea-styled {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
}

.input-styled:focus,
.select-styled:focus,
.textarea-styled:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.input-styled::placeholder,
.textarea-styled::placeholder { color: var(--color-text-muted); }
.input-small { padding: var(--space-2) var(--space-3); width: 100px; }
.textarea-styled { min-height: 80px; resize: vertical; }

.select-styled {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

.error-message {
    padding: var(--space-3) var(--space-4);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: var(--text-sm);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: var(--shadow-glow); }

.btn-secondary {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}
.btn-secondary:hover { background: var(--color-bg-hover); border-color: var(--color-border-strong); }

.btn-ghost { color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

.btn-icon { padding: var(--space-2); }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.btn-full { width: 100%; }

.spinner { width: 20px; height: 20px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   HEADER
   ============================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 var(--space-6);
    background: rgba(15, 15, 18, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.header-left, .header-right { display: flex; align-items: center; gap: var(--space-4); }
.logo-small { display: flex; }
.logo-small svg { width: 32px; height: 32px; }
.header h1 { font-size: var(--text-lg); font-weight: 600; }

.sprint-selector { margin-left: var(--space-4); }
.sprint-selector .select-styled {
    min-width: 180px;
    padding: var(--space-2) var(--space-3);
    padding-right: 36px;
    font-size: var(--text-sm);
}

.filter-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

#filter-toggle { position: relative; }

/* User Menu */
.user-menu { position: relative; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    color: white;
    transition: transform var(--transition-fast);
}

.user-avatar:hover { transform: scale(1.05); }

.dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.dropdown-header span:first-child { font-weight: 500; }
.role-badge { font-size: var(--text-xs); color: var(--color-primary); font-weight: 500; }
.dropdown-divider { height: 1px; background: var(--color-border); }

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

/* ============================================
   FILTER PANEL
   ============================================ */
.filter-panel {
    position: fixed;
    top: var(--header-height);
    right: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border);
    z-index: 90;
    transform: translateX(100%);
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.filter-panel:not(.hidden) { transform: translateX(0); }
.filter-content { padding: var(--space-6); }

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.filter-header h3 { font-size: var(--text-lg); font-weight: 600; }
.filter-body { display: flex; flex-direction: column; gap: var(--space-5); }

.filter-footer {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.saved-filters {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
}

.saved-filters h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-3);
}

.saved-filters-list { display: flex; flex-direction: column; gap: var(--space-2); }

.saved-filter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.saved-filter-item:hover { background: var(--color-surface-hover); }
.saved-filter-item span { font-size: var(--text-sm); }
.saved-filter-item button { padding: var(--space-1); color: var(--color-text-muted); opacity: 0; transition: opacity var(--transition-fast); }
.saved-filter-item:hover button { opacity: 1; }
.saved-filter-item button:hover { color: var(--color-error); }

/* ============================================
   KANBAN BOARD
   ============================================ */
.kanban-container { padding: var(--space-6); overflow-x: auto; }

.kanban-board {
    display: flex;
    gap: var(--kanban-gap);
    min-height: calc(100vh - var(--header-height) - 48px);
}

.kanban-column {
    flex-shrink: 0;
    width: var(--kanban-column-width);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.column-header-left { display: flex; align-items: center; gap: var(--space-3); }
.column-indicator { width: 4px; height: 24px; border-radius: 2px; }
.column-indicator.backlog { background: var(--color-backlog); }
.column-indicator.todo { background: var(--color-todo); }
.column-indicator.in_progress { background: var(--color-progress); }
.column-indicator.review { background: var(--color-review); }
.column-indicator.done { background: var(--color-done); }

.column-title { font-size: var(--text-base); font-weight: 600; }

.column-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 var(--space-2);
    background: var(--color-surface-hover);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.kanban-column-content {
    flex: 1;
    padding: var(--space-3);
    overflow-y: auto;
    min-height: 200px;
}

.kanban-column.drag-over { background: var(--color-surface-active); border-color: var(--color-primary); }
.kanban-column.drag-over .kanban-column-content {
    outline: 2px dashed var(--color-primary);
    outline-offset: -8px;
    border-radius: var(--radius-md);
}

/* ============================================
   TICKET CARDS
   ============================================ */
.ticket-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    cursor: grab;
    transition: all var(--transition-fast);
}

.ticket-card:hover {
    border-color: var(--color-border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.ticket-card:active { cursor: grabbing; }
.ticket-card.dragging { opacity: 0.5; transform: rotate(3deg); }

.ticket-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.ticket-number { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); }

.priority-badge {
    font-size: var(--text-xs);
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.priority-badge.low { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.priority-badge.normal { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.priority-badge.high { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.priority-badge.urgent { background: rgba(239, 68, 68, 0.2); color: #f87171; }

.ticket-card .ticket-title {
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ticket-card-footer { display: flex; align-items: center; justify-content: space-between; }
.ticket-owner { display: flex; align-items: center; gap: var(--space-2); }

.avatar-small {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.owner-name { font-size: var(--text-xs); color: var(--color-text-secondary); }

.ticket-estimate {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.ticket-estimate svg { width: 14px; height: 14px; }
.estimate-warning { color: var(--color-warning); }
.estimate-over { color: var(--color-error); }

/* ============================================
   MODALS
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalIn 0.2s ease;
}

.modal-content.modal-small { max-width: 400px; }
.modal-content.sprint-manager { max-width: 640px; }

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

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

.modal-header h2 { font-size: var(--text-lg); font-weight: 600; }
.modal-close { color: var(--color-text-secondary); }
.modal-close:hover { color: var(--color-text-primary); }

.modal-body { padding: var(--space-6); overflow-y: auto; max-height: calc(90vh - 140px); }

/* Ticket Detail */
.ticket-header-info { display: flex; align-items: center; gap: var(--space-3); }
.ticket-detail .ticket-number { font-size: var(--text-sm); color: var(--color-text-secondary); }
.ticket-detail .ticket-title { font-size: var(--text-xl); font-weight: 600; margin-bottom: var(--space-4); }

.ticket-meta {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.meta-item { display: flex; flex-direction: column; gap: var(--space-1); }
.meta-label { font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.meta-value { font-size: var(--text-sm); color: var(--color-text-secondary); }

.ticket-section { margin-bottom: var(--space-5); }
.ticket-section > label { display: block; font-size: var(--text-sm); font-weight: 500; color: var(--color-text-secondary); margin-bottom: var(--space-2); }

.owner-display {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--color-surface);
    border-radius: var(--radius-md);
}

.owner-display .btn { margin-left: auto; }

/* Estimate Section */
.estimate-section { padding: var(--space-4); background: var(--color-surface); border-radius: var(--radius-md); }
.estimate-inputs { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-3); }
.estimate-group { display: flex; flex-direction: column; gap: var(--space-1); }
.estimate-label { font-size: var(--text-xs); color: var(--color-text-muted); }

.estimate-diff { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); font-size: var(--text-sm); font-weight: 500; }
.estimate-diff.positive { color: var(--color-success); }
.estimate-diff.negative { color: var(--color-error); }

.estimate-section .textarea-styled { margin-bottom: var(--space-3); }

/* Sprint Modal */
.sprint-form { padding-bottom: var(--space-6); }
.sprint-form h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-4); }
.divider { height: 1px; background: var(--color-border); margin: var(--space-6) 0; }
.sprint-list h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-4); }
.sprints-container { display: flex; flex-direction: column; gap: var(--space-3); }

/* ============================================
   TICKET DETAIL MODAL - ZWEISPALTIGES LAYOUT
   ============================================ */
.ticket-detail-large {
    max-width: 1200px;
    width: 95vw;
    max-height: 90vh;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.ticket-detail-large .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.ticket-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.ticket-detail-body {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: var(--space-5);
    flex: 1;
    overflow: hidden;
    padding: var(--space-5);
    min-height: 0;
}

/* Linke Spalte - Kommunikation */
.ticket-left-column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ticket-left-column .ticket-title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-4);
    line-height: 1.3;
    flex-shrink: 0;
}

.ticket-articles-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.ticket-articles-container .section-header {
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.ticket-articles-container .section-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0;
}

.ticket-articles {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Neue Notiz hinzufügen */
.ticket-add-note {
    flex-shrink: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ticket-add-note .section-header {
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
}

.ticket-add-note .section-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0;
}

.ticket-add-note .textarea-styled {
    border: none;
    border-radius: 0;
    resize: none;
}

.note-options {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-top: 1px solid var(--color-border);
}

.note-time-input {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.note-time-input label {
    color: var(--color-text-muted);
}

.input-time {
    width: 70px !important;
    padding: 6px 10px !important;
    text-align: center;
    font-size: var(--text-sm);
}

.input-tiny {
    width: 50px !important;
    padding: 4px 8px !important;
    text-align: center;
    font-size: var(--text-sm);
}

.note-options .checkbox-label {
    font-size: var(--text-sm);
}

.note-options .btn {
    margin-left: auto;
}

/* Rechte Spalte - Einstellungen */
.ticket-right-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    overflow-y: auto;
    padding-right: var(--space-2);
}

.ticket-right-column .ticket-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.ticket-right-column .ticket-section h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-3) 0;
}

.ticket-meta-section .meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

.ticket-meta-section .meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ticket-meta-section .meta-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.ticket-meta-section .meta-value {
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

/* Kompakte Zeitschätzung */
.estimate-inputs-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.estimate-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.estimate-row .estimate-label {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.estimate-row .input-small {
    width: 70px;
}

.estimate-unit {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.btn-full {
    width: 100%;
}

/* Responsive für kleinere Bildschirme */
@media (max-width: 900px) {
    .ticket-detail-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
    
    .ticket-left-column {
        overflow: visible;
    }
    
    .ticket-articles {
        max-height: 300px;
    }
    
    .ticket-right-column {
        overflow: visible;
        padding-right: 0;
    }
}

.sprint-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.sprint-item:hover { border-color: var(--color-border-strong); }
.sprint-info { flex: 1; }
.sprint-name { font-weight: 500; margin-bottom: var(--space-1); }
.sprint-dates { font-size: var(--text-xs); color: var(--color-text-muted); }

.sprint-status { font-size: var(--text-xs); font-weight: 500; padding: 4px 10px; border-radius: var(--radius-full); margin-right: var(--space-3); }
.sprint-status.planned { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.sprint-status.active { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.sprint-status.completed { background: rgba(99, 102, 241, 0.2); color: #818cf8; }

.sprint-actions { display: flex; gap: var(--space-2); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container { position: fixed; bottom: var(--space-6); right: var(--space-6); display: flex; flex-direction: column; gap: var(--space-3); z-index: 300; }

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-error); }
.toast.info { border-left: 3px solid var(--color-info); }

.toast-icon { width: 20px; height: 20px; }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error .toast-icon { color: var(--color-error); }
.toast.info .toast-icon { color: var(--color-info); }

.toast-message { font-size: var(--text-sm); }
.toast-close { padding: var(--space-1); color: var(--color-text-muted); margin-left: var(--space-2); }
.toast-close:hover { color: var(--color-text-primary); }

/* Empty State */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-8); text-align: center; color: var(--color-text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state p { font-size: var(--text-sm); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    :root { --kanban-column-width: 280px; --header-height: 56px; }
    .header { padding: 0 var(--space-4); }
    .header h1 { display: none; }
    .sprint-selector .select-styled { min-width: 140px; }
    .kanban-container { padding: var(--space-4); }
    .filter-panel { width: 100%; }
    .modal-content { margin: var(--space-4); max-height: calc(100vh - 32px); }
    .ticket-meta { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
}

/* ============================================
   GLOBALE SUCHE
   ============================================ */
.header-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-left: var(--space-6);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    color: var(--color-text-tertiary);
    pointer-events: none;
}

.header-search input {
    width: 280px;
    padding: 8px 12px 8px 40px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: var(--color-bg-secondary);
    width: 360px;
}

.header-search input::placeholder {
    color: var(--color-text-muted);
}

.search-shortcut {
    position: absolute;
    right: 10px;
    padding: 2px 6px;
    background: var(--color-bg-hover);
    border-radius: 4px;
    font-size: 11px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    pointer-events: none;
}

.header-search input:focus + .search-shortcut {
    display: none;
}

/* Suchergebnisse Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--color-bg-hover);
}

.search-result-item .ticket-number {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-primary);
    font-weight: 600;
}

.search-result-item .ticket-title {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-item .ticket-status {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--color-text-muted);
}

/* ============================================
   WIP LIMITS
   ============================================ */
.column-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wip-limit {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.wip-limit.warning {
    color: var(--color-warning);
}

.wip-limit.exceeded {
    color: var(--color-error);
    font-weight: 600;
}

.kanban-column.wip-exceeded {
    border-color: var(--color-error);
}

.kanban-column.wip-exceeded .kanban-column-header {
    background: rgba(239, 68, 68, 0.1);
}

.kanban-column.wip-warning .kanban-column-header {
    background: rgba(245, 158, 11, 0.1);
}

/* ============================================
   SPRINT STATISTIKEN
   ============================================ */
.modal-large {
    max-width: 800px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.backlog { background: rgba(107, 114, 128, 0.2); color: var(--color-backlog); }
.stat-icon.todo { background: rgba(59, 130, 246, 0.2); color: var(--color-todo); }
.stat-icon.progress { background: rgba(245, 158, 11, 0.2); color: var(--color-progress); }
.stat-icon.review { background: rgba(139, 92, 246, 0.2); color: var(--color-review); }
.stat-icon.done { background: rgba(16, 185, 129, 0.2); color: var(--color-done); }

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* Fortschrittsbalken */
.stats-progress-section,
.stats-chart-section,
.stats-team-section {
    margin-bottom: var(--space-6);
}

.stats-progress-section h3,
.stats-chart-section h3,
.stats-team-section h3 {
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-4);
}

.progress-bar-container {
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.progress-bar {
    height: 24px;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    background: var(--color-bg-primary);
}

.progress-segment {
    height: 100%;
    transition: width var(--transition-slow);
}

.progress-segment.backlog { background: var(--color-backlog); }
.progress-segment.todo { background: var(--color-todo); }
.progress-segment.in_progress { background: var(--color-progress); }
.progress-segment.review { background: var(--color-review); }
.progress-segment.done { background: var(--color-done); }

.progress-legend {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-3);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.backlog { background: var(--color-backlog); }
.legend-color.todo { background: var(--color-todo); }
.legend-color.in_progress { background: var(--color-progress); }
.legend-color.review { background: var(--color-review); }
.legend-color.done { background: var(--color-done); }

/* Bar Chart */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: var(--space-4);
    height: 150px;
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-lg);
}

.bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.bar {
    width: 100%;
    max-width: 60px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height var(--transition-slow);
    min-height: 4px;
}

.bar.backlog { background: var(--color-backlog); }
.bar.todo { background: var(--color-todo); }
.bar.in_progress { background: var(--color-progress); }
.bar.review { background: var(--color-review); }
.bar.done { background: var(--color-done); }

.bar-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: center;
}

.bar-value {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
}

/* Team Stats */
.team-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.team-member {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
}

.team-member .avatar-small {
    width: 32px;
    height: 32px;
}

.team-member-info {
    flex: 1;
}

.team-member-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

.team-member-tickets {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.team-member-bar {
    width: 120px;
    height: 8px;
    background: var(--color-bg-primary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.team-member-bar-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* Responsive Stats */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .header-search {
        display: none;
    }
    
    .header-search.mobile-visible {
        display: flex;
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        padding: var(--space-3);
        background: var(--color-bg-secondary);
    }
    
    .header-search.mobile-visible input {
        width: 100%;
    }
}

/* ============================================
   TAGS
   ============================================ */
.ticket-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: var(--space-2) 0;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
}

/* Bekannte Tag-Typen */
.tag-bug {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.tag-feature {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.tag-urgent {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.tag-blocked {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.tag-docs {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.tag-test {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
}

.tag-design {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
}

.tag-security {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

/* Fallback-Farben */
.tag-color-0 { background: rgba(99, 102, 241, 0.2); color: #6366f1; }
.tag-color-1 { background: rgba(20, 184, 166, 0.2); color: #14b8a6; }
.tag-color-2 { background: rgba(168, 85, 247, 0.2); color: #a855f7; }
.tag-color-3 { background: rgba(251, 146, 60, 0.2); color: #fb923c; }
.tag-color-4 { background: rgba(34, 211, 238, 0.2); color: #22d3ee; }
.tag-color-5 { background: rgba(163, 230, 53, 0.2); color: #a3e635; }

.tag-more {
    background: var(--color-bg-tertiary);
    color: var(--color-text-muted);
}

/* ============================================
   DEADLINE BADGES
   ============================================ */
.ticket-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.deadline-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.deadline-badge.overdue {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    animation: pulse-red 2s infinite;
}

.deadline-badge.today {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.deadline-badge.soon {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Ticket-Card Deadline-Styling */
.ticket-card.deadline-overdue {
    border-left: 3px solid #ef4444;
}

.ticket-card.deadline-today {
    border-left: 3px solid #f59e0b;
}

.ticket-card.deadline-soon {
    border-left: 3px solid #fbbf24;
}

/* ============================================
   TICKET ERSTELLEN / UPDATE MODALS
   ============================================ */
.modal-medium {
    max-width: 600px;
}

.btn-create {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-create .btn-text {
    font-weight: 500;
}

@media (max-width: 600px) {
    .btn-create .btn-text {
        display: none;
    }
}

.ticket-number-badge {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-primary);
    margin-left: var(--space-3);
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-small {
    width: 70px !important;
    text-align: center;
}

.time-separator {
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.ticket-actions {
    display: flex;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    margin-top: var(--space-4);
}

.ticket-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Verbessertes Ticket-Card Header Layout */
.ticket-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

/* ============================================
   KUNDENSUCHE
   ============================================ */
.customer-search-container {
    position: relative;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
}

.search-dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

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

.search-dropdown-item:hover {
    background: var(--color-bg-hover);
}

.search-dropdown-item.selected {
    background: var(--color-primary-glow);
}

.customer-name, .org-name {
    font-weight: 500;
    color: var(--color-text-primary);
}

.customer-email {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.customer-org, .org-domain {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}

.search-dropdown-empty {
    padding: 15px;
    text-align: center;
    color: var(--color-text-muted);
}

.selected-customer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.selected-customer .customer-info {
    flex: 1;
}

.selected-customer .remove-customer {
    padding: 4px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
}

.selected-customer .remove-customer:hover {
    color: var(--color-error);
}

/* ============================================
   TICKET ARTIKEL / KOMMUNIKATION
   ============================================ */
.ticket-articles-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ticket-articles-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
}

.ticket-articles-section .section-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0;
}

.ticket-articles {
    max-height: 400px;
    overflow-y: auto;
}

.ticket-articles.collapsed {
    max-height: 0;
    overflow: hidden;
}

.articles-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: var(--space-6);
    color: var(--color-text-muted);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.article-item {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

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

.article-item.internal {
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid var(--color-warning);
}

.article-item.incoming {
    background: rgba(59, 130, 246, 0.05);
    border-left: 3px solid var(--color-info);
}

.article-item.outgoing {
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid var(--color-success);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-author {
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: var(--text-sm);
}

.article-type-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.article-type-badge.internal {
    background: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
}

.article-type-badge.email {
    background: rgba(59, 130, 246, 0.2);
    color: var(--color-info);
}

.article-type-badge.note {
    background: rgba(139, 92, 246, 0.2);
    color: var(--color-review);
}

.article-type-badge.phone {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.article-time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.article-subject {
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
}

.article-body {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.article-body-collapsed {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.article-body-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--color-bg-secondary));
}

.article-expand-btn {
    display: inline-block;
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-primary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.article-expand-btn:hover {
    text-decoration: underline;
}

.article-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--space-3);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: background var(--transition-fast);
}

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

.article-time-unit {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-2);
}

.no-articles {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
}

/* ============================================
   ZEITÜBERSICHT MODAL
   ============================================ */
.modal-large {
    max-width: 800px;
    width: 95vw;
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

/* Zeitraum-Tabs */
.time-period-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
    padding: var(--space-1);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
}

.time-period-tabs .tab-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.time-period-tabs .tab-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-hover);
}

.time-period-tabs .tab-btn.active {
    background: var(--color-primary);
    color: white;
}

/* Zeit-Karten */
.time-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.time-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.time-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}

.time-card.total .time-card-icon {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}

.time-card.tickets .time-card-icon {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.time-card.entries .time-card-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.time-card-content {
    display: flex;
    flex-direction: column;
}

.time-card-value {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1;
}

.time-card-unit {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 2px;
}

.time-card-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* Detail-Liste */
.time-details-section h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: var(--color-text-secondary);
}

.time-details-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.time-entry {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

.time-entry:last-child {
    border-bottom: none;
}

.time-entry:hover {
    background: var(--color-bg-hover);
}

.time-entry-date {
    flex-shrink: 0;
    width: 90px;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.time-entry-ticket {
    flex: 1;
    min-width: 0;
}

.time-entry-ticket-number {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-primary);
}

.time-entry-ticket-title {
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-entry-minutes {
    flex-shrink: 0;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    min-width: 70px;
    text-align: right;
}

.time-entry-note {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-no-entries {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
}

.time-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    background: var(--color-bg-tertiary);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
}

.time-date-total {
    font-weight: 500;
    color: var(--color-primary);
}

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

/* Responsive */
@media (max-width: 600px) {
    .time-summary-cards {
        grid-template-columns: 1fr;
    }
    
    .time-entry {
        flex-wrap: wrap;
    }
    
    .time-entry-date {
        width: 100%;
        margin-bottom: var(--space-2);
    }
}

/* ============================================
   SPRINT-PLANUNG
   ============================================ */

/* Fullscreen Modal */
.modal-fullscreen .modal-backdrop {
    background: var(--color-bg-primary);
}

.modal-fullscreen-content {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.modal-fullscreen-content .modal-header {
    flex-shrink: 0;
    border-bottom: 1px solid var(--color-border);
}

.modal-fullscreen-content .modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
}

/* Sprint Planning Controls */
.sprint-planning-controls {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
    margin-right: var(--space-4);
}

.sprint-planning-controls label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.select-small {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    min-width: 120px;
}

/* Planning Mode Badge */
.planning-mode-badge {
    font-size: var(--text-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
    margin-left: var(--space-3);
}

.planning-mode-badge.master {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}

.planning-mode-badge.user {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

/* Sprint Planning Board */
.sprint-planning-body {
    height: 100%;
    overflow: hidden;
}

.sprint-planning-board {
    display: flex;
    gap: var(--space-4);
    height: 100%;
    padding: var(--space-4);
    overflow-x: auto;
}

/* Sprint Spalten */
.sprint-planning-column {
    flex: 1;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.sprint-planning-column.backlog-column {
    background: var(--color-bg-secondary);
    border-color: var(--color-border);
    min-width: 320px;
}

.sprint-planning-column-header {
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.backlog-column .sprint-planning-column-header {
    background: var(--color-bg-primary);
}

.sprint-planning-column-title {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.sprint-planning-column-title .sprint-status {
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.sprint-status.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
}

.sprint-status.planned {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}

.sprint-status.completed {
    background: rgba(107, 114, 128, 0.15);
    color: var(--color-text-muted);
}

.sprint-planning-column-info {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.sprint-planning-column-meta {
    display: flex;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--space-1);
}

.sprint-planning-column-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: var(--color-bg-hover);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* Sprint Ticket Liste */
.sprint-planning-tickets {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.sprint-planning-tickets.drag-over {
    background: var(--color-primary-glow);
}

/* Sprint Planning Ticket Cards (kompakter) */
.sprint-planning-ticket {
    padding: var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: all var(--transition-fast);
}

.sprint-planning-ticket:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.sprint-planning-ticket.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.sprint-planning-ticket-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.sprint-planning-ticket-number {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--color-primary);
}

.sprint-planning-ticket-priority {
    font-size: var(--text-xs);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-tertiary);
}

.sprint-planning-ticket-priority.priority-high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.sprint-planning-ticket-priority.priority-normal {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.sprint-planning-ticket-priority.priority-low {
    background: rgba(107, 114, 128, 0.15);
    color: var(--color-text-muted);
}

.sprint-planning-ticket-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sprint-planning-ticket-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.sprint-planning-ticket-estimate {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sprint-planning-ticket-owner {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Backlog spezifisch */
.backlog-column .sprint-planning-ticket {
    background: var(--color-bg-primary);
}

/* Sprint Stunden-Summe */
.sprint-hours-total {
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.sprint-hours-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.sprint-hours-total strong {
    color: var(--color-text-primary);
}

/* Mitarbeiter-Aufschlüsselung (nur für Master) */
.sprint-user-breakdown {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-2);
    margin-top: var(--space-2);
}

.sprint-user-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
    font-size: var(--text-xs);
}

.sprint-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.sprint-user-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-primary);
}

.sprint-user-stats {
    flex-shrink: 0;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

/* Tatsächliche Zeit (aus Zammad) - etwas dezenter */
.actual-time {
    color: var(--color-success);
    opacity: 0.8;
}

.sprint-planning-ticket-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sprint-planning-ticket-time .actual-time {
    font-size: var(--text-xs);
}

.sprint-planning-ticket-time .actual-time.loading {
    color: var(--color-text-muted);
    animation: pulse 1.5s infinite;
}

/* Zeit-Anzeige Lade-Zustand */
.ticket-time-actual.loading {
    color: var(--color-text-muted);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.ticket-estimate .ticket-time-actual {
    color: var(--color-success);
}

.ticket-estimate.estimate-over .ticket-time-actual {
    color: var(--color-error);
}

.ticket-estimate.estimate-under .ticket-time-actual {
    color: var(--color-success);
}

/* Empty State */
.sprint-planning-empty {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Aktives Ticket in Sprint-Planung */
.sprint-planning-ticket.active {
    border-color: var(--color-primary);
    background: var(--color-bg-tertiary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* ============================================
   SPRINT TICKET SIDEBAR
   ============================================ */

.sprint-ticket-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 450px;
    background: var(--color-bg-secondary);
    border-left: 1px solid var(--color-border-strong);
    display: flex;
    flex-direction: column;
    z-index: 10;
    animation: slideInRight 0.2s ease-out;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.sprint-ticket-sidebar.hidden {
    display: none;
}

.sprint-ticket-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-tertiary);
}

.sprint-ticket-sidebar-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sprint-ticket-sidebar-title .ticket-number {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-primary);
}

.sprint-ticket-sidebar-actions-top {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.sprint-ticket-sidebar-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Header Section mit Titel und Meta */
.sidebar-ticket-header-section {
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-ticket-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-3);
    line-height: 1.4;
}

.sidebar-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.sidebar-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.sidebar-meta-item svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* Artikel Section */
.sidebar-articles-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.sidebar-articles-header {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-articles-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.sidebar-articles-loading,
.sidebar-no-articles,
.sidebar-articles-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-6);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

.sidebar-no-articles svg {
    opacity: 0.5;
}

.sidebar-articles-error {
    color: var(--color-error);
}

.spinner-small {
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Einzelner Artikel */
.sidebar-article {
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: var(--text-sm);
}

.sidebar-article.internal {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
}

.sidebar-article.incoming {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.4);
}

.sidebar-article-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    font-size: var(--text-xs);
}

.sidebar-article-from {
    font-weight: 600;
    color: var(--color-text-primary);
}

.sidebar-article-type {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.sidebar-article-type.internal {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.sidebar-article-type.email {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.sidebar-article-type.phone {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.sidebar-article-time {
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.sidebar-article-date {
    color: var(--color-text-muted);
    margin-left: auto;
}

.sidebar-article-body {
    color: var(--color-text-secondary);
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
}

/* Footer */
.sprint-ticket-sidebar-footer {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-tertiary);
}

.sprint-ticket-sidebar-footer .btn-block {
    width: 100%;
    justify-content: center;
}

/* Adjust Sprint-Planning-Body for sidebar */
.sprint-planning-body {
    position: relative;
}

/* ============================================
   ATTACHMENT UPLOAD
   ============================================ */

.note-attachments {
    margin-top: var(--space-2);
}

.attachment-upload-area {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-tertiary);
    transition: all 0.2s ease;
}

.attachment-upload-area:hover {
    border-color: var(--color-accent);
    background: var(--color-surface);
}

.attachment-upload-area.drag-over {
    border-color: var(--color-accent);
    background: rgba(var(--color-accent-rgb), 0.1);
    border-style: solid;
}

.attachment-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.attachment-preview {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.attachment-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.attachment-icon svg {
    display: block;
}

.attachment-name {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-size {
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.attachment-remove {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.attachment-remove:hover {
    background: var(--color-error);
    color: white;
}

/* Spinner für Upload-Button */
.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .sprint-planning-column {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .sprint-planning-board {
        flex-direction: column;
    }

    .sprint-planning-column {
        max-width: 100%;
        min-width: 100%;
        max-height: 400px;
    }
}

/* ============================================
   HAUPTNAVIGATION (Kanban / Wiki)
   ============================================ */

.main-nav {
    display: flex;
    gap: var(--space-1);
    margin-left: var(--space-4);
    padding: var(--space-1);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    cursor: pointer;
}

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

.nav-item.active {
    background: var(--color-primary);
    color: white;
}

.nav-item svg {
    flex-shrink: 0;
}

/* ============================================
   WIKI VIEW LAYOUT
   ============================================ */

.wiki-view {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height));
}

.wiki-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Wiki Sidebar */
.wiki-sidebar {
    width: 280px;
    background: var(--color-bg-secondary);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wiki-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}

.wiki-sidebar-header h3 {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin: 0;
}

/* Wiki Suche */
.wiki-search {
    padding: var(--space-3) var(--space-4);
    position: relative;
    border-bottom: 1px solid var(--color-border);
}

.wiki-search .search-icon {
    position: absolute;
    left: calc(var(--space-4) + var(--space-3));
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.wiki-search input {
    width: 100%;
    padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-3) + 24px);
    background: var(--color-bg-tertiary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
}

.wiki-search input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

/* Kategorie-Baum */
.wiki-category-tree {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

.wiki-category-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-size: var(--text-sm);
}

.wiki-category-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.wiki-category-item.active {
    background: var(--color-primary-glow);
    color: var(--color-primary);
}

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

.wiki-category-item .category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wiki-category-item .category-count {
    flex-shrink: 0;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    background: var(--color-bg-tertiary);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

/* Hierarchische Kategorien */
.wiki-category-group {
    display: flex;
    flex-direction: column;
}

.wiki-category-item-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
}

.wiki-category-item-wrapper:hover .category-actions {
    opacity: 1;
}

.category-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.category-toggle:hover {
    color: var(--color-text-primary);
}

.category-toggle.expanded {
    transform: rotate(90deg);
}

.category-toggle-placeholder {
    width: 20px;
    flex-shrink: 0;
}

.wiki-category-children {
    margin-left: 20px;
    border-left: 1px solid var(--color-border);
    padding-left: var(--space-1);
}

.wiki-category-child .wiki-category-item {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-2);
}

.wiki-category-child .wiki-category-item .category-icon {
    width: 16px;
    height: 16px;
}

.wiki-category-child .wiki-category-item .category-icon svg {
    width: 14px;
    height: 14px;
}

/* Kategorie-Aktionen (Edit/Delete) */
.category-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    margin-left: auto;
    padding-right: var(--space-2);
}

.category-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.category-action-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.category-action-btn.category-action-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

/* Schnellzugriff */
.wiki-quick-links {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.wiki-quick-links h4 {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-2) 0;
}

.wiki-quick-link {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) var(--space-3);
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.wiki-quick-link:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

/* ============================================
   WIKI HAUPTBEREICH
   ============================================ */

.wiki-main {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
    background: var(--color-bg-primary);
}

/* Artikel-Liste Header */
.wiki-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.wiki-list-header h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin: 0;
    color: var(--color-text-primary);
}

.wiki-list-actions {
    display: flex;
    gap: var(--space-2);
}

/* Artikel-Liste */
.wiki-article-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Artikel-Karte */
.wiki-article-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.wiki-article-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.wiki-article-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2);
    gap: var(--space-3);
}

.wiki-article-card-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.wiki-article-card-badges {
    display: flex;
    gap: var(--space-2);
    flex-shrink: 0;
}

.badge-internal {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

.badge-category {
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    color: white;
}

.badge-customer {
    background: rgba(59, 130, 246, 0.15);
    color: var(--color-info);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
}

.wiki-article-card-excerpt {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    line-height: 1.5;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wiki-article-card-meta {
    display: flex;
    gap: var(--space-4);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.wiki-article-card-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

/* ============================================
   WIKI KUNDEN-ÜBERSICHT
   ============================================ */

.wiki-customer-view {
    max-width: 800px;
}

.wiki-customer-search {
    flex: 1;
    max-width: 300px;
}

.wiki-customer-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.wiki-customer-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.wiki-customer-card:hover {
    border-color: var(--color-border-strong);
    background: var(--color-bg-tertiary);
    transform: translateX(4px);
}

.wiki-customer-card .customer-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--color-primary-glow);
    border-radius: var(--radius-md);
    color: var(--color-primary);
}

.wiki-customer-card .customer-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

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

.wiki-customer-card .customer-article-count {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.wiki-customer-card .customer-arrow {
    color: var(--color-text-muted);
    transition: transform var(--transition-fast);
}

.wiki-customer-card:hover .customer-arrow {
    transform: translateX(4px);
    color: var(--color-primary);
}

.wiki-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12);
    color: var(--color-text-muted);
    text-align: center;
}

.wiki-empty-state svg {
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.wiki-empty-state p {
    font-size: var(--text-lg);
    font-weight: 500;
    margin-bottom: var(--space-2);
    color: var(--color-text-secondary);
}

.wiki-empty-state span {
    font-size: var(--text-sm);
}

/* ============================================
   WIKI ARTIKEL-ANSICHT
   ============================================ */

.wiki-article-view {
    max-width: 900px;
}

.wiki-article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.wiki-article-actions {
    display: flex;
    gap: var(--space-2);
}

.wiki-article-content {
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
}

/* Markdown-Rendering */
.wiki-article-content h1 {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin: 0 0 var(--space-4) 0;
    color: var(--color-text-primary);
}

.wiki-article-content h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    margin: var(--space-6) 0 var(--space-3) 0;
    color: var(--color-text-primary);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}

.wiki-article-content h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: var(--space-4) 0 var(--space-2) 0;
    color: var(--color-text-primary);
}

.wiki-article-content p {
    margin: 0 0 var(--space-4) 0;
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.wiki-article-content ul,
.wiki-article-content ol {
    margin: 0 0 var(--space-4) 0;
    padding-left: var(--space-6);
    color: var(--color-text-secondary);
}

.wiki-article-content li {
    margin-bottom: var(--space-2);
    line-height: 1.6;
}

.wiki-article-content code {
    background: var(--color-bg-tertiary);
    padding: 2px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--color-primary);
}

.wiki-article-content pre {
    background: var(--color-bg-tertiary);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 0 0 var(--space-4) 0;
    border: 1px solid var(--color-border);
}

.wiki-article-content pre code {
    background: none;
    padding: 0;
    color: var(--color-text-primary);
}

.wiki-article-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding-left: var(--space-4);
    margin: 0 0 var(--space-4) 0;
    color: var(--color-text-secondary);
    font-style: italic;
}

.wiki-article-content a {
    color: var(--color-primary);
    text-decoration: none;
}

.wiki-article-content a:hover {
    text-decoration: underline;
}

.wiki-article-content mark {
    background: rgba(var(--color-warning-rgb, 245, 158, 11), 0.3);
    padding: 1px 4px;
    border-radius: 2px;
}

/* Artikel Metadaten */
.wiki-article-meta {
    margin-top: var(--space-6);
    padding: var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-6);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.wiki-article-meta-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.wiki-article-meta-label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   WIKI EDITOR
   ============================================ */

.wiki-editor-modal .modal-content {
    max-width: 1000px;
    width: 95vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

.wiki-editor-modal .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-6);
}

.wiki-editor {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--color-bg-secondary);
}

.editor-toolbar {
    display: flex;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-3);
    background: var(--color-bg-tertiary);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.editor-toolbar button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.editor-toolbar button:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-primary);
}

.editor-toolbar button.active {
    background: var(--color-primary);
    color: white;
}

.editor-toolbar-spacer {
    flex: 1;
}

.editor-content {
    display: flex;
    flex: 1;
    min-height: 400px;
}

.editor-textarea {
    flex: 1;
    padding: var(--space-4);
    border: none;
    resize: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.editor-textarea:focus {
    outline: none;
}

.editor-preview {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
    background: var(--color-bg-primary);
    border-left: 1px solid var(--color-border);
}

/* Wiki Customer Dropdown */
.customer-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.customer-dropdown .dropdown-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition-fast);
}

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

.customer-dropdown .dropdown-item:hover {
    background: var(--color-bg-hover);
}

.customer-dropdown .dropdown-item strong {
    display: block;
    color: var(--color-text-primary);
}

.customer-dropdown .dropdown-item .org-domain {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.customer-dropdown .dropdown-empty {
    padding: 15px;
    text-align: center;
    color: var(--color-text-muted);
}

/* Wiki customer field container - needs relative for dropdown positioning */
.wiki-customer-field {
    position: relative;
}

.wiki-customer-field .input-styled {
    width: 100%;
}

/* ============================================
   WIKI VERSIONSHISTORIE
   ============================================ */

.version-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.version-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    background: var(--color-bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.version-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.version-number {
    font-weight: 600;
    color: var(--color-text-primary);
}

.version-summary {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

.version-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.version-actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================
   WIKI SUCH-ERGEBNISSE
   ============================================ */

.wiki-search-results {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-primary);
    z-index: 10;
    padding: var(--space-6);
    overflow-y: auto;
}

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

@media (max-width: 1024px) {
    .wiki-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .main-nav span {
        display: none;
    }

    .main-nav .nav-item {
        padding: var(--space-2);
    }

    .wiki-layout {
        flex-direction: column;
    }

    .wiki-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .wiki-category-tree {
        display: flex;
        flex-wrap: wrap;
        gap: var(--space-2);
        padding: var(--space-3);
    }

    .wiki-category-item {
        flex: 0 0 auto;
    }

    .wiki-quick-links {
        display: none;
    }

    .wiki-article-content {
        padding: var(--space-4);
    }
}

/* Form Color Input */
.input-color {
    width: 60px;
    height: 38px;
    padding: var(--space-1);
    cursor: pointer;
}

/* Form Row Flex */
.form-row.flex-row {
    display: flex;
    gap: var(--space-4);
}

.form-group.flex-1 {
    flex: 1;
}

.form-group.flex-2 {
    flex: 2;
}