:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e6ee;
  --text: #1c2233;
  --muted: #667085;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --accent-text: #3730a3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 12px;
  --st-todo: #98a2b3; --st-sent: #2e90fa; --st-replied: #7a5af8; --st-interview: #f79009; --st-accepted: #12b76a; --st-refused: #f04438; --st-skipped: #667085;
  --ok-bg: #e7f8ef; --ok-fg: #067647; --mid-bg: #fff6e0; --mid-fg: #8a5300; --no-bg: #f2f4f7; --no-fg: #667085;
  --star: #f5b400;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1320; --surface: #171c2c; --surface-2: #1f2537; --border: #2a3147; --text: #e6e9f2; --muted: #9aa3b8;
    --accent: #8b85ff; --accent-soft: #24264a; --accent-text: #c7c4ff; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    --ok-bg: #0f3324; --ok-fg: #6ce9a6; --mid-bg: #3a2a07; --mid-fg: #fdb022; --no-bg: #232a3d; --no-fg: #9aa3b8;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }

/* ---------- boutons & champs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); padding: 7px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 4px 9px; font-size: 13px; border-radius: 7px; }
.btn.danger { color: #d92d20; }
.icon-btn { border: none; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px; line-height: 1; font-size: 18px; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.input, .select, .textarea { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 8px 11px; font-size: 14px; width: 100%; }
.select { width: auto; padding-right: 28px; }
.textarea { min-height: 110px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; user-select: none; }

/* ---------- connexion ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 30px 28px; }
.login-card h1 { margin: 10px 0 2px; font-size: 26px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.login-error { color: #d92d20; font-size: 14px; min-height: 20px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #ec4899); display: grid; place-items: center; color: #fff; font-size: 17px; font-weight: 800; }

/* ---------- barre du haut ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 18px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { padding: 7px 13px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14.5px; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.lang-switch button { border: none; background: transparent; padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.lang-switch button.active { background: var(--accent); color: #fff; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-accepted); display: inline-block; }
.sync-dot.err { background: var(--st-refused); }
main { max-width: 1400px; margin: 0 auto; padding: 22px 20px 80px; }

/* ---------- tableau de bord ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hero h1 { margin: 0; font-size: 26px; }
.progress { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), #ec4899); transition: width .4s; }
.hero-progress { flex: 1 1 360px; max-width: 560px; }
.hero-progress .hp-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s; }
.kpi:hover { transform: translateY(-1px); }
.kpi .v { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 2px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.kpi .bar { height: 4px; border-radius: 4px; margin-bottom: 10px; }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1050px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card + .card { margin-top: 16px; }
.stack > .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 10px; padding: 5px 0; cursor: pointer; border-radius: 8px; }
.funnel-row:hover { background: var(--surface-2); }
.funnel-track { height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.funnel-track span { display: block; height: 100%; border-radius: 6px; min-width: 2px; transition: width .4s; }
.funnel-row .n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.list-progress { padding: 8px 0; }
.list-progress .top { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; gap: 8px; }
.stacked { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.stacked span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.weekly { display: flex; align-items: flex-end; gap: 8px; height: 140px; padding-top: 10px; }
.weekly .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.weekly .b { width: 100%; max-width: 38px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height .4s; }
.weekly .c { font-size: 12px; font-weight: 600; }
.weekly .w { font-size: 11px; color: var(--muted); white-space: nowrap; }
.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 9px; cursor: pointer; }
.mini-item:hover { background: var(--surface-2); }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item .t { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .d { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); font-size: 14px; padding: 10px 4px; }

/* ---------- avatar & badges ---------- */
.avatar { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; overflow: hidden; background: var(--accent); }
.avatar img { width: 22px; height: 22px; }
.avatar.has-img { background: #fff; border: 1px solid var(--border); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.feas-yes { background: var(--ok-bg); color: var(--ok-fg); }
.badge.feas-maybe { background: var(--mid-bg); color: var(--mid-fg); }
.badge.feas-no { background: var(--no-bg); color: var(--no-fg); }
.badge.hiring { background: #e0f2fe; color: #026aa2; }
.badge.asia { background: #fde7ec; color: #c01048; }
.badge.en { background: var(--accent-soft); color: var(--accent-text); }
@media (prefers-color-scheme: dark) { .badge.hiring { background: #0b2a3d; color: #7cd4fd; } .badge.asia { background: #3d0f1d; color: #fda4af; } }
.stars { color: var(--star); letter-spacing: -1px; font-size: 13px; }
.stars .off { color: var(--border); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 99px; font-size: 13px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); cursor: pointer; white-space: nowrap; }
.status-pill .dot, .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
select.status-select { appearance: none; -webkit-appearance: none; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 4px 26px 4px 26px; font-size: 13px; font-weight: 600; cursor: pointer; background-repeat: no-repeat; background-position: 9px 50%, right 9px center; background-size: 9px 9px, 10px 10px; }
.star-btn { border: none; background: transparent; cursor: pointer; font-size: 19px; line-height: 1; color: var(--border); padding: 4px; }
.star-btn.on { color: var(--star); }

/* ---------- liste des entreprises ---------- */
.segments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.segment { border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 6px 13px; font-size: 14px; cursor: pointer; color: var(--muted); }
.segment.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.segment .c { opacity: .7; margin-left: 4px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .search { flex: 1 1 260px; position: relative; }
.toolbar .search .input { padding-left: 34px; }
.toolbar .search::before { content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters .select { font-size: 13px; padding: 6px 26px 6px 10px; }
.filters-toggle { display: none; margin-bottom: 10px; }
.result-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 8px; gap: 10px; flex-wrap: wrap; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.row { display: grid; grid-template-columns: 34px minmax(200px, 2.2fr) minmax(220px, 2fr) 130px 190px 34px; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; cursor: pointer; transition: border-color .12s, box-shadow .12s; border-left: 4px solid var(--st-todo); }
.row:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }
.row .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
@media (max-width: 980px) {
  .row { grid-template-columns: 34px 1fr auto; grid-template-areas: "av main star" "av badges badges" "av status status"; row-gap: 8px; }
  .row > .av { grid-area: av; align-self: start; }
  .row > .main { grid-area: main; min-width: 0; }
  .row > .bdg { grid-area: badges; }
  .row > .meta { display: none; }
  .row > .st { grid-area: status; }
  .row > .sb { grid-area: star; }
}

/* ---------- pipeline ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; border: 2px dashed transparent; transition: border-color .12s, background .12s; }
.column.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.column h3 { margin: 2px 4px 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.column h3 .count { margin-left: auto; font-weight: 600; color: var(--muted); font-size: 13px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 11px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .5; }
.kcard .t { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.kcard .t .kt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.kcard .d { font-size: 12.5px; color: var(--muted); margin: 4px 0 6px; }
.kcard .foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 6px; }
.kcard select { font-size: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); padding: 2px 4px; max-width: 140px; }
.more-cards { font-size: 12.5px; color: var(--muted); text-align: center; padding: 6px; }

/* ---------- fiche (tiroir) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 19, 32, .45); z-index: 40; opacity: 0; transition: opacity .2s; }
.overlay.open { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(720px, 100vw); background: var(--bg); z-index: 50; box-shadow: var(--shadow-lg); transform: translateX(100%); transition: transform .22s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 20px 14px; }
.drawer-head .top { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 21px; line-height: 1.25; }
.drawer-head .links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.drawer-body { padding: 16px 20px 40px; overflow-y: auto; flex: 1; }
.steps { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.step { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 99px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.step.active { color: #fff; border-color: transparent; }
.dates { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
.section { margin-top: 14px; }
.section h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.prose { white-space: pre-wrap; font-size: 14.5px; }
.tr-note { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.contact { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.contact:last-child { border-bottom: none; }
.contact .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; } }
.offer { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.offer:last-child { border-bottom: none; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { display: flex; gap: 10px; align-items: center; padding: 5px 0; }
details.sources summary { cursor: pointer; color: var(--muted); font-size: 13px; }
details.sources ul { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; overflow-wrap: anywhere; }
.save-hint { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 4px; }

/* ---------- modale ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(15, 19, 32, .45); }
.modal .box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: 92vh; overflow: auto; padding: 20px; }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--surface); padding: 9px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: all .2s; z-index: 80; pointer-events: none; box-shadow: var(--shadow-lg); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #d92d20; color: #fff; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar-inner { flex-wrap: wrap; gap: 10px; padding: 8px 14px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav a { padding: 6px 10px; font-size: 14px; }
  .logo-text { display: none; }
  .filters-toggle { display: inline-flex; }
  .filters { display: none; }
  .filters.open { display: flex; }
  .filters .select { flex: 1 1 140px; }
  main { padding: 14px 12px 70px; }
  .hero h1 { font-size: 21px; }
  .kpi .v { font-size: 23px; }
  .funnel-row { grid-template-columns: 110px 1fr 34px; font-size: 13px; }
  .drawer-head, .drawer-body { padding-left: 14px; padding-right: 14px; }
}
