/* Charte inspirée de la ligne graphique EPFL (rouge #FF0000, gris chauds, angles droits).
   Police officielle : Suisse Int'l — à ajouter dans /public/fonts si l'EPFL fournit la licence. */
:root {
  --red: #FF0000;
  --groseille: #B51F1F;
  --leman: #00A79F;
  --canard: #007480;
  --taupe: #413D3A;
  --ink: #212121;
  --muted: #707070;
  --line: #E6E6E6;
  --line-2: #CAC7C7;
  --perle: #F4F4F4;
  --bg: #FFFFFF;
  --card: #FFFFFF;
  --focus: 0 0 0 3px rgba(255, 0, 0, .25);
  --font: "Suisse Int'l", "Suisse Intl", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 var(--font); color: var(--ink); background: var(--perle); display: flex; flex-direction: column; min-height: 100vh; }
main.wrap { flex: 1; padding-top: 28px; padding-bottom: 56px; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

a { color: var(--ink); text-decoration-color: var(--red); text-underline-offset: 3px; }
a:hover { color: var(--red); }
h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; margin: 0 0 18px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 19px; margin: 0 0 14px; font-weight: 700; }
h3 { font-size: 15px; margin: 20px 0 8px; font-weight: 700; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--perle); padding: 1px 5px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 18px; color: var(--taupe); }
.strong { font-weight: 700; }
.pre { white-space: pre-wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: 13px; font-weight: 700; color: var(--red); margin-bottom: 6px; }

/* ---- En-tête -------------------------------------------------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar::before { content: ""; display: block; height: 4px; background: var(--red); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); margin-right: auto; }
.logo { font-weight: 800; font-size: 30px; letter-spacing: -.04em; color: var(--red); line-height: 1; }
.brand-sep { width: 1px; height: 30px; background: var(--line-2); }
.brand-title { font-weight: 700; font-size: 15px; line-height: 1.2; display: flex; flex-direction: column; }
.brand-title small { font-weight: 400; color: var(--muted); font-size: 13px; }
.mainnav { display: flex; align-items: center; gap: 4px; }
.mainnav a, .mainnav button { font: inherit; font-size: 15px; padding: 8px 12px; text-decoration: none; color: var(--ink); background: none; border: 0; cursor: pointer; border-bottom: 3px solid transparent; }
.mainnav a.on { border-bottom-color: var(--red); font-weight: 700; }
.mainnav a:hover, .mainnav button:hover { color: var(--red); }
.logout { margin: 0 0 0 8px; }
.logout button { color: var(--muted); }
.menu-btn { display: none; background: none; border: 0; width: 44px; height: 44px; padding: 10px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; background: var(--ink); margin: 5px 0; }

@media (max-width: 760px) {
  .brand-sep, .brand-title small { display: none; }
  .logo { font-size: 26px; }
  .menu-btn { display: block; }
  .mainnav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: #fff; flex-direction: column; align-items: stretch; border-bottom: 1px solid var(--line); padding: 6px 0 10px; box-shadow: 0 8px 16px rgba(0,0,0,.06); }
  .menu-open .mainnav { display: flex; }
  .mainnav a, .mainnav button { padding: 12px 16px; border-bottom: 0; border-left: 3px solid transparent; text-align: left; }
  .mainnav a.on { border-left-color: var(--red); }
  .logout { margin: 0; }
}

.footer { border-top: 1px solid var(--line); background: #fff; font-size: 14px; color: var(--muted); }
.footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; }
.footer a { color: var(--muted); }

/* ---- Composants ------------------------------------------------ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 700; font-size: 15px; line-height: 1.2; padding: 11px 20px; background: var(--red); color: #fff; border: 2px solid var(--red); text-decoration: none; cursor: pointer; border-radius: 0; white-space: nowrap; }
.btn:hover { background: var(--groseille); border-color: var(--groseille); color: #fff; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-danger { background: #fff; color: var(--groseille); border-color: var(--groseille); }
.btn-danger:hover { background: var(--groseille); color: #fff; }
.btn-small { padding: 6px 12px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }
.linklike:hover { color: var(--red); }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-size: 14px; }
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
form.inline { display: inline; }

.card { background: var(--card); border: 1px solid var(--line); padding: 22px; margin-bottom: 20px; }
.card-accent { border-top: 4px solid var(--red); }
@media (max-width: 600px) { .card { padding: 16px; } }

.alert { padding: 12px 16px; margin-bottom: 20px; border-left: 4px solid; background: #fff; }
.alert-ok { border-color: var(--leman); }
.alert-err { border-color: var(--red); }
.alert-key { border-color: var(--canard); background: #E6F4F4; }
.alert ul { margin: 8px 0 0; padding-left: 20px; }
.pw { font-size: 18px; padding: 3px 8px; background: #fff; margin: 0 6px; user-select: all; }

.badge { display: inline-block; padding: 4px 10px; font-size: 13px; font-weight: 700; color: #fff; background: var(--c); line-height: 1.3; }
.tag { display: inline-block; font-size: 12px; padding: 1px 6px; background: var(--perle); color: var(--muted); border: 1px solid var(--line); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin-bottom: 0; }
.page-head .lead { margin: 8px 0 0; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 14px; }
.crumbs a { color: var(--muted); }
.crumbs span { margin: 0 6px; }

.grid-2 { display: grid; gap: 24px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-wide-left { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } }
.narrow { max-width: 520px; }
.center-block { margin: 40px auto; text-align: center; }

.empty { background: #fff; border: 1px dashed var(--line-2); padding: 40px 20px; text-align: center; }

/* ---- Formulaires ------------------------------------------------ */
.form label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 16px; }
.form label small { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400; font-size: 16px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line-2); background: #fff; border-radius: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--taupe); }
textarea { resize: vertical; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; }
.form .row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-wide { max-width: 860px; }
.form .check, .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--red); flex: none; }
fieldset { border: 1px solid var(--line); padding: 14px 16px 6px; margin: 0 0 16px; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.checklist { max-height: 280px; overflow: auto; margin-top: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 16px; }
.checklist .check { margin-bottom: 8px; }
.filter-input { margin-top: 0 !important; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.searchbar { display: flex; gap: 8px; margin-bottom: 18px; }
.searchbar input { margin: 0; }
@media (max-width: 520px) { .searchbar .btn { padding: 10px 12px; } }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 14px; background: #fff; border: 1px solid var(--line-2); text-decoration: none; color: var(--ink); }
.chip i { width: 10px; height: 10px; background: var(--c); display: inline-block; }
.chip b { color: var(--muted); font-weight: 400; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.on b { color: #ccc; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line-2); margin-bottom: 18px; }
.tabs a { padding: 10px 16px; text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { border-bottom-color: var(--red); font-weight: 700; }

/* ---- Tableaux responsives ----------------------------------------- */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); font-size: 15px; }
.table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 2px solid var(--ink); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:hover td { background: #FAFAFA; }
.table tr.inactive td { color: var(--muted); }
@media (max-width: 760px) {
  .rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable thead { display: none; }
  .rtable { border: 0; background: none; }
  .rtable tr { background: #fff; border: 1px solid var(--line); margin-bottom: 10px; padding: 8px 0; }
  .rtable td { border: 0; padding: 4px 14px; display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
  .rtable td::before { content: attr(data-l); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding-top: 3px; }
  .rtable td:first-child { grid-template-columns: 1fr; font-size: 17px; }
  .rtable td:first-child::before { display: none; }
}

.quick-status select { margin: 0; padding: 6px 30px 6px 10px; font-size: 14px; font-weight: 700; border: 0; border-left: 5px solid var(--c); background-color: var(--perle); cursor: pointer; min-width: 180px; }

/* ---- Espace chercheur -------------------------------------------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.pcard { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--red); padding: 20px; text-decoration: none; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.pcard:hover { color: var(--ink); box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.pcard.is-final { border-top-color: var(--line-2); }
.pcard-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.pcard-ref { text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.pcard-title { font-size: 20px; line-height: 1.25; margin: 0 0 6px; }
.pcard-partner { color: var(--taupe); font-size: 15px; margin-bottom: 14px; }
.pcard-status { margin-top: auto; padding-top: 6px; }
.pcard-desc { font-size: 14px; color: var(--muted); margin: 8px 0 0; }
.pcard-contact { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.progress { height: 6px; background: var(--perle); margin-top: 14px; }
.progress span { display: block; height: 100%; background: var(--c); }

.status-hero { background: #fff; border: 1px solid var(--line); border-left: 8px solid var(--c); padding: 22px 24px; margin-bottom: 22px; }
.status-hero-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.status-hero-value { font-size: clamp(24px, 4vw, 32px); font-weight: 700; line-height: 1.2; color: var(--c); margin-bottom: 8px; }
.status-hero-desc { font-size: 17px; margin-bottom: 8px; }
.status-hero-date { font-size: 14px; color: var(--muted); margin: 0; }

.stepper { list-style: none; padding: 0; margin: 0 0 30px; display: flex; counter-reset: s; }
.stepper li { flex: 1; position: relative; text-align: center; font-size: 13px; color: var(--muted); padding-top: 26px; }
.stepper li::before { content: ""; position: absolute; top: 8px; left: -50%; right: 50%; height: 3px; background: var(--line-2); }
.stepper li:first-child::before { display: none; }
.stepper .dot { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 19px; height: 19px; border: 3px solid var(--line-2); background: #fff; border-radius: 50%; z-index: 1; }
.stepper li.done .dot { background: var(--ink); border-color: var(--ink); }
.stepper li.done::before, .stepper li.current::before { background: var(--ink); }
.stepper li.current .dot { border-color: var(--red); background: var(--red); box-shadow: 0 0 0 4px rgba(255,0,0,.15); }
.stepper li.current { color: var(--ink); font-weight: 700; }
.stepper .lbl { display: block; padding: 0 4px; line-height: 1.3; }
@media (max-width: 760px) {
  .stepper { flex-direction: column; gap: 0; }
  .stepper li { text-align: left; padding: 0 0 14px 32px; }
  .stepper li::before { left: 8px; right: auto; top: -14px; width: 3px; height: 22px; }
  .stepper .dot { left: 0; transform: none; }
  .stepper .lbl { padding: 0; }
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -8px; top: 3px; width: 14px; height: 14px; background: var(--c); }
.tl-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.tl-head time { font-size: 13px; color: var(--muted); }
.tl-comment { background: #fff; border: 1px solid var(--line); padding: 10px 14px; margin: 8px 0 0; white-space: pre-wrap; font-size: 15px; }
.tl-meta { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 15px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.people, .plain { list-style: none; padding: 0; margin: 0 0 12px; }
.people li { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.people li:last-child { border-bottom: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* ---- Admin : choix du statut -------------------------------------- */
.status-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.form .spill { margin: 0; font-weight: 400; }
.spill input { position: absolute; opacity: 0; }
.spill span { display: inline-block; padding: 8px 14px; border: 2px solid var(--line-2); border-left: 6px solid var(--c); background: #fff; cursor: pointer; font-size: 14px; }
.spill input:checked + span { background: var(--c); border-color: var(--c); color: #fff; font-weight: 700; }
.spill input:focus-visible + span { box-shadow: var(--focus); }
@media (max-width: 600px) { .status-pick { flex-direction: column; } .spill span { display: block; } }

.status-list { margin-bottom: 10px; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.status-edit { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 260px; }
.status-edit input { margin: 0; }
.status-edit input[type=color] { width: 40px; height: 40px; padding: 2px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; }
.status-label-input { flex: 1 1 200px; width: auto !important; font-weight: 700 !important; }
.status-desc-input { flex: 2 1 260px; width: auto !important; }
.status-edit .check { margin: 0; }
.status-tools { display: flex; align-items: center; gap: 6px; }
.status-tools form { margin: 0; }

/* ---- Connexion ----------------------------------------------------- */
.login { display: flex; justify-content: center; padding: 24px 0; }
.login-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--red); padding: 32px; }
@media (max-width: 480px) { .login-card { padding: 22px 18px; } }

.smtp-box { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.smtp-box h3 { margin-top: 0; }
.smtp-box .dl { margin-bottom: 12px; }

/* ---- Langue ---------------------------------------------------------- */
.lang-switch { font-size: 13px; font-weight: 700; text-decoration: none; color: var(--muted); border: 1px solid var(--line-2); padding: 4px 8px; letter-spacing: .04em; }
.lang-switch:hover { color: var(--red); border-color: var(--red); }

/* ---- Retards ------------------------------------------------------- */
.alert-warn { border-color: #C97C00; background: #FFF6E5; }
.alert-link { display: block; text-decoration: none; color: var(--ink); }
.alert-link:hover { color: var(--ink); background: #FFEFD1; }
.chip-warn { border-color: #C97C00; }
.chip-warn.on { background: #C97C00; border-color: #C97C00; }
.table tr.is-overdue td:first-child { box-shadow: inset 4px 0 0 #C97C00; }
.late { color: #A15F00; font-weight: 700; font-size: 13px; white-space: nowrap; }
@media (max-width: 760px) { .rtable tr.is-overdue { border-left: 4px solid #C97C00; } .table tr.is-overdue td:first-child { box-shadow: none; } }

/* ---- Statuts bilingues ------------------------------------------------ */
.status-edit { align-items: flex-start; }
.status-fields { flex: 1 1 420px; display: flex; flex-direction: column; gap: 6px; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flag { font-size: 11px; font-weight: 700; color: var(--muted); width: 22px; }
.status-opts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.form .alert-days, .alert-days { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; margin: 0; color: var(--muted); }
.alert-days input { width: 64px; margin: 0; padding: 8px; }
