/* =========================================================
   Mon alternance — design "carnet" épuré
   ========================================================= */
:root {
    --bg:        #f6f4ef;   /* papier crème */
    --surface:   #ffffff;
    --ink:       #23211c;   /* encre */
    --muted:     #8a857a;
    --line:      #e7e2d8;
    --accent:    #4f6df5;   /* indigo */
    --accent-d:  #3a55d8;
    --ok:        #1f9d6b;
    --warn:      #b58a2e;
    --danger:    #d24b4b;
    --radius:    14px;
    --shadow:    0 1px 2px rgba(40,35,25,.05), 0 6px 18px rgba(40,35,25,.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 1.7rem; margin: 0 0 .2rem; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; letter-spacing: -.01em; }
h3 { margin: .1rem 0 .4rem; font-size: 1.12rem; }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: .92rem; }
.opt   { color: var(--muted); font-weight: 400; font-size: .85em; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
    font-size: .95rem; font-weight: 600; cursor: pointer; transition: .15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-sm { padding: .42rem .8rem; font-size: .88rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-d); color: #fff; }
.btn-light { background: #efece5; color: var(--ink); }
.btn-light:hover { background: #e6e2d9; }
.btn-danger { background: transparent; color: var(--danger); border-color: #eccaca; margin-left: auto; }
.btn-danger:hover { background: #fbeded; }

.icon-btn {
    border: none; background: transparent; cursor: pointer; color: var(--muted);
    font-size: 1.05rem; padding: .25rem .45rem; border-radius: 8px; line-height: 1;
}
.icon-btn:hover { background: #efece5; color: var(--ink); text-decoration: none; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem 1.3rem; background: var(--surface);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: .4rem; }
.nav a { color: var(--muted); padding: .4rem .7rem; border-radius: 8px; font-weight: 600; font-size: .92rem; }
.nav a:hover { background: #f1eee7; color: var(--ink); text-decoration: none; }
.nav a.on { color: var(--ink); background: #ece8df; }
.nav a.ghost { color: var(--accent); }
.nav .logout { color: var(--muted); font-size: 1.1rem; }
.nav .who { color: var(--ink); font-weight: 600; font-size: .9rem; padding: 0 .3rem 0 .6rem; }

/* ---------- Layout ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 1.8rem 1.3rem 4rem; }
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap;
}
.clear-filter { margin-left: .5rem; font-size: .85rem; }

/* ---------- Timeline / cartes ---------- */
.timeline { display: flex; flex-direction: column; gap: 1rem; }
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}
.card-top { display: flex; justify-content: space-between; align-items: center; }
.date { color: var(--accent); font-weight: 600; font-size: .85rem; text-transform: capitalize; }
.desc { margin: .3rem 0 .7rem; color: #45413a; }

.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .3rem; }
.tag {
    background: #eef1fe; color: var(--accent-d); border: 1px solid #dde2fc;
    padding: .2rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: .3rem;
}
.proofs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .7rem; }
.proof {
    display: inline-flex; align-items: center; gap: .3rem;
    background: #eafaf2; color: var(--ok); border: 1px solid #c8efdc;
    padding: .25rem .65rem; border-radius: 8px; font-size: .84rem; font-weight: 600;
}
.proof:hover { background: #ddf5e9; text-decoration: none; }

/* ---------- État vide ---------- */
.empty {
    text-align: center; padding: 3.5rem 1.5rem; background: var(--surface);
    border: 1px dashed var(--line); border-radius: var(--radius);
}
.empty-mark { font-size: 2.6rem; }
.empty h2 { margin: .6rem 0 .3rem; }
.empty .btn { margin-top: 1rem; }

/* ---------- Formulaire ---------- */
.mission-form {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow);
}
.field { margin-bottom: 1.2rem; }
.field > label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .95rem; }
input[type=text], input[type=url], input[type=date], input[type=password], textarea {
    width: 100%; padding: .65rem .8rem; border: 1px solid var(--line);
    border-radius: 10px; font: inherit; background: #fcfbf8; color: var(--ink);
}
input:focus, textarea:focus {
    outline: none; border-color: var(--accent); background: #fff;
    box-shadow: 0 0 0 3px rgba(79,109,245,.12);
}
textarea { resize: vertical; }
.hint { font-size: .82rem; color: var(--muted); margin: .4rem 0 0; }

/* tags input */
.tag-input { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.tag-input:empty { display: none; }
.tag-removable { padding-right: .35rem; }
.tag-x {
    border: none; background: transparent; color: var(--accent-d); cursor: pointer;
    font-size: 1rem; line-height: 1; padding: 0 .1rem;
}
.tag-x:hover { color: var(--danger); }

/* preuves */
.proof-row { display: flex; gap: .5rem; margin-bottom: .5rem; align-items: center; }
.proof-row input[name="proof_label[]"] { flex: 0 0 38%; }
.proof-row input[type=url] { flex: 1; }

.form-actions { display: flex; align-items: center; gap: .6rem; margin-top: 1.2rem; }

/* ---------- Compétences ---------- */
.skill-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}
.skill-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.1rem; box-shadow: var(--shadow); color: var(--ink); display: block;
    transition: .15s;
}
.skill-card:hover { transform: translateY(-2px); text-decoration: none; border-color: #d6d0c4; }
.skill-name { font-weight: 700; margin-bottom: .6rem; }
.bar { height: 8px; background: #ece8df; border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #7b91f8); border-radius: 999px; }
.skill-meta { display: flex; justify-content: space-between; margin-top: .55rem; font-size: .84rem; color: var(--muted); }
.skill-meta .ok { color: var(--ok); font-weight: 600; }
.skill-meta .warn { color: var(--warn); }

/* ---------- Gate (login / setup) ---------- */
.gate-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 1.5rem; }
.gate {
    background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
    box-shadow: var(--shadow); padding: 2.2rem; max-width: 380px; width: 100%; text-align: center;
}
.gate-mark { font-size: 2.4rem; }
.gate h1 { margin-top: .4rem; }
.gate-form { display: flex; flex-direction: column; gap: .7rem; margin-top: 1.3rem; }
.gate-form .btn { justify-content: center; }
.alert { background: #fbeded; color: var(--danger); border: 1px solid #eccaca; padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; margin-top: 1rem; }
.btn-rayor {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    background: #000; color: #fff; padding: .85rem 1.1rem; border-radius: 12px;
    font-weight: 600; margin-top: 1.4rem; text-decoration: none; transition: .15s;
}
.btn-rayor:hover { background: #222; text-decoration: none; transform: translateY(-1px); }

/* =========================================================
   Dossier jury (export imprimable)
   ========================================================= */
.export-body { background: #efece5; }
.export-toolbar {
    position: sticky; top: 0; display: flex; align-items: center; gap: 1rem;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: .7rem 1.3rem;
}
.export-toolbar .muted { margin-right: auto; }
.dossier {
    max-width: 760px; margin: 1.5rem auto; background: #fff; padding: 2.5rem;
    box-shadow: var(--shadow); border-radius: 8px;
}
.dossier-head { border-bottom: 2px solid var(--ink); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.dossier-stats { display: flex; gap: 1.5rem; margin-top: .8rem; }
.dossier-stats strong { font-size: 1.3rem; color: var(--accent-d); }
.dossier-section { margin-bottom: 2rem; }
.skill-block h2 { border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.recap { width: 100%; border-collapse: collapse; font-size: .92rem; }
.recap th, .recap td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
.recap th { color: var(--muted); font-weight: 600; }
.recap td:nth-child(2), .recap td:nth-child(3),
.recap th:nth-child(2), .recap th:nth-child(3) { text-align: center; width: 90px; }
.dossier-mission { margin: .9rem 0 1rem; padding-left: .9rem; border-left: 3px solid #eef1fe; }
.dm-head { display: flex; justify-content: space-between; gap: 1rem; }
.dm-proofs { margin: .4rem 0 0; padding-left: 1.1rem; font-size: .9rem; color: var(--ok); }
.dm-proofs .url { color: var(--muted); word-break: break-all; }

@media print {
    .no-print { display: none !important; }
    .export-body { background: #fff; }
    .dossier { margin: 0; box-shadow: none; max-width: none; padding: 0; }
    .skill-block { break-inside: avoid; }
    .dossier-mission { break-inside: avoid; }
    a { color: var(--ink); }
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .proof-row { flex-wrap: wrap; }
    .proof-row input[name="proof_label[]"] { flex: 1 1 100%; }
    .dossier { padding: 1.3rem; }
    .nav a:not(.btn):not(.logout) { display: none; }
}
