:root {
    --bg: #F5F6FA;
    --surface: #FFFFFF;
    --border: #E8E9F0;
    --text: #16181D;
    --text-secondary: #6E7180;
    --text-faint: #A3A6B3;

    --col-voir: #6366F1;
    --col-voir-bg: #EEF0FE;
    --col-envoyee: #F59E0B;
    --col-envoyee-bg: #FEF6E7;
    --col-entretien: #10B981;
    --col-entretien-bg: #E9FBF3;
    --col-refusee: #94A3B8;
    --col-refusee-bg: #F1F3F7;

    --score-high: #10B981;
    --score-high-bg: #E9FBF3;
    --score-mid: #6366F1;
    --score-mid-bg: #EEF0FE;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
  }
  .wrap { max-width: 1200px; margin: 0 auto; padding: 32px 28px 80px; }

  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }
  .title-block h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
  }
  .title-block p {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: 2px;
  }

  .stats {
    display: flex;
    gap: 10px;
  }
  .stat-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 16px;
    text-align: center;
    min-width: 76px;
  }
  .stat-chip .n { font-size: 18px; font-weight: 700; }
  .stat-chip .l { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }

  .history {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 20px;
  }
  .history-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
  }
  .history-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
  .history-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 64px;
  }
  .hbar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 4px;
    border-radius: 8px;
    padding: 4px 2px 2px;
    transition: background 0.15s;
  }
  .hbar-col:hover { background: var(--bg); }
  .hbar-col.selected { background: var(--col-voir-bg); }
  .hbar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: var(--col-voir-bg);
    position: relative;
    min-height: 4px;
  }
  .hbar.today { background: #6366F1; }
  .hbar-day { font-size: 10px; color: var(--text-faint); font-weight: 500; }
  .hbar-n { font-size: 10px; color: var(--text-secondary); font-weight: 600; }

  .seen-badge {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--score-high);
    background: var(--score-high-bg);
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .dup-badge {
    font-size: 9.5px;
    font-weight: 700;
    color: #B45309;
    background: #FEF3C7;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .card-salary {
    font-size: 12px;
    font-weight: 600;
    color: #059669;
    margin-top: 2px;
    margin-bottom: 8px;
  }

  .view-toggle {
    display: flex;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 3px;
  }
  .view-toggle button {
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
  }
  .view-toggle button.active {
    background: var(--text);
    color: var(--surface);
  }

  .theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
  }
  .theme-toggle:hover { border-color: #6366F1; }

  .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .stats-view {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
  }
  .stats-view-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }
  .stats-view-head h2 { font-size: 16px; font-weight: 700; }
  .range-pills { display: flex; gap: 6px; }
  .chart-wrap { position: relative; height: 320px; }

  .export-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
  }
  .export-btn:hover { border-color: #6366F1; color: var(--text); }

  .toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 22px;
    flex-wrap: wrap;
  }
  .search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 320px; }
  .search {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 14px 9px 34px;
    font-size: 13.5px;
    font-family: 'Inter', sans-serif;
    color: var(--text);
  }
  .search:focus { outline: none; border-color: #6366F1; }
  .search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 14px; }

  .src-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 9px;
    cursor: pointer;
  }
  .src-pill.active { background: var(--text); color: var(--surface); border-color: var(--text); }

  .board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
  }

  .column {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
  }

  .col-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 2px solid;
  }
  .col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
  .col-name { font-size: 13.5px; font-weight: 700; }
  .col-count {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 700;
    color: #fff;
    border-radius: 20px;
    padding: 2px 9px;
  }

  .cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
    padding: 12px;
    background: var(--bg);
    flex: 1;
    transition: background 0.15s, box-shadow 0.15s;
  }
  .column.drag-over .cards {
    background: rgba(99,102,241,0.08);
    box-shadow: inset 0 0 0 2px #6366F1;
  }

  .empty-column-hint {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-faint);
    text-align: center;
    padding: 20px 10px;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
  }
  .card:hover { box-shadow: 0 4px 14px rgba(20,20,40,0.08); transform: translateY(-1px); }
  .card.dragging { opacity: 0.4; cursor: grabbing; }

  .card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
  }
  .avatar {
    max-width: 150px;
    padding: 5px 10px;
    border-radius: 7px;
    background: var(--col-voir-bg);
    color: var(--col-voir);
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .score {
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
  }
  .score.high { background: var(--score-high-bg); color: var(--score-high); }
  .score.mid { background: var(--score-mid-bg); color: var(--score-mid); }
  .card-quick-link {
    color: var(--text-faint);
    text-decoration: none;
    font-size: 14px;
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
  }
  .card-quick-link:hover { background: var(--bg); color: #6366F1; }

  .card-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 4px;
  }
  .card-company {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
  }
  .card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid var(--border);
  }
  .card-source {
    font-size: 10.5px;
    color: var(--text-faint);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }
  .card-loc { font-size: 11.5px; color: var(--text-faint); }

  .card-status-select {
    width: 100%;
    margin-top: 10px;
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 8px;
    border-radius: 7px;
    background: var(--bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-family: 'Inter', sans-serif;
    cursor: pointer;
  }
  .card-status-select:hover { border-color: #6366F1; color: var(--text); }

  .drag-handle {
    color: var(--text-faint);
    font-size: 13px;
    cursor: grab;
    padding: 2px 4px;
    line-height: 1;
  }

  footer { margin-top: 32px; text-align: center; font-size: 12px; color: var(--text-faint); }

  .overlay {
    position: fixed; inset: 0;
    background: rgba(20,20,30,0.35);
    display: none;
    z-index: 100;
  }
  .overlay.open { display: block; }

  .detail-panel {
    position: fixed;
    top: 0; right: 0;
    width: 420px;
    max-width: 90vw;
    height: 100vh;
    background: var(--surface);
    box-shadow: -8px 0 30px rgba(0,0,0,0.12);
    z-index: 101;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
  }
  .detail-panel.open { transform: translateX(0); }

  .detail-head {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }
  .detail-close {
    background: var(--bg);
    border: none;
    width: 28px; height: 28px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
  }
  .detail-body { padding: 20px; overflow-y: auto; flex: 1; }
  .detail-score {
    display: inline-block;
    font-size: 22px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
  }
  .detail-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
  .detail-meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
  .detail-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 18px 0 6px;
  }
  .detail-reason {
    font-size: 13.5px;
    color: var(--text);
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    line-height: 1.5;
  }
  .detail-notes {
    width: 100%;
    min-height: 90px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: vertical;
    background: var(--surface);
    color: var(--text);
  }
  .detail-notes:focus { outline: none; border-color: #6366F1; }
  .detail-notes-status { font-size: 11px; color: var(--text-faint); margin-top: 4px; height: 14px; }
  .detail-foot { padding: 16px 20px; border-top: 1px solid var(--border); }
  .detail-open-link {
    display: block;
    text-align: center;
    background: var(--text);
    color: var(--surface);
    text-decoration: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
  }

  @media (max-width: 900px) {
    .board { grid-template-columns: repeat(2, 1fr); }
  }
  @media (max-width: 560px) {
    .board { grid-template-columns: 1fr; }
    header { flex-direction: column; align-items: flex-start; gap: 12px; }
  }

  /* ---- Mode sombre ---- */
  [data-theme="dark"] {
    --bg: #14161B;
    --surface: #1D2027;
    --border: #2A2E38;
    --text: #ECEDEF;
    --text-secondary: #9CA0AC;
    --text-faint: #6B707C;

    --col-voir-bg: #23263A;
    --col-envoyee-bg: #332B1A;
    --col-entretien-bg: #16332A;
    --col-refusee-bg: #23262C;

    --score-high-bg: #16332A;
    --score-mid-bg: #23263A;
  }
  [data-theme="dark"] .hbar { background: #23263A; }
  [data-theme="dark"] .dup-badge { background: #3A2E12; color: #F5B94D; }
  [data-theme="dark"] .card-salary { color: #34D399; }
  [data-theme="dark"] .overlay { background: rgba(0,0,0,0.55); }
