/* ═══════════════════════════════════════════════════════════
   MatchIT — Atos  (Billy-inspired light theme)
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg:            #f1f2f4;
    --bg-white:      #FFFFFF;
    --bg-hero:       #EAEAEA;
    --text:          #1A1A1A;
    --text-secondary:#555555;
    --text-muted:    #888888;
    --primary:       #0033A0;       /* Atos blue */
    --primary-800:   #1e3a8a;
    --primary-light: #E8EEF8;
    --primary-hover: #002480;
    --accent:        #4DA3FF;
    --success:       #16A34A;
    --success-bg:    #ECFDF5;
    --warning:       #CA8A04;
    --warning-bg:    #FEFCE8;
    --danger:        #DC2626;
    --danger-bg:     #FEF2F2;
    --info:          #2563EB;
    --info-bg:       #EFF6FF;
    --border:        #d6d9df;
    --border-focus:  #0033A0;
    --shadow:        0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg:     0 4px 20px rgba(0,0,0,0.08);
    --radius:        12px;
    --radius-sm:     8px;
    --radius-pill:   999px;
    --header-height: 68px;
}

/* Utility classes requested for MatchIT branding */
.text-4xl { font-size: 2.25rem; line-height: 1.15; }
.font-semibold { font-weight: 600; }
.text-primary-800 { color: var(--primary-800); }
.font-biennale {
    font-family: "Biennale", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ════════════════  TOP NAVIGATION BAR  ════════════════ */
.topbar-wrap {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-white);
    height: var(--header-height);
    flex-shrink: 0;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
    background: var(--bg-white);
    border-bottom: 1px solid #d2d7de;
    box-shadow: 0 4px 8px rgba(15, 23, 42, 0.10);
    position: relative;
    z-index: 50;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    padding: 0 1rem;
    height: 100%;
    flex-shrink: 0;
    cursor: pointer;
}
.topbar-brand:hover {
    text-decoration: none;
}
.topbar-brand .text-4xl {
    font-size: 2.25rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.topbar-logo {
    width: 87px;
    height: 30px;
    object-fit: contain;
    flex-shrink: 0;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.id-cartouche {
    cursor: pointer;
    min-width: 260px;
    padding: 0.55rem 1rem;
    border-radius: 50px;
    border: 1px solid #cfd4dc;
    min-height: 56px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10);
    transition: background 0.2s, border-color 0.2s;
    font-family: inherit;
}
.id-cartouche:hover {
    background: #f5f8fe;
    border-color: #c3cedd;
}
.id-avatar {
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 51, 160, 0.15);
    color: var(--primary-800);
}
.id-avatar svg {
    width: 20px;
    height: 20px;
}
.id-text {
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    font-size: 0.98rem;
}
.id-chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: #475569;
}
.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    color: var(--text);
}
.topbar-link {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}
.topbar-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}
.topbar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.mission-age {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
}

.mission-age-green {
    color: var(--success);
    background: var(--success-bg);
}

.mission-age-orange {
    color: var(--warning);
    background: var(--warning-bg);
}

.mission-age-red {
    color: var(--danger);
    background: var(--danger-bg);
}

.mission-line {
    transition: color 0.15s ease;
}

.mission-line strong {
    color: inherit;
}

.mission-line-green {
    color: var(--success);
}

.mission-line-orange {
    color: var(--warning);
}

.mission-line-red {
    color: var(--danger);
}

/* ════════════════  HERO / LANDING PAGE  ════════════════ */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: calc(100vh - var(--header-height));
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0,51,160,0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(0,51,160,0.04) 0%, transparent 50%),
        var(--bg);
    padding: 4.25rem 1.5rem 2.25rem;
    text-align: center;
}

.hero-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}
.hero-logo svg {
    width: 44px;
    height: 44px;
    fill: white;
}

.hero-title-row {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: "Biennale", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: 700;
    font-size: 4.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    line-height: 1;
}
.hero-title-logo {
    width: auto;
    height: 78px;
    min-width: 68px;
    object-fit: contain;
    /* SVG contains embedded raster content, so use a visual thickening effect */
    filter: contrast(1.08) saturate(1.04)
            drop-shadow(0 0 0.35px var(--primary))
            drop-shadow(0 0 0.35px var(--primary));
}
.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    max-width: 550px;
}
.hero-subtitle-strong {
    font-size: 1.125rem;
    font-weight: 600;
    text-align: center;
    max-width: 64rem;
    margin-left: auto;
    margin-right: auto;
}

/* Search / Upload bar */
.search-bar-wrap {
    width: 100%;
    max-width: 700px;
    margin-bottom: 2rem;
}
.search-bar {
    display: flex;
    align-items: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,51,160,0.1);
}
.search-bar input[type="file"] {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    background: transparent;
    color: var(--text);
    font-family: inherit;
}
.search-bar input[type="file"]::file-selector-button {
    display: none;
}
.search-bar .search-label {
    flex: 1;
    text-align: left;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: default;
}
.search-bar .search-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.search-bar .search-btn:hover {
    background: var(--primary);
}
.search-bar .search-btn:hover svg { fill: white; }
.search-bar .search-btn svg {
    width: 20px;
    height: 20px;
    fill: var(--primary);
    transition: fill 0.15s;
}

/* Analyse button under the search bar */
.btn-analyse {
    margin-top: 1rem;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    border-radius: var(--radius-pill);
    transition: background 0.15s, opacity 0.2s;
}
.btn-analyse:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Examples */
.examples {
    max-width: 700px;
    text-align: left;
}
.examples h3 {
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.examples ul {
    list-style: none;
    padding: 0;
}
.examples li {
    margin-bottom: 0.5rem;
}
.examples li::before {
    content: "•";
    color: var(--primary);
    font-weight: 700;
    margin-right: 0.75rem;
}
.examples a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.examples a:hover { color: var(--primary); }

/* ════════════════  PAGE CONTAINER  ════════════════ */
.page-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.75rem 1.25rem 1.5rem;
}

/* ════════════════  DASHBOARD BANNER  ════════════════ */
.dashboard-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.1rem;
    margin-bottom: 0.5rem;
}
.dashboard-banner-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dashboard-banner-logo {
    flex-shrink: 0;
}
.dashboard-banner-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-800);
    line-height: 1.2;
}
.dashboard-banner-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ════════════════  DASHBOARD 2-COL LAYOUT  ════════════════ */
.dashboard-cols {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) minmax(0, 2.2fr);
    gap: 1rem;
    align-items: start;
}
.dash-left {
    min-width: 0;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.dash-right {
    min-width: 0;
}

/* ════════════════  CARDS  ════════════════ */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.card-accent-blue   { border-left: 4px solid var(--primary); }
.card-accent-green  { border-left: 4px solid var(--success); }

/* ════════════════  SECTION HEADERS  ════════════════ */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
}
.section-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ════════════════  BUTTONS  ════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    text-decoration: none;
    font-family: inherit;
}
.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}
.btn-secondary {
    background: var(--bg-white);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg);
    text-decoration: none;
}
.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* ════════════════  SEND EMAIL  ════════════════ */
.send-email-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.65rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
}
.btn-send-email {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    background: linear-gradient(135deg, #0033A0, #4DA3FF);
    color: #fff;
    transition: opacity .15s, transform .1s;
}
.btn-send-email:hover {
    opacity: .9;
    transform: translateY(-1px);
}
.btn-send-email:disabled,
.btn-send-email.sending {
    opacity: .55;
    cursor: wait;
}
.send-email-status {
    font-size: 0.85rem;
    font-weight: 500;
}
.send-email-status.status-success {
    color: var(--success);
}
.send-email-status.status-error {
    color: var(--danger);
}

/* ════════════════  FORMS  ════════════════ */
.form-label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.form-help {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.input-number {
    background: var(--bg-white);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    width: 90px;
    font-family: inherit;
    font-size: 0.9rem;
}
.input-number:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,51,160,0.1);
}
.multi-select {
    width: 100%;
    background: var(--bg-white);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-family: inherit;
}

.display-mode-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.display-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.display-mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.display-mode-option .dot {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    border: 2px solid #6b7a99;
    background: #fff;
    box-shadow: inset 0 0 0 3px #fff;
    transition: border-color 0.15s, background-color 0.15s;
}
.display-mode-option input:checked + .dot {
    border-color: var(--primary);
    background: var(--primary);
}
.display-mode-option input:checked + .dot + span {
    color: var(--primary);
    font-weight: 600;
}

/* ════════════════  TABLES  ════════════════ */
.table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-white);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.data-table th,
.data-table td {
    padding: 0.65rem 0.85rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.data-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--primary-light); }

/* ════════════════  SCORE BADGES  ════════════════ */
.score-badge {
    display: inline-block;
    padding: 0.2rem 0.85rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.85rem;
}
.score-high { background: var(--success-bg); color: var(--success); }
.score-mid  { background: var(--warning-bg); color: var(--warning); }
.score-low  { background: var(--danger-bg);  color: var(--danger); }

/* ════════════════  CHIPS  ════════════════ */
.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}
.chip {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
}
.chip-success .chip { background: var(--success-bg); color: var(--success); }
.chip-danger  .chip { background: var(--danger-bg);  color: var(--danger); }
.chip-warning .chip { background: var(--warning-bg); color: var(--warning); }
.chip-info    .chip { background: var(--info-bg);    color: var(--info); }

td.chip-success { color: var(--success); }
td.chip-danger  { color: var(--danger); }

/* ════════════════  DETAILS / EXPANDABLE  ════════════════ */
details {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
}
details summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
details[open] summary {
    margin-bottom: 0.75rem;
}

/* ════════════════  TWO-COL GRID  ════════════════ */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 0.75rem 0;
}

/* ════════════════  INFO / ALERT BOXES  ════════════════ */
.info-box {
    background: var(--info-bg);
    border: 1px solid rgba(37,99,235,0.2);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    margin: 1rem 0;
    color: var(--info);
    font-size: 0.9rem;
}
.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.summary-text {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.35;
}

/* ════════════════  AO SUMMARY CARD  ════════════════ */
.ao-summary-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 0;
    box-shadow: var(--shadow);
}
.ao-summary-card h2 {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
}

/* ════════════════  AO NEEDS SECTION  ════════════════ */
.ao-needs {
    background: var(--primary-light);
    border: 1px solid rgba(0,51,160,0.15);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    margin: 0.4rem 0 0.4rem;
}
.ao-needs h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.ao-needs p {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

/* ════════════════  BADGES  ════════════════ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    vertical-align: middle;
    margin-right: 0.5rem;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }

/* ════════════════  TABLE SECTION TITLES  ════════════════ */
.table-section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}
.results-card {
    padding: 0.35rem 0.75rem 0.6rem;
}
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

/* ════════════════  MINI CV CARDS  ════════════════ */
.mini-cv-card {
    border-left: 4px solid var(--success);
}
.cv-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}
.cv-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

/* ════════════════  LOADING OVERLAY  ════════════════ */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(241,242,244,0.78);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
}
.loading-overlay.active { display: flex; }

.analysis-progress-overlay-content {
    width: min(720px, 92vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.analysis-stage-line {
    width: 100%;
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.analysis-stage {
    position: absolute;
    opacity: 0;
    transform: translateY(6px) scale(0.98);
    transition: opacity .25s ease, transform .25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.analysis-stage.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.analysis-stage-icon {
    width: 54px;
    height: 54px;
    border-radius: 999px;
    border: 1px solid rgba(0, 51, 160, 0.35);
    color: var(--primary);
    background: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: stageBlink 1.05s ease-in-out infinite;
}

.analysis-stage-icon svg {
    width: 28px;
    height: 28px;
}

.analysis-stage-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.2px;
    text-align: center;
}

@keyframes stageBlink {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 51, 160, 0.28); }
    50% { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(0, 51, 160, 0); }
}

.analysis-progress-track {
    width: 100%;
    height: 12px;
    border-radius: var(--radius-pill);
    background: rgba(148, 163, 184, 0.35);
    overflow: hidden;
}

.analysis-progress-fill {
    width: 8%;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.55s ease;
}

@media (max-width: 900px) {
    .analysis-stage-text {
        font-size: 0.98rem;
    }
}

/* ════════════════  CANDIDATE CARDS GRID  ════════════════ */
.candidates-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.55rem;
    margin: 0.4rem 0;
}

.candidate-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.55rem;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 580px;
}
.candidate-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.candidate-card-available {
    background: linear-gradient(180deg, #f4fbf7 0%, #ffffff 45%);
    border-color: #b8e8cc;
}

.candidate-card-unavailable {
    background: linear-gradient(180deg, #fff9ef 0%, #ffffff 45%);
    border-color: #f5d8a6;
}

/* Card top row: rank + score */
.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}
.card-rank {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}
.card-score {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.8rem;
}

/* Card body */
.card-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-name-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.card-name-link:hover {
    color: var(--primary);
}
.card-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.08rem;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-languages {
    margin-bottom: 0.08rem;
    max-height: 1.2rem;
    overflow: hidden;
}
.candidate-card:not(.expanded) .card-languages {
    display: none;
}
.card-city {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-bottom: 0.12rem;
}
.card-tx {
    margin-bottom: 0.12rem;
    align-self: flex-start;
}

/* Skills chips inside card */
.card-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.1rem;
    max-height: 1.22rem;
    overflow: hidden;
}
.chip-matched {
    background: var(--success-bg);
    color: var(--success);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 500;
}
.chip-missing {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 500;
}
.chip-nice {
    background: var(--info-bg);
    color: var(--info);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Expand hint */
.card-expand-hint {
    display: none;
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 0.5rem;
    transition: opacity 0.2s;
}

/* Hidden details section */
.card-details {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s ease, opacity 0.25s ease;
}
.card-details hr {
    margin: 0.5rem 0;
}
.card-details p {
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}
.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 0.4rem !important;
    margin-bottom: 0.2rem !important;
    font-size: 0.75rem !important;
}
.score-help-row {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0.2rem 0 0.45rem;
}
.score-help-icon {
    width: 1.1rem;
    height: 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--bg-white);
    cursor: help;
}
.score-help-label {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.score-help-tooltip {
    position: absolute;
    top: 1.4rem;
    left: 0;
    min-width: 250px;
    max-width: 320px;
    background: #111827;
    color: #ffffff;
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    box-shadow: var(--shadow-lg);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    pointer-events: none;
}
.score-help-icon:hover + .score-help-label + .score-help-tooltip,
.score-help-icon:focus + .score-help-label + .score-help-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.score-help-tooltip-line {
    display: block;
    font-size: 0.72rem;
    line-height: 1.3;
    margin: 0.15rem 0;
}

/* Expanded state */
.candidate-card.expanded {
    grid-column: span 2;
    grid-row: span 2;
    z-index: 10;
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    max-height: none;
}
.candidate-card.expanded .card-details {
    max-height: 500px;
    opacity: 1;
}
.candidate-card.expanded .card-expand-hint {
    opacity: 0;
}
.candidate-card.expanded .card-name {
    white-space: normal;
}
.candidate-card.expanded .card-role {
    white-space: normal;
}
.candidate-card.expanded .card-languages,
.candidate-card.expanded .card-skills {
    display: block;
    max-height: none;
}

/* ════════════════  RESPONSIVE  ════════════════ */
@media (max-width: 1200px) {
    .candidates-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 960px) {
    .dashboard-cols { grid-template-columns: 1fr; }
    .dash-left { max-height: none; }
}
@media (max-width: 768px) {
    .topbar { padding: 0 0.75rem; }
    .topbar-brand { padding: 0 0.5rem; gap: 0.6rem; }
    .topbar-brand .text-4xl { font-size: 1.6rem; }
    .id-cartouche { min-width: 56px; padding: 0.45rem 0.6rem; }
    .id-text { display: none; }
    .hero-title-row { font-size: 2.75rem; margin-bottom: 1rem; }
    .hero-title-logo { width: auto; height: 50px; min-width: 50px; }
    .search-bar-wrap { max-width: 100%; }
    .two-col { grid-template-columns: 1fr; }
    .page-container { padding: 1rem; }
    .candidates-grid { grid-template-columns: repeat(2, 1fr); }
    .candidate-card.expanded { grid-column: span 1; grid-row: span 1; }
}
@media (max-width: 480px) {
    .candidates-grid { grid-template-columns: 1fr; }
}

@media (min-width: 1024px) {
    .topbar {
        padding-right: 5rem;
        padding-left: 0;
    }
    .topbar-brand {
        padding-left: 5rem;
        padding-right: 1rem;
    }
    .id-cartouche {
        min-width: 320px;
    }
}

/* ════════════════  STATISTICS DASHBOARD  ════════════════ */
.stats-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 3rem;
}
.stats-header {
    text-align: center;
    margin-bottom: 1.25rem;
}
.stats-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* Dashboard grid — cards as tiles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    align-items: start;
}

/* ── Filter card: spans 1 col, all 4 rows ── */
.stats-filter-card {
    grid-column: 1;
    grid-row: 1 / 5;
    padding: 1.15rem 1.1rem !important;
    margin-bottom: 0 !important;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}
.filter-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.85rem;
}
.filter-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.filter-stack {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}
.filter-stack .filter-group {
    min-width: 0;
}
.filter-stack .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}
.filter-input {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text);
    transition: border-color 0.2s;
}
.filter-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0, 51, 160, 0.1);
}
.filter-btns {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.85rem;
}
.filter-btns .btn {
    flex: 1;
    justify-content: center;
}
.btn-filter-apply {
    gap: 0.3rem;
}

/* ── KPI cards: each takes 1 cell in the top row ── */
.kpi-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.1rem 0.75rem;
    border-radius: var(--radius);
    transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}
.kpi-icon svg {
    width: 20px;
    height: 20px;
}
.kpi-icon-blue   { background: var(--primary-light); color: var(--primary); }
.kpi-icon-green  { background: var(--success-bg);    color: var(--success); }
.kpi-icon-purple { background: #f3eaff;              color: #7C3AED; }
.kpi-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.kpi-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ── Chart cards: span 3 cols (the right side) ── */
.stats-chart-card {
    grid-column: 2 / 5;
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius);
}
.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.skills-header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}
.chart-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.chart-empty {
    text-align: center;
    padding: 2rem 0;
}

/* ── Custom skill bar rows ── */
.skill-bar-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--bg);
}
.skill-bar-row:last-child {
    border-bottom: none;
}
.skill-bar-rank {
    width: 22px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    flex-shrink: 0;
}
.skill-bar-name {
    width: 120px;
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.skill-bar-track {
    flex: 1;
    height: 22px;
    background: var(--bg);
    border-radius: var(--radius-pill);
    overflow: hidden;
    display: flex;
    position: relative;
}
.skill-bar-fill-req {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-pill) 0 0 var(--radius-pill);
    transition: width 0.5s ease;
}
.skill-bar-fill-nice {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
}
.skill-bar-fill-req:last-child,
.skill-bar-fill-nice:last-child {
    border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
}
.skill-bar-fill-req:first-child:last-child {
    border-radius: var(--radius-pill);
}
.skill-bar-stats {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
    min-width: 80px;
    justify-content: flex-end;
}
.skill-bar-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text);
}
.skill-bar-pct {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-pill);
}

/* Legend for skill bars */
.skill-bar-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.65rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.3rem;
    vertical-align: middle;
}
.legend-dot-req  { background: var(--primary); }
.legend-dot-nice { background: var(--accent); }

/* ── Responsive ── */
@media (max-width: 960px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .stats-filter-card {
        grid-column: 1 / 4;
        grid-row: auto;
        position: static;
    }
    .stats-chart-card {
        grid-column: 1 / 4;
    }
}
@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .stats-filter-card {
        grid-column: 1;
    }
    .stats-chart-card {
        grid-column: 1;
    }
}
