/* ============================================
   IMC - Interface Management Cockpit
   ============================================ */

:root {
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-danger: #dc2626;
    --color-orange: #ea580c;

    --radius: 10px;
    --radius-sm: 6px;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ Navigation ============ */
.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
    height: 56px;
    background: var(--color-text);
    color: #fff;
}

.nav-brand a {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.05em;
}
.nav-brand a:hover { text-decoration: none; }

.nav-subtitle {
    color: #9ca3af;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.nav-links { display: flex; gap: 1rem; }
.nav-links a {
    color: #d1d5db;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}
.nav-links a:hover,
.nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #d1d5db;
    font-size: 0.875rem;
}

/* ============ Container ============ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s;
}
.btn:hover { background: var(--color-bg); text-decoration: none; }
.btn-primary { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ============ Forms ============ */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.15s;
}
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea.form-input { resize: vertical; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-group-full { grid-column: 1 / -1; }

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* ============ Flash messages ============ */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}
.flash-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ============ Cards (detail pages) ============ */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}
.card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}
.card-full { grid-column: 1 / -1; }

/* ============ Dashboard header & filters ============ */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.dashboard-header h1 { font-size: 1.5rem; }
.dashboard-stats .stat { color: var(--color-text-muted); font-size: 0.875rem; }

/* (old simple filters removed — now using .filter-section) */

/* =============================================
   DASHBOARD ROW CARDS (Floating cards layout)
   ============================================= */

/* Row card — the floating card per route */
.row-card {
    display: grid;
    grid-template-columns: 280px 1fr 200px;
    align-items: center;
    gap: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 0.625rem;
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s, transform 0.2s;
}

.row-card-link {
    color: var(--color-text);
    cursor: pointer;
}

.row-card-link:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
    text-decoration: none;
}

/* Header row */
.row-header {
    background: transparent;
    box-shadow: none;
    padding: 0 1.25rem 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.row-header .pipeline-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    text-align: center;
}

/* Empty state */
.row-empty {
    display: flex;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

/* ---- Column 1: Kunde / Info ---- */
.col-info-name {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
    color: var(--color-text);
}

.col-info-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* Generic badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
}

.badge-route {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
}

.badge-software {
    background: #f3f4f6;
    color: #374151;
}

.badge-protocol {
    background: #fdf4ff;
    color: #86198f;
}

.badge-bearbeiter {
    background: #f0fdf4;
    color: #15803d;
}

.badge-priority {
    font-weight: 600;
}
.badge-priority-critical { background: #fef2f2; color: #dc2626; }
.badge-priority-high { background: #fff7ed; color: #ea580c; }
.badge-priority-medium { background: #fefce8; color: #a16207; }
.badge-priority-low { background: #f0fdf4; color: #16a34a; }

.badge-deadline {
    background: #f3f4f6;
    color: #374151;
    font-variant-numeric: tabular-nums;
}

.badge-blocker {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    font-weight: 700;
    font-size: 0.625rem;
    letter-spacing: 0.04em;
}

/* ---- Column 2: Status Pipeline ---- */
.col-pipeline {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: center;
    position: relative;
    padding: 0 1rem;
}

.pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    z-index: 2;
}

.pipeline-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pipeline-done .pipeline-dot {
    border-color: var(--color-success);
    background: var(--color-success);
    color: #fff;
}

.pipeline-active .pipeline-dot {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

.pipeline-dot-fill {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: pulse 2s ease-in-out infinite;
}

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

.pipeline-label {
    display: none; /* hidden on row level, shown in header */
}

/* Track line behind dots */
.pipeline-track {
    position: absolute;
    top: 50%;
    left: calc(100% / 14 + 12px);
    right: calc(100% / 14 + 12px);
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    transform: translateY(-50%);
    z-index: 1;
}

.pipeline-track-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 2px;
    transition: width 0.3s;
}

/* Status overlays (blocked / cancelled) */
.pipeline-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    z-index: 3;
}

.pipeline-overlay-blocked {
    background: rgba(254, 242, 242, 0.9);
    color: #dc2626;
    border: 1px dashed #fca5a5;
}

.pipeline-overlay-cancelled {
    background: rgba(243, 244, 246, 0.9);
    color: #6b7280;
    border: 1px dashed #d1d5db;
}

/* ---- Column 3: Badges (Deadline / Ampel / Blocker) ---- */
.col-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Traffic light dot */
.traffic-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.traffic-dot-green {
    background: var(--color-success);
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
}
.traffic-dot-yellow {
    background: var(--color-warning);
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}
.traffic-dot-orange {
    background: var(--color-orange);
    box-shadow: 0 0 6px rgba(234, 88, 12, 0.4);
}
.traffic-dot-red {
    background: var(--color-danger);
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

/* ============ Status badges (detail pages) ============ */
.status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.status-beauftragt { background: #f3f4f6; color: #374151; }
.status-offen { background: #fef3c7; color: #92400e; }
.status-analyse { background: #dbeafe; color: #1e40af; }
.status-entwicklung { background: #fef9c3; color: #854d0e; }
.status-test { background: #e0e7ff; color: #3730a3; }
.status-produktiv { background: #dcfce7; color: #166534; }
.status-abgerechnet { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.status-blocked { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.status-cancelled { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }

/* Priority badges (detail pages) */
.priority-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.priority-critical { background: #fef2f2; color: #dc2626; }
.priority-high { background: #fff7ed; color: #ea580c; }
.priority-medium { background: #fefce8; color: #a16207; }
.priority-low { background: #f0fdf4; color: #16a34a; }

/* Route badges (detail pages) */
.route-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.25rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    background: #e5e7eb;
    color: #374151;
}
.route-badge-beauftragt { background: #f3f4f6; color: #374151; }
.route-badge-offen { background: #fef3c7; color: #92400e; }
.route-badge-analyse { background: #dbeafe; color: #1e40af; }
.route-badge-entwicklung { background: #fef9c3; color: #854d0e; }
.route-badge-test { background: #e0e7ff; color: #3730a3; }
.route-badge-produktiv { background: #dcfce7; color: #166534; }
.route-badge-abgerechnet { background: #f0fdf4; color: #166534; }

.cell-routes { display: flex; gap: 0.25rem; }

/* Traffic light (detail pages) */
.traffic-light {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
}
.traffic-light-green { background: var(--color-success); box-shadow: 0 0 4px rgba(22, 163, 74, 0.4); }
.traffic-light-yellow { background: var(--color-warning); box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
.traffic-light-orange { background: var(--color-orange); box-shadow: 0 0 4px rgba(234, 88, 12, 0.4); }
.traffic-light-red { background: var(--color-danger); box-shadow: 0 0 4px rgba(220, 38, 38, 0.4); }

/* Blocker */
.blocker-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.625rem;
    font-weight: 700;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    margin-left: 0.25rem;
    vertical-align: middle;
}

.blocker-box {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: #991b1b;
}

/* ============ Detail pages ============ */
.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.375rem 1rem;
    font-size: 0.875rem;
}
.detail-list dt { color: var(--color-text-muted); font-weight: 500; }

.project-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
.project-header h1 { font-size: 1.5rem; margin: 0.25rem 0; }
.project-meta { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }

/* Show page: Status row & mini pipeline */
.show-status-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
}

.show-pipeline {
    position: relative;
    display: flex;
    align-items: flex-start;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
}

.show-pipeline-track {
    position: absolute;
    top: 22px;
    left: calc(1rem + 12px);
    right: calc(1rem + 12px);
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    z-index: 0;
}

.show-pipeline-track-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.show-pipeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.show-pipeline-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    text-align: center;
    white-space: nowrap;
}

.show-pipeline-step.pipeline-active .show-pipeline-label {
    color: var(--color-primary);
    font-weight: 600;
}

.show-pipeline-step.pipeline-done .show-pipeline-label {
    color: var(--color-success);
}

.show-querstatus {
    margin-top: 0.5rem;
}

.project-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Inner tables */
.inner-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.inner-table th {
    text-align: left;
    padding: 0.375rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
}
.inner-table td { padding: 0.375rem 0.5rem; border-bottom: 1px solid var(--color-border); }
.inner-table tbody tr:last-child td { border-bottom: none; }

/* Notes */
.note-form { margin-bottom: 1rem; }
.note-form textarea { margin-bottom: 0.5rem; }
.notes-list { display: flex; flex-direction: column; gap: 0.75rem; }
.note-item { padding: 0.75rem; background: var(--color-bg); border-radius: var(--radius-sm); }
.note-meta { display: flex; justify-content: space-between; margin-bottom: 0.375rem; font-size: 0.8rem; }
.note-content { font-size: 0.875rem; }

/* Routes fieldset */
.routes-fieldset {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin: 1rem 0;
}
.routes-fieldset legend { font-weight: 600; padding: 0 0.5rem; }
.route-row { display: flex; gap: 0.75rem; margin-bottom: 0.5rem; }
.route-row .form-select { flex: 1; }

/* Misc */
.back-link {
    display: inline-block;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}
.back-link:hover { color: var(--color-primary); }
.page-header { margin-bottom: 1.5rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.page-header h1 { font-size: 1.5rem; }
.text-muted { color: var(--color-text-muted); }
.empty-state { text-align: center; padding: 2rem !important; color: var(--color-text-muted); }

/* Checkbox group */
.checkbox-group { display: flex; flex-direction: column; gap: 0.5rem; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; }

/* Role badge */
.badge-role {
    display: inline-block;
    padding: 0.125rem 0.4rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    background: #e0e7ff;
    color: #3730a3;
}

/* Login */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}
.login-box h1 { font-size: 1.5rem; text-align: center; }
.login-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* Project form */
.project-form {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
}

/* ============ Filter Section ============ */
.filter-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
}

.filter-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.filter-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

/* Filter row: [× remove] [field] gleich [tags...] [+ dropdown] */
.filter-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.filter-remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.15s;
}

.filter-remove-btn:hover {
    background: #fecaca;
}

.filter-field-select {
    padding: 0.3rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    min-width: 110px;
}

.filter-operator {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.filter-tags-area {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1;
    min-height: 32px;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}

.filter-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0;
    margin-left: 0.125rem;
}

.filter-tag-remove:hover {
    color: #fff;
}

/* Combobox (typeahead input + dropdown) */
.filter-combobox {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.filter-combobox-input {
    width: 100%;
    padding: 0.15rem 0.35rem;
    font-size: 0.8125rem;
    border: none;
    background: transparent;
    color: var(--color-text);
    outline: none;
}

.filter-combobox-input::placeholder {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    opacity: 0.7;
}

.filter-combobox-input:disabled {
    cursor: default;
}

.filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: -8px;
    right: -8px;
    min-width: 200px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    z-index: 100;
    padding: 0.25rem 0;
}

.filter-dropdown-item {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--color-text);
    transition: background 0.1s;
}

.filter-dropdown-item:hover,
.filter-dropdown-item.is-highlighted {
    background: #eff6ff;
    color: var(--color-primary);
}

.filter-dropdown-item mark {
    background: #fef08a;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

.filter-dropdown-empty {
    color: var(--color-text-muted);
    font-style: italic;
    cursor: default;
}

.filter-dropdown-empty:hover {
    background: none;
    color: var(--color-text-muted);
}

.filter-add-link {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.filter-add-link:hover {
    text-decoration: underline;
}

/* ============ Sort Bar ============ */
.sort-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding: 0 0.25rem;
}

.sort-bar-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

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

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

.sort-arrow {
    font-size: 0.7rem;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
    .row-card {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .col-badges {
        justify-content: flex-start;
    }
    .col-pipeline {
        padding: 0;
    }
}

@media (max-width: 768px) {
    .main-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem 1rem;
    }
    .project-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .filters { flex-wrap: wrap; }
    .row-header { display: none; }
    .filter-row { flex-wrap: wrap; }
    .filter-tags-area { min-width: 100%; }
    .sort-bar { flex-wrap: wrap; }
}

/* ============ Data Tables ============ */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.overdue-days {
    color: var(--color-danger);
    font-weight: 600;
}

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

/* ============ Edit Page ============ */
.edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.edit-form > .card {
    margin-bottom: 1rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.form-select-sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
}

.edit-routes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.edit-route-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
}

.edit-route-label {
    font-weight: 500;
    min-width: 120px;
}

.edit-route-protocol {
    color: var(--color-text-muted);
    min-width: 80px;
}

.edit-route-row .form-select-sm {
    margin-left: auto;
    min-width: 140px;
}

.edit-route-add {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0;
}

.btn-icon {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--color-text-muted);
}

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

.btn-icon-danger {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.btn-icon-danger:hover {
    background: #fef2f2;
}

.input-with-clear {
    position: relative;
}

.input-with-clear textarea {
    padding-right: 2.5rem;
}

.btn-clear {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--color-text-muted);
}

.btn-clear:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
    background: #fef2f2;
}

/* ── Route-Edit-Card (Edit-Seite: pro Schnittstelle) ── */
.route-edit-card {
    border-left: 4px solid var(--color-primary);
}

.route-edit-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ── Show-Seite: Route-Summary-Liste ── */
.show-route-summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.show-route-summary:last-child {
    border-bottom: none;
}

/* ── Route-Row expanded (New-Seite) ── */
.route-row-expanded {
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
    .edit-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .form-grid-4 { grid-template-columns: 1fr 1fr; }
    .edit-route-row { flex-wrap: wrap; }
    .route-edit-header { flex-wrap: wrap; }
}
