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

:root {
    /* Minimalist Light Mode (Todoist-style) */
    --primary-color: #db4035;
    --primary-dark: #c03a2f;
    --primary-light: #e85a47;
    --secondary-color: #7c8087;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --link-color: #c03a2f;

    /* Light Mode - Background & Text */
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-tertiary: #f5f5f5;
    --bg-hover: #f0f0f0;
    --text-primary: #202020;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --shadow: none;
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 4px 8px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    --font-size-sm: 0.8125rem;
    --font-size-base: 0.9375rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.125rem;
    --font-size-2xl: 1.375rem;
    --font-size-3xl: 1.625rem;
}

html.dark-mode {
    /* Minimalist Dark Mode */
    --bg-primary: #1e1e1e;
    --bg-secondary: #252525;
    --bg-tertiary: #2d2d2d;
    --bg-hover: #333333;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --border-color: #363636;
    --primary-color: #db4035;
    --primary-dark: #c03a2f;
    --primary-light: #e85a47;
    --link-color: #f07a6a;
    --shadow: none;
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 4px 8px rgba(0, 0, 0, 0.4);
}

html, body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    height: 100%;
    font-size: var(--font-size-base);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Unklassierte Links (z.B. automatisch verlinkte URLs) und #x-Aufgabenlinks statt Browser-Blau.
   :where() haelt die Spezifitaet bei 0, damit komponentenspezifische Regeln gewinnen. */
:where(a:not([class]), a.task-ref) {
    color: var(--link-color);
}

:where(a:not([class]), a.task-ref):hover {
    color: var(--primary-color);
}

/* ============================================================================
   LAYOUT & NAVIGATION
   ============================================================================ */

.layout-wrapper {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-secondary);
}

.sidebar {
    width: 250px;
    background-color: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transition: width 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar-brand {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
}

.brand-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-lg);
    transition: color 0.3s ease;
    white-space: nowrap;
}

.brand-link:hover {
    color: var(--primary-color);
}

.brand-link i {
    font-size: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.brand-text {
    overflow: hidden;
}

.sidebar.collapsed .brand-link {
    justify-content: center;
}

.sidebar.collapsed .brand-text {
    display: none;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    height: 44px;
}

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

.nav-item i {
    font-size: 1.1rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-text {
    display: none;
}

/* Gruppen-Ueberschrift (Zustand, Einstellungen); eingeklappt nur eine Trennlinie */
.nav-group-label {
    padding: 0.75rem 1rem 0;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.7;
    white-space: nowrap;
}

.sidebar.collapsed .nav-group-label {
    height: 1px;
    padding: 0;
    margin: 0.5rem 0.75rem;
    font-size: 0;
    background: var(--border-color);
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

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

.theme-label {
    font-size: var(--font-size-base);
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.3s ease;
    width: 100%;
}

.sidebar-toggle-btn:hover {
    color: var(--primary-color);
}

.sidebar-toggle-btn i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 80px;
}

.main-container {
    flex: 1;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

main {
    min-height: calc(100vh - 200px);
    padding: 0;
}

.footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    text-align: center;
    padding: 2rem;
    margin-top: 4rem;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ============================================================================
   FORMS & INPUTS
   ============================================================================ */

.form {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 8px;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--font-size-base);
    font-family: inherit;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
    border-color: var(--primary-light);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-list label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-list label:hover {
    color: var(--primary-color);
}

.checkbox-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.75rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Two-column form layout for larger screens */
.form-two-column {
    max-width: 800px;
}

.form-two-column .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-two-column .form-row .form-group {
    margin-bottom: 0;
}

.form-two-column > .form-group {
    margin-bottom: 2.5rem;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    min-height: 36px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-primary:active {
    transform: scale(0.98);
}

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

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #991b1b;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    min-height: 32px;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-base);
    min-height: 44px;
}

/* ============================================================================
   TABLES
   ============================================================================ */

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.table thead {
    background-color: #e8e8e8;
    border-bottom: 2px solid var(--primary-color);
}

html.dark-mode .table thead {
    background-color: #1a1a1a;
}

.table th {
    padding: 0.75rem 1.25rem;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background-color 0.3s ease;
    height: 50px;
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

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

/* Table action buttons */
.table td form {
    display: inline;
    margin: 0;
    padding: 0;
}

.table td .btn {
    margin: 0;
    vertical-align: middle;
}

/* ============================================================================
   TASKS - MODERN CARD STYLE
   ============================================================================ */

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.task-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.task-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

/* Task Header */
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.task-header-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

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

.task-title-row {
    display: block;
    margin-bottom: 0.5rem;
}

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

.task-date {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.task-info-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.task-number {
    display: inline-block;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 600;
    white-space: nowrap;
}

.task-title {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-due-date-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

.task-due-date-inline i {
    font-size: 0.7rem;
}

.task-priority-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.task-priority-icon.priority-low {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.15);
}

.task-priority-icon.priority-medium {
    color: #f39c12;
    background-color: rgba(243, 156, 18, 0.15);
}

.task-priority-icon.priority-high {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.15);
}

.task-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.task-assignees-compact {
    display: flex;
    gap: 0.25rem;
}

.assignee-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: white;
    font-size: var(--font-size-sm);
    font-weight: 700;
}

.task-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-action-btn:hover {
    color: var(--primary-color);
}

.task-action-delete:hover {
    color: var(--danger-color);
}

/* Task Meta Row (badges) */
.task-meta-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Comments Section */
.task-comments-section {
    padding: 0.75rem 0;
    margin-bottom: 0;
}

.task-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0;
}

.task-toggle-btn:hover {
    color: var(--primary-dark);
}

.task-toggle-btn i {
    transition: transform 0.2s ease;
}

.task-toggle-btn.open i {
    transform: rotate(180deg);
}

.comment-count {
    font-weight: 600;
}

.task-comments {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0;
    padding-left: 0;
}

.task-comment {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--primary-color);
    padding-left: 0.75rem;
    font-size: var(--font-size-base);
    background-color: transparent;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 0;
}

/* Priority-based border colors */
.task-comment[data-priority="low"] {
    border-left-color: #fbc02d;
}

.task-comment[data-priority="medium"] {
    border-left-color: #ff9800;
}

.task-comment[data-priority="high"] {
    border-left-color: #f44336;
}

.task-comment:hover {
    background-color: var(--bg-hover);
}

.comment-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
}

.comment-meta-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.comment-author-info {
    display: contents;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.comment-assigned {
    color: var(--primary-color);
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.comment-content {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: var(--font-size-base);
    flex: 1;
}

.comment-attachments {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.attachment-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

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

/* Comment Form */
.task-comment-form {
    padding-top: 0.75rem;
}

.comment-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}

.comment-priority-select {
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    min-width: 120px;
}

/* Wrapper is layout-only; the button carries the field look so it matches textarea + priority select */
.comment-assign-select {
    display: flex;
    min-width: 150px;
}

.comment-assign-select .assignee-select-btn {
    flex: 1;
    max-width: 220px;
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    background-color: var(--bg-secondary);
    font-size: var(--font-size-base);
    text-align: left;
}

/* Same fixed height for all single-line controls in the comment row */
.comment-textarea,
.comment-priority-select,
.comment-assign-select .assignee-select-btn {
    min-height: 2.75rem;
}

.comment-priority-select,
.comment-assign-select .assignee-select-btn {
    height: 2.75rem;
}

.comment-assign-select[multiple] {
    height: 5.5rem;
}

.comment-textarea {
    flex: 1;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    resize: none;
    transition: all 0.2s ease;
}

.comment-textarea::placeholder {
    color: var(--text-muted);
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--bg-primary);
}

.comment-content-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.comment-priority-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    margin-top: 0.25rem;
}

.priority-badge-low {
    background-color: #fffde7;
    color: #f57f17;
    border: 1px solid #fbc02d;
}

.priority-badge-medium {
    background-color: #fff3e0;
    color: #e65100;
    border: 1px solid #ff9800;
}

.priority-badge-high {
    background-color: #ffebee;
    color: #c62828;
    border: 1px solid #f44336;
}

.comment-submit-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
}

.comment-submit-btn:hover {
    background-color: var(--primary-dark);
}

.comment-submit-btn:active {
    transform: scale(0.98);
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.6rem;
    border-radius: 0.75rem;
    height: 1.5rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: capitalize;
}

.badge-low {
    background-color: rgba(108, 117, 125, 0.2);
    color: var(--text-secondary);
}

.badge-medium {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.badge-high {
    background-color: rgba(220, 53, 69, 0.2);
    color: var(--danger-color);
}

.badge-open {
    background-color: rgba(23, 162, 184, 0.2);
    color: var(--info-color);
}

.badge-in_progress {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.badge-done {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.badge-testen {
    background-color: #8e44ad;
    color: #fff;
}

.badge-einspielen {
    background-color: #f0932b;
    color: #fff;
}

.task-status-control {
    position: relative;
    display: inline-flex;
}

.status-badge-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.status-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    min-width: 140px;
    overflow: hidden;
}

.status-menu.open {
    display: block;
}

.status-menu-item {
    display: block;
    width: 100%;
    padding: 0.4rem 0.75rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    white-space: nowrap;
}

.status-menu-item:hover {
    background-color: var(--bg-secondary);
}

/* Hinweis bei blockiertem Statuswechsel. Absolut positioniert,
   damit die Zeilenhoehe der Liste nicht springt. */
.status-error-hint {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 50;
    white-space: nowrap;
    font-size: 0.75rem;
    color: var(--danger-color);
    background: var(--bg-primary);
    border: 1px solid var(--danger-color);
    border-radius: 3px;
    padding: 0.2rem 0.4rem;
    margin-top: 0.2rem;
}

/* Assignee checkbox dropdown (comment + reply forms) */
.assignee-select {
    position: relative;
    display: inline-block;
}

.assignee-select-btn {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: inherit;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.assignee-select-btn.has-selection {
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.assignee-select-error .assignee-select-btn {
    border-color: var(--priority-high, #db4035);
}

.assignee-select-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    margin-top: 0.25rem;
    min-width: 180px;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.25rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.assignee-select-menu.open {
    display: block;
}

.assignee-select-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    white-space: nowrap;
}

.assignee-select-option:hover {
    background-color: var(--bg-secondary);
}

.assignee-select-option input {
    cursor: pointer;
    margin: 0;
}

.badge-admin {
    background-color: rgba(0, 102, 204, 0.2);
    color: var(--primary-color);
}

.badge-member {
    background-color: rgba(108, 117, 125, 0.2);
    color: var(--text-secondary);
}

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    box-shadow: var(--shadow);
}

.alert-error {
    background-color: rgba(220, 53, 69, 0.1);
    color: #c82333;
    border-left-color: var(--danger-color);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #155724;
    border-left-color: var(--success-color);
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
    border-left-color: var(--warning-color);
}

.alert-info {
    background-color: rgba(23, 162, 184, 0.1);
    color: #0c5460;
    border-left-color: var(--info-color);
}

/* ============================================================================
   DASHBOARD & CARDS
   ============================================================================ */

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: all 0.2s ease;
}

.stat-card:hover {
    border-color: var(--primary-color);
}

.stat-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.dashboard-section {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

/* Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h1 {
    margin: 0;
    font-size: var(--font-size-2xl);
}

.project-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 2rem 0 3rem 0;
}

.info-card {
    background-color: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.info-card p {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: 500;
}

.team-list {
    list-style: none;
    padding: 0;
}

.team-list li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

h1 { font-size: var(--font-size-2xl); font-weight: 700; }
h2 { font-size: var(--font-size-xl); font-weight: 700; }
h3 { font-size: var(--font-size-lg); font-weight: 600; }

/* Dashboard h1 alignment and spacing */
main > h1 {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

p {
    margin: 0;
}

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

.text-secondary {
    color: var(--text-secondary);
}

.link-primary {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

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

.link-secondary {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.link-secondary:hover {
    color: var(--primary-color);
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================================
   LOGIN
   ============================================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem 0;
}

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 420px;
}

.login-box {
    background-color: var(--bg-primary);
    padding: 2.5rem 2rem;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    border: 1px solid var(--border-color);
}

.login-box h1 {
    margin-bottom: 2rem;
    text-align: center;
    font-size: var(--font-size-2xl);
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.login-footer p {
    margin: 0;
}

/* Login ohne Sidebar: Inhalt mittig, Wasserzeichen im Hintergrund (wie my.gymaddic.ch) */
body.login-page .main-content {
    margin-left: 0;
    position: relative;
    z-index: 1;
}

body.login-page .layout-wrapper {
    overflow: hidden;
}

/* Box liegt über dem Wasserzeichen */
body.login-page .login-container {
    position: relative;
    z-index: 1;
}

.login-watermark {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25em;
    font-size: 26vw;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: rgba(0, 0, 0, 0.035);
    transform: rotate(-15deg) scale(1.15);
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
}

html.dark-mode .login-watermark {
    color: rgba(255, 255, 255, 0.035);
}

.login-box .login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: var(--font-size-2xl);
    font-weight: 600;
}

.login-brand i {
    color: var(--primary-color);
    font-size: 1.6rem;
}

.login-submit {
    width: 100%;
    justify-content: center;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
}

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.login-lang {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.login-theme {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--font-size-sm);
    cursor: pointer;
}

.login-theme:hover {
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    .login-watermark {
        font-size: 45vw;
        flex-direction: column;
    }
}

/* ============================================================================
   PAGINATION
   ============================================================================ */

.pagination {
    display: flex;
    gap: 0.5rem;
    margin-top: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination a {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.pagination a:hover:not(.active) {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

.pagination a.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================================================
   TASK DETAILS
   ============================================================================ */

.task-details {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.task-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.meta-item {
    display: flex;
    flex-direction: column;
}

.meta-item .label {
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-item .value {
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.task-description,
.task-assignees,
.task-comments {
    margin-bottom: 0;
}

.task-description h2,
.task-assignees h2,
.task-comments h2 {
    margin-bottom: 1rem;
    font-size: var(--font-size-xl);
}

.task-assignees ul {
    list-style: none;
    padding-left: 0;
}

.task-assignees li {
    padding: 0.75rem 0;
    color: var(--text-secondary);
}

/* ============================================================================
   COMMENTS
   ============================================================================ */

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.comment {
    background-color: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.comment:hover {
    box-shadow: var(--shadow);
}

.comment-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.comment-author {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-date {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.comment-body {
    color: var(--text-secondary);
    line-height: 1.6;
}

.comment-body p {
    margin: 0;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet & Small Devices */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        flex-direction: column;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        z-index: 1000;
    }

    .sidebar.collapsed {
        width: 100%;
        max-height: 0;
    }

    .sidebar.open {
        max-height: 100vh;
    }

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

    .sidebar-nav {
        flex: 1;
        flex-direction: column;
        padding: 0;
    }

    .nav-item {
        padding: 1rem;
        border-left: 3px solid transparent;
        border-bottom: 1px solid var(--border-color);
        height: auto;
        font-size: var(--font-size-base);
    }

    .sidebar-footer {
        border-top: 1px solid var(--border-color);
        border-left: none;
        flex-direction: column;
        padding: 1rem 0;
    }

    .main-content {
        margin-left: 0;
    }

    .main-container {
        padding: 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 1.5rem;
    }

    .task-meta {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .section-header h1 {
        font-size: var(--font-size-xl);
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .table {
        font-size: var(--font-size-sm);
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .form {
        padding: 1.5rem;
    }

    h1 { font-size: var(--font-size-2xl); }
    h2 { font-size: var(--font-size-xl); }
    h3 { font-size: var(--font-size-lg); }
}

/* Mobile Devices */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .navbar-brand a {
        font-size: var(--font-size-lg);
    }

    .dashboard-stats {
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }

    .section-header h1 {
        font-size: var(--font-size-lg);
    }

    .form {
        padding: 1rem;
    }

    .form-group {
        margin-bottom: 1rem;
    }

    .login-box {
        padding: 1.5rem;
    }

    .login-box h1 {
        font-size: var(--font-size-xl);
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group .btn {
        width: 100%;
    }

    main {
        padding: 1rem 0;
    }

    h1 { font-size: var(--font-size-xl); }
    h2 { font-size: var(--font-size-lg); }
}

/* ============================================================================
   SEARCH BAR
   ============================================================================ */
.search-bar {
    margin-bottom: 1rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-input {
    flex: 1;
    max-width: 400px;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-family: inherit;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(219, 64, 53, 0.1);
}

.search-submit {
    padding: 0.625rem 1rem;
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.search-submit:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================================================
   FILTER BAR
   ============================================================================ */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.filter-form {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.filter-select[type="text"] {
    cursor: text;
}

.filter-select::placeholder {
    color: var(--text-muted);
}

/* ============================================================================
   PROJECT INFO ROW
   ============================================================================ */
.project-info-row {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.project-meta-item {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.project-meta-item.text-sm {
    font-size: var(--font-size-sm);
}

/* ============================================================================
   COMMENT FILE INPUT
   ============================================================================ */
.comment-file-input {
    display: none;
}

.comment-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-file-btn:hover {
    color: var(--primary-color);
}

.comment-submit-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-size: 1rem;
    padding: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-submit-btn:hover {
    color: var(--primary-dark);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.comment-actions {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-comment:hover .comment-actions {
    opacity: 1;
}

.comment-edit-btn,
.comment-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0.25rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-edit-btn:hover {
    color: var(--primary-color);
}

.comment-delete-btn:hover {
    color: var(--danger-color);
}

.comment-convert-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.comment-convert-btn:hover {
    color: var(--primary-color);
}

.comment-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    padding: 0.5rem 0;
    width: 100%;
}

.comment-edit-textarea {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    resize: vertical;
}

.comment-edit-assign-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    min-width: 150px;
    min-height: 2.5rem;
}

.comment-edit-priority-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-size-base);
    min-width: 120px;
    min-height: 2.5rem;
}

.comment-edit-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ============================================================================
   TABLE ACTION ICONS
   ============================================================================ */
.table td.table-actions {
    text-align: center;
    vertical-align: middle;
}

.table-actions {
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    transition: all 0.2s ease;
    padding: 0;
}

.action-icon:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.action-icon-delete:hover {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

/* ============================================================================
   COMMENTS CONTAINER & TOGGLES
   ============================================================================ */

.task-comments-container {
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.task-toggle-comments-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    font-weight: 600;
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    padding: 0.5rem 0;
    width: 100%;
}

.task-toggle-comments-btn:hover {
    color: var(--primary-dark);
}

.task-toggle-comments-btn i {
    transition: transform 0.2s ease;
}

.task-toggle-comments-btn.open i {
    transform: rotate(180deg);
}

.task-comments-content {
    display: block;
    animation: slideDown 0.2s ease;
}

.task-comments-content.collapsed {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

/* ============================================================================
   TASK TOPIC & TYPE & ATTACHMENTS
   ============================================================================ */

.task-topic {
    display: inline;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.task-topic::before {
    content: "\2013";
    margin: 0 0.25rem;
}

.task-due-date {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-left: 0.75rem;
}

.task-due-date i {
    font-size: 0.7rem;
}

.task-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.75rem;
}

/* Type badge colors */
.badge-type-fehler {
    background-color: rgba(220, 53, 69, 0.2);
    color: var(--danger-color);
}

.badge-type-besprechen {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

.badge-type-notiz {
    background-color: rgba(108, 117, 125, 0.2);
    color: var(--text-secondary);
}

.badge-type-aufgabe {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.badge-type-anfrage {
    background-color: rgba(23, 162, 184, 0.2);
    color: var(--info-color);
}

.badge-type-verbesserung {
    background-color: rgba(75, 192, 192, 0.2);
    color: #4bc0c0;
}

/* Task Attachments */
.task-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* Attachments sit outside .task-comments-container, so hide them with the card */
.task-card:not(.expanded) .task-attachments {
    display: none;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary-color);
    text-decoration: none;
    font-size: var(--font-size-sm);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.attachment-link:hover {
    background-color: rgba(219, 64, 53, 0.1);
    color: var(--primary-dark);
}

.attachment-link i {
    font-size: 0.7rem;
}

/* Task Description */
.task-description-section {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.task-description {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.description-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.description-content {
    color: var(--text-color);
    font-size: var(--font-size);
    line-height: 1.5;
    /* Umbrüche kommen als <br> aus renderLinks(); pre-wrap würde sie verdoppeln */
    word-wrap: break-word;
}

/* Integrations-Metadaten (Umgebung, Seite, Browser) */
.description-meta {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.description-meta a {
    color: inherit;
}

/* Activity Badges */
.badge-activity-taskcreated {
    background-color: rgba(40, 167, 69, 0.2);
    color: var(--success-color);
}

.badge-activity-statuschanged {
    background-color: rgba(23, 162, 184, 0.2);
    color: var(--info-color);
}

.badge-activity-commented {
    background-color: rgba(100, 100, 100, 0.2);
    color: var(--text-secondary);
}

.badge-activity-attachmentadded {
    background-color: rgba(150, 150, 150, 0.2);
    color: #999;
}

/* ============================================================================
   COMMENT READ/UNREAD SYSTEM
   ============================================================================ */

/* Badge showing unread count in navigation */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    margin-left: 0.5rem;
    padding: 0 0.35rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

/* Read/Unread toggle button in comments */
.comment-read-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.comment-read-btn:hover {
    background-color: rgba(219, 64, 53, 0.1);
    color: var(--primary-color);
}

.comment-read-btn.read {
    color: var(--success-color);
}

.comment-read-btn.read:hover {
    background-color: rgba(46, 204, 113, 0.1);
}

.comment-read-btn.unread {
    color: var(--text-secondary);
}

.comment-read-btn.unread:hover {
    color: var(--primary-color);
}

.comment-read-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
    color: #95a5a6; /* gray: nobody read yet */
    cursor: default;
}

.comment-read-status.read-partial {
    color: #f39c12;
}

.comment-read-status.read-all {
    color: #2ecc71;
}

.comment-read-count {
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Recipient badges show who has read: unread ones are faded + dashed */
.user-badge.recipient-unread {
    opacity: 0.45;
    background-color: transparent;
    border: 1px dashed currentColor;
}

.comment-read-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.comment-read-toggle:hover {
    color: var(--primary-color);
}

/* Unread comments widget on dashboard */
.unread-comments-widget {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.unread-comment-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    transition: all 0.2s ease;
}

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

.unread-comment-item:hover {
    background-color: var(--bg-hover);
}

.comment-task-title {
    margin-bottom: 0.35rem;
}

.comment-task-title a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: var(--font-size-base);
}

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

.comment-content-preview {
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    margin-bottom: 0.35rem;
    line-height: 1.4;
}

.comment-meta {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

/* Highlight unread comments in task list */
.task-comment.unread {
    background-color: rgba(219, 64, 53, 0.05);
}

/* Parent comment styling */
.parent-comment {
    border-left: 3px solid var(--border-color);
    padding-left: 1rem;
    margin-bottom: 1rem;
}

/* Child comment (reply) styling */
.child-comment {
    margin-left: 2rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    border-left: 2px solid var(--border-color-light, rgba(0,0,0,0.1));
    font-size: 0.95rem;
    background-color: var(--bg-secondary, rgba(0,0,0,0.02));
    border-radius: 4px;
}

/* Erledigte Unteraufgaben: durchgestrichen und gedaempft, aber weiterhin lesbar */
.comment-done .comment-text {
    text-decoration: line-through;
}

.comment-done {
    opacity: 0.6;
}

/* Der Erledigt-Button selbst bleibt voll sichtbar, sonst findet niemand
   den Weg zurueck auf "offen". */
.comment-done .comment-done-toggle {
    opacity: 1;
}

.comment-done-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.comment-done-toggle .done-active {
    color: var(--primary-color);
}

/* Reply button */
.reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

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

.reply-btn i {
    font-size: 0.75rem;
}

/* Reply form container */
.reply-form-container {
    margin-left: 2rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background-color: var(--bg-secondary, rgba(0,0,0,0.02));
    border-radius: 4px;
    border-left: 2px solid var(--primary-color);
}

.reply-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reply-textarea {
    min-height: 60px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
}

.reply-assigned {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.reply-assigned[multiple] {
    height: 4.5rem;
}

.reply-priority {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.reply-form-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.reply-file-input {
    display: none;
}

.reply-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reply-file-btn:hover {
    color: var(--primary-color);
}

.reply-form-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.cancel-reply {
    background: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.cancel-reply:hover {
    background-color: var(--bg-secondary, rgba(0,0,0,0.05));
}

/* Sticky Task Filter Bar */
.task-filter-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-primary);
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    padding: 10px 16px;
    margin-bottom: 1rem;
}

.task-filter-row-1 {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 8px;
    gap: 1rem;
}

/* Status Tabs */
.status-tabs {
    display: flex;
    gap: 3px;
    align-items: center;
}

.status-tab {
    padding: 6px 12px;
    border: none;
    border-radius: 5px 5px 0 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.status-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.status-tab.active {
    background: var(--primary-color);
    color: white;
}

.status-tab-count {
    background: rgba(255,255,255,0.3);
    padding: 1px 5px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.status-tab.active .status-tab-count {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* Sort Control */
.sort-control {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.sort-control label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Filter Row 2 */
.task-filter-row-2 {
    display: flex;
    gap: 6px;
    align-items: center;
    background: var(--bg-secondary);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.filter-search {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.85rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    flex: 0 1 220px;
}

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

/* Toggle-Filter (Ungelesen / Mir zugewiesen) */
.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s, color 0.2s;
}

.filter-toggle:hover {
    border-color: var(--primary-color);
}

.filter-toggle.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-toggle-input {
    margin: 0;
    accent-color: var(--primary-color);
}

.filter-reset {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.2s;
}

.filter-reset:hover {
    color: var(--primary-dark);
}

/* Task Collapse Button */
.task-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.task-collapse-btn:hover {
    color: var(--primary-color);
}

.task-collapse-btn i {
    transition: transform 0.2s ease;
}

.task-card.expanded .task-collapse-btn i {
    transform: rotate(180deg);
}

/* Collapsed Comments Container */
.task-comments-container.collapsed {
    display: none;
}

.task-comments-container {
    display: block;
}

.comment-move {
    position: relative;
    display: inline-block;
}

.comment-move-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.comment-move-btn:hover {
    color: var(--primary-color);
}

.comment-move-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 100;
    min-width: 260px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
}

.comment-move-menu.open {
    display: block;
}

.comment-move-search {
    width: 100%;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.comment-move-results {
    max-height: 240px;
    overflow-y: auto;
    margin-top: 0.35rem;
}

.comment-move-result {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
}

.comment-move-result:hover {
    background: var(--bg-hover);
}

.comment-move-project {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.comment-move-empty {
    padding: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Glossary tooltips (renderGlossary in config/app.php) */
abbr.glossary-term {
    text-decoration: underline dotted;
    text-decoration-color: var(--text-secondary);
    text-underline-offset: 2px;
    cursor: help;
}

/* ===== Task header: two lines (info / byline) + controls ===== */
.task-header-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
}

.task-info-inline {
    flex: none;
    width: 100%;
}

.task-byline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.task-byline .task-date {
    margin-right: 0.25rem;
}

.task-byline-arrow,
.comment-assigned-arrow {
    color: var(--text-muted);
    cursor: default;
}

.task-header-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Number/title click = quick filter toggle */
a.task-filter-link {
    color: inherit;
    text-decoration: none;
    border-radius: 3px;
    transition: color 0.15s ease;
}

a.task-number.task-filter-link {
    color: var(--text-muted);
}

a.task-filter-link:hover {
    color: var(--primary-color);
    text-decoration: underline dotted;
    text-underline-offset: 3px;
}

a.task-filter-link.active {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Inline-editable type/priority (reuse the status menu) */
.field-badge-btn {
    border: none;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}

.field-badge-btn:hover {
    filter: brightness(1.15);
}

.badge-type-none {
    background: transparent;
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
}

.status-menu.status-menu-right {
    left: auto;
    right: 0;
}

.priority-text-high { color: #e74c3c; }
.priority-text-medium { color: #f39c12; }
.priority-text-low { color: #3498db; }

/* ===== Initials badges (userBadge() in config/app.php) ===== */
.user-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.3rem;
    border-radius: 0.75rem;
    background-color: rgba(219, 64, 53, 0.15);
    color: var(--primary-color);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: default;
    flex-shrink: 0;
}

/* Author: neutral, assignees: accent (reads as author -> recipient) */
.user-badge.task-author,
.user-badge.comment-author {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 0.6875rem;
}

/* External reporter (integrations) without a task-app user */
.external-reporter {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: default;
}

.external-reporter-tag {
    padding: 0 0.35rem;
    border: 1px dashed var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Melder-Antworten: Link-Knoepfe, Schalter "An Melder senden", Kennzeichnung */
.reporter-link-actions {
    display: inline-flex;
    gap: 0.1rem;
}

.reporter-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.15rem 0.25rem;
}

.reporter-link-btn:hover,
.reporter-link-btn.copied {
    color: var(--primary-color);
}

.comment-to-reporter {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.comment-to-reporter:has(input:checked) {
    color: var(--primary-color);
}

.reporter-comment-badge {
    padding: 0 0.35rem;
    border-radius: 0.5rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.reporter-comment-badge.to {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.reporter-comment-badge.from {
    border: 1px dashed var(--border-color);
    color: var(--text-secondary);
}

/* "an Melder" am Zeilenende, abgesetzt von den internen Empfaengern */
.reporter-sent {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.35rem;
    padding-left: 0.6rem;
    border-left: 1px solid var(--border-color);
}

.reporter-resend-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
}

.reporter-resend-btn:hover {
    color: var(--primary-color);
    background: var(--bg-hover);
}

.reporter-resend-btn.is-busy i {
    animation: reporter-resend-spin 0.8s linear infinite;
}

.reporter-resend-btn.is-ok {
    color: var(--success-color);
}

.reporter-resend-btn.is-fail {
    color: var(--danger-color);
}

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

.comment-assigned {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== Comment threads: grouped, focus on hover ===== */
.task-comments {
    gap: 1rem;
}

.parent-comment {
    margin-bottom: 0;
}

.child-comment {
    margin-top: 0.35rem;
}

/* Hovering a thread (answer + its sub-answers) fades the other threads */
.task-comments > .parent-comment {
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.task-comments:has(> .parent-comment:hover) > .parent-comment:not(:hover) {
    opacity: 0.4;
}

/* Done entries: readable again on hover */
.comment-done:hover {
    opacity: 1;
}

.comment-done:hover .comment-text {
    text-decoration: none;
}

/* ===== Task header hierarchy: title line + quiet meta line ===== */
.task-card {
    padding: 0.75rem 1rem;
}

.task-info-inline {
    gap: 0.6rem;
}

.task-info-inline .task-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.task-info-inline .task-topic {
    font-size: var(--font-size-base);
    margin-left: -0.35rem;
}

.task-byline {
    gap: 0.4rem;
}

.task-byline-sep {
    color: var(--border-color);
    user-select: none;
}

.task-byline-people {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.task-byline .user-badge {
    min-width: 1.35rem;
    height: 1.35rem;
    font-size: 0.625rem;
}

/* Number and project: plain text, underline only on hover/active */
.task-byline a.task-filter-link,
.task-byline a.task-number.task-filter-link {
    color: var(--text-secondary);
    font-weight: 500;
}

.task-byline a.task-filter-link:hover,
.task-byline a.task-filter-link.active {
    color: var(--primary-color);
}

.task-byline .task-due-date-inline {
    color: var(--text-muted);
}

.task-byline .task-due-date-inline.overdue {
    color: var(--danger-color);
    font-weight: 600;
}

/* Status + priority as a fixed-width column so cards line up */
.task-header-controls .status-badge-btn,
.task-header-controls > .badge {
    min-width: 7.5rem;
    justify-content: center;
}

/* Attachment preview modal */
.attachment-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: rgba(0, 0, 0, 0.7);
}

.attachment-modal[hidden] {
    display: none;
}

.attachment-modal-open-body {
    overflow: hidden;
}

.attachment-modal-dialog {
    display: flex;
    flex-direction: column;
    width: min(1100px, 100%);
    max-height: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.attachment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.attachment-modal-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.attachment-modal-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.attachment-modal-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
}

.attachment-modal-action:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.attachment-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: auto;
    background-color: var(--bg-secondary);
}

.attachment-modal-body.is-image img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 7rem);
    object-fit: contain;
}

.attachment-modal-body.is-frame iframe {
    width: 100%;
    height: calc(100vh - 7rem);
    border: 0;
    background-color: #fff;
}

.attachment-modal-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem 1.5rem;
    color: var(--text-secondary);
    text-align: center;
}

.attachment-modal-fallback i {
    font-size: 2.5rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .attachment-modal {
        padding: 0.5rem;
    }
}

/* ===== Integrations ===== */
.integration-credentials {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    max-width: 640px;
}

.integration-credentials h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.integration-code {
    display: block;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    overflow-x: auto;
}

.integration-secret-row {
    display: flex;
    gap: 0.5rem;
}

.integration-secret-row input {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.85rem;
}

/* Log viewer */
.log-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.log-filters > * {
    min-width: 0;
    max-width: 100%;
}

.log-filters input[name="q"] {
    flex: 1 1 220px;
}

.log-summary {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.log-entry {
    --log-color: #95a5a6;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--log-color);
    border-radius: 4px;
    background: var(--bg-primary);
}

.log-level-fatal { --log-color: #c0392b; }
.log-level-error { --log-color: #e74c3c; }
.log-level-warning { --log-color: #f39c12; }
.log-level-notice,
.log-level-deprecated { --log-color: #3498db; }
.log-level-info { --log-color: #2ecc71; }

.log-entry summary {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    list-style: none;
}

.log-entry summary::-webkit-details-marker {
    display: none;
}

.log-level {
    flex-shrink: 0;
    width: 5.5rem;
    color: var(--log-color);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.log-msg {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8125rem;
    overflow-wrap: anywhere;
}

.log-meta {
    display: inline-flex;
    flex-shrink: 0;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.log-version,
.log-count {
    padding: 0 0.375rem;
    border-radius: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    font-weight: 600;
}

.log-detail {
    padding: 0 0.75rem 0.75rem;
}

.log-pre {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 320px;
    overflow: auto;
}

.log-facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
}

.log-facts dt {
    color: var(--text-secondary);
}

.log-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .log-filters input[name="q"] {
        flex-basis: 100%;
    }

    .log-entry summary {
        flex-wrap: wrap;
        gap: 0.25rem 0.75rem;
    }

    .log-msg {
        flex-basis: 100%;
        order: 3;
    }
}

/* ===== Browser push toggle (sidebar footer) ===== */
.push-toggle[hidden] {
    display: none;
}

.push-toggle.active i {
    color: var(--primary-color);
}

.push-toggle:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Bitte testen (Status 'testen', nur fuer Tester) */
.test-request-bar {
    margin: 0.5rem 0;
    padding: 0.4rem 0.75rem;
    border-left: 3px solid #8e44ad;
    background: var(--bg-secondary);
    border-radius: 4px;
}

/* Zugeklappte Aufgabe: Testleiste erst beim Aufklappen zeigen */
.task-card:not(.expanded) .test-request-bar {
    display: none;
}

.test-request-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.test-request-label {
    font-weight: 600;
    margin-right: auto;
}

.test-result-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.test-notify-reporter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.test-result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.test-result-error {
    color: var(--danger-color);
    font-size: 0.85rem;
}

.test-result-form[hidden],
.test-notify-reporter[hidden] {
    display: none;
}

/* Kompakte Unteraufgaben */
.task-comment[hidden],
.subtask-toggle[hidden] {
    display: none;
}

.subtask-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.35rem 0.25rem;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

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

.subtask-toggle i {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.subtask-toggle.open i {
    transform: rotate(180deg);
}

/* Kopfzeile mit globaler Suche (und Menue-Knopf auf dem Handy) */
.app-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.5rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.app-header-menu {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
}

.app-search {
    position: relative;
    flex: 1;
    max-width: 480px;
}

.app-search i {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.app-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px; /* verhindert Zoom beim Fokus auf iOS */
}

@media (max-width: 768px) {
    .app-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .app-header-menu {
        display: inline-flex;
    }

    .app-search {
        max-width: none;
    }
}

/* ============================================================================
   HANDY-LAYOUT
   Flex-Kinder schrumpfen standardmaessig nicht unter ihre Inhaltsbreite
   (min-width: auto). Ohne min-width: 0 dehnt breiter Inhalt (nowrap-Zeilen,
   Tabellen, Filterleisten) .main-content ueber den Bildschirm hinaus - die
   Seite wirkt dann rechts abgeschnitten.
   ============================================================================ */
.main-content,
.main-container {
    min-width: 0;
}

@media (max-width: 768px) {
    .main-container {
        padding: 0.75rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    /* Tabellen scrollen in sich statt die Seite zu verbreitern */
    .table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Filterleiste: Tabs horizontal scrollbar, Filter umbrechen */
    .task-filter-bar {
        position: static;
    }

    .task-filter-row-1 {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .status-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .status-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .task-filter-row-2 {
        flex-wrap: wrap;
    }

    .task-filter-row-2 .filter-select,
    .task-filter-row-2 .filter-toggle {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
    }

    /* Aufgabenkarte: Titel volle Breite, Status/Aktionen darunter */
    .task-card {
        padding: 0.75rem;
    }

    .task-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .task-header-meta {
        flex: 1 1 calc(100% - 48px);
    }

    .task-header-controls {
        margin-left: 40px;
        flex-wrap: wrap;
    }

    .task-actions {
        margin-left: auto;
    }

    .task-title {
        overflow-wrap: anywhere;
    }

    /* Antwortfeld: Textarea volle Breite, Bedienelemente darunter */
    .comment-input-wrapper {
        flex-wrap: wrap;
    }

    .comment-input-wrapper .comment-textarea {
        flex: 1 1 100%;
    }

    .comment-assign-select,
    .comment-priority-select {
        min-width: 0;
        flex: 1 1 auto;
    }

    .comment-textarea,
    .comment-priority-select,
    .comment-assign-select .assignee-select-btn {
        font-size: 16px; /* verhindert Zoom beim Fokus auf iOS */
    }

    /* Kommentare: lange Woerter/Links umbrechen */
    .task-comment,
    .task-description {
        overflow-wrap: anywhere;
    }

    /* Testen-Leiste: Buttons nicht auf volle Breite ziehen */
    .test-request-bar .btn {
        width: auto;
    }

    .status-tab,
    .task-action-btn,
    .subtask-toggle {
        min-height: 40px;
    }
}

@media (max-width: 768px) {
    /* Offene Sidebar: scrollbar (Push-Knopf erreichbar), nicht unter der
       Statusleiste des iPhones */
    .sidebar.open {
        overflow-y: auto;
        padding-top: env(safe-area-inset-top, 0px);
    }
}

/* Kunden-/Projektzeile in der Aufgabenliste */
.task-scope-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.task-scope-customer {
    font-weight: 600;
    margin-right: 0.5rem;
}

.scope-chip {
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
}

.scope-chip:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.scope-chip.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.scope-close {
    margin-left: auto;
    color: var(--text-muted);
    text-decoration: none;
}

/* Kartenkopf auf einer Zeile (Desktop); bricht bei Platzmangel um */
.task-header-meta {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 0.75rem;
    row-gap: 0.25rem;
}

.task-info-inline {
    width: auto;
    flex: 0 1 auto;
}

@media (max-width: 768px) {
    .task-header-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .task-info-inline {
        width: 100%;
    }
}

/* Dark Mode: Seite dunkler als Karten/Leisten, klarere Kanten */
html.dark-mode {
    --border-color: #3d3d3d;
    --text-secondary: #c2c2c2;
    --text-muted: #8f8f8f;
}

html.dark-mode .layout-wrapper {
    background-color: #141414;
}

/* Antwortfeld erst auf Klick (rotes Plus im Kartenkopf) */
.task-comment-form[hidden] {
    display: none;
}

.task-add-comment-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 0.25rem;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.task-add-comment-btn:hover {
    background: var(--primary-dark);
}

/* Weniger Luft ueber dem Seitentitel */
.main-container {
    padding-top: 1.25rem;
}

.section-header {
    margin-top: 0;
    margin-bottom: 1.25rem;
}

/* Kopfzeile und Sidebar-Logo gleich hoch (Desktop) */
@media (min-width: 769px) {
    .sidebar-brand,
    .app-header {
        box-sizing: border-box;
        height: 68px;
        padding-top: 0;
        padding-bottom: 0;
        align-items: center;
    }
}

/* Aufgabennummer vor dem Titel */
.task-info-inline .task-number {
    margin-right: 0.15rem;
}

.toggle-all-tasks {
    margin-right: 0.75rem;
}

@media (max-width: 768px) {
    .toggle-all-tasks {
        width: auto;
    }
}

/* Fehlerprotokolle: Uebersicht, Export, Leeren */
.log-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.log-header-actions .inline-form,
.log-cleared-info .inline-form {
    display: inline;
    margin: 0;
}

.log-cleared-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--warning-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.log-cleared-info .btn-link {
    border: none;
    background: none;
    padding: 0;
    color: var(--link-color);
    cursor: pointer;
    text-decoration: underline;
    font-size: inherit;
}

.log-copy-feedback {
    position: fixed;
    right: 1.5rem;
    bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    z-index: 2000;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 0.85rem;
}

.log-copy-one {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.25rem;
}

.log-copy-one:hover {
    color: var(--primary-color);
}

.log-overview-customer {
    margin-bottom: 1.5rem;
}

.log-overview-customer h2 {
    font-size: var(--font-size-lg);
    margin-bottom: 0.5rem;
}

.log-overview-customer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.log-overview-customer li {
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .log-header-actions .btn {
        width: auto;
    }
}

/* Eingeklappte Sidebar: Titel beim Ueberfahren neben dem Symbol zeigen */
@media (min-width: 769px) {
    .sidebar.collapsed {
        overflow: visible;
    }

    .sidebar.collapsed .nav-item {
        position: relative;
    }

    .sidebar.collapsed .nav-item:hover .nav-text,
    .sidebar.collapsed .nav-item:focus-visible .nav-text {
        display: block;
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        padding: 0.35rem 0.6rem;
        border-radius: 4px;
        background: var(--text-primary);
        color: var(--bg-primary);
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        pointer-events: none;
        z-index: 1100;
    }
}

/* Melder-Seite (oeffentlich, ohne Navigation) */
.reporter-body {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
}

.reporter-page {
    max-width: 40rem;
    margin: 0 auto;
    padding: max(1.25rem, env(safe-area-inset-top, 0px)) 1rem max(2rem, env(safe-area-inset-bottom, 0px));
    display: grid;
    gap: 1rem;
}

.reporter-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.reporter-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 600;
    font-size: var(--font-size-lg);
    color: var(--text-primary);
}

.reporter-logo {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.reporter-head-right {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.reporter-theme {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
}

.reporter-theme:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.reporter-theme svg {
    width: 1rem;
    height: 1rem;
}

.reporter-theme .icon-sun,
html.dark-mode .reporter-theme .icon-moon {
    display: none;
}

html.dark-mode .reporter-theme .icon-sun {
    display: block;
}

.reporter-status {
    padding: 0.2rem 0.65rem;
    border-radius: 1rem;
    font-size: var(--font-size-sm);
    font-weight: 600;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    white-space: nowrap;
}

.reporter-status-working { background: rgba(52, 152, 219, 0.12); color: var(--info-color); }
.reporter-status-testing { background: rgba(243, 156, 18, 0.15); color: #b9770e; }
.reporter-status-done { background: rgba(46, 204, 113, 0.15); color: #1e8449; }

.reporter-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: grid;
    gap: 0.6rem;
}

.reporter-card h2 {
    margin: 0;
    font-size: var(--font-size-lg);
}

.reporter-label,
.reporter-msg-meta,
.reporter-empty {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.reporter-title {
    margin: 0;
    font-size: var(--font-size-xl);
    overflow-wrap: anywhere;
}

.reporter-text {
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.reporter-notice {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: rgba(46, 204, 113, 0.12);
    color: #1e8449;
}

.reporter-notice.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.reporter-thread {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.6rem;
}

.reporter-msg {
    padding: 0.65rem 0.8rem;
    border-radius: 0.5rem;
    background: var(--bg-tertiary);
    max-width: 90%;
}

.reporter-msg.mine {
    justify-self: end;
    background: rgba(219, 64, 53, 0.08);
}

.reporter-reply,
.reporter-test-fail form {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.reporter-reply label,
.reporter-test-fail label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.reporter-page textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem;
    font: inherit;
    font-size: 16px; /* iOS zoomt sonst beim Fokus */
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    resize: vertical;
}

.reporter-file {
    display: grid;
    gap: 0.25rem;
}

.reporter-file input {
    font-size: 16px;
}

.reporter-page .btn {
    min-height: 44px;
    justify-content: center;
    touch-action: manipulation;
}

.reporter-test {
    border-color: var(--warning-color);
}

.reporter-test p {
    margin: 0;
}

.reporter-test-pass .btn {
    width: 100%;
}

.reporter-test-fail summary {
    list-style: none;
    width: 100%;
    box-sizing: border-box;
    cursor: pointer;
}

.reporter-test-fail summary::-webkit-details-marker {
    display: none;
}

.reporter-gone {
    text-align: center;
    margin-top: 3rem;
}

/* Zustand */
.health-stale,
.health-notice {
    padding: 0.6rem 0.9rem;
    border-radius: 0.4rem;
    background: rgba(243, 156, 18, 0.12);
    color: #9a6400;
    margin: 0 0 1rem;
}

.health-notice {
    background: rgba(46, 204, 113, 0.12);
    color: #1e8449;
}

.health-notice.error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger-color);
}

.health-customer {
    margin-bottom: 1.5rem;
}

.health-customer h2,
.health-group h2 {
    font-size: var(--font-size-lg);
    margin-bottom: 0.5rem;
}

.health-projects {
    list-style: none;
    padding: 0;
    margin: 0;
}

.health-project {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--border-color);
}

.health-domains {
    font-size: var(--font-size-sm);
    overflow-wrap: anywhere;
}

.health-counts {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-left: auto;
}

.health-count {
    font-size: 0.75rem;
    padding: 0.05rem 0.45rem;
    border-radius: 0.5rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    white-space: nowrap;
}

.health-checked {
    font-size: 0.75rem;
}

.health-ampel {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex: none;
    vertical-align: middle;
}

.health-ampel-rot { background: var(--danger-color); }
.health-ampel-gelb { background: var(--warning-color); }
.health-ampel-gruen { background: var(--success-color); }

.health-meta {
    margin: -0.5rem 0 1rem;
}

.health-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.health-filter a {
    padding: 0.25rem 0.7rem;
    border-radius: 1rem;
    color: var(--text-secondary);
    text-decoration: none;
}

.health-filter a.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.health-group {
    margin-bottom: 1.5rem;
}

.health-logs-link {
    font-size: var(--font-size-sm);
    font-weight: normal;
    margin-left: 0.5rem;
}

.health-finding {
    border-bottom: 1px solid var(--border-color);
}

.health-finding summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.6rem;
    padding: 0.5rem 0;
    cursor: pointer;
    list-style: none;
}

.health-finding summary::-webkit-details-marker {
    display: none;
}

.health-finding-title {
    flex: 1 1 16rem;
    overflow-wrap: anywhere;
}

.health-finding-domain {
    font-size: var(--font-size-sm);
}

.health-finding-body {
    padding: 0 0 0.75rem 0.5rem;
    font-size: var(--font-size-sm);
}

.health-finding-body code {
    overflow-wrap: anywhere;
}

.health-detail {
    white-space: normal;
    overflow-wrap: anywhere;
}

.health-sev {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.05rem 0.4rem;
    border-radius: 0.5rem;
    white-space: nowrap;
}

.health-sev-kritisch { background: var(--danger-color); color: #fff; }
.health-sev-hoch { background: rgba(243, 156, 18, 0.2); color: #9a6400; }
.health-sev-mittel { background: var(--bg-tertiary); color: var(--text-secondary); }
.health-sev-niedrig { border: 1px dashed var(--border-color); color: var(--text-muted); }

.health-actions,
.health-ignore,
.health-domain,
.health-move,
.health-hide {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.health-actions {
    gap: 0.75rem;
}

.health-ignore input[type="text"] {
    min-width: 12rem;
    max-width: 100%;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.3rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.health-domain {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 0.5rem 1rem;
}

.health-domain > span {
    font-weight: 600;
    min-width: 10rem;
}

.health-move select {
    max-width: 14rem;
}

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

@media (max-width: 600px) {
    .health-counts {
        margin-left: 0;
    }
}

/* ============================================================================
   NEUE AUFGABENLISTE (.liste-neu, vorerst per ?liste=neu fuer Admins)
   Flache Bloecke, feste Spalten, Rot nur fuer die Hauptaktion.
   ============================================================================ */
.tasks-list.liste-neu {
    --ln-cols: 28px 52px minmax(0, 1fr) 160px 240px 150px 92px;
    --ln-inset: calc(0.75rem + 28px + 52px + 1.5rem);
    --ln-violet: #8e44ad;
    gap: 6px;
}

html.dark-mode .tasks-list.liste-neu {
    --ln-violet: #b294f0;
}

.liste-neu .task-list-head,
.liste-neu .task-row {
    display: grid;
    grid-template-columns: var(--ln-cols);
    align-items: center;
    column-gap: 0.75rem;
}

.liste-neu .task-list-head {
    padding: 0 0.75rem;
    height: 26px;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.liste-neu .task-card {
    padding: 0;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    gap: 0;
}

.liste-neu .task-card:hover {
    border-color: var(--border-color);
    box-shadow: none;
}

.liste-neu .task-card.expanded {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.liste-neu .task-row {
    margin: 0;
    padding: 0.5rem 0.75rem;
    min-height: 54px;
    gap: 0 0.75rem;
}

.liste-neu .task-card.expanded > .task-row {
    border-bottom: 1px solid var(--border-color);
}

.liste-neu .task-collapse-btn i {
    transition: transform 0.15s ease;
}

.liste-neu .task-card.expanded .task-collapse-btn i {
    transform: rotate(90deg);
}

.liste-neu .task-row > .task-number {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.liste-neu .task-row > .task-number:hover,
.liste-neu .task-row > .task-number.active {
    color: var(--primary-color);
}

.liste-neu .task-row-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.liste-neu .task-row-title {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    min-width: 0;
}

.liste-neu .task-row-title .task-title {
    font-size: var(--font-size-base);
    font-weight: 600;
}

.liste-neu .task-row-title .task-topic {
    color: var(--text-secondary);
    white-space: nowrap;
}

.liste-neu .task-row-sub {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.15rem 0.7rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Art als kleiner Punkt + Text statt Pille */
.liste-neu .task-row-sub .task-type.badge {
    height: auto;
    padding: 0;
    background: none;
    font-size: 0.75rem;
    font-weight: 600;
    gap: 0.3rem;
}

.liste-neu .task-row-sub .task-type.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.liste-neu .task-row-sub .task-type.badge-type-none {
    color: var(--text-muted);
    font-weight: 400;
}

.liste-neu .task-row-sub .task-date {
    font-size: 0.75rem;
}

.liste-neu .task-row-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 16rem;
    color: var(--text-secondary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.liste-neu .task-row-attachment:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.liste-neu .task-row-project {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--font-size-sm);
}

.liste-neu .task-row-project a {
    color: var(--text-secondary);
    text-decoration: none;
}

.liste-neu .task-row-project a:hover,
.liste-neu .task-row-project a.active {
    color: var(--primary-color);
}

.liste-neu .task-row-people {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: hidden;
}

.liste-neu .task-row-people > * {
    flex-shrink: 0;
}

.liste-neu .task-row-people > .external-reporter {
    flex-shrink: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.liste-neu .task-row-people .user-badge {
    min-width: 1.4rem;
    height: 1.4rem;
    font-size: 0.625rem;
}

.liste-neu .task-row-people .external-reporter {
    min-width: 0;
}

.liste-neu .task-row-people .reporter-link-actions {
    display: inline-flex;
}

/* Status als Punkt + Text */
.liste-neu .task-header-controls {
    justify-content: flex-start;
    gap: 0.35rem;
}

.liste-neu .task-header-controls .status-badge-btn,
.liste-neu .task-header-controls > .badge {
    min-width: 0;
    justify-content: flex-start;
    gap: 0.4rem;
    padding: 0 0.4rem;
    background: transparent;
    font-weight: 600;
}

.liste-neu .task-header-controls .status-badge-btn:hover {
    background: var(--bg-hover);
}

.liste-neu .task-header-controls .badge::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.liste-neu .task-header-controls .badge-open { color: var(--info-color); }
.liste-neu .task-header-controls .badge-in_progress { color: #c99400; }
.liste-neu .task-header-controls .badge-testen { color: var(--ln-violet); }
.liste-neu .task-header-controls .badge-einspielen { color: #e67e22; }
.liste-neu .task-header-controls .badge-done { color: var(--success-color); }

.liste-neu .task-priority-icon {
    width: 1.35rem;
    height: 1.35rem;
    background: transparent;
    font-size: 0.7rem;
}

/* Aktionen ruhig, erst beim Ueberfahren deutlich */
.liste-neu .task-actions {
    justify-content: flex-end;
    gap: 0.1rem;
}

.liste-neu .task-actions .task-add-comment-btn,
.liste-neu .task-actions .task-action-btn {
    width: 28px;
    height: 28px;
    margin: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.liste-neu .task-actions .task-add-comment-btn:hover,
.liste-neu .task-actions .task-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.liste-neu .task-actions .task-action-delete:hover {
    color: var(--danger-color);
}

@media (hover: hover) {
    .liste-neu .task-actions {
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .liste-neu .task-card:hover .task-actions,
    .liste-neu .task-card:focus-within .task-actions,
    .liste-neu .task-card.expanded .task-actions {
        opacity: 1;
    }
}

/* Inhalt der aufgeklappten Aufgabe an der Titelspalte ausrichten */
.liste-neu .task-card > .test-request-bar,
.liste-neu .task-card > .task-comments-container {
    margin-left: var(--ln-inset);
    margin-right: 0.75rem;
}

.liste-neu .task-comments-container {
    border-top: none;
    padding-top: 0.25rem;
    padding-bottom: 0.75rem;
}

.liste-neu .task-comments-container.collapsed {
    padding: 0;
}

/* Bitte testen: dezenter Rahmen, gehoert zur Aufgabe */
.liste-neu .test-request-bar {
    margin-top: 0.85rem;
    margin-bottom: 0.5rem;
    padding: 0.35rem 0.4rem 0.35rem 0.85rem;
    border: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
}

.liste-neu .test-request-row {
    gap: 0.5rem 0.75rem;
}

.liste-neu .test-request-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-right: 0;
    color: var(--ln-violet);
}

.liste-neu .test-request-label i {
    display: none;
}

.liste-neu .test-request-label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.liste-neu .test-request-question {
    margin-right: auto;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.liste-neu .test-request-bar .btn {
    height: 28px;
    padding: 0 0.7rem;
    font-size: 0.8rem;
}

/* Technische Details zugeklappt */
.liste-neu .description-tech {
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.liste-neu .description-tech summary {
    width: max-content;
    cursor: pointer;
    color: var(--text-muted);
}

.liste-neu .description-tech summary:hover {
    color: var(--text-primary);
}

.liste-neu .description-tech .description-meta {
    display: block;
    border-top: none;
    margin-top: 0.35rem;
    padding-top: 0;
}

/* Mittlere Breite: Projekt in die Infozeile verschieben spart eine Spalte */
@media (max-width: 1200px) {
    .tasks-list.liste-neu {
        --ln-cols: 28px 48px minmax(0, 1fr) 130px 210px 140px 92px;
    }
}

@media (max-width: 900px) {
    .liste-neu .task-list-head {
        display: none;
    }

    .liste-neu .task-row {
        grid-template-columns: 24px minmax(0, 1fr) auto;
        grid-template-areas:
            "chev main ctrl"
            "chev proj proj"
            "chev ppl  act";
        row-gap: 0.3rem;
        padding: 0.6rem 0.6rem 0.5rem 0.4rem;
    }

    .liste-neu .task-row > .task-collapse-btn { grid-area: chev; align-self: start; }
    .liste-neu .task-row > .task-number { display: none; }
    .liste-neu .task-row-main { grid-area: main; }
    .liste-neu .task-row-project { grid-area: proj; white-space: normal; }
    .liste-neu .task-row-people { grid-area: ppl; }
    .liste-neu .task-row > .task-header-controls { grid-area: ctrl; align-self: start; margin-left: 0; }
    .liste-neu .task-row > .task-actions { grid-area: act; margin-left: 0; }

    .liste-neu .task-row-title {
        flex-wrap: wrap;
    }

    .liste-neu .task-row-title .task-title {
        white-space: normal;
    }

    .liste-neu .task-card > .test-request-bar,
    .liste-neu .task-card > .task-comments-container {
        margin-left: calc(0.4rem + 24px + 0.75rem);
        margin-right: 0.6rem;
    }
}

@media (max-width: 520px) {
    .liste-neu .task-card > .test-request-bar,
    .liste-neu .task-card > .task-comments-container {
        margin-left: 0.6rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .liste-neu .task-collapse-btn i,
    .liste-neu .task-actions {
        transition: none;
    }
}

.liste-neu .task-row > .task-collapse-btn {
    margin: 0;
    padding: 4px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.liste-neu .task-row > .task-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.liste-neu .task-row {
    cursor: pointer;
}

.liste-neu .task-row:hover {
    background: var(--bg-hover);
}

.liste-neu .task-card {
    overflow: visible;
}

.liste-neu .task-card > .task-row {
    border-radius: 7px 7px 0 0;
}

.liste-neu .task-card:not(.expanded) > .task-row {
    border-radius: 7px;
}

/* Kommentare: Datum/Personen, Text und Aktionen auf einer Zeile */
@media (min-width: 701px) {
    .liste-neu .task-comment {
        display: grid;
        grid-template-columns: max-content minmax(0, 1fr) max-content;
        column-gap: 0.85rem;
        row-gap: 0.35rem;
        align-items: baseline;
    }

    .liste-neu .task-comment > .comment-meta {
        display: contents;
    }

    .liste-neu .task-comment > .comment-meta > .comment-meta-info {
        grid-row: 1;
        grid-column: 1;
    }

    .liste-neu .task-comment > .comment-content-wrapper {
        grid-row: 1;
        grid-column: 2;
        min-width: 0;
    }

    .liste-neu .task-comment > .comment-meta > .comment-actions {
        grid-row: 1;
        grid-column: 3;
        align-self: center;
    }

    .liste-neu .task-comment > :not(.comment-meta):not(.comment-content-wrapper) {
        grid-column: 1 / -1;
    }
}

.reporter-link-btn.sent { color: var(--success-color); }
.reporter-link-btn.failed { color: var(--danger-color); }
.reporter-link-btn.is-busy { opacity: 0.5; cursor: progress; }

/* ============================================================================
   FIXIERTE KOPFZEILE mit Seitentitel + Aktion; Copyright in der Sidebar
   ============================================================================ */
:root {
    --app-header-h: 68px;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 200;
}

.app-header-title {
    margin: 0 1rem 0 0;
    font-size: var(--font-size-xl);
    font-weight: 600;
    white-space: nowrap;
}

.app-header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.app-header-action {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

/* Filterleiste rastet unter der Kopfzeile ein statt darunter zu verschwinden */
.task-filter-bar {
    top: var(--app-header-h);
}

.sidebar-copyright {
    margin: 0.25rem 0 0;
    padding: 0 1rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-copyright {
    display: none;
}

@media (max-width: 768px) {
    :root {
        --app-header-h: calc(56px + env(safe-area-inset-top, 0px));
    }

    .app-header-title {
        display: none;
    }

    /* Handy: nur das Plus, damit die Suche Platz hat */
    .app-header-action {
        width: 40px;
        height: 40px;
        padding: 0;
        justify-content: center;
    }

    .app-header-action span {
        display: none;
    }
}

/* Liste: Art buendig unter dem Titel, Anhang gleich hoch wie der Rest der Infozeile,
   Status in derselben Groesse wie die Art und ohne Umbruch */
.liste-neu .task-row-sub .task-type,
.liste-neu .task-row-sub .task-status-control {
    margin-left: 0;
}

.liste-neu .task-row-sub,
.liste-neu .task-row-sub > * {
    line-height: 1.4;
}

.liste-neu .task-row-sub .task-row-attachment {
    font-size: 0.75rem;
}

.liste-neu .task-row-sub .task-row-attachment i {
    font-size: 0.7rem;
}

.liste-neu .task-header-controls {
    flex-wrap: nowrap;
}

.liste-neu .task-header-controls .status-badge-btn,
.liste-neu .task-header-controls > .badge {
    height: auto;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    white-space: nowrap;
    line-height: 1.4;
}

/* Kopfzeile: Titel mit HTML (Ampel, Schwere), Unterzeile, mehrere Aktionen */
.app-header-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-header-sub {
    font-size: var(--font-size-sm);
    font-weight: 400;
    color: var(--text-muted);
}

.app-header-actions .btn {
    white-space: nowrap;
}

.app-header-actions form {
    display: inline-flex;
    margin: 0;
}

.app-header-actions > span,
.app-header-actions > div {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .app-header {
        flex-wrap: wrap;
    }

    /* Seiten mit mehreren Knoepfen: Titel + Knoepfe in zweiter Zeile */
    .app-header-title:not(.is-compact) {
        display: inline-flex;
        order: 3;
        flex: 1 1 auto;
        font-size: var(--font-size-lg);
        margin: 0.15rem 0 0;
    }

    .app-header-actions:not(.is-compact) {
        order: 4;
        margin-left: auto;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .app-header-actions:not(.is-compact) .btn {
        padding: 0.4rem 0.65rem;
        font-size: var(--font-size-sm);
    }
}

@media (max-width: 768px) {
    /* Erste Zeile: Menue + Suche; Titel/Knoepfe darunter */
    .app-header .app-search {
        flex: 1 1 calc(100% - 56px);
    }

    /* Aufgaben: das «+» bleibt neben der Suche */
    .app-header:has(.app-header-actions.is-compact) .app-search {
        flex: 1 1 auto;
    }
}

/* Liste: Unteraufgaben enger zusammen */
.liste-neu .task-description-section {
    padding: 0.6rem 0 0.5rem;
}

.liste-neu .task-comments-section {
    padding: 0.4rem 0;
}

.liste-neu .task-comments {
    gap: 0.2rem;
}

.liste-neu .task-comments > .task-comment {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

.liste-neu .task-comment .child-comment,
.liste-neu .child-comment {
    margin-top: 0.2rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

/* ============================================================================
   LISTE: Unteraufgaben ruhig (ohne Prioritaetsbalken/Kaesten), Aktionen einheitlich
   ============================================================================ */
.liste-neu .task-comment,
.liste-neu .task-comment[data-priority] {
    border-left: 2px solid transparent;
    border-radius: 6px;
    padding-left: 0.6rem;
    padding-right: 0.4rem;
    background: transparent;
}

/* Nur hohe Prioritaet bekommt eine (schmale) Farbmarke */
.liste-neu .task-comment[data-priority="high"] {
    border-left-color: var(--danger-color);
}

.liste-neu .task-comment:hover {
    background: var(--bg-hover);
}

.liste-neu .task-comment.unread {
    background: rgba(219, 64, 53, 0.06);
}

/* Unteraufgaben durch feine Linie getrennt statt durch Abstand + Balken */
.liste-neu .task-comments > .parent-comment + .parent-comment {
    border-top: 1px solid var(--border-color);
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

/* Antworten: eingerueckt mit duenner Faden-Linie, ohne Kasten */
.liste-neu .comment-replies {
    margin: 0.15rem 0 0 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.liste-neu .comment-replies:empty {
    display: none;
}

.liste-neu .child-comment,
.liste-neu .task-comment .child-comment {
    margin: 0;
    padding: 0.25rem 0.4rem 0.25rem 0.5rem;
    background: transparent;
    border-left: 2px solid transparent;
    font-size: inherit;
}

/* Anhaenge: dezent, unter dem Text statt rot ueber die ganze Breite */
.liste-neu .task-comment .comment-attachments .attachment-link {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.liste-neu .task-comment .comment-attachments .attachment-link:hover {
    color: var(--primary-color);
}

@media (min-width: 701px) {
    .liste-neu .task-comment > .comment-attachments {
        grid-column: 2 / -1;
    }
}

/* Aktionen: gleich grosse, ruhige Icon-Knoepfe; Loeschen zuletzt */
.liste-neu .comment-actions {
    gap: 2px;
    flex-wrap: nowrap;
}

.liste-neu .comment-actions button,
.liste-neu .comment-actions .comment-move-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    cursor: pointer;
}

.liste-neu .comment-actions button:hover,
.liste-neu .comment-actions .comment-move-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.liste-neu .comment-actions .comment-delete-btn:hover {
    color: var(--danger-color);
}

.liste-neu .comment-actions .comment-done-toggle .done-active {
    color: var(--success-color);
}

/* Antworten-Knopf zeigt die Anzahl: etwas breiter */
.liste-neu .comment-actions .reply-btn {
    width: auto;
    min-width: 26px;
    padding: 0 0.4rem;
    font-size: 0.7rem;
}

.liste-neu .comment-actions .reply-btn i {
    font-size: 0.75rem;
}

.liste-neu .comment-actions > form,
.liste-neu .comment-actions > span {
    display: inline-flex;
}

.liste-neu .comment-actions > .reply-btn { order: 1; }
.liste-neu .comment-actions > .comment-done-toggle { order: 2; }
.liste-neu .comment-actions > .comment-read-toggle { order: 3; }
.liste-neu .comment-actions > .comment-edit-btn { order: 4; }
.liste-neu .comment-actions > .comment-move { order: 5; }
.liste-neu .comment-actions > form:has(.comment-convert-btn) { order: 6; }
.liste-neu .comment-actions > form:has(.comment-delete-btn) { order: 7; }

/* Mails an den Melder (Protokoll an der Aufgabe) */
.reporter-mails {
    margin: 0.6rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.reporter-mails summary {
    width: max-content;
    max-width: 100%;
    cursor: pointer;
}

.reporter-mails summary:hover {
    color: var(--text-primary);
}

.reporter-mails-list {
    list-style: none;
    margin: 0.35rem 0 0;
    padding: 0;
    line-height: 1.6;
    word-wrap: break-word;
}

.reporter-mails-list li.failed {
    color: var(--danger-color);
}

.reporter-mail-time {
    font-variant-numeric: tabular-nums;
}

.reporter-mail-failed {
    margin-left: 0.4rem;
    padding: 0 0.4rem;
    border-radius: 4px;
    background: color-mix(in srgb, var(--danger-color) 14%, transparent);
    color: var(--danger-color);
    font-weight: 600;
}
