/* ============================================================
   MATCHING COCKPIT — Parameter Tuning & Visualisation
   ATLAS / Randstad Digital Belgium
   ============================================================ */

/* ---- Layout Shell ---- */
.mc-cockpit {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 0;
    height: 100%;
    min-height: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    transition: background 0.3s, border-color 0.3s;
}

.mc-cockpit.mc-panel-open {
    grid-template-columns: 300px 1fr;
}

/* ---- Parameters Panel (collapsible left) ---- */
.mc-params {
    display: none;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow: hidden;
    transition: background 0.3s, border-color 0.3s;
}

.mc-panel-open .mc-params {
    display: flex;
}

.mc-params-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mc-params-title {
    font-family: var(--font-atlas);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.mc-params-close {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
}

.mc-params-close:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* ---- Presets Row ---- */
.mc-presets {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
}

.mc-preset-btn {
    padding: 4px 10px;
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

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

/* ---- Sliders Area (compact: all 12 controls visible without scroll) ---- */
.mc-params-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 14px 10px;
    scrollbar-width: thin;
    scrollbar-color: rgba(100,116,139,0.2) transparent;
}

.mc-params-body::-webkit-scrollbar { width: 4px; }
.mc-params-body::-webkit-scrollbar-thumb { background: rgba(100,116,139,0.2); border-radius: 2px; }

/* ---- Section Divider inside panel ---- */
.mc-param-section {
    font-family: var(--font-atlas);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 6px 0 3px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.mc-param-section:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
}

/* ---- Individual Slider (compact) ---- */
.mc-slider-group {
    margin-bottom: 6px;
}

/* Slider is greyed + disabled when the current requirement doesn't demand
   the corresponding dimension. The tooltip set via JS explains why. */
.mc-slider-group.mc-slider-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.mc-slider-group.mc-slider-disabled .mc-slider-label,
.mc-slider-group.mc-slider-disabled .mc-slider-value {
    color: var(--text-muted);
    font-weight: 600;
}
.mc-slider-group.mc-slider-disabled .mc-range {
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(1);
}

.mc-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.mc-slider-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-atlas);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.15;
}

.mc-slider-icon {
    font-size: 0.68rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.mc-slider-value {
    font-family: var(--font-atlas);
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--primary-color);
    min-width: 28px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Compact mode: hide descriptions in the drawer.
   Full text is preserved as a tooltip on the slider group (set via JS). */
.mc-slider-desc {
    display: none;
}

/* Range input styling */
.mc-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.mc-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}

.mc-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(59,130,246,0.35);
}

.mc-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--surface);
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}

/* Filled track effect via gradient (set by JS) */
.mc-range {
    background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) 50%, var(--border) 50%, var(--border) 100%);
}

/* ---- Weight normalisation indicator (compact) ---- */
.mc-weight-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0 2px;
}

.mc-weight-bar-track {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
    display: flex;
}

.mc-weight-bar-seg {
    height: 100%;
    transition: width 0.25s ease;
}

.mc-weight-bar-label {
    font-family: var(--font-atlas);
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---- Main Stage (right side) ---- */
.mc-stage {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ---- Toolbar ---- */
.mc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 12px;
    flex-wrap: wrap;
}

.mc-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mc-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mc-toggle-params {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-family: var(--font-atlas);
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.mc-toggle-params:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mc-toggle-params.mc-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.mc-toggle-params svg {
    width: 14px;
    height: 14px;
}

/* View switcher (Table / Chart) */
.mc-view-switch {
    display: flex;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.mc-view-btn {
    padding: 5px 14px;
    font-family: var(--font-atlas);
    font-size: 0.74rem;
    font-weight: 600;
    border: none;
    background: var(--background);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mc-view-btn + .mc-view-btn {
    border-left: 1px solid var(--border);
}

.mc-view-btn:hover {
    color: var(--text-primary);
}

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

.mc-view-btn svg {
    width: 13px;
    height: 13px;
}

/* ---- Axis Selectors (chart mode only) ---- */
.mc-axis-selectors {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mc-axis-selectors.mc-hidden {
    display: none;
}

.mc-axis-label {
    font-family: var(--font-atlas);
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

.mc-axis-select {
    padding: 3px 8px;
    font-family: var(--font-atlas);
    font-size: 0.72rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-primary);
    cursor: pointer;
    min-width: 0;
}

.mc-axis-vs {
    font-family: var(--font-atlas);
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ---- Stat Pills in toolbar ---- */
.mc-stats-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mc-stat-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-atlas);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.mc-stat-pill strong {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.mc-stat-pill .mc-qualified {
    color: var(--success-color);
}

.mc-stat-pill .mc-below {
    color: var(--error-color);
}

/* ---- Results Stage ----
   The chart MUST never scroll; only the table body may scroll internally. */
.mc-results {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}
.mc-results .mc-chart-wrap {
    flex: 1;
}
.mc-results .mc-table-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}

/* ---- TABLE VIEW ---- */
.mc-table-wrap {
    padding: 0;
}

.mc-table {
    width: 100%;
    border-collapse: collapse;
}

.mc-table th,
.mc-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-atlas);
    font-size: 0.78rem;
    transition: background 0.15s;
    white-space: nowrap;
}

.mc-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--background);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.mc-table th:hover {
    color: var(--text-primary);
}

.mc-table th.mc-sort-active {
    color: var(--primary-color);
}

.mc-table th .mc-sort-arrow {
    display: inline-block;
    margin-left: 3px;
    font-size: 0.58rem;
    opacity: 0.5;
}

.mc-table th.mc-sort-active .mc-sort-arrow {
    opacity: 1;
}

.mc-table tbody tr {
    cursor: pointer;
    transition: background 0.12s;
}

.mc-table tbody tr:hover {
    background: var(--background);
}

.mc-table tbody tr.mc-row-selected {
    background: color-mix(in srgb, var(--primary-color) 8%, var(--surface));
    box-shadow: inset 3px 0 0 var(--primary-color);
}

/* ---- Rank Badge ---- */
.mc-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.mc-rank-1 { background: #fef3c7; color: #92400e; }
.mc-rank-2 { background: #e5e7eb; color: #374151; }
.mc-rank-3 { background: #fed7aa; color: #9a3412; }
.mc-rank-n { background: var(--background); color: var(--text-muted); }

[data-theme="dark"] .mc-rank-1 { background: #78350f; color: #fde68a; }
[data-theme="dark"] .mc-rank-2 { background: #374151; color: #d1d5db; }
[data-theme="dark"] .mc-rank-3 { background: #7c2d12; color: #fdba74; }
[data-theme="dark"] .mc-rank-n { background: var(--background); color: var(--text-muted); }

/* ---- Score Cell ---- */
.mc-score-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mc-score-num {
    font-weight: 800;
    font-size: 0.88rem;
    font-variant-numeric: tabular-nums;
    min-width: 30px;
}

.mc-score-green { color: #059669; }
.mc-score-amber { color: #d97706; }
.mc-score-red   { color: #dc2626; }

[data-theme="dark"] .mc-score-green { color: #34d399; }
[data-theme="dark"] .mc-score-amber { color: #fbbf24; }
[data-theme="dark"] .mc-score-red   { color: #f87171; }

.mc-score-bar {
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
    flex-shrink: 0;
}

.mc-score-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.35s cubic-bezier(.4,0,.2,1), background 0.35s;
}

/* ---- Sub-score sparkline cells ---- */
.mc-sub-score {
    font-variant-numeric: tabular-nums;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ---- Must-have pills ---- */
.mc-musthave {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 100px;
}

.mc-musthave-ok {
    background: #d1fae5;
    color: #065f46;
}

.mc-musthave-miss {
    background: #fee2e2;
    color: #991b1b;
}

[data-theme="dark"] .mc-musthave-ok { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .mc-musthave-miss { background: #7f1d1d; color: #fca5a5; }

/* ---- Below-threshold row fade ---- */
.mc-table tbody tr.mc-row-below {
    opacity: 0.45;
}

.mc-table tbody tr.mc-row-below:hover {
    opacity: 0.75;
}

/* ---- Candidate name cell ---- */
.mc-candidate-name {
    font-weight: 700;
    color: var(--text-primary);
}

.mc-candidate-profile {
    font-size: 0.66rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 1px;
}

/* ============================================================
   2D SCATTER CHART
   ============================================================ */
.mc-chart-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 18px 24px 42px 56px;
    --mc-dot-stroke: rgba(255,255,255,0.9);
    --mc-dot-stroke-w: 2;
    --mc-chart-bg: transparent;
}

.mc-chart-canvas {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Outer block that stacks the chart wrap (canvas + axes) and the legend
   below it. Sized to fill the results pane; the chart wrap flexes to fill
   the remaining vertical space, the legend takes its natural height. */
.mc-chart-block {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
}
.mc-chart-block > .mc-chart-wrap {
    flex: 1;
    min-height: 0;
}

/* SVG overlay */
.mc-chart-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Axis labels — darker + clear of tick numbers */
.mc-chart-xlabel,
.mc-chart-ylabel {
    position: absolute;
    font-family: var(--font-atlas);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    pointer-events: none;
}

.mc-chart-xlabel {
    bottom: 10px;
    left: 0;
    right: 0;
    text-align: center;
}

.mc-chart-ylabel {
    left: 14px;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    transform-origin: center center;
    white-space: nowrap;
}

/* Tick labels — slightly darker for legibility */
.mc-chart-tick {
    font-family: var(--font-atlas);
    font-size: 0.62rem;
    fill: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Grid lines */
.mc-chart-grid {
    stroke: var(--border);
    stroke-dasharray: 2 4;
    opacity: 0.5;
}

/* Threshold lines */
.mc-chart-threshold {
    stroke: var(--error-color);
    stroke-dasharray: 6 3;
    stroke-width: 1.5;
    opacity: 0.5;
}

/* Dots */
.mc-dot {
    cursor: pointer;
    stroke: var(--surface);
    stroke-width: 2.5;
    transition: r 0.2s, opacity 0.25s, cx 0.4s cubic-bezier(.4,0,.2,1), cy 0.4s cubic-bezier(.4,0,.2,1);
}

.mc-dot:hover {
    filter: brightness(1.2);
}

.mc-dot-label {
    font-family: var(--font-atlas);
    font-size: 0.62rem;
    font-weight: 700;
    fill: var(--text-primary);
    pointer-events: none;
    text-anchor: middle;
    transition: x 0.4s cubic-bezier(.4,0,.2,1), y 0.4s cubic-bezier(.4,0,.2,1);
}

.mc-dot-below {
    opacity: 0.3;
}

/* ---- Quadrant labels ---- */
.mc-quadrant-label {
    position: absolute;
    font-family: var(--font-atlas);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.25;
    pointer-events: none;
}

/* ---- Detail Tooltip / Flyout ---- */
.mc-detail-flyout {
    position: fixed;
    z-index: 200;
    width: 280px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.15s, transform 0.15s;
}

.mc-detail-flyout.mc-flyout-visible {
    opacity: 1;
    transform: translateY(0);
    /* Stay non-interactive even when shown — otherwise the flyout slides
       under the cursor, mouseleave fires on the dot, and the flyout
       flickers away while the recruiter is still hovering. */
    pointer-events: none;
}

[data-theme="dark"] .mc-detail-flyout {
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}

.mc-flyout-name {
    font-family: var(--font-atlas);
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.mc-flyout-profile {
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.mc-flyout-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.mc-flyout-bar-row.mc-flyout-bar-excluded {
    opacity: 0.55;
}
.mc-flyout-bar-row.mc-flyout-bar-excluded .mc-flyout-bar-label {
    text-decoration: line-through;
}
.mc-flyout-bar-note {
    flex: 1;
    font-size: 0.64rem;
    font-style: italic;
    color: var(--text-muted);
}

.mc-flyout-bar-label {
    font-family: var(--font-atlas);
    font-size: 0.64rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 72px;
    flex-shrink: 0;
}

.mc-flyout-bar-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    overflow: hidden;
}

.mc-flyout-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.mc-flyout-bar-val {
    font-family: var(--font-atlas);
    font-size: 0.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    width: 28px;
    text-align: right;
    color: var(--text-primary);
}

.mc-flyout-composite {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.mc-flyout-composite-label {
    font-family: var(--font-atlas);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.mc-flyout-composite-val {
    font-family: var(--font-atlas);
    font-size: 1.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* ---- Empty State ---- */
.mc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.mc-empty-icon {
    width: 56px;
    height: 56px;
    margin-bottom: 16px;
    color: var(--text-muted);
    opacity: 0.5;
}

.mc-empty h3 {
    font-family: var(--font-atlas);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mc-empty p {
    font-family: var(--font-atlas);
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 360px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .mc-cockpit.mc-panel-open {
        grid-template-columns: 1fr;
    }

    .mc-panel-open .mc-params {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 320px;
    }

    .mc-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============================================================
   LIGHT MODE REFINEMENTS
   ============================================================ */

/* Chart dot strokes — dark on light backgrounds */
:root:not([data-theme="dark"]) .mc-chart-wrap,
[data-theme="light"] .mc-chart-wrap {
    --mc-dot-stroke: rgba(255,255,255,0.95);
    --mc-dot-stroke-w: 2.5;
}

/* Slightly stronger grid in light mode for readability */
:root:not([data-theme="dark"]) .mc-chart-grid,
[data-theme="light"] .mc-chart-grid {
    stroke: #cbd5e1;
    opacity: 0.4;
}

/* Stronger threshold lines on light backgrounds */
:root:not([data-theme="dark"]) .mc-chart-threshold,
[data-theme="light"] .mc-chart-threshold {
    opacity: 0.6;
}

/* Dot labels need stronger contrast on light */
:root:not([data-theme="dark"]) .mc-dot-label,
[data-theme="light"] .mc-dot-label {
    fill: #1e293b;
    font-weight: 800;
    paint-order: stroke fill;
    stroke: rgba(255,255,255,0.7);
    stroke-width: 3px;
    stroke-linejoin: round;
}

/* Panel background gets a subtle warm tint */
:root:not([data-theme="dark"]) .mc-params,
[data-theme="light"] .mc-params {
    background: #f8fafc;
}

/* Slider track fill visibility */
:root:not([data-theme="dark"]) .mc-range::-webkit-slider-thumb,
[data-theme="light"] .mc-range::-webkit-slider-thumb {
    border-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
}

:root:not([data-theme="dark"]) .mc-range::-moz-range-thumb,
[data-theme="light"] .mc-range::-moz-range-thumb {
    border-color: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Preset buttons — crisper in light */
:root:not([data-theme="dark"]) .mc-preset-btn,
[data-theme="light"] .mc-preset-btn {
    background: #fff;
    border-color: #e2e8f0;
}

:root:not([data-theme="dark"]) .mc-preset-btn:hover,
[data-theme="light"] .mc-preset-btn:hover {
    background: #eff6ff;
}

/* Active preset under the light theme needs a higher-specificity override —
   the plain `:root:not([data-theme="dark"]) .mc-preset-btn` rule above (0,2,1)
   beat `.mc-preset-btn.mc-preset-active` (0,2,0), forcing the chip back to
   #fff and rendering white text on white. Re-assert primary background here
   and on the .mc-preset-builtin variant too. */
:root:not([data-theme="dark"]) .mc-preset-btn.mc-preset-active,
:root:not([data-theme="dark"]) .mc-preset-builtin.mc-preset-active,
[data-theme="light"] .mc-preset-btn.mc-preset-active,
[data-theme="light"] .mc-preset-builtin.mc-preset-active {
    background: var(--primary-color, #2175d9);
    border-color: var(--primary-color, #2175d9);
    color: #fff;
}

/* View switch buttons */
:root:not([data-theme="dark"]) .mc-view-btn,
[data-theme="light"] .mc-view-btn {
    background: #fff;
    color: var(--text-secondary);
}
:root:not([data-theme="dark"]) .mc-view-btn.mc-view-active,
[data-theme="light"] .mc-view-btn.mc-view-active {
    background: var(--primary-color);
    color: #fff;
}

/* Toggle params button */
:root:not([data-theme="dark"]) .mc-toggle-params,
[data-theme="light"] .mc-toggle-params {
    background: #fff;
    color: var(--text-secondary);
}
:root:not([data-theme="dark"]) .mc-toggle-params.mc-active,
[data-theme="light"] .mc-toggle-params.mc-active {
    background: var(--primary-color);
    color: #fff;
}

/* Table header */
:root:not([data-theme="dark"]) .mc-table th,
[data-theme="light"] .mc-table th {
    background: #f1f5f9;
}

/* Table hover rows — warmer on light */
:root:not([data-theme="dark"]) .mc-table tbody tr:hover,
[data-theme="light"] .mc-table tbody tr:hover {
    background: #f8fafc;
}

/* Selected row */
:root:not([data-theme="dark"]) .mc-table tbody tr.mc-row-selected,
[data-theme="light"] .mc-table tbody tr.mc-row-selected {
    background: #eff6ff;
}

/* Flyout — lighter shadow for light mode */
:root:not([data-theme="dark"]) .mc-detail-flyout,
[data-theme="light"] .mc-detail-flyout {
    box-shadow: 0 8px 30px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04);
}

/* Rank badges — ensure contrast */
:root:not([data-theme="dark"]) .mc-rank-n,
[data-theme="light"] .mc-rank-n {
    background: #f1f5f9;
    color: #64748b;
}

/* Weight bar segments — add subtle separation */
:root:not([data-theme="dark"]) .mc-weight-bar-track,
[data-theme="light"] .mc-weight-bar-track {
    background: #e2e8f0;
}

/* Score bars — track more visible in light */
:root:not([data-theme="dark"]) .mc-score-bar,
[data-theme="light"] .mc-score-bar {
    background: #e2e8f0;
}

:root:not([data-theme="dark"]) .mc-flyout-bar-track,
[data-theme="light"] .mc-flyout-bar-track {
    background: #e2e8f0;
}

/* Axis select dropdowns */
:root:not([data-theme="dark"]) .mc-axis-select,
[data-theme="light"] .mc-axis-select {
    background: #fff;
    border-color: #e2e8f0;
}

/* ============================================================
   ENTRANCE ANIMATIONS
   ============================================================ */
@keyframes mc-slideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

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

.mc-params {
    animation: mc-slideIn 0.3s ease-out both;
}

.mc-table tbody tr {
    animation: mc-fadeIn 0.25s ease-out both;
}

.mc-table tbody tr:nth-child(1)  { animation-delay: 0ms; }
.mc-table tbody tr:nth-child(2)  { animation-delay: 30ms; }
.mc-table tbody tr:nth-child(3)  { animation-delay: 60ms; }
.mc-table tbody tr:nth-child(4)  { animation-delay: 90ms; }
.mc-table tbody tr:nth-child(5)  { animation-delay: 120ms; }
.mc-table tbody tr:nth-child(6)  { animation-delay: 150ms; }
.mc-table tbody tr:nth-child(7)  { animation-delay: 180ms; }
.mc-table tbody tr:nth-child(8)  { animation-delay: 210ms; }
.mc-table tbody tr:nth-child(9)  { animation-delay: 240ms; }
.mc-table tbody tr:nth-child(10) { animation-delay: 270ms; }

/* ============================================================
   WP05 ADDITIONS
   T024 — Three-band row treatment + band badge
   T025 — Chart guide lines + band-aware dots
   T026 — Drawer rail + collapse animation
   T027 — Hover modal augmentation
   T028 — Preset library section
   T029 — Name-collision validation styles
   ============================================================ */

/* ---- Band CSS custom properties ---- */
:root {
    --mc-band-shortlist-bg:     rgba(5,  150,  105, 0.08);
    --mc-band-shortlist-border: #059669;
    --mc-band-qualified-bg:     rgba(217, 119,   6, 0.07);
    --mc-band-qualified-border: #d97706;
    --mc-band-below-border:     #94a3b8;
}

[data-theme="dark"] {
    --mc-band-shortlist-bg:     rgba(52, 211, 153, 0.10);
    --mc-band-shortlist-border: #34d399;
    --mc-band-qualified-bg:     rgba(251, 191,  36, 0.09);
    --mc-band-qualified-border: #fbbf24;
    --mc-band-below-border:     #64748b;
}

/* T024 — Band row treatment */
.mc-table tbody tr.mc-table-row.mc-band-shortlist {
    background: var(--mc-band-shortlist-bg);
    border-left: 3px solid var(--mc-band-shortlist-border);
}

.mc-table tbody tr.mc-table-row.mc-band-qualified {
    background: var(--mc-band-qualified-bg);
    border-left: 3px solid var(--mc-band-qualified-border);
}

.mc-table tbody tr.mc-table-row.mc-band-below {
    opacity: 0.7;
    border-left: 3px solid var(--mc-band-below-border);
}

.mc-table tbody tr.mc-table-row.mc-band-below:hover {
    opacity: 0.85;
}

/* T024 — Band badge pill */
.mc-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mc-band-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 100px;
    font-family: var(--font-atlas);
    font-size: 0.62rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.mc-band-badge-shortlist {
    background: var(--mc-band-shortlist-bg);
    color: var(--mc-band-shortlist-border);
    border: 1px solid var(--mc-band-shortlist-border);
}

.mc-band-badge-qualified {
    background: var(--mc-band-qualified-bg);
    color: var(--mc-band-qualified-border);
    border: 1px solid var(--mc-band-qualified-border);
}

.mc-band-badge-below {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--mc-band-below-border);
}

.mc-band-glyph {
    font-size: 0.68rem;
}

/* T023 — Clamp flash for cutoff sliders */
@keyframes mc-clamp-flash {
    0%   { color: var(--error-color); }
    100% { color: var(--primary-color); }
}

.mc-clamp-flash {
    animation: mc-clamp-flash 0.4s ease-in-out;
    color: var(--error-color) !important;
}

/* T025 — Chart guide lines */
.mc-chart-guideline {
    stroke-dasharray: 6 3;
    stroke-width: 1.5;
    opacity: 0.7;
}

.mc-chart-guideline-qualified {
    stroke: var(--mc-band-qualified-border);
}

.mc-chart-guideline-shortlist {
    stroke: var(--mc-band-shortlist-border);
}

.mc-chart-guideline-label {
    font-family: var(--font-atlas);
    font-size: 0.55rem;
    font-weight: 600;
    fill: var(--text-muted);
}

/* T025 — Band-aware dot classes */
.mc-dot-shortlist {
    cursor: pointer;
    stroke: var(--surface);
    stroke-width: 1.5;
    transition: opacity 0.2s;
}

.mc-dot-qualified {
    cursor: pointer;
    stroke: var(--surface);
    stroke-width: 2;
    transition: opacity 0.2s, r 0.2s;
}

.mc-dot-below {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.mc-dot-below:hover,
.mc-dot-qualified:hover,
.mc-dot-shortlist:hover {
    filter: brightness(1.2);
}

/* T026 — Drawer rail collapse */
.mc-params-collapse {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.75rem;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mc-params-collapse:hover {
    background: var(--background);
    color: var(--text-primary);
}

/* Smooth panel animation — NFR-004 ≤250ms */
.mc-params {
    transition: width 0.22s ease, background 0.3s, border-color 0.3s;
}

/* Stat pill colours for tiered counts */
.mc-stat-pill .mc-shortlist {
    color: var(--mc-band-shortlist-border);
}

/* T027 — Flyout augmentation styles */
.mc-flyout-contrib {
    font-family: var(--font-atlas);
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 36px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.mc-flyout-section {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.mc-flyout-mh {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.mc-flyout-mh-glyph {
    font-size: 0.7rem;
    font-weight: 800;
}

.mc-flyout-mh-ok {
    color: #059669;
}

.mc-flyout-mh-miss {
    color: #dc2626;
}

.mc-flyout-seniority {
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.mc-flyout-sen-label {
    font-weight: 700;
    color: var(--text-primary);
}

.mc-flyout-sen-gap {
    color: var(--error-color);
    font-weight: 700;
}

.mc-flyout-band {
    /* reuses .mc-band-badge styles; adjust size for flyout */
    font-size: 0.66rem;
}

[data-theme="dark"] .mc-flyout-mh-ok  { color: #34d399; }
[data-theme="dark"] .mc-flyout-mh-miss { color: #f87171; }

/* T028 — Preset library section */
.mc-preset-section {
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
}

.mc-preset-group {
    margin-bottom: 8px;
}

.mc-preset-group:last-child {
    margin-bottom: 0;
}

.mc-preset-group-label {
    font-family: var(--font-atlas);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.mc-preset-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Built-in chips — reuse .mc-preset-btn, mark as read-only via cursor */
.mc-preset-builtin {
    padding: 4px 10px;
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.mc-preset-builtin:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mc-preset-builtin.mc-preset-active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* Own / shared custom preset chips */
.mc-preset-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px 3px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: var(--background);
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    position: relative;
}

.mc-preset-chip:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mc-preset-chip-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mc-preset-shared-indicator {
    font-size: 0.62rem;
    opacity: 0.6;
}

.mc-preset-owner-badge {
    font-size: 0.58rem;
    color: var(--text-muted);
    padding: 1px 5px;
    background: var(--background);
    border-radius: 100px;
    border: 1px solid var(--border);
}

.mc-preset-menu-btn {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
    transition: all 0.12s;
    flex-shrink: 0;
}

.mc-preset-menu-btn:hover {
    background: var(--border);
    color: var(--text-primary);
}

/* T028 — Preset action dropdown menu */
.mc-preset-action-menu {
    position: fixed;
    z-index: 300;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    padding: 4px;
    min-width: 150px;
}

.mc-action-item {
    display: block;
    width: 100%;
    padding: 6px 10px;
    font-family: var(--font-atlas);
    font-size: 0.74rem;
    text-align: left;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.12s;
}

.mc-action-item:hover {
    background: var(--background);
}

.mc-action-danger {
    color: var(--error-color);
}

.mc-action-danger:hover {
    background: rgba(220, 38, 38, 0.08);
}

/* T028 — In-place rename input */
.mc-preset-rename-input {
    font-family: var(--font-atlas);
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    width: 120px;
}

.mc-preset-rename-error {
    display: block;
    font-family: var(--font-atlas);
    font-size: 0.58rem;
    color: var(--error-color);
    margin-top: 2px;
}

/* T028 — Save-as preset button */
.mc-save-preset-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 7px 12px;
    font-family: var(--font-atlas);
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.mc-save-preset-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(33, 117, 217, 0.04);
}

/* T028 — Save preset modal */
.mc-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-save-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    padding: 24px;
    width: 360px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mc-modal-title {
    font-family: var(--font-atlas);
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.mc-modal-label {
    font-family: var(--font-atlas);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.mc-modal-input,
.mc-modal-textarea {
    width: 100%;
    font-family: var(--font-atlas);
    font-size: 0.78rem;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.mc-modal-input:focus,
.mc-modal-textarea:focus {
    border-color: var(--primary-color);
}

.mc-modal-textarea {
    resize: vertical;
    min-height: 48px;
}

/* T029 — Inline validation error */
.mc-modal-error {
    font-family: var(--font-atlas);
    font-size: 0.66rem;
    color: var(--error-color);
    min-height: 1em;
    display: block;
}

.mc-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.mc-modal-btn {
    padding: 7px 18px;
    font-family: var(--font-atlas);
    font-size: 0.76rem;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.mc-modal-cancel {
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
}

.mc-modal-cancel:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.mc-modal-save {
    border: none;
    background: var(--primary-color);
    color: #fff;
}

.mc-modal-save:hover:not(:disabled) {
    filter: brightness(1.1);
}

.mc-modal-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* T029 — Toast notification */
.mc-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 500;
    background: #1e293b;
    color: #f1f5f9;
    font-family: var(--font-atlas);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    white-space: nowrap;
    max-width: 90vw;
}

.mc-toast.mc-toast-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .mc-toast {
    background: #334155;
    color: #f8fafc;
}

/* Light-mode overrides for new elements */
:root:not([data-theme="dark"]) .mc-preset-chip,
[data-theme="light"] .mc-preset-chip {
    background: #fff;
    border-color: #e2e8f0;
}

:root:not([data-theme="dark"]) .mc-save-modal,
[data-theme="light"] .mc-save-modal {
    box-shadow: 0 16px 50px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
}

:root:not([data-theme="dark"]) .mc-preset-action-menu,
[data-theme="light"] .mc-preset-action-menu {
    box-shadow: 0 6px 20px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04);
}

/* Responsive guard for new preset section */
@media (max-width: 900px) {
    .mc-preset-section {
        padding: 8px 12px;
    }
}

/* ============================================================
   MATCHING TAB — FULL-VIEWPORT LAYOUT
   When the matching tab is active, the page never scrolls.
   The cockpit fills the viewport below the fixed header+nav.
   Drawer body scrolls internally if needed; table body scrolls
   internally; chart never scrolls.
   ============================================================ */
body[data-tab="matching"] {
    overflow: hidden;
}
body[data-tab="matching"] #main-app .main-content {
    height: 100vh;
    padding-top: 126px;
    padding-bottom: 16px;
    max-width: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body[data-tab="matching"] #matching.tab-content.active {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body[data-tab="matching"] #matching .content-header {
    flex-shrink: 0;
    margin-bottom: 10px;
}
body[data-tab="matching"] #matching #mm-selection-header {
    flex-shrink: 0;
}
body[data-tab="matching"] #matching .matching-content {
    flex: 1;
    min-height: 0;
    display: flex;
}
body[data-tab="matching"] .mc-cockpit {
    flex: 1;
    height: 100%;
    min-height: 0;
}

/* ============================================================
   SELECTION HEADER — strip above the cockpit
   Re-uses .matching-selection-header / .selected-cv-badge styles
   from matching_styles.css; here we add the modern compact tweaks.
   ============================================================ */
#mm-selection-header.matching-selection-header {
    flex-shrink: 0;
    padding: 10px 14px;
    margin: 0 0 10px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
#mm-selection-header .selection-info {
    gap: 8px;
}
#mm-selection-header .requirement-info,
#mm-selection-header .selected-cvs-info {
    flex-wrap: wrap;
}
#mm-selection-header .info-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 600;
}
#mm-selection-header .mm-active-req {
    color: var(--primary-color);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
#mm-selection-header .selected-cv-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
#mm-selection-header .selected-cv-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 6px;
    background: rgba(33,117,217,0.10);
    color: var(--primary-color);
    border: 1px solid rgba(33,117,217,0.25);
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
}
#mm-selection-header .selected-cv-name {
    color: var(--text-primary);
    font-weight: 500;
}
#mm-selection-header .remove-cv-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
    cursor: pointer;
    border-radius: 999px;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#mm-selection-header .remove-cv-btn:hover {
    background: rgba(33,117,217,0.18);
    color: var(--primary-color);
}
#mm-selection-header .no-selection {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}
#mm-selection-header .compare-selected-btn {
    margin-left: auto;
}

/* Selected chart dot: halo ring */
.mc-dot.mm-dot-selected {
    stroke: var(--primary-color);
    stroke-width: 3;
    filter: drop-shadow(0 0 4px rgba(59,130,246,0.55));
}

/* ============================================================
   CHART LEGEND
   Sits BELOW the chart canvas (not floating on top of it) so it
   never covers candidates near the top-right corner.
   ============================================================ */
.mc-chart-legend {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 8px 12px;
    margin-top: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-atlas);
    pointer-events: none;
}
.mc-legend-row {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.1;
}
.mc-legend-glyph {
    flex-shrink: 0;
    display: block;
}
.mc-legend-label {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}
:root:not([data-theme="dark"]) .mc-chart-legend,
[data-theme="light"] .mc-chart-legend {
    background: rgba(255,255,255,0.85);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* ============================================================
   COMPARE BUTTON — inline trailing element of the badge list.
   Override the legacy "margin-left: auto" so the button sits
   immediately after the last selected-candidate badge.
   ============================================================ */
#mm-selection-header .selected-cv-list .compare-selected-btn {
    margin-left: 4px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    background: var(--primary-color, #2175d9);
    color: #fff;
}
#mm-selection-header .selected-cv-list .compare-selected-btn:hover {
    background: var(--primary-color-hover, #1d63bb);
}
#mm-selection-header .selected-cv-list .compare-selected-btn:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

/* ============================================================
   UNMATCHABLE SECTION — CVs missing fundamental data.
   Sits beneath the main results, collapsed by default with a
   visible count badge so recruiters notice it without it
   competing with the ranking.
   ============================================================ */
.mc-unmatchable {
    margin: 14px 0 6px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: rgba(148, 163, 184, 0.06);
}
.mc-unmatchable-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: var(--font-atlas);
    color: var(--text-primary);
}
.mc-unmatchable-header:hover {
    background: rgba(148, 163, 184, 0.08);
    border-radius: 10px;
}
.mc-unmatchable-caret {
    font-size: 0.85rem;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}
.mc-unmatchable-title {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}
.mc-unmatchable-count {
    background: rgba(148, 163, 184, 0.25);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.mc-unmatchable-body {
    padding: 0 14px 12px;
}
.mc-unmatchable-intro {
    margin: 4px 0 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}
.mc-unmatchable-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mc-unmatchable-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.mc-unmatchable-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}
.mc-unmatchable-id {
    background: rgba(33, 117, 217, 0.10);
    color: var(--primary-color);
    border: 1px solid rgba(33, 117, 217, 0.25);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.mc-unmatchable-profile {
    color: var(--text-muted);
    font-size: 0.78rem;
}
.mc-unmatchable-missing {
    color: #b45309;
    font-size: 0.78rem;
    white-space: nowrap;
}
[data-theme="dark"] .mc-unmatchable-missing {
    color: #fbbf24;
}
