/* ============================================
   TEAM FAIRNESS MODAL - ADMIN/MANAGER VIEW
   Organization-wide fairness comparison
   ============================================ */

/* Modal Container */
.team-fairness-modal .modal-content {
    max-width: 1020px;
    width: 96%;
    max-height: 92vh;
    border-radius: 20px;
    overflow: hidden;
}

.team-fairness-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 85vh;
    overflow-y: auto;
}

/* Header */
.team-fairness-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.team-fairness-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-fairness-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-fairness-header h2 i {
    opacity: 0.9;
}

.team-fairness-badge {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.team-fairness-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.team-fairness-period {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
}

.team-fairness-period:focus {
    outline: none;
    border-color: rgba(255,255,255,0.4);
}

/* Manage members (2026-09-23) — same chrome as the period select beside it.
   Plain rgba only: the owner's phone (iOS 15.6) cannot paint color-mix(). */
.team-fairness-manage-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.team-fairness-manage-btn:hover,
.team-fairness-manage-btn:focus-visible {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.4);
    outline: none;
}

.team-fairness-period option {
    background: #1e293b;
    color: #fff;
}

.team-fairness-header .icon-button-small {
    color: rgba(255,255,255,0.7);
    background: rgba(255,255,255,0.1);
}

.team-fairness-header .icon-button-small:hover {
    color: #fff;
    background: rgba(255,255,255,0.2);
}

/* Overview Stats */
.team-overview-stats {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 16px;
    padding: 20px 24px;
    background: var(--bg-secondary, #f8fafc);
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-overview-stats {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(148, 163, 184, 0.1);
}

.team-stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.04);
}

body.dark-mode .team-stat-card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.1);
}

.team-stat-card.team-stat-equity {
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    border-color: rgba(99, 102, 241, 0.2);
}

body.dark-mode .team-stat-card.team-stat-equity {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.1));
}

.team-stat-ring {
    position: relative;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
}

.team-stat-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.team-ring-bg {
    fill: none;
    stroke: var(--bg-tertiary, #e2e8f0);
    stroke-width: 8;
}

body.dark-mode .team-ring-bg {
    stroke: rgba(148, 163, 184, 0.2);
}

.team-ring-progress {
    fill: none;
    stroke: var(--primary-500, #6366f1);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
}

.team-stat-ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 800;
    color: var(--primary-600, #4f46e5);
}

.team-stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.team-stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .team-stat-label {
    color: #f1f5f9;
}

.team-stat-hint {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.team-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-100, #e0e7ff), var(--primary-50, #eef2ff));
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 18px;
    color: var(--primary-600, #4f46e5);
}

body.dark-mode .team-stat-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.1));
    color: #a5b4fc;
}

.team-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    line-height: 1.1;
}

body.dark-mode .team-stat-value {
    color: #f1f5f9;
}

/* Team Alert */
.team-alert {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 24px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(249, 115, 22, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 12px;
}

body.dark-mode .team-alert {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(249, 115, 22, 0.08));
}

.team-alert.critical {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border-color: rgba(239, 68, 68, 0.3);
}

.team-alert-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d97706;
    font-size: 18px;
    flex-shrink: 0;
}

.team-alert.critical .team-alert-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

body.dark-mode .team-alert-icon {
    color: #fbbf24;
}

body.dark-mode .team-alert.critical .team-alert-icon {
    color: #f87171;
}

.team-alert-content {
    flex: 1;
}

.team-alert-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 2px;
}

body.dark-mode .team-alert-title {
    color: #f1f5f9;
}

.team-alert-message {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
}

.team-alert-action {
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    color: #b45309;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-alert-action:hover {
    background: rgba(245, 158, 11, 0.25);
}

body.dark-mode .team-alert-action {
    color: #fbbf24;
}

/* Section Headers */
.team-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.team-section-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark-mode .team-section-header h3 {
    color: #f1f5f9;
}

.team-section-header h3 i {
    color: var(--primary-500, #6366f1);
    font-size: 14px;
}

/* Sort Buttons */
.team-sort-options {
    display: flex;
    gap: 6px;
}

.team-sort-btn {
    padding: 6px 12px;
    background: var(--bg-secondary, #f1f5f9);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.team-sort-btn:hover {
    background: var(--bg-tertiary, #e2e8f0);
}

.team-sort-btn.active {
    background: var(--primary-500, #6366f1);
    border-color: var(--primary-500, #6366f1);
    color: #fff;
}

body.dark-mode .team-sort-btn {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .team-sort-btn:hover {
    background: rgba(51, 65, 85, 0.6);
}

/* Members Section */
.team-members-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-members-section {
    border-color: rgba(148, 163, 184, 0.1);
}

.team-members-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Member Row */
.team-member-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.team-member-row:hover {
    background: var(--bg-tertiary, #f1f5f9);
}

body.dark-mode .team-member-row {
    background: rgba(15, 23, 42, 0.4);
}

body.dark-mode .team-member-row:hover {
    background: rgba(15, 23, 42, 0.6);
}

.team-member-row.highlighted {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(220, 38, 38, 0.04));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.team-member-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    color: #fff;
    flex-shrink: 0;
}

.team-member-info {
    flex: 1;
    min-width: 0;
}

.team-member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .team-member-name {
    color: #f1f5f9;
}

.team-member-meta {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-member-tz {
    display: flex;
    align-items: center;
    gap: 4px;
}

.team-member-scores {
    display: flex;
    align-items: center;
    gap: 20px;
}

.team-member-score-item {
    text-align: center;
    min-width: 50px;
}

.team-member-score-value {
    font-size: 18px;
    font-weight: 700;
}

.team-member-score-value.excellent { color: #4c1d95; }
.team-member-score-value.good { color: #5b21b6; }
.team-member-score-value.fair { color: #6d28d9; }
.team-member-score-value.attention { color: #7c3aed; }
.team-member-score-value.critical { color: #8b5cf6; }

.team-member-score-label {
    font-size: 10px;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.team-member-burden-bar {
    width: 120px;
    height: 8px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: 4px;
    overflow: hidden;
}

body.dark-mode .team-member-burden-bar {
    background: rgba(148, 163, 184, 0.2);
}

.team-member-burden-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease-out;
}

.team-member-status {
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.team-member-status.excellent { background: rgba(91, 33, 182, 0.15); color: #4c1d95; }
.team-member-status.good { background: rgba(109, 40, 217, 0.15); color: #5b21b6; }
.team-member-status.fair { background: rgba(124, 58, 237, 0.15); color: #6d28d9; }
.team-member-status.attention { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.team-member-status.critical { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }

body.dark-mode .team-member-status.excellent { background: rgba(91, 33, 182, 0.25); color: #8b5cf6; }
body.dark-mode .team-member-status.good { background: rgba(109, 40, 217, 0.25); color: #a78bfa; }
body.dark-mode .team-member-status.fair { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
body.dark-mode .team-member-status.attention { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
body.dark-mode .team-member-status.critical { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }

/* Dimensions Section */
.team-dimensions-section {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-dimensions-section {
    border-color: rgba(148, 163, 184, 0.1);
}

.team-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.team-dimension-card {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 14px;
    padding: 16px;
}

body.dark-mode .team-dimension-card {
    background: rgba(15, 23, 42, 0.4);
}

.team-dimension-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.team-dimension-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.team-dimension-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .team-dimension-name {
    color: #f1f5f9;
}

.team-dimension-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-dim-bar-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-dim-bar-name {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.team-dim-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}

body.dark-mode .team-dim-bar-track {
    background: rgba(148, 163, 184, 0.2);
}

.team-dim-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease-out;
}

.team-dim-bar-value {
    font-size: 12px;
    font-weight: 600;
    width: 30px;
    text-align: right;
}

/* Recommendations Section */
.team-recommendations-section {
    padding: 20px 24px;
}

.team-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-recommendation-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: 12px;
    border-left: 4px solid var(--primary-500, #6366f1);
}

body.dark-mode .team-recommendation-card {
    background: rgba(15, 23, 42, 0.4);
}

.team-recommendation-card.warning {
    border-left-color: #f59e0b;
}

.team-recommendation-card.critical {
    border-left-color: #ef4444;
}

.team-recommendation-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-600, #4f46e5);
    font-size: 16px;
    flex-shrink: 0;
}

.team-recommendation-card.warning .team-recommendation-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.team-recommendation-card.critical .team-recommendation-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

body.dark-mode .team-recommendation-icon {
    color: #a5b4fc;
}

body.dark-mode .team-recommendation-card.warning .team-recommendation-icon {
    color: #fbbf24;
}

body.dark-mode .team-recommendation-card.critical .team-recommendation-icon {
    color: #f87171;
}

.team-recommendation-content {
    flex: 1;
}

.team-recommendation-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 4px;
}

body.dark-mode .team-recommendation-title {
    color: #f1f5f9;
}

.team-recommendation-text {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
}

/* Footer */
.team-fairness-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
    background: var(--bg-secondary, #f8fafc);
    border-top: 1px solid var(--border-color, #e2e8f0);
    position: sticky;
    bottom: 0;
}

/* Advisory note — heuristic frame per docs/legal/POSTURE.md.
   Renders above action buttons so admins see the frame before exporting. */
.team-fairness-footer .tf-advisory-note {
    margin: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
}

.team-fairness-footer .tf-advisory-note i {
    margin-top: 2px;
    flex-shrink: 0;
    opacity: 0.7;
}

.team-fairness-footer .tf-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}
/* Reports cluster (2026-09-07): the three exports read as one group with a
   label, the share action stands apart as the primary. */
.team-fairness-footer .tf-reports-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-right: auto;
}
.team-fairness-footer .tf-reports-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary, #64748b);
    margin-right: 2px;
}
.team-fairness-footer .tf-reports-group .team-btn {
    padding: 8px 14px;
    font-size: 13px;
}
@media (max-width: 640px) {
    .team-fairness-footer .tf-footer-actions { justify-content: stretch; }
    .team-fairness-footer .tf-reports-group { width: 100%; margin-right: 0; }
    .team-fairness-footer .tf-reports-group .team-btn { flex: 1 1 auto; justify-content: center; }
}

body.dark-mode .team-fairness-footer {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(148, 163, 184, 0.1);
}

body.dark-mode .team-fairness-footer .tf-advisory-note {
    color: var(--text-secondary, #94a3b8);
}

.team-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

/* Brand teal (2026-09-07): the indigo gradient was the only surface in the
   app still wearing another brand's colour. */
.team-btn-primary {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
    color: #fff;
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}

.team-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.36);
}

.team-btn-secondary {
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-primary, #475569);
    border: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-btn-secondary {
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

.team-btn-secondary:hover {
    background: var(--bg-secondary, #f1f5f9);
}

body.dark-mode .team-btn-secondary:hover {
    background: rgba(71, 85, 105, 0.6);
}

/* Responsive */
@media (max-width: 768px) {
    .team-overview-stats {
        grid-template-columns: 1fr 1fr;
    }

    .team-stat-card.team-stat-equity {
        grid-column: span 2;
    }

    .team-dimensions-grid {
        grid-template-columns: 1fr;
    }

    .team-member-scores {
        display: none;
    }

    .team-member-burden-bar {
        width: 80px;
    }

    .team-fairness-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .team-fairness-header-right {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Empty State */
.team-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-secondary, #64748b);
}

.team-empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.team-empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin: 0 0 8px 0;
}

body.dark-mode .team-empty-state h3 {
    color: #f1f5f9;
}

.team-empty-state p {
    font-size: 14px;
    margin: 0;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Forward-looking demo variant (signed-out sample board only) — a positive
   "here's what Fairness will track" teaser rather than an absent/empty card, so
   its icon reads at full strength and the two lines get breathing room. Adds no
   data; the copy is derived live from the board. (2026-07-12 demo redesign.) */
.team-empty-state--demo i {
    opacity: 0.85;
    color: var(--accent, #6366f1);
}

.team-empty-state--demo p + p,
.team-empty-state--demo .team-empty-state-hint {
    margin-top: 10px;
}

.team-empty-state--demo .team-empty-state-hint {
    font-size: 13px;
    opacity: 0.85;
}

/* Animation */
@keyframes teamSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.team-member-row {
    animation: teamSlideIn 0.3s ease-out;
    animation-fill-mode: both;
}

.team-member-row:nth-child(1) { animation-delay: 0.05s; }
.team-member-row:nth-child(2) { animation-delay: 0.1s; }
.team-member-row:nth-child(3) { animation-delay: 0.15s; }
.team-member-row:nth-child(4) { animation-delay: 0.2s; }
.team-member-row:nth-child(5) { animation-delay: 0.25s; }
.team-member-row:nth-child(6) { animation-delay: 0.3s; }
.team-member-row:nth-child(7) { animation-delay: 0.35s; }
.team-member-row:nth-child(8) { animation-delay: 0.4s; }


/* ============================================
   FAIRNESS DASHBOARD MODAL (FDM) - PREMIUM
   Dynamic modal for the Fairness Dashboard popup
   ============================================ */

/* Modal Container */
.fdm-modal {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fdm-modal-content {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-xl, 16px);
    width: 98%;
    max-width: 1400px;
    max-height: 94vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    margin: auto;
}

body.dark-mode .fdm-modal-content {
    background: #0f172a;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

/* Header - Purple accent for Fairness module distinction */
.fdm-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 20px 24px;
    padding-bottom: 16px;
    position: relative;
    overflow: visible;
}

/* Ensure decorative elements don't block content */
.fdm-header::before,
.fdm-header::after {
    pointer-events: none;
}

.fdm-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
}

.fdm-header-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.fdm-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fdm-brand-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.fdm-brand-icon i {
    font-size: 20px;
    color: #fff;
}

.fdm-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fdm-title-group h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.fdm-tier-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    padding: 3px 8px;
    border-radius: 6px;
}

.fdm-period-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.fdm-period-tabs::-webkit-scrollbar {
    display: none;
}

.fdm-period-tab {
    padding: 8px 14px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm, 8px);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.fdm-period-tab:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.fdm-period-tab.active {
    background: #fff;
    color: #4338ca;
}

.fdm-period-tab.locked {
    opacity: 0.6;
}

.fdm-lock {
    font-size: 10px;
}

.fdm-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full, 9999px);
    border: none;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.fdm-close-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* Body */
.fdm-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Dashboard Content */
.fdm-dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Stats Row */
.fdm-stats-row {
    display: flex;
    gap: 14px;
}

.fdm-stat-card {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 1;
    gap: 8px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

body.dark-mode .fdm-stat-card {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.1);
}

.fdm-stat-card.primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 16px;
    min-width: 200px;
}

.fdm-stat-ring {
    position: relative;
    width: 70px;
    height: 70px;
    flex-shrink: 0;
}

.fdm-stat-ring svg {
    width: 100%;
    height: 100%;
}

.fdm-ring-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 800;
    color: #fff;
}

.fdm-stat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    color: #fff;
}

.fdm-stat-label {
    font-size: 12px;
    opacity: 0.9;
}

.fdm-stat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
}

.fdm-stat-status i {
    font-size: 14px;
}

.fdm-stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
}

.fdm-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fdm-stat-value {
    color: #f1f5f9;
}

.fdm-stat-card > .fdm-stat-label {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

/* Sections */
.fdm-section {
    background: var(--bg-primary, #fff);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

body.dark-mode .fdm-section {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(148, 163, 184, 0.1);
}

.fdm-section-title {
    margin: 0 0 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 8px;
}

body.dark-mode .fdm-section-title {
    color: #f1f5f9;
}

.fdm-section-title i {
    color: var(--primary-500, #6366f1);
}

/* Dimension Rows */
.fdm-dimensions-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fdm-dimension-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.fdm-dim-label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 140px;
}

.fdm-dim-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    flex-shrink: 0;
}

.fdm-dim-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fdm-dim-name {
    color: #f1f5f9;
}

.fdm-dim-bar-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.fdm-dim-bar {
    flex: 1;
    height: 10px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: 5px;
    overflow: hidden;
}

body.dark-mode .fdm-dim-bar {
    background: rgba(148, 163, 184, 0.2);
}

.fdm-dim-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease-out;
}

.fdm-dim-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    min-width: 30px;
    text-align: right;
}

body.dark-mode .fdm-dim-value {
    color: #f1f5f9;
}

/* Member Cards Grid */
.fdm-members-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.fdm-member-card {
    background: var(--bg-secondary, #f8fafc);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

body.dark-mode .fdm-member-card {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.1);
}

.fdm-member-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.fdm-member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.fdm-member-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fdm-member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fdm-member-name {
    color: #f1f5f9;
}

.fdm-member-score {
    font-size: 18px;
    font-weight: 700;
}

.fdm-member-score.excellent { color: #22c55e; }
.fdm-member-score.good { color: #22c55e; }
.fdm-member-score.warning { color: #f59e0b; }
.fdm-member-score.critical { color: #ef4444; }

.fdm-member-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fdm-member-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fdm-bar-label {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    min-width: 60px;
}

.fdm-bar-track {
    flex: 1;
    height: 6px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}

body.dark-mode .fdm-bar-track {
    background: rgba(148, 163, 184, 0.2);
}

.fdm-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.fdm-bar-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    min-width: 24px;
    text-align: right;
}

.fdm-member-insight {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #e2e8f0);
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

body.dark-mode .fdm-member-insight {
    border-color: rgba(148, 163, 184, 0.1);
}

.fdm-member-insight i {
    color: #f59e0b;
    margin-top: 2px;
}

/* Alerts */
.fdm-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fdm-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
}

.fdm-alert.success {
    background: rgba(34, 197, 94, 0.08);
    border-left-color: #22c55e;
}

.fdm-alert.critical {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: #ef4444;
}

body.dark-mode .fdm-alert {
    background: rgba(245, 158, 11, 0.12);
}

body.dark-mode .fdm-alert.success {
    background: rgba(34, 197, 94, 0.12);
}

body.dark-mode .fdm-alert.critical {
    background: rgba(239, 68, 68, 0.12);
}

.fdm-alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    flex-shrink: 0;
}

.fdm-alert.success .fdm-alert-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.fdm-alert.critical .fdm-alert-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.fdm-alert-content {
    flex: 1;
}

.fdm-alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: block;
}

body.dark-mode .fdm-alert-title {
    color: #f1f5f9;
}

.fdm-alert-message {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

/* Empty State */
.fdm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary, #64748b);
}

.fdm-empty-state i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 16px;
}

.fdm-empty-state h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fdm-empty-state h4 {
    color: #f1f5f9;
}

.fdm-empty-state p {
    margin: 0;
    font-size: 13px;
}

/* Free Tier Upgrade Note */
.fdm-upgrade-note {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    margin-top: 20px;
}

body.dark-mode .fdm-upgrade-note {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border-color: rgba(99, 102, 241, 0.3);
}

.fdm-upgrade-note-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fdm-upgrade-note-icon i {
    font-size: 20px;
    color: #fff;
}

.fdm-upgrade-note-content {
    flex: 1;
}

.fdm-upgrade-note-content h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fdm-upgrade-note-content h4 {
    color: #f1f5f9;
}

.fdm-upgrade-note-content p {
    margin: 0 0 14px 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
}

.fdm-upgrade-note-content p strong {
    color: #6366f1;
}

body.dark-mode .fdm-upgrade-note-content p {
    color: #94a3b8;
}

.fdm-upgrade-note-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.fdm-upgrade-note-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.fdm-upgrade-note-btn i {
    font-size: 14px;
}

/* Responsive */
@media (max-width: 600px) {
    .fdm-modal-content {
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 95vh;
    }

    .fdm-header-content {
        gap: 12px;
    }

    .fdm-period-tabs {
        flex-wrap: wrap;
    }

    .fdm-period-tab {
        padding: 8px 14px;
        font-size: 12px;
    }

    .fdm-stats-row {
        flex-direction: column;
    }

    .fdm-stat-card.primary {
        min-width: auto;
    }

    .fdm-members-grid {
        grid-template-columns: 1fr;
    }

    .fdm-dimension-row {
        flex-wrap: wrap;
    }

    .fdm-dim-label {
        min-width: 100%;
        margin-bottom: 8px;
    }

    .fdm-upgrade-note {
        flex-direction: column;
        text-align: center;
        padding: 16px;
    }

    .fdm-upgrade-note-icon {
        margin: 0 auto;
    }
}

/* ======================================================================
   Business-tier admin surfaces: contribution alerts, custom fairness
   weighting, audit trail. Reuse the modal's existing tokens + .team-btn
   styles so they read as part of the same modal.
   ====================================================================== */
.team-business-section {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-business-section {
    border-color: rgba(148, 163, 184, 0.1);
}

.team-business-section .tf-section-hint {
    margin: 4px 0 14px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
}

body.dark-mode .team-business-section .tf-section-hint {
    color: #94a3b8;
}

/* --- Contribution alerts --- */
.team-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-secondary, #f8fafc);
    border: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .team-alert-row {
    background: rgba(15, 23, 42, 0.5);
    border-color: rgba(148, 163, 184, 0.15);
}

.team-alert-row-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.team-alert-row-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .team-alert-row-name {
    color: #f1f5f9;
}

.team-alert-row-detail {
    font-size: 12.5px;
    color: var(--text-secondary, #64748b);
}

.team-alert-dismiss {
    padding: 6px 14px;
    font-size: 13px;
    flex-shrink: 0;
}

.team-alerts-empty {
    padding: 14px;
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    text-align: center;
}

/* --- Custom fairness weighting --- */
.team-weights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.team-weight-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
}

.team-weight-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary, #475569);
}

body.dark-mode .team-weight-label {
    color: #e2e8f0;
}

.team-weight-input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
    font-size: 14px;
}

body.dark-mode .team-weight-input {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.team-weights-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}

.team-weights-sum {
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
}

.team-weights-sum.is-invalid {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.team-weights-status {
    flex: 1;
    font-size: 12.5px;
    color: var(--text-secondary, #64748b);
}

.team-weights-foot .team-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* --- Audit trail --- */
.team-audit-range {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 12.5px;
    color: var(--text-secondary, #64748b);
}

.team-audit-date {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
    font-size: 13px;
    margin-left: 6px;
}

body.dark-mode .team-audit-date {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.team-audit-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 280px;
    overflow-y: auto;
}

.team-audit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    gap: 10px;
    align-items: baseline;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
}

.team-audit-row:nth-child(odd) {
    background: var(--bg-secondary, #f8fafc);
}

body.dark-mode .team-audit-row:nth-child(odd) {
    background: rgba(15, 23, 42, 0.4);
}

.team-audit-who {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .team-audit-who {
    color: #f1f5f9;
}

.team-audit-row.is-anonymous .team-audit-who {
    font-weight: 500;
    font-style: italic;
    color: var(--text-secondary, #64748b);
}

.team-audit-what {
    color: var(--text-secondary, #475569);
}

body.dark-mode .team-audit-what {
    color: #cbd5e1;
}

.team-audit-when {
    color: var(--text-secondary, #94a3b8);
    font-size: 12px;
    white-space: nowrap;
}

.team-audit-empty {
    padding: 14px;
    font-size: 13px;
    color: var(--text-secondary, #64748b);
    text-align: center;
}

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

    .team-audit-row {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}

/* ── Admin view body (rebuilt 2026-09-26) ─────────────────────────────── */
/* Verdict: the spread sentence, the counts behind it, then three stats. */
.team-verdict {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--bg-secondary, #f8fafc);
    border-left: 4px solid var(--fv-l3);
}
.team-verdict[data-tone="notable"] { border-left-color: var(--fv-l6); }
.team-verdict[data-tone="high"] { border-left-color: var(--fv-l8); }
.team-verdict[data-tone="empty"] { border-left-color: var(--border-color, #e2e8f0); }
.team-verdict-lead {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}
.team-verdict-lead i { margin-right: 6px; color: var(--text-secondary, #64748b); }
.team-verdict-why {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary, #64748b);
}
.team-verdict .team-overview-stats { margin: 8px 0 0; }

/* The key: one place that defines every word the table uses. */
.tf-key {
    margin: 0 0 16px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-primary, #fff);
}
.tf-key > summary {
    padding: 9px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}
.tf-key > summary i { margin-right: 6px; color: var(--text-secondary, #64748b); }
.tf-key-list {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 14px;
    margin: 0;
    padding: 4px 12px 12px;
    font-size: 12.5px;
    line-height: 1.45;
}
.tf-key-list dt { font-weight: 700; color: var(--text-primary, #1e293b); }
.tf-key-list dd { margin: 0; color: var(--text-secondary, #64748b); }
@media (max-width: 560px) {
    .tf-key-list { grid-template-columns: 1fr; }
    .tf-key-list dd { margin-bottom: 6px; }
}

/* A person row: the summary is a button; the detail opens under it. */
.team-members-list .team-member-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
}
.team-member-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: 12px;
}
.team-member-summary:focus-visible { outline: 2px solid var(--primary-500, #14b8a6); outline-offset: -2px; }
.team-member-counts {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 12.5px;
    color: var(--text-primary, #1e293b);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.team-member-trend { font-size: 11.5px; color: var(--text-secondary, #64748b); }
.team-member-trend[data-change="up"] { color: var(--fv-l8); font-weight: 600; }
.team-member-trend[data-change="down"] { color: var(--fv-l3); font-weight: 600; }
.team-member-burden-fill[data-status="more"] { background: var(--fv-l8); }
.team-member-burden-fill[data-status="even"] { background: var(--fv-l5); }
.team-member-burden-fill[data-status="room"] { background: var(--fv-l2); }
.tf-detail {
    padding: 0 16px 14px 72px;
    font-size: 12.5px;
    color: var(--text-secondary, #64748b);
}
.tf-detail[hidden] { display: none; }
.tf-detail-head { margin: 0 0 4px; font-weight: 700; color: var(--text-primary, #1e293b); }
.tf-detail-list { margin: 0 0 6px; padding: 0; list-style: none; }
.tf-detail-list li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.tf-detail-title { color: var(--text-primary, #1e293b); font-weight: 600; }
.tf-detail-times { color: var(--text-secondary, #64748b); font-weight: 700; }
.tf-detail-line { margin: 2px 0; }
.tf-detail-room { color: var(--text-primary, #1e293b); font-weight: 600; }
@media (max-width: 640px) {
    .team-member-summary { flex-wrap: wrap; gap: 8px 12px; }
    .team-member-counts { align-items: flex-start; order: 3; width: 100%; white-space: normal; }
    .team-member-burden-bar { order: 4; flex: 1; }
    .team-member-status { order: 5; }
    .tf-detail { padding-left: 16px; }
}
.team-verdict .team-overview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0; background: none; border-bottom: none; }
body.dark-mode .team-verdict .team-overview-stats { background: none; }

/* All teams (Business): one row per group, worst first. */
.tf-teams { margin-bottom: 16px; }
.tf-teams-list { display: flex; flex-direction: column; gap: 6px; }
.tf-team-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 10px;
    background: var(--surface-primary, #fff);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tf-team-row.is-current { border-color: var(--primary-500, #14b8a6); box-shadow: inset 3px 0 0 var(--primary-500, #14b8a6); }
.tf-team-row:focus-visible { outline: 2px solid var(--primary-500, #14b8a6); outline-offset: 2px; }
.tf-team-name { font-weight: 600; color: var(--text-primary, #1e293b); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-team-counts { font-size: 12.5px; color: var(--text-secondary, #64748b); white-space: nowrap; }
.team-fairness-group[hidden] { display: none; }
@media (max-width: 640px) {
    .tf-team-row { grid-template-columns: minmax(0, 1fr) auto; }
    .tf-team-counts { grid-column: 1; white-space: normal; }
}
/* The rebuilt body sits on the same 24px gutter as the People section. */
.tf-teams { padding: 20px 24px 0; margin-bottom: 0; }
.team-verdict { margin: 16px 24px; }
.tf-key { margin: 0 24px 4px; }
@media (max-width: 640px) {
    .tf-teams { padding: 16px 16px 0; }
    .team-verdict { margin: 12px 16px; }
    .tf-key { margin: 0 16px 4px; }
}
/* Whose meetings the numbers are (2026-09-26, database-led). */
.team-verdict-source { margin: 0; font-size: 11.5px; color: var(--text-secondary, #64748b); }
.team-verdict-source[data-source="device-fallback"] { color: var(--fv-l8); }
.team-verdict-source[data-source="server"]::before {
    content: "\f1c0";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 6px;
}
/* What to change: the server's daily recommendations (2026-09-26). */
.tf-recs-list { display: flex; flex-direction: column; gap: 8px; }
.tf-rec {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--surface-primary, #fff);
}
.tf-rec > i { margin-top: 3px; color: var(--primary-600, #0d9488); }
.tf-rec-text { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-primary, #1e293b); }
.tf-rec-empty { margin: 0; font-size: 13px; color: var(--text-secondary, #64748b); }
@media (max-width: 560px) {
    .tf-rec { grid-template-columns: 18px minmax(0, 1fr); }
    .tf-rec-dismiss { grid-column: 2; justify-self: start; }
}

/* Whole-group audit rows (2026-10-08): a category tag, the sentence, the time. */
.team-audit-row[data-category] { grid-template-columns: auto minmax(0, 1fr) auto; }
.team-audit-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
body.dark-mode .team-audit-tag { background: #1e293b; color: #cbd5e1; }
.team-audit-row[data-category] .team-audit-what { color: var(--text-primary, #1e293b); overflow-wrap: anywhere; }
body.dark-mode .team-audit-row[data-category] .team-audit-what { color: #f1f5f9; }
@media (max-width: 520px) {
    .team-audit-row[data-category] { grid-template-columns: auto minmax(0, 1fr); }
    .team-audit-row[data-category] .team-audit-when { grid-column: 2; font-size: 11.5px; }
}

/* ── Workload (Business, 2026-10-08; owner-approved mock) ─────────────────
   Per person: meetings, hours, and where they landed in that person's day,
   in the Fairness dial's three bands. Admins only. */
.tf-workload-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 12px; }
.tf-workload-periods { display: flex; gap: 8px; flex-wrap: wrap; flex-grow: 1; }
.tf-workload-period {
    min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #e2e8f0;
    background: #fff; color: #334155; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.tf-workload-period.is-active { border-color: #99f6e4; background: #f0fdfa; color: #0f766e; font-weight: 700; }
.tf-workload-dept { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; }
.tf-workload-dept select { min-height: 36px; border-radius: 10px; border: 1px solid #cbd5e1; padding: 0 8px; font: inherit; background: #fff; }
.tf-workload-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tf-wl-tile { padding: 12px 14px; border-radius: 14px; background: #f8fafc; }
.tf-wl-tile.is-edge { background: #fefce8; }
.tf-wl-tile.is-sleep { background: #f5f3ff; }
.tf-wl-tile-n { font-size: 22px; font-weight: 800; color: #0f172a; line-height: 1.2; }
.tf-wl-tile.is-edge .tf-wl-tile-n { color: #a16207; }
.tf-wl-tile.is-sleep .tf-wl-tile-n { color: #6d28d9; }
.tf-wl-tile-label { font-size: 12px; color: #64748b; }
.tf-workload-table { border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; }
.tf-wl-row {
    display: grid; grid-template-columns: minmax(0, 1.6fr) 0.7fr 0.7fr minmax(0, 2.4fr) 0.7fr;
    gap: 12px; align-items: center; padding: 11px 14px; font-size: 14px; color: #0f172a;
}
.tf-wl-row + .tf-wl-row { border-top: 1px solid #f1f5f9; }
.tf-wl-head { background: #f8fafc; font-size: 12px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.tf-wl-who { display: flex; flex-direction: column; min-width: 0; }
.tf-wl-who b { overflow-wrap: anywhere; }
.tf-wl-who span { font-size: 12px; color: #64748b; overflow-wrap: anywhere; }
.tf-wl-bar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; font-size: 11px; font-weight: 700; color: #0f172a; }
.tf-wl-bar-empty { background: #f1f5f9; }
.tf-wl-seg { display: flex; align-items: center; justify-content: center; min-width: 14px; flex-basis: 0; }
.tf-wl-in { background: #6ee7a0; }
.tf-wl-edge { background: #facc15; }
.tf-wl-sleep { background: #a78bfa; }
.tf-workload-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; color: #475569; }
.tf-workload-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.tf-wl-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
body.dark-mode .tf-workload-period { background: #0f172a; border-color: #334155; color: #cbd5e1; }
body.dark-mode .tf-workload-period.is-active { background: rgba(20, 184, 166, 0.15); border-color: #14b8a6; color: #5eead4; }
body.dark-mode .tf-workload-dept select { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark-mode .tf-wl-tile { background: #1e293b; }
body.dark-mode .tf-wl-tile.is-edge { background: rgba(250, 204, 21, 0.12); }
body.dark-mode .tf-wl-tile.is-sleep { background: rgba(167, 139, 250, 0.14); }
body.dark-mode .tf-wl-tile-n { color: #f1f5f9; }
body.dark-mode .tf-wl-tile.is-edge .tf-wl-tile-n { color: #facc15; }
body.dark-mode .tf-wl-tile.is-sleep .tf-wl-tile-n { color: #c4b5fd; }
body.dark-mode .tf-workload-table { border-color: #334155; }
body.dark-mode .tf-wl-row { color: #e2e8f0; }
body.dark-mode .tf-wl-row + .tf-wl-row { border-top-color: #1e293b; }
body.dark-mode .tf-wl-head { background: #1e293b; color: #94a3b8; }
body.dark-mode .tf-wl-bar-empty { background: #1e293b; }
@media (max-width: 560px) {
    .tf-workload-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tf-wl-row { grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 6px; }
    .tf-wl-head span:nth-child(4), .tf-wl-head span:nth-child(5) { display: none; }
    .tf-wl-row .tf-wl-bar { grid-column: 1 / -1; }
    .tf-wl-row > span:last-child:not(.tf-wl-bar) { display: none; }
}
