/* ============================================
   FAIRNESS DASHBOARD - PREMIUM DESIGN
   A comprehensive, multi-view dashboard system
   ============================================ */

/* ============================================
   CSS VARIABLES - Fairness module accent
   ----------------------------------------------
   The primary accent is the APP's teal brand, not a bespoke indigo. It was
   #6366f1 (indigo), which shipped through to the LIVE period-selector buttons
   (.fm-period-btn.active / :hover) so those buttons read off-brand against the
   teal app (Connect button, logo, .btn-primary). Repointed to the canonical
   teal ramp (--primary-500 #14b8a6 / --primary-600 #0d9488, defined in
   style.css) so every fairness accent — the live fm-* buttons AND any fd-*
   surface — matches the rest of the app. Categorical hues below (success/warn/
   danger/info/purple/cyan/pink) are deliberate data encodings and stay as-is.
   ============================================ */
:root {
    --fd-primary: var(--primary-500, #14b8a6);
    --fd-primary-light: var(--primary-300, #5eead4);
    --fd-primary-dark: var(--primary-600, #0d9488);
    --fd-success: #22c55e;
    --fd-success-light: #4ade80;
    --fd-warning: #f59e0b;
    --fd-warning-light: #fbbf24;
    --fd-danger: #ef4444;
    --fd-danger-light: #f87171;
    --fd-info: #3b82f6;
    --fd-purple: #8b5cf6;
    --fd-cyan: #06b6d4;
    --fd-pink: #ec4899;
}

/* ============================================
   DASHBOARD HEADER
   ============================================ */
.fd-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    border-radius: var(--radius-xl);
    padding: 20px 24px 0;
    margin-bottom: 20px;
    position: relative;
    overflow: visible;
}

.fd-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.3) 0%, transparent 70%);
    pointer-events: none;
}

.fd-header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: 10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.fd-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.fd-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

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

.fd-brand-icon i {
    font-size: 22px;
    color: #fff;
}

.fd-brand-text h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fd-brand-tier {
    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: var(--radius-sm);
}

.fd-header-actions {
    display: flex;
    gap: 8px;
}

.fd-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    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;
}

.fd-icon-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
    transform: translateY(-1px);
}

/* View Tabs */
.fd-view-tabs {
    display: flex;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.fd-view-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.6);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transition: all 0.2s ease;
    position: relative;
}

.fd-view-tab i {
    font-size: 15px;
}

.fd-view-tab:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.05);
}

.fd-view-tab.active {
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #1e293b);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

body.dark-mode .fd-view-tab.active {
    background: var(--bg-primary, #0f172a);
    color: var(--text-primary, #f1f5f9);
}

.fd-tab-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.fd-view-tab.active .fd-tab-badge {
    background: var(--fd-primary);
    color: #fff;
}

/* ============================================
   VIEW CONTAINERS
   ============================================ */
.fd-view {
    display: none;
}

.fd-view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PERSONAL VIEW - HERO CARD
   ============================================ */
.fd-hero-card {
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    border-radius: var(--radius-xl);
    padding: 28px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.fd-hero-gradient {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: radial-gradient(ellipse at 100% 50%, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.fd-hero-content {
    display: flex;
    align-items: center;
    gap: 28px;
    position: relative;
    z-index: 1;
}

.fd-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

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

.fd-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 10;
}

.fd-ring-progress {
    fill: none;
    stroke: #fff;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-out;
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.4));
}

.fd-score-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
}

.fd-score-number {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.fd-score-max {
    font-size: 14px;
    opacity: 0.7;
}

.fd-hero-info {
    flex: 1;
    color: #fff;
}

.fd-hero-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 6px;
}

.fd-hero-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: var(--radius-2xl);
    font-size: 15px;
    font-weight: 600;
    backdrop-filter: blur(4px);
    margin-bottom: 10px;
}

.fd-hero-status i {
    font-size: 16px;
}

.fd-hero-desc {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.5;
    max-width: 300px;
}

.fd-hero-stats {
    display: flex;
    gap: 24px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    position: relative;
    z-index: 1;
}

.fd-mini-stat {
    text-align: center;
    color: #fff;
}

.fd-mini-value {
    font-size: 22px;
    font-weight: 700;
    display: block;
}

.fd-mini-value.trend-up {
    color: #bbf7d0;
}

.fd-mini-value.trend-down {
    color: #fecaca;
}

.fd-mini-label {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   DIMENSION CARDS
   ============================================ */
.fd-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.fd-dim-card {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fd-dim-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

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

.fd-dim-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.fd-dim-icon.accommodation { background: linear-gradient(135deg, #ec4899, #be185d); }
.fd-dim-icon.flexibility { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.fd-dim-icon.social { background: linear-gradient(135deg, #f97316, #ea580c); }
.fd-dim-icon.rest { background: linear-gradient(135deg, #14b8a6, #0d9488); }

.fd-dim-content {
    flex: 1;
    min-width: 0;
}

.fd-dim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

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

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

.fd-dim-score {
    font-size: 18px;
    font-weight: 700;
    color: var(--fd-success);
}

.fd-dim-score.warning { color: var(--fd-warning); }
.fd-dim-score.danger { color: var(--fd-danger); }

.fd-dim-bar {
    height: 6px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: var(--radius-xs);
    overflow: hidden;
    margin-bottom: 8px;
}

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

.fd-dim-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    background: linear-gradient(90deg, var(--fd-success), var(--fd-success-light));
    transition: width 0.8s ease-out;
}

.fd-dim-fill.warning {
    background: linear-gradient(90deg, var(--fd-warning), var(--fd-warning-light));
}

.fd-dim-fill.danger {
    background: linear-gradient(90deg, var(--fd-danger), var(--fd-danger-light));
}

.fd-dim-desc {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    margin: 0;
    line-height: 1.4;
}

/* ============================================
   TWO COLUMN LAYOUT
   ============================================ */
.fd-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

/* ============================================
   PANELS (Insights, Quota)
   ============================================ */
.fd-panel {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

.fd-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

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

body.dark-mode .fd-panel-header h3 {
    color: #f1f5f9;
}

.fd-panel-header h3 i {
    color: var(--fd-primary);
    font-size: 15px;
}

.fd-panel-badge {
    background: var(--fd-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-md);
    min-width: 24px;
    text-align: center;
}

/* Insights List */
.fd-insights-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 240px;
    overflow-y: auto;
}

.fd-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary, #f8fafc);
    transition: transform 0.2s ease;
}

.fd-insight-item:hover {
    transform: translateX(4px);
}

body.dark-mode .fd-insight-item {
    background: rgba(15, 23, 42, 0.4);
}

.fd-insight-item.success { border-left: 3px solid var(--fd-success); }
.fd-insight-item.warning { border-left: 3px solid var(--fd-warning); }
.fd-insight-item.info { border-left: 3px solid var(--fd-info); }
.fd-insight-item.critical { border-left: 3px solid var(--fd-danger); }

.fd-insight-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.fd-insight-item.success .fd-insight-icon { background: rgba(34, 197, 94, 0.15); color: var(--fd-success); }
.fd-insight-item.warning .fd-insight-icon { background: rgba(245, 158, 11, 0.15); color: var(--fd-warning); }
.fd-insight-item.info .fd-insight-icon { background: rgba(59, 130, 246, 0.15); color: var(--fd-info); }
.fd-insight-item.critical .fd-insight-icon { background: rgba(239, 68, 68, 0.15); color: var(--fd-danger); }

.fd-insight-content {
    flex: 1;
    min-width: 0;
}

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

body.dark-mode .fd-insight-title {
    color: #f1f5f9;
}

.fd-insight-message {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    line-height: 1.4;
}

.fd-insight-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-secondary, #64748b);
}

.fd-insight-empty i {
    font-size: 24px;
    opacity: 0.4;
}

.fd-insight-empty span {
    font-size: 12px;
}

/* Quota Panel */
.fd-quota-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.fd-quota-ring {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

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

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

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

.fd-quota-ring-fill {
    fill: none;
    stroke: var(--fd-primary);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease-out;
}

.fd-quota-ring-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: 700;
    color: var(--fd-primary);
}

.fd-quota-breakdown {
    flex: 1;
}

.fd-quota-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .fd-quota-row {
    border-color: rgba(148, 163, 184, 0.1);
}

.fd-quota-row:last-child {
    border-bottom: none;
}

.fd-quota-row.total {
    padding-top: 10px;
    margin-top: 4px;
}

.fd-quota-label {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.fd-quota-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-quota-value {
    color: #f1f5f9;
}

.fd-quota-value.highlight {
    color: var(--fd-primary);
}

.fd-quota-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fd-quota-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-sm);
    font-size: 11px;
}

body.dark-mode .fd-quota-chip {
    background: rgba(15, 23, 42, 0.4);
}

.fd-quota-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.fd-period-selector select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f8fafc);
    font-size: 12px;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
}

body.dark-mode .fd-period-selector select {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

/* ============================================
   TEAM VIEW
   ============================================ */
.fd-team-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.fd-team-stat-card {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
    position: relative;
    overflow: hidden;
}

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

.fd-team-stat-card.primary {
    background: linear-gradient(135deg, var(--fd-primary), var(--fd-primary-dark));
    border: none;
}

.fd-team-stat-card.primary * {
    color: #fff !important;
}

.fd-team-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: linear-gradient(135deg, var(--fd-primary), var(--fd-primary-dark));
    color: #fff;
}

.fd-team-stat-card.primary .fd-team-stat-icon {
    background: rgba(255,255,255,0.2);
}

.fd-team-stat-icon.secondary { background: linear-gradient(135deg, var(--fd-purple), #7c3aed); }
.fd-team-stat-icon.success { background: linear-gradient(135deg, var(--fd-success), #16a34a); }
.fd-team-stat-icon.warning { background: linear-gradient(135deg, var(--fd-warning), #d97706); }

.fd-team-stat-content {
    flex: 1;
}

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

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

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

.fd-team-stat-trend {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.fd-team-stat-trend.up { color: var(--fd-success); }
.fd-team-stat-trend.down { color: var(--fd-danger); }

/* Your Position */
.fd-your-position {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

.fd-position-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

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

body.dark-mode .fd-position-header h3 {
    color: #f1f5f9;
}

.fd-position-header h3 i {
    color: var(--fd-primary);
}

.fd-position-rank {
    background: linear-gradient(135deg, var(--fd-success), var(--fd-success-light));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
}

.fd-position-chart {
    margin-bottom: 20px;
}

.fd-distribution-bar {
    height: 24px;
    border-radius: var(--radius-md);
    display: flex;
    overflow: hidden;
    position: relative;
    margin-bottom: 10px;
}

.fd-dist-segment {
    height: 100%;
    transition: width 0.5s ease;
}

.fd-dist-segment.critical { background: var(--fd-danger); }
.fd-dist-segment.attention { background: var(--fd-warning); }
.fd-dist-segment.fair { background: #fbbf24; }
.fd-dist-segment.good { background: #22c55e; }
.fd-dist-segment.excellent { background: var(--fd-success); }

.fd-your-marker {
    position: absolute;
    top: -8px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.5s ease;
}

.fd-marker-dot {
    width: 16px;
    height: 16px;
    background: #fff;
    border: 3px solid var(--fd-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.fd-marker-label {
    background: var(--fd-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-md);
    margin-top: 4px;
    white-space: nowrap;
}

.fd-dist-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary, #64748b);
}

.fd-position-comparison {
    display: flex;
    gap: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .fd-position-comparison {
    border-color: rgba(148, 163, 184, 0.1);
}

.fd-compare-item {
    flex: 1;
    text-align: center;
}

.fd-compare-label {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    display: block;
    margin-bottom: 4px;
}

.fd-compare-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-compare-value {
    color: #f1f5f9;
}

.fd-compare-value.highlight {
    color: var(--fd-primary);
}

.fd-compare-value.positive {
    color: var(--fd-success);
}

.fd-compare-value.negative {
    color: var(--fd-danger);
}

/* Team Dimensions Comparison */
.fd-team-dimensions {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

.fd-team-dim-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.fd-team-dim-row {
    display: grid;
    grid-template-columns: 100px 1fr 60px;
    gap: 14px;
    align-items: center;
}

.fd-team-dim-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #1e293b);
}

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

.fd-team-bar-track {
    height: 20px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

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

.fd-team-bar {
    position: absolute;
    height: 8px;
    border-radius: var(--radius-xs);
    transition: width 0.8s ease;
}

.fd-team-bar.you {
    top: 2px;
    background: linear-gradient(90deg, var(--fd-primary), var(--fd-primary-light));
}

.fd-team-bar.avg {
    bottom: 2px;
    background: var(--text-secondary, #94a3b8);
    opacity: 0.6;
}

.fd-team-dim-values {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    font-weight: 600;
}

.fd-team-dim-values .you {
    color: var(--fd-primary);
}

.fd-team-dim-values .avg {
    color: var(--text-secondary, #64748b);
}

.fd-team-dim-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.fd-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.fd-legend-dot {
    width: 12px;
    height: 6px;
    border-radius: var(--radius-xs);
}

.fd-legend-item.you .fd-legend-dot {
    background: linear-gradient(90deg, var(--fd-primary), var(--fd-primary-light));
}

.fd-legend-item.avg .fd-legend-dot {
    background: var(--text-secondary, #94a3b8);
    opacity: 0.6;
}

/* Team Insights */
.fd-team-insights {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

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

/* ============================================
   ADMIN VIEW
   ============================================ */
.fd-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.fd-admin-title h3 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-admin-title h3 {
    color: #f1f5f9;
}

.fd-admin-subtitle {
    font-size: 13px;
    color: var(--text-secondary, #64748b);
}

.fd-admin-actions {
    display: flex;
    gap: 10px;
}

.fd-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

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

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

body.dark-mode .fd-btn-secondary {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

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

/* Admin Stats */
.fd-admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.fd-admin-stat {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

.fd-admin-stat.warning {
    border-color: rgba(245, 158, 11, 0.3);
}

.fd-admin-stat.warning .fd-admin-stat-value {
    color: var(--fd-warning);
}

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

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

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

/* Member Panel */
.fd-member-panel {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

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

.fd-member-search {
    flex: 1;
    position: relative;
}

.fd-member-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #64748b);
    font-size: 14px;
}

.fd-member-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-member-search input {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.fd-member-filters {
    display: flex;
    gap: 10px;
}

.fd-member-filters select {
    padding: 10px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md);
    font-size: 13px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
    cursor: pointer;
}

body.dark-mode .fd-member-filters select {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.fd-member-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.fd-member-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.fd-member-card:hover {
    background: var(--bg-tertiary, #f1f5f9);
    transform: translateX(4px);
}

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

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

.fd-member-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

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

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

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

.fd-member-tz {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.fd-member-score {
    font-size: 20px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.fd-member-score.excellent { color: var(--fd-success); }
.fd-member-score.good { color: #22c55e; }
.fd-member-score.fair { color: var(--fd-warning); }
.fd-member-score.attention { color: #f59e0b; }
.fd-member-score.critical { color: var(--fd-danger); }

.fd-member-burden {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 80px;
}

.fd-member-burden-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: var(--radius-xs);
    overflow: hidden;
}

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

.fd-member-burden-fill {
    height: 100%;
    border-radius: var(--radius-xs);
    background: var(--fd-primary);
    transition: width 0.5s ease;
}

.fd-member-burden-label {
    font-size: 10px;
    color: var(--text-secondary, #64748b);
}

.fd-member-actions {
    display: flex;
    gap: 6px;
}

.fd-member-actions button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fd-member-actions button:hover {
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-primary, #1e293b);
}

.fd-member-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-secondary, #64748b);
}

.fd-member-empty i {
    font-size: 36px;
    opacity: 0.4;
}

/* Admin Alerts */
.fd-admin-alerts {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color, rgba(0,0,0,0.04));
}

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

.fd-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fd-alert-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid var(--fd-warning);
}

.fd-alert-item.critical {
    background: rgba(239, 68, 68, 0.08);
    border-left-color: var(--fd-danger);
}

.fd-alert-item.info {
    background: rgba(59, 130, 246, 0.08);
    border-left-color: var(--fd-info);
}

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

.fd-alert-item.critical .fd-alert-icon {
    background: rgba(239, 68, 68, 0.15);
    color: var(--fd-danger);
}

.fd-alert-item.info .fd-alert-icon {
    background: rgba(59, 130, 246, 0.15);
    color: var(--fd-info);
}

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

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

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

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

.fd-alert-action {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--fd-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fd-alert-action:hover {
    transform: translateY(-1px);
}

/* ============================================
   SETTINGS DRAWER
   ============================================ */
.fd-settings-drawer {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100vh;
    height: 100dvh; /* Mobile-chrome-aware viewport unit (audit Wave 4A) */
    background: var(--bg-primary, #fff);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

body.dark-mode .fd-settings-drawer {
    background: #1e293b;
}

.fd-settings-drawer.open {
    right: 0;
}

.fd-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .fd-drawer-header {
    border-color: rgba(148, 163, 184, 0.1);
}

.fd-drawer-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    display: flex;
    align-items: center;
    gap: 10px;
}

body.dark-mode .fd-drawer-header h3 {
    color: #f1f5f9;
}

.fd-drawer-header h3 i {
    color: var(--fd-primary);
}

.fd-drawer-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full, 9999px);
    border: none;
    background: var(--bg-secondary, #f1f5f9);
    color: var(--text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

.fd-drawer-close:hover {
    background: var(--bg-tertiary, #e2e8f0);
    color: var(--text-primary, #1e293b);
}

.fd-drawer-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.fd-setting-group {
    margin-bottom: 24px;
}

.fd-setting-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin-bottom: 8px;
}

body.dark-mode .fd-setting-label {
    color: #f1f5f9;
}

.fd-setting-input,
.fd-setting-select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--bg-secondary, #f8fafc);
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-setting-input,
body.dark-mode .fd-setting-select {
    background: rgba(15, 23, 42, 0.4);
    border-color: rgba(148, 163, 184, 0.2);
    color: #f1f5f9;
}

.fd-setting-hint {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    margin-top: 6px;
    display: block;
}

.fd-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

body.dark-mode .fd-setting-row {
    border-color: rgba(148, 163, 184, 0.1);
}

.fd-setting-info {
    flex: 1;
}

/* ============================================
   UPGRADE BANNER
   ============================================ */
.fd-upgrade-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    margin-top: 20px;
}

body.dark-mode .fd-upgrade-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
}

.fd-upgrade-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.fd-upgrade-content > i {
    font-size: 24px;
    color: var(--fd-warning);
}

.fd-upgrade-content strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary, #1e293b);
}

body.dark-mode .fd-upgrade-content strong {
    color: #f1f5f9;
}

.fd-upgrade-content span {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.fd-upgrade-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--fd-primary), var(--fd-primary-dark));
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fd-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .fd-team-overview {
        grid-template-columns: repeat(2, 1fr);
    }

    .fd-admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .fd-two-col {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .fd-header {
        padding: 16px 16px 0;
    }

    .fd-brand-text h2 {
        font-size: 16px;
    }

    .fd-view-tab {
        padding: 12px 14px;
        font-size: 13px;
    }

    .fd-view-tab span {
        display: none;
    }

    .fd-hero-content {
        flex-direction: column;
        text-align: center;
    }

    .fd-hero-info {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .fd-hero-stats {
        justify-content: center;
    }

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

    .fd-team-overview,
    .fd-admin-stats {
        grid-template-columns: 1fr 1fr;
    }

    .fd-team-stat-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .fd-admin-header {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .fd-admin-actions {
        justify-content: stretch;
    }

    .fd-admin-actions .fd-btn {
        flex: 1;
        justify-content: center;
    }

    .fd-member-header {
        flex-direction: column;
    }

    .fd-member-filters {
        width: 100%;
    }

    .fd-member-filters select {
        flex: 1;
    }

    .fd-team-dim-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .fd-upgrade-banner {
        flex-direction: column;
        gap: 14px;
        text-align: center;
    }

    .fd-upgrade-content {
        flex-direction: column;
    }

    .fd-settings-drawer {
        width: 100%;
        right: -100%;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
}

.fd-marker-dot {
    animation: pulseGlow 2s ease-in-out infinite;
}

/* ============================================
   PERIOD SELECTOR BAR & TIER INDICATOR
   (for multi-tier data lifecycle)
   ============================================ */
.fm-period-selector-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.fm-period-selector {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary, #f1f5f9);
    border-radius: var(--radius-md);
    padding: 3px;
}

body.dark-mode .fm-period-selector {
    background: rgba(15, 23, 42, 0.4);
}

.fm-period-btn {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fm-period-btn:hover {
    color: var(--text-primary, #1e293b);
    /* Teal tint of --primary-500 #14b8a6 (was an off-brand indigo tint). */
    background: rgba(20, 184, 166, 0.08);
}

body.dark-mode .fm-period-btn:hover {
    color: #f1f5f9;
    background: rgba(20, 184, 166, 0.15);
}

.fm-period-btn.active {
    background: var(--fd-primary, #14b8a6);
    color: #fff;
    font-weight: 600;
    /* Teal glow to match the teal active fill (was an off-brand indigo glow). */
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
}

/* Tier-locked periods. The padlock is a compact Font Awesome glyph appended via
   ::after (was a trailing " 🔒" in the label, which inflated each locked button
   by ~20px and pushed the 5-button row off narrow phones — user 2026-07-07).
   The label text itself carries no lock now, so buttons stay slim; the muted
   colour + small lock still read as "locked". */
.fm-period-btn-locked {
    color: var(--text-tertiary, #94a3b8);
    opacity: 0.85;
}

.fm-period-btn-locked::after {
    content: "\f023"; /* fa-lock */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.72em;
    margin-left: 4px;
    opacity: 0.7;
    vertical-align: baseline;
}

.tier-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tier-indicator.tier-raw {
    background: rgba(34, 197, 94, 0.12);
    color: var(--fd-success, #22c55e);
}

.tier-indicator.tier-weekly {
    background: rgba(59, 130, 246, 0.12);
    color: var(--fd-info, #3b82f6);
}

.tier-indicator.tier-monthly {
    background: rgba(139, 92, 246, 0.12);
    color: var(--fd-purple, #8b5cf6);
}

/* "Updated X mins ago" caption next to the period selector. Quiet by
   default — users only check it when they wonder how stale their view
   is, so it shouldn't compete with the period buttons for attention. */
.fm-freshness {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--fd-text-muted, #64748b);
    opacity: 0.75;
    white-space: nowrap;
}
.fm-freshness:empty { display: none; }

/* Fairness-score sparklines.
   Plots fairness score 0–100 (not raw burden) so direction semantics
   invert vs a burden chart: higher score = more fair = green; lower
   score = less fair = red. Colours derive from the canonical
   STATUS_PRESENTATION palette tokens (see traffic_light_palette memory)
   so they stay in sync with the rest of the fairness colouring. */
.fm-sparkline {
    display: inline-block;
    line-height: 0;
    color: var(--fd-text-muted, #64748b);
}
.fm-sparkline-svg {
    display: block;
    width: 100%;
    height: 100%;
}
.fm-sparkline-svg[data-trend="up"]   { color: var(--fv-l2, #22c55e); }
.fm-sparkline-svg[data-trend="down"] { color: var(--fv-l8, #dc2626); }
.fm-sparkline-svg[data-trend="flat"] { color: var(--fd-text-muted, #64748b); }
.fm-sparkline-line {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.fm-sparkline-dot { fill: currentColor; }
.fm-sparkline-empty { min-height: 22px; }
.fm-sparkline-empty:not(:has(.fm-sparkline-empty-caption))::after {
    content: '';
    display: block;
    height: 1px;
    background: var(--fv-panel-border, #e5e7eb);
    opacity: 0.6;
    margin-top: 10px;
}
.fm-sparkline-empty-caption {
    display: inline-block;
    line-height: 1.4;
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    font-style: italic;
}

/* Overall sparkline lives next to the hero subtitle, taking up the
   width of the hero text column. The dimension sparklines are
   compacter so they fit inside each gauge card. */
.fm-overall-trend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}
.fm-overall-trend .fm-sparkline {
    flex: 1;
    height: 36px;
    max-width: 240px;
}
/* Collapse the trend row when there's no history to plot (empty sparkline +
   hidden delta chip) so the hero isn't padded by ~46px of empty space — the
   common case for new users, which was making the hero read as oversized. */
.fm-overall-trend:has(.fm-sparkline-empty):has(.fm-delta-chip[hidden]) {
    display: none;
}

.fm-dim-trendline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    margin-bottom: 4px;
}
.fm-dim-trendline .fm-sparkline-sm {
    flex: 1;
    height: 22px;
    max-width: 120px;
}

/* Delta chip ("▲ 8 vs prior 30d") sits next to its sparkline.
   Quiet styling — it's a side-channel, not a callout. */
.fm-delta-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    background: var(--fv-header-bg, #f9fafb);
    color: var(--fd-text-muted, #64748b);
    border: 1px solid var(--fv-panel-border, #e5e7eb);
    white-space: nowrap;
}
.fm-delta-chip.fm-delta-up {
    color: var(--fv-l2, #22c55e);
    background: color-mix(in srgb, var(--fv-l2, #22c55e) 10%, transparent);
    border-color: color-mix(in srgb, var(--fv-l2, #22c55e) 25%, transparent);
}
.fm-delta-chip.fm-delta-down {
    color: var(--fv-l8, #dc2626);
    background: color-mix(in srgb, var(--fv-l8, #dc2626) 10%, transparent);
    border-color: color-mix(in srgb, var(--fv-l8, #dc2626) 25%, transparent);
}
.fm-delta-chip.fm-delta-flat {
    color: var(--fd-text-muted, #64748b);
}

/* Trend glyph — single ▲ / ▼ / — derived from monthly summary trend. */
.fm-dim-trend {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    color: var(--fd-text-muted, #64748b);
}
.fm-dim-trend.fm-trend-up   { color: var(--fv-l2, #22c55e); }
.fm-dim-trend.fm-trend-down { color: var(--fv-l8, #dc2626); }
.fm-dim-trend.fm-trend-flat { color: var(--fd-text-muted, #64748b); }

/* Retention horizon line under the period selector. Neutral copy:
   informs the user how much history this tier retains, with a soft
   prompt for free/personal to extend it. */
.fm-retention-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    background: var(--fv-header-bg, #f9fafb);
    border: 1px solid var(--fv-panel-border, #e5e7eb);
    border-radius: 8px;
}
.fm-retention-line i {
    opacity: 0.7;
}
/* Window/direction explainer (2026-07-15 education-surfaces audit). Retrospective
   + low-means-carried-more clarifier under the retention line. */
.fm-window-explainer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    margin: 6px 0 2px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--fd-text-muted, #64748b);
    background: var(--fv-header-bg, #f9fafb);
    border: 1px solid var(--fv-panel-border, #e5e7eb);
    border-radius: 8px;
}
.fm-window-explainer i {
    opacity: 0.7;
    margin-top: 2px;
    flex-shrink: 0;
}
.fm-retention-upgrade {
    margin-left: auto;
    font-weight: 600;
    color: var(--fd-link, #2563eb);
    text-decoration: none;
}
.fm-retention-upgrade:hover {
    text-decoration: underline;
}

body.dark-mode .tier-indicator.tier-raw {
    background: rgba(34, 197, 94, 0.18);
}

body.dark-mode .tier-indicator.tier-weekly {
    background: rgba(59, 130, 246, 0.18);
}

body.dark-mode .tier-indicator.tier-monthly {
    background: rgba(139, 92, 246, 0.18);
}

@media (max-width: 600px) {
    .fm-period-selector-bar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Wrap the 5 period buttons onto a second row instead of scrolling them
       off the right edge (user 2026-07-07: "they go off screen, there isn't
       enough space"). overflow-x:auto hid the locked buttons behind a scroll;
       wrapping keeps every option visible. Slimmer padding/gap + the compact
       ::after lock (no more " 🔒" text) let 5 buttons fit two tidy rows. */
    .fm-period-selector {
        flex-wrap: wrap;
        gap: 3px;
        justify-content: center;
    }

    .fm-period-btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .tier-indicator {
        align-self: flex-start;
    }
}

/* Print Styles */
@media print {
    .fd-header {
        background: #0d9488 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .fd-settings-drawer,
    .fd-upgrade-banner,
    .fd-admin-actions,
    .fd-member-actions,
    .fm-period-selector-bar {
        display: none !important;
    }
}

/* ============================================
   FDM - DYNAMIC DASHBOARD MODAL
   Styles for JS-generated fairness dashboard
   (showDashboard / generateDashboardHTML)
   ============================================ */

/* Modal overlay & container */
.fdm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.fdm-modal.active {
    opacity: 1;
}

.fdm-modal-content {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-xl, 16px);
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.fdm-modal.active .fdm-modal-content {
    transform: translateY(0);
}

body.dark-mode .fdm-modal-content {
    background: #1e293b;
}

/* Header */
.fdm-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
}

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

.fdm-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

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

.fdm-brand-icon {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border-radius: var(--radius-lg, 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 h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.fdm-tier-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #1e1b4b;
    padding: 2px 8px;
    border-radius: var(--radius-sm, 4px);
    margin-left: 8px;
}

.fdm-close-btn {
    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;
    font-size: 16px;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
}

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

/* Period tabs */
.fdm-period-tabs {
    display: flex;
    gap: 4px;
}

.fdm-period-tab {
    padding: 6px 14px;
    border: none;
    border-radius: var(--radius-sm, 4px);
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.fdm-period-tab.active {
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 600;
}

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

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

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

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

/* Stats row */
.fdm-stats-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 14px;
}

.fdm-stat-card {
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-lg, 12px);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.06));
}

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, var(--fd-primary, #6366f1), var(--fd-primary-dark, #4f46e5));
    border: none;
    color: #fff;
    flex-direction: row;
}

.fdm-stat-card.primary * {
    color: #fff;
}

.fdm-stat-card:not(.primary) {
    flex-direction: column;
    text-align: center;
}

/* Score ring in stat card */
.fdm-stat-ring {
    position: relative;
    width: 64px;
    height: 64px;
    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: 20px;
    font-weight: 800;
}

.fdm-stat-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

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

.fdm-stat-status.excellent,
.fdm-stat-status.good { color: var(--fd-success, #22c55e); }
.fdm-stat-card.primary .fdm-stat-status.excellent,
.fdm-stat-card.primary .fdm-stat-status.good { color: #bbf7d0; }
.fdm-stat-status.warning { color: var(--fd-warning, #f59e0b); }
.fdm-stat-status.critical { color: var(--fd-danger, #ef4444); }

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

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

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

/* Sections */
.fdm-section {
    background: var(--bg-secondary, #f8fafc);
    border-radius: var(--radius-lg, 12px);
    padding: 20px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.06));
}

body.dark-mode .fdm-section {
    background: rgba(30, 41, 59, 0.6);
    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;
}

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

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

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

.fdm-dim-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm, 4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #fff;
    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: 10px;
}

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

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

.fdm-dim-fill {
    height: 100%;
    border-radius: var(--radius-xs, 2px);
    transition: width 0.8s ease-out;
}

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

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

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

.fdm-member-card {
    background: var(--bg-primary, #fff);
    border-radius: var(--radius-md, 8px);
    padding: 16px;
    border: 1px solid var(--border-color, rgba(0,0,0,0.06));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fdm-member-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

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: 10px;
    margin-bottom: 12px;
}

.fdm-member-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

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

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

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

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

.fdm-member-score.excellent { color: var(--fd-success, #22c55e); }
.fdm-member-score.good { color: #22c55e; }
.fdm-member-score.warning { color: var(--fd-warning, #f59e0b); }
.fdm-member-score.critical { color: var(--fd-danger, #ef4444); }

/* Member bar rows */
.fdm-member-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.fdm-member-bar-row {
    display: grid;
    grid-template-columns: 65px 1fr 28px;
    gap: 8px;
    align-items: center;
}

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

.fdm-bar-track {
    height: 5px;
    background: var(--bg-tertiary, #e2e8f0);
    border-radius: var(--radius-xs, 2px);
    overflow: hidden;
}

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

.fdm-bar-fill {
    height: 100%;
    border-radius: var(--radius-xs, 2px);
    transition: width 0.6s ease-out;
}

.fdm-bar-value {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    text-align: right;
}

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

/* Member insight */
.fdm-member-insight {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color, rgba(0,0,0,0.06));
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.fdm-member-insight i {
    color: var(--fd-warning, #f59e0b);
    flex-shrink: 0;
    margin-top: 1px;
}

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

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

.fdm-empty-state i {
    font-size: 36px;
    opacity: 0.4;
}

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

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

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

.fdm-alert {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-md, 8px);
    background: rgba(59, 130, 246, 0.08);
    border-left: 3px solid var(--fd-info, #3b82f6);
}

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

.fdm-alert.warning {
    background: rgba(245, 158, 11, 0.08);
    border-left-color: var(--fd-warning, #f59e0b);
}

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

.fdm-alert-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md, 8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fdm-alert.success .fdm-alert-icon { background: rgba(34, 197, 94, 0.15); color: var(--fd-success, #22c55e); }
.fdm-alert.warning .fdm-alert-icon { background: rgba(245, 158, 11, 0.15); color: var(--fd-warning, #f59e0b); }
.fdm-alert.critical .fdm-alert-icon { background: rgba(239, 68, 68, 0.15); color: var(--fd-danger, #ef4444); }
.fdm-alert-icon { background: rgba(59, 130, 246, 0.15); color: var(--fd-info, #3b82f6); }

.fdm-alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

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

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

/* Upgrade note */
.fdm-upgrade-note {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg, 12px);
}

body.dark-mode .fdm-upgrade-note {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
}

.fdm-upgrade-note-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md, 8px);
    background: linear-gradient(135deg, var(--fd-primary, #6366f1), var(--fd-primary-dark, #4f46e5));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
}

.fdm-upgrade-note-content h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    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 12px 0;
    font-size: 12px;
    color: var(--text-secondary, #64748b);
    line-height: 1.5;
}

.fdm-upgrade-note-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--fd-primary, #6366f1), var(--fd-primary-dark, #4f46e5));
    color: #fff;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fdm-upgrade-note-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

/* FDM Responsive */
@media (max-width: 600px) {
    .fdm-modal {
        padding: 10px;
    }

    .fdm-modal-content {
        max-height: 92vh;
    }

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

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

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

    .fdm-dim-label {
        min-width: 120px;
    }

    .fdm-upgrade-note {
        flex-direction: column;
    }
}

/* ============================================
   FAIRNESS DASHBOARD — EMPTY / FIRST-RUN STATE
   ============================================
   Applied via .fm-is-empty on the hero + each dimension card when the
   user has too few synced events to produce a meaningful score. Replaces
   the previous "all zeros + Needs Attention warning" path with a quiet,
   honest "no data yet" view that day-1 users don't experience as alarming.
*/

.fm-hero.fm-is-empty {
    /* Keep the layout but soften the values. The em-dash in the score
       number tells the story; opacity reinforces "this isn't ready yet". */
    opacity: 0.85;
}
.fm-hero.fm-is-empty .fm-score-number {
    color: var(--slate-400, #94a3b8);
    font-weight: 500;
}
.fm-hero.fm-is-empty .fm-hero-status {
    color: var(--slate-500, #64748b);
}
.fm-hero.fm-is-empty .fm-hero-status i {
    color: var(--slate-400, #94a3b8);
}
.fm-hero.fm-is-empty .fm-hero-subtitle {
    color: var(--slate-600, #475569);
    font-style: italic;
}

.fm-dimension-card.fm-is-empty {
    opacity: 0.55;
}
.fm-dimension-card.fm-is-empty .fm-dim-score {
    color: var(--slate-400, #94a3b8);
    background: transparent;
}
.fm-dimension-card.fm-is-empty .fm-dim-gauge-fill {
    /* Cleared via JS but reinforce here in case of repaint races. */
    width: 0% !important;
    background: var(--slate-200, #e2e8f0);
}

body.dark-mode .fm-hero.fm-is-empty .fm-hero-subtitle {
    color: var(--slate-400, #94a3b8);
}
body.dark-mode .fm-dimension-card.fm-is-empty .fm-dim-gauge-fill {
    background: var(--slate-700, #334155);
}

/* ============================================
   FAIRNESS DASHBOARD — PERSONAL / TEAM SECTION BREAK
   ============================================
   The .fm-section-break wrapper sits between the personal block (hero +
   metrics + insight) and the team-balance narrative. Visual hierarchy:
   a thin top border + an h3 with an icon, no heavy decoration. Hidden
   together as a unit when there's no team data, so the header never
   orphans.
*/

.fm-section-break {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle, #e2e8f0);
}
.fm-section-break .fm-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    letter-spacing: 0.01em;
}
.fm-section-break .fm-section-title i {
    color: var(--primary-500, #14b8a6);
    font-size: 0.95rem;
}
.fm-section-break .fm-team-balance {
    /* Override the standalone .fm-team-balance margin from the legacy
       layout where it sat above the hero — it's now wrapped, so the
       parent .fm-section-break drives the spacing. */
    margin: 0;
}
body.dark-mode .fm-section-break {
    border-top-color: var(--border-default, #334155);
}
body.dark-mode .fm-section-break .fm-section-title {
    color: var(--slate-400, #94a3b8);
}
body.dark-mode .fm-section-break .fm-section-title i {
    color: var(--primary-400, #2dd4bf);
}

/* Top-tier users see "Showing 365 days." without the dead "Upgrade for
   more" anchor. CSS-only trick: hide the trailing space + period that
   the markup leaves behind when the anchor is display:none. */
.fm-tier-pill.fm-tier-banner-no-upgrade span {
    /* The legacy markup is: Showing <strong>X</strong> days. <a>...</a>
       — when the <a> is hidden, the period before it stays. That's fine
       (it reads as "Showing 365 days."), so this rule is intentionally
       minimal: no change needed beyond cosmetics. */
}

/* ── Seeded-history provenance + import flow (2026-08-24) ──────────────────
   Imported (seeded) ledger rows are inferred, never measured. The provenance
   line under the retention line discloses their existence; the import modal
   is the preview/confirm surface. Amber accents mark "estimate", matching
   nothing that reads as a score band. */
.fm-provenance-line {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    background: var(--fv-header-bg, #f9fafb);
    border: 1px dashed var(--warning-300, #fcd34d);
    border-radius: 8px;
    /* WRAP, don't overflow (2026-09-01, reported on a phone): the row is
       icon + copy + a nowrap button pinned by margin-left:auto. With no
       wrapping and a non-shrinking button, a two-line label pushed "Import
       past meetings" straight off the right edge of the modal. Allowing the
       row to wrap lets the button drop to its own line instead. */
    flex-wrap: wrap;
}

/* The copy takes the remaining width and may wrap; it must be allowed to
   shrink below its content size or flex keeps the row too wide. */
.fm-provenance-line > span:not(.fm-provenance-btn) {
    flex: 1 1 12ch;
    min-width: 0;
}
.fm-provenance-line i { opacity: 0.7; }
.fm-provenance-btn {
    margin-left: auto;
    flex-shrink: 0;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-700, #0f766e);
    background: transparent;
    border: 1px solid var(--primary-300, #5eead4);
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
}
.fm-provenance-btn:hover {
    background: var(--primary-50, #f0fdfa);
}
body.dark-mode .fm-provenance-line {
    background: var(--slate-800, #1e293b);
    border-color: var(--warning-700, #b45309);
}
body.dark-mode .fm-provenance-btn {
    color: var(--primary-300, #5eead4);
    border-color: var(--primary-600, #0d9488);
}
body.dark-mode .fm-provenance-btn:hover {
    background: rgba(45, 212, 191, 0.08);
}

/* Import modal */
.fairness-import-content {
    max-width: 560px;
    width: min(560px, calc(100vw - 32px));
}
.fairness-import-body {
    max-height: min(60vh, 520px);
    overflow-y: auto;
}
.fis-explainer {
    font-size: 13px;
    line-height: 1.5;
    color: var(--fd-text-muted, #64748b);
    margin: 0 0 12px;
}
.fis-section { margin: 0 0 14px; }
.fis-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.fis-section-head h3 {
    font-size: 13px;
    font-weight: 700;
    margin: 0;
}
.fis-section-hint {
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    margin: 0 0 8px;
}
.fis-toggle-all {
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}
.fis-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 6px;
    border: 1px solid var(--fv-panel-border, #e5e7eb);
    border-radius: 8px;
    background: var(--fv-header-bg, #f9fafb);
}
.fis-candidate { cursor: pointer; }
.fis-check { margin-top: 3px; flex: none; }
.fis-row-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.fis-row-title {
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}
.fis-row-meta,
.fis-row-note {
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
}
.fis-row-note { font-style: italic; }
.fis-seeded {
    border-style: dashed;
    border-color: var(--warning-300, #fcd34d);
}
.fis-badge {
    flex: none;
    margin-top: 2px;
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--warning-800, #92400e);
    background: var(--warning-100, #fef3c7);
    border-radius: 999px;
}
.fis-remove,
.fis-remove-all,
.btn-text.fis-remove {
    flex: none;
    margin-left: auto;
    padding: 2px 8px;
    font-size: 12px;
    color: var(--fd-text-muted, #64748b);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: underline;
}
.fis-remove:hover,
.fis-remove-all:hover { color: var(--danger-600, #dc2626); }
.fis-skipped summary {
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
}
.fis-skip-row { opacity: 0.75; }
.fis-blocked,
.fis-none {
    font-size: 13px;
    color: var(--fd-text-muted, #64748b);
    padding: 10px;
    text-align: center;
}
.fairness-import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
body.dark-mode .fis-row {
    background: var(--slate-800, #1e293b);
    border-color: var(--border-default, #334155);
}
body.dark-mode .fis-seeded { border-color: var(--warning-700, #b45309); }
body.dark-mode .fis-badge {
    color: var(--warning-200, #fde68a);
    background: rgba(180, 83, 9, 0.25);
}

/* ============================================================
   2026-09-01 REDESIGN — score-invisible personal balance
   The ring + four dimension gauges are gone; these blocks style their
   replacements. Fresh class names (.fm-verdict-hero, .fm-facts,
   .fm-behind) deliberately escape the legacy .fm-hero / .fm-dimensions
   rules in settings-modals.css, which now style nothing.
   ============================================================ */

/* Verdict hero — a sentence in the app's verdict idiom: tone on a left
   rule, neutral wash, no gradient card. Band hue anchors reuse the same
   --fm-band-hue contract the old hero used (set via [data-band] from
   updateHeroStatus, canonical --fv-* ramp). */
.fm-verdict-hero {
    padding: 12px 14px;
    border-radius: var(--radius-sm, 8px);
    border-left: 3px solid var(--status-empty, #e2e8f0);
    background: rgba(148, 163, 184, 0.08);
}

.fm-verdict-hero[data-band="excellent"]  { --fm-band-hue: var(--fv-l2, #15803d); }
.fm-verdict-hero[data-band="balanced"]   { --fm-band-hue: var(--fv-l3, #16a34a); }
.fm-verdict-hero[data-band="mixed"]      { --fm-band-hue: var(--fv-l5, #d97706); }
.fm-verdict-hero[data-band="stretched"]  { --fm-band-hue: var(--fv-l7, #ea580c); }
.fm-verdict-hero[data-band="overloaded"] { --fm-band-hue: var(--fv-l8, #dc2626); }

.fm-verdict-hero[data-band] {
    border-left-color: var(--fm-band-hue);
}

.fm-verdict-title {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #64748b);
}

.fm-verdict-hero .fm-hero-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
}

.fm-verdict-hero[data-band] .fm-hero-status {
    color: var(--fm-band-hue);
}

.fm-verdict-why {
    margin: 4px 0 0;
    font-size: 12.5px;
    color: var(--text-secondary, #64748b);
}

.fm-verdict-hero.fm-is-empty .fm-hero-status {
    color: var(--text-secondary, #64748b);
}

body.dark-mode .fm-verdict-hero {
    background: rgba(148, 163, 184, 0.1);
}

/* Facts row — the .ts-stat tile idiom: uppercase label, plain value,
   small note. Counts, never gauges. */
.fm-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.fm-fact {
    padding: 8px 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-left-width: 3px;
    border-left-color: var(--fd-primary, var(--primary-500, #14b8a6));
    border-radius: var(--radius-sm, 8px);
    background: var(--bg-primary, #fff);
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

body.dark-mode .fm-fact {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(148, 163, 184, 0.2);
    border-left-color: var(--fd-primary, var(--primary-500, #14b8a6));
}

.fm-fact-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary, #64748b);
}

.fm-fact-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #1e293b);
    font-variant-numeric: tabular-nums;
}

.fm-fact-note {
    font-size: 11px;
    color: var(--text-secondary, #64748b);
}

.fm-facts.fm-is-empty .fm-fact-value {
    color: var(--text-secondary, #64748b);
}

/* "What's behind this" breakdown — collapsed by default; facts about the
   viewer's own meetings only. */
.fm-behind {
    margin-top: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm, 8px);
    background: var(--bg-primary, #fff);
}

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

.fm-behind summary {
    padding: 9px 12px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    user-select: none;
}

.fm-behind summary::-webkit-details-marker { display: none; }

.fm-behind summary i {
    font-size: 12px;
    color: var(--text-secondary, #64748b);
}

.fm-behind-count {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: var(--radius-full, 9999px);
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary, #64748b);
}

.fm-behind summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: var(--text-secondary, #64748b);
    margin-left: auto;
    transition: transform 0.2s ease;
}

.fm-behind[open] summary::after { transform: rotate(180deg); }

.fm-behind-list {
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fm-behind-row {
    display: grid;
    grid-template-columns: minmax(72px, auto) 1fr auto auto;
    gap: 10px;
    align-items: baseline;
    padding: 5px 8px;
    border-radius: var(--radius-xs, 4px);
    font-size: 12px;
}

.fm-behind-row:nth-child(odd) {
    background: rgba(148, 163, 184, 0.07);
}

.fm-behind-row--outside {
    border-left: 2px solid var(--status-flex, #fbbf24);
}

.fm-behind-when {
    color: var(--text-secondary, #64748b);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fm-behind-title {
    color: var(--text-primary, #1e293b);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fm-behind-local {
    color: var(--text-secondary, #64748b);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.fm-behind-how {
    color: var(--text-secondary, #64748b);
    font-style: italic;
    white-space: nowrap;
}

.fm-behind-more {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary, #64748b);
    font-style: italic;
    padding-left: 8px;
}

/* History cards carry a band WORD in the old numeral slot; size it as a
   word, not a 32px number. */
.fm-history-card-band {
    font-size: 15px !important;
    font-weight: 700;
    line-height: 1.3;
}

/* History view hides the new current-view blocks (the legacy hide list in
   settings-modals.css targets .fm-hero/.fm-dimensions, which no longer
   exist). */
.fairness-modal-body.fm-view-history > .fm-verdict-hero,
.fairness-modal-body.fm-view-history > .fm-facts,
.fairness-modal-body.fm-view-history > .fm-behind,
.fairness-modal-body.fm-view-history > .fm-window-explainer,
.fairness-modal-body.fm-view-history > .fm-retention-line {
    display: none;
}

@media (max-width: 540px) {
    .fm-facts { grid-template-columns: 1fr 1fr; }
    .fm-behind-row {
        grid-template-columns: minmax(64px, auto) 1fr;
    }
    .fm-behind-local, .fm-behind-how { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
    .fm-behind summary::after { transition: none; }
}
