:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e3e6eb;
  --primary: #2f5bd3;
  --primary-dark: #2348ad;
  --danger: #c0392b;
  --warn-bg: #fff4e5;
  --warn: #b45309;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: .95rem; margin: 1.2rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.muted { color: var(--muted); }
.small, small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; margin: 0; }

/* ---------- Barre du haut ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .7rem 1.2rem; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.nav { display: flex; align-items: center; gap: 1rem; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--text); padding: .3rem 0; }
.nav a.active { color: var(--primary); font-weight: 600; border-bottom: 2px solid var(--primary); }
.nav a.btn { color: #fff; border-bottom: none; }
.menu-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 1.2rem; padding: .2rem .6rem; }

.container { max-width: 1280px; margin: 0 auto; padding: 1.2rem; }

/* ---------- Composants ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 > * { min-width: 0; }
.head-actions select { width: auto; }
.grid-2 + .grid-2, .grid-2 + .card, .card + .grid-2 { margin-top: 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.page-head h1 { margin-bottom: .2rem; }
.subtitle { margin: 0 0 1rem; color: var(--muted); }
.head-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

.btn {
  display: inline-block; padding: .5rem 1rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { color: var(--danger); border-color: #f1c4bf; }
.btn-danger:hover { background: #fdecea; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .3rem .7rem; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-icon { background: none; border: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1; }
.btn-icon:hover { color: var(--danger); }

.alert { background: #fdecea; color: var(--danger); border-radius: 8px; padding: .7rem 1rem; }
.alert-relance { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; background: var(--warn-bg); color: var(--warn); margin-bottom: 1rem; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; }
.s-todo { --c: #6b7280; --cbg: #eef0f3; }
.s-applied { --c: #2f5bd3; --cbg: #e7eefc; }
.s-interview { --c: #7c3aed; --cbg: #f1eafe; }
.s-offer { --c: #15803d; --cbg: #e4f6ea; }
.s-refused { --c: #b42318; --cbg: #fdecea; }
.s-dropped { --c: #8a8f98; --cbg: #f3f4f6; }
.badge { color: var(--c); background: var(--cbg); }

.resp { font-size: .85rem; font-weight: 600; }
.resp-pos { color: #15803d; }
.resp-neg { color: #b42318; }
.resp-wait { color: var(--warn); }
.resp-none { color: var(--muted); font-weight: 400; }

.stars { color: #f5a623; letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: #dcdfe4; }
.relance-due { color: var(--warn); font-weight: 600; background: var(--warn-bg); border-radius: 6px; padding: .05rem .4rem; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; display: flex; flex-direction: column; color: var(--text); }
a.kpi:hover { text-decoration: none; border-color: var(--primary); }
.kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: .85rem; }
.kpi-alert .kpi-value { color: var(--warn); }

/* ---------- Listes ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }
.list.compact li { display: block; padding: .4rem 0; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0; }
.tags li { background: #eef2fb; color: #2b3a67; padding: .2rem .6rem; border-radius: 999px; font-size: .85rem; }

dl.info { display: grid; grid-template-columns: 140px 1fr; gap: .45rem 1rem; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; }

.timeline { list-style: none; margin: 0 0 1rem; padding: 0 0 0 1rem; border-left: 2px solid var(--border); }
.timeline li { position: relative; display: flex; justify-content: space-between; gap: .5rem; padding: .4rem 0 .6rem .6rem; }
.timeline li::before { content: ""; position: absolute; left: -1.38rem; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline li.future::before { background: #fff; border: 2px solid var(--primary); }
.timeline form { margin: 0; }

/* ---------- Formulaires ---------- */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; font-weight: 600; flex: 1; min-width: 160px; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff;
  border: 1px solid #cfd4dc; border-radius: 8px; padding: .5rem .6rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(47, 91, 211, .25); border-color: var(--primary); }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); }
legend { font-weight: 700; padding: 0 .4rem; }
.form .card > label, .form .row { margin-bottom: .9rem; }
.row { display: flex; gap: .9rem; flex-wrap: wrap; align-items: flex-end; }
.grow-2 { flex: 2; }
.check, .check-inline { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; min-width: auto; flex: 0 0 auto; }
.check-inline { padding-bottom: .55rem; }
.actions { display: flex; gap: .6rem; }
.exchange-form { border-top: 1px solid var(--border); padding-top: 1rem; display: flex; flex-direction: column; gap: .6rem; }
.exchange-form .btn { align-self: flex-start; }

.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filters input[type="search"] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; flex: 0 0 auto; }

.login-box { max-width: 380px; margin: 12vh auto; }
.login-box form { display: flex; flex-direction: column; gap: 1rem; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.card.table-wrap { padding: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
.table tbody tr:hover { background: #fafbff; }
.table .num { text-align: right; }
.row-alert { box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- Barres (stats) ---------- */
.bar { background: #eef0f3; border-radius: 999px; height: 8px; overflow: hidden; min-width: 80px; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.bar-lg { height: 14px; flex: 1; }
.funnel-row { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.funnel-label { width: 170px; font-size: .9rem; }
.weeks { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 1rem; }
.week { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.week-bar { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.week-count { font-size: .75rem; color: var(--muted); }
.week-label { font-size: .7rem; color: var(--muted); margin-top: .3rem; }

/* ---------- Kanban ---------- */
.hint { margin-top: -.6rem; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(175px, 1fr); gap: .8rem; overflow-x: auto; padding-bottom: 1rem; }
.column { background: #eceff3; border-radius: var(--radius); padding: .6rem; min-height: 300px; border-top: 4px solid var(--c); transition: background .15s; }
.column.over { background: #dfe6f7; }
.column header { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; margin-bottom: .6rem; }
.column .count { background: #fff; border-radius: 999px; padding: 0 .5rem; font-weight: 600; color: var(--muted); }
.cards { display: flex; flex-direction: column; gap: .5rem; min-height: 50px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .6rem .7rem; box-shadow: var(--shadow); cursor: grab; }
.kcard.dragging { opacity: .5; }
.kcard-alert { border-left: 3px solid var(--warn); }
.kcard-title { font-weight: 600; color: var(--text); display: block; }
.kcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: .3rem; }
.kcard-select { margin-top: .4rem; font-size: .8rem; padding: .2rem .3rem; display: none; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 > .card { margin-bottom: 0; }
  .menu-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: .4rem; }
  .nav.open { display: flex; }
  dl.info { grid-template-columns: 110px 1fr; }
  .funnel-label { width: 120px; }
  .kcard-select { display: block; }
  .container { padding: .8rem; }
}
@media (hover: none) {
  .kcard-select { display: block; }
}
