/* W2 Finder — une seule feuille de style, thème clair et sombre. */
:root {
    color-scheme: light;
    --bg: #f1f3f7;
    --surface: #ffffff;
    --ink: #14213d;
    --muted: #5b6680;
    --line: #d7dce7;
    --accent: #2743c4;
    --accent-ink: #ffffff;
    --ok: #17703f;
    --ok-bg: #e2f3e9;
    --warn: #8a5600;
    --warn-bg: #fbefd3;
    --bad: #a52a25;
    --bad-bg: #fbe4e2;
    --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #0e1422;
        --surface: #172033;
        --ink: #e7ebf5;
        --muted: #9ba6bf;
        --line: #2b3552;
        --accent: #93a8ff;
        --accent-ink: #0e1422;
        --ok: #6fd39c;
        --ok-bg: #153426;
        --warn: #e6b65c;
        --warn-bg: #3a2c0e;
        --bad: #f2908a;
        --bad-bg: #40191a;
    }
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.5 var(--font); }
a { color: var(--accent); }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; margin: 0; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* En-tête */
.top { display: flex; align-items: center; gap: 2rem; padding: .9rem clamp(1rem, 4vw, 2.5rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; align-items: center; }
.top nav a { padding: .35rem .75rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); background: var(--bg); }
.top nav .nav-logout { padding: .35rem .75rem; color: var(--muted); }

main { max-width: 1120px; margin: 0 auto; padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.back { display: inline-block; margin-bottom: 1rem; font-weight: 500; }

/* Messages */
.flash { padding: .7rem 1rem; border-radius: 8px; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }

/* Boutons et champs */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: .5rem .9rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 500 .95rem var(--font); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: 500 .9rem var(--font); text-decoration: underline; cursor: pointer; }
label { display: block; font-size: .9rem; font-weight: 500; color: var(--muted); }
input[type=text], input[type=email], input[type=number], input[type=file], input[type=password], input[type=url], textarea, select {
    display: block; width: 100%; margin-top: .3rem; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px;
    background: var(--surface); color: var(--ink); font: 400 .95rem/1.5 var(--font);
}
textarea { resize: vertical; }
.stack > * + * { margin-top: .8rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hint { font-size: .88rem; color: var(--muted); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem 1rem; }
.login { max-width: 26rem; margin: 2rem auto; }
.import { max-width: 46rem; margin-top: 1rem; }

/* Filtres et onglets */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; }
.filters input[type=number] { width: 5.5rem; }
.filters .check { display: flex; align-items: center; gap: .45rem; padding-bottom: .5rem; }
.listing-filters { padding: .75rem 0 1rem; }
.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; overflow-x: auto; }
.tabs a { padding: .6rem 0; color: var(--muted); text-decoration: none; font-weight: 500; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.count { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; margin-left: .2rem; }

/* Le score : l'élément fort de l'interface */
.score { width: 3.4rem; flex: none; }
.score-n { display: block; font-size: 1.9rem; line-height: 1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.score-bar { display: block; height: 4px; margin-top: .4rem; border-radius: 2px; background: linear-gradient(to right, var(--accent) calc(var(--score) * 1%), var(--line) 0); }
.score-lg { width: 5rem; }
.score-lg .score-n { font-size: 3rem; }

/* Liste des offres */
.jobs { list-style: none; margin: 0; padding: 0; }
.job { display: flex; gap: 1.25rem; align-items: flex-start; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.job-main { flex: 1; min-width: 0; }
.job-title { font-size: 1.1rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.job-title:hover { color: var(--accent); text-decoration: underline; }
.job-meta { color: var(--muted); margin: .1rem 0 .35rem; }
.job-why { font-size: .92rem; margin: 0; max-width: 62ch; }
.job-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; font-size: .88rem; text-align: right; flex: none; max-width: 22rem; }
.date { color: var(--muted); font-size: .88rem; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.badges { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 0; }

/* Écran vide */
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 1.2rem; }
.empty pre { display: inline-block; padding: .6rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); }

/* Détail d'une offre */
.job-head { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; margin-bottom: .75rem; }
.job-heading { flex: 1; min-width: min(14rem, 100%); }
.job-actions { margin-bottom: 1.75rem; }
.analysis-action { margin-bottom: 1.75rem; }
.facts { display: grid; gap: .85rem; margin: 0 0 1.75rem; }
.facts > div { border-bottom: 1px solid var(--line); padding-bottom: .75rem; }
.facts dt { font-weight: 600; margin-bottom: .2rem; }
.facts dd { margin: 0; }
.facts blockquote { margin: .45rem 0 0; padding-left: .75rem; border-left: 2px solid var(--line); color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.profile-cv-summary { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem); gap: 2.5rem; align-items: start; }
.fit { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.75rem; }
.fit ul { margin: 0; padding: 0; list-style: none; }
.fit li { padding: .3rem 0 .3rem .9rem; border-left: 3px solid var(--line); margin-bottom: .35rem; font-size: .95rem; }
.list-ok li { border-left-color: var(--ok); }
.list-gap li { border-left-color: var(--warn); }
.description { max-width: 70ch; font-size: .95rem; line-height: 1.6; color: var(--ink); }

.apply { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.channel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.channel > * + * { margin-top: .8rem; }
.done { color: var(--ok); font-weight: 600; }
.mail-subject { font-weight: 600; margin-top: .6rem; }
.mail-body { font-size: .92rem; }
.answers { display: grid; gap: .6rem; max-height: 24rem; overflow-y: auto; }
.answer { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; font-size: .9rem; }
.answer-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .2rem; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.5rem; }
.chip { padding: .2rem .6rem; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; }

/* Tableau des candidatures */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: .5rem .75rem .5rem 0; border-bottom: 1px solid var(--line); }
td { padding: .7rem .75rem .7rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }

@media (max-width: 860px) {
    .cols { grid-template-columns: 1fr; gap: 1.5rem; }
    .apply { position: static; }
    .fit { grid-template-columns: 1fr; }
    .job { flex-wrap: wrap; }
    .job-side { flex-basis: 100%; align-items: flex-start; text-align: left; flex-direction: row; flex-wrap: wrap; gap: .5rem .9rem; max-width: none; }
    .job > .score ~ .job-side { padding-left: 4.65rem; }
}

@media (max-width: 540px) {
    .top { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .top nav { margin-left: -.75rem; }
    .field-grid { grid-template-columns: 1fr; }
}
