/* ============================================
   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);
}

.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;
    gap: 12px;
}

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;
}

.team-btn-primary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.team-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.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;
    }
}

/* 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;
    }
}
