/* ==========================================================================
   Tenant Filter Bar — Cross-Tenant Unified View
   ========================================================================== */

.tenant-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white, #fff);
    border: 1px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.tenant-filter-bar::-webkit-scrollbar {
    height: 4px;
}
.tenant-filter-bar::-webkit-scrollbar-thumb {
    background: var(--gray-300, #d1d5db);
    border-radius: 2px;
}

.tenant-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    white-space: nowrap;
    margin-right: 4px;
}

.tenant-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    border: 2px solid transparent;
    user-select: none;
}

/* "Alle Mandanten" chip */
.tenant-chip--all {
    background: var(--gray-100, #f3f4f6);
    color: var(--gray-700, #374151);
    border-color: var(--gray-300, #d1d5db);
}
.tenant-chip--all.active {
    background: var(--gray-800, #1f2937);
    color: #fff;
    border-color: var(--gray-800, #1f2937);
}
.tenant-chip--all:hover:not(.active) {
    background: var(--gray-200, #e5e7eb);
}

/* Individual tenant chip — colors set inline */
.tenant-chip--tenant {
    background: transparent;
    border-color: currentColor;
    opacity: 0.5;
}
.tenant-chip--tenant.active {
    opacity: 1;
    color: #fff !important;
}
.tenant-chip--tenant:hover:not(.active) {
    opacity: 0.75;
}

.tenant-chip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tenant-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    font-size: 11px;
    line-height: 1;
    margin-left: 2px;
    cursor: pointer;
}
.tenant-chip__remove:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Tenant badge in table rows */
.tenant-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    color: #fff;
}

.tenant-badge-inline__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
}

/* Per-tenant dashboard breakdown */
.tenant-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.tenant-kpi-card {
    padding: 16px;
    border-radius: 10px;
    border-left: 4px solid;
    background: var(--white, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.tenant-kpi-card__name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.tenant-kpi-card__stat {
    font-size: 12px;
    color: var(--gray-600, #4b5563);
    margin-bottom: 4px;
}

.tenant-kpi-card__value {
    font-weight: 700;
    color: var(--gray-900, #111827);
}

/* Dark mode support */
body.dark .tenant-filter-bar {
    background: var(--gray-800, #1f2937);
    border-color: var(--gray-700, #374151);
}
body.dark .tenant-filter-label {
    color: var(--gray-400, #9ca3af);
}
body.dark .tenant-chip--all {
    background: var(--gray-700, #374151);
    color: var(--gray-200, #e5e7eb);
    border-color: var(--gray-600, #4b5563);
}
body.dark .tenant-chip--all.active {
    background: var(--gray-200, #e5e7eb);
    color: var(--gray-900, #111827);
    border-color: var(--gray-200, #e5e7eb);
}
body.dark .tenant-kpi-card {
    background: var(--gray-800, #1f2937);
}

/* Responsive */
@media (max-width: 768px) {
    .tenant-filter-bar {
        padding: 8px 12px;
        gap: 6px;
    }
    .tenant-chip {
        padding: 4px 10px;
        font-size: 12px;
    }
}
