:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1c1f2e;
  --muted: #6b7085;
  --line: #e4e6ef;
  --primary: #4f46e5;
  --primary-soft: #eef0ff;
  --green: #16a34a;
  --green-soft: #e7f7ed;
  --red: #dc2626;
  --red-soft: #fdecec;
  --orange: #ea7a0c;
  --orange-soft: #fff1e2;
  --purple: #7c3aed;
  --purple-soft: #f2ebff;
  --blue: #2563eb;
  --blue-soft: #e8efff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 22, 40, .06), 0 4px 16px rgba(20, 22, 40, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.5rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
p { margin: .4rem 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .75rem; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; }
.warn { color: var(--red); font-weight: 600; }
.link { color: var(--primary); text-decoration: none; }
.link:hover { text-decoration: underline; }
/* Accessibilité : un lien dans une phrase se distingue autrement que par la couleur (WCAG 1.4.1). */
p .link, li .link, label .link, .file-row .link, .legal-table .link { text-decoration: underline; text-underline-offset: 2px; }
/* Lien d'évitement (visible au focus clavier) et texte réservé aux lecteurs d'écran. */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: #fff; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0; }

/* ---------- barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-shrink: 0; text-decoration: none; }
.brand-logo { display: block; height: 40px; width: auto; }
.topbar-tag { font-size: .7rem; color: var(--muted); background: var(--bg); padding: .1rem .45rem; border-radius: 99px; }
.live { margin-left: auto; display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--muted); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: #c3c6d4; }
.live-on .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- navigation des espaces admin (Admin | Commerciaux | Communication | Trésorerie) */
.topbar { flex-wrap: wrap; }
.admin-nav { display: flex; gap: .25rem; overflow-x: auto; max-width: 100%; }
.admin-nav a {
  padding: .3rem .65rem; border-radius: 99px; font-size: .85rem; font-weight: 600;
  color: var(--muted); text-decoration: none; white-space: nowrap;
}
.admin-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.admin-nav a.on { color: var(--primary); background: var(--primary-soft); }
.live-spacer { margin-left: auto; }
.readonly-note { background: var(--blue-soft); color: var(--blue); border-radius: 10px;
  padding: .6rem .9rem; margin: 0 0 14px; font-size: .9rem; }
.space-placeholder { text-align: center; padding: 40px 20px; }
@media (max-width: 640px) { .admin-nav { order: 10; width: 100%; } }

.container { max-width: 960px; margin: 0 auto; padding: 16px 16px 48px; }

/* ---------- cartes */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 0 0 16px;
}
.hero { padding: 12px 0 8px; }
.hero h1 { font-size: 1.8rem; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; margin: 4px 0 16px; }
/* Commandes affichées (page Système) : retour à la ligne plutôt qu'un débordement sur téléphone. */
pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.choice-grid, .company-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
.choice, .company-card {
  display: flex; flex-direction: column; gap: .15rem;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  color: inherit; text-decoration: none; background: var(--card);
  transition: border-color .15s, transform .15s;
}
.choice:hover, .company-card:hover { border-color: var(--primary); transform: translateY(-1px); }

/* ---------- lignes planning / RDV */
.row-card {
  display: grid; grid-template-columns: 56px 1fr; gap: 6px 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.row-card:first-of-type { border-top: 0; }
.row-time { font-weight: 700; font-size: 1.05rem; color: var(--primary); font-variant-numeric: tabular-nums; }
.row-free .row-time { color: var(--muted); font-weight: 500; }
.row-actions { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }

/* ---------- badges */
.badge {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .55rem;
  border-radius: 99px; white-space: nowrap;
}
.badge-blue { background: var(--blue-soft); color: #1d4ed8; }
.badge-orange { background: var(--orange-soft); color: #b45309; }
.badge-green { background: var(--green-soft); color: #15803d; }
.badge-red { background: var(--red-soft); color: #b91c1c; }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-grey { background: #eef0f4; color: #545a6e; }
.badge-light { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }

/* ---------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  min-height: 40px; padding: .45rem .95rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--primary); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-ghost-danger { color: var(--red); }
.btn-ghost-danger:hover { border-color: var(--red); }
.btn-sm { min-height: 30px; padding: .2rem .55rem; font-size: .8rem; }
.btn-xl { display: flex; width: 100%; min-height: 56px; font-size: 1.1rem; margin: 12px 0 6px; }
.btn-yes { background: var(--green); border-color: var(--green); color: #fff; }
.btn-no { background: #fff; border-color: var(--red); color: var(--red); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.center .chips, .chips.center { justify-content: center; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .7rem;
  font: inherit; font-size: .82rem; cursor: pointer; min-height: 34px;
}
.chip-on.chip-present { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 600; }
.chip-on.chip-late { background: var(--orange-soft); border-color: var(--orange); color: #b45309; font-weight: 600; }
.chip-on.chip-absent { background: var(--red-soft); border-color: var(--red); color: var(--red); font-weight: 600; }

/* ---------- créneaux */
.slot-list { display: grid; gap: 8px; }
.slot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
}
.slot-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-label { font-size: .85rem; color: var(--muted); text-align: right; }
.slot-mine { border-color: var(--green); background: var(--green-soft); }
.slot-taken, .slot-conflict, .slot-already { background: #fafafc; }
.slot-taken .slot-time, .slot-conflict .slot-time, .slot-already .slot-time { color: var(--muted); }
.slot-conflict .slot-label { color: #b45309; }

/* ---------- bannières */
.banner {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 12px 14px; border-radius: 12px; margin-bottom: 12px;
  text-decoration: none; color: #fff; font-size: .95rem;
}
.banner-live { background: linear-gradient(90deg, #e2470f, #ea7a0c); animation: pulse 2s infinite; }
.banner-choice { background: var(--purple); }
.banner .timer { color: #fff; background: rgba(255, 255, 255, .2); }
.banner-cta { font-weight: 700; }
@keyframes pulse { 50% { filter: brightness(1.1); } }

/* ---------- entretien */
.timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: .85rem;
  background: var(--orange-soft); color: #b45309; padding: .1rem .5rem; border-radius: 99px;
}
.timer.low { background: var(--red-soft); color: #b91c1c; }
.interview { padding: 20px 16px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; text-align: center; }
.vs > div { display: flex; flex-direction: column; }
.vs strong { font-size: 1.15rem; }
.vs-sep { font-size: 1.5rem; color: var(--muted); }
.interview-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; align-items: center; margin: 12px 0 4px; }
.big-timer {
  text-align: center; font-size: clamp(4rem, 22vw, 7rem); font-weight: 800; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1; margin: 16px 0 8px; color: var(--text);
}
.big-timer.idle { color: #80869a; }
.big-timer.done { color: #80869a; font-size: clamp(2.5rem, 12vw, 4rem); }
.big-timer.low { color: var(--red); }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 0 0 12px; }
.progress-bar { height: 100%; width: 100%; background: var(--primary); transition: width 1s linear; }
@media (prefers-reduced-motion: reduce) { .progress-bar, .banner-live { transition: none; animation: none; } }
.progress-bar.low { background: var(--red); }
.question { text-align: center; font-size: 1.2rem; font-weight: 700; margin: 18px 0 4px; }
.choice-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result {
  text-align: center; font-size: 2rem; font-weight: 800; padding: 22px 12px; border-radius: 14px; margin: 14px 0 4px;
}
.result span { display: block; font-size: .95rem; font-weight: 500; margin-top: 4px; }
.result-match { background: var(--green-soft); color: var(--green); }
.result-nomatch { background: #eef0f4; color: #545a6e; }

/* ---------- admin */
.admin-settings { display: grid; gap: 20px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 14px; color: var(--muted); font-size: .85rem; }
.stat span { display: block; font-size: 1.6rem; font-weight: 800; color: var(--text); }
.stat-orange span { color: var(--orange); }
.stat-green span { color: var(--green); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .3rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.tab span { color: var(--muted); }
.tab-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-on span { color: #dcdcff; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
.table-wrap:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }   /* tableau défilant au clavier */
.admin-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 1050px; }
.admin-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.admin-table th, .admin-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table select, .admin-table input { font: inherit; font-size: .8rem; padding: 3px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.admin-table input { width: 64px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.dur { display: inline-flex; gap: 2px; align-items: center; }
.row-cancelled td { opacity: .5; }

/* ---------- toast */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; color: #fff;
  font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.toast-ok { background: #1f2937; }
.toast-error { background: var(--red); }

/* ---------- écrans plus larges */
@media (min-width: 640px) {
  .choice-grid { grid-template-columns: repeat(3, 1fr); }
  .company-grid { grid-template-columns: repeat(2, 1fr); }
  .row-card { grid-template-columns: 64px 1fr auto; align-items: center; }
  .row-actions { grid-column: auto; justify-content: flex-end; }
  .admin-settings { grid-template-columns: 1fr 1fr; }
  .card { padding: 20px 22px; }
  .table-wrap { margin: 0 -22px; padding: 0 22px; }
  .interview { padding: 28px 32px; max-width: 640px; margin-left: auto; margin-right: auto; }
}
@media (min-width: 900px) {
  .company-grid { grid-template-columns: repeat(3, 1fr); }
}
body[data-page="admin"] .container { max-width: 1320px; }

/* ---------- menu utilisateur */
.user-menu { display: flex; align-items: center; gap: .5rem; }
.live + .user-menu { margin-left: .4rem; }
.topbar .live { margin-left: auto; }
.user-name { font-size: .85rem; font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .user-name, .live-label, .topbar-tag { display: none; }
}

/* ---------- connexion / inscription */
.auth-wrap { max-width: 520px; margin: 0 auto; }
.auth-card h1 { margin-bottom: 1rem; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 600; margin-bottom: 14px; flex: 1; min-width: 0; }
.field[hidden] { display: none; }
.field input, .field select, .field textarea {
  font: inherit; font-weight: 400; font-size: 16px; /* 16px : évite le zoom auto sur iPhone */
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text); width: 100%;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field-row { display: flex; flex-direction: column; gap: 0 12px; }
.hint { font-weight: 400; font-size: .78rem; color: var(--muted); }
.optional { font-weight: 400; font-size: .75rem; color: var(--muted); background: var(--bg); padding: 0 .4rem; border-radius: 99px; margin-left: .25rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; margin: 4px 0 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex-shrink: 0; }
.btn-block { display: flex; width: 100%; min-height: 48px; font-size: 1rem; }
/* .form-error-note : même aspect, mais hors de la zone d'erreur que remplit auth.js (« Lien incomplet » de reset.html). */
.form-error, .form-error-note { background: var(--red-soft); color: #b91c1c; padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.role-switch { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-switch legend { font-size: .9rem; font-weight: 600; margin-bottom: 6px; padding: 0; }
.role-switch label { cursor: pointer; }
.role-switch input { position: absolute; opacity: 0; pointer-events: none; }
.role-switch span { display: flex; justify-content: center; padding: 12px; border: 2px solid var(--line); border-radius: 12px; font-weight: 600; }
.role-switch input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.role-switch input:focus-visible + span { outline: 2px solid var(--primary); }
.demo-accounts summary { cursor: pointer; font-weight: 600; }
.demo-accounts ul { padding-left: 1.1rem; margin: .5rem 0 0; }
.demo-accounts li { margin: 4px 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
code { background: var(--bg); padding: .05rem .35rem; border-radius: 6px; font-size: .85em; }
.accounts-table { min-width: 1080px; }
.accounts-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.accounts-tools input, .accounts-tools select { font: inherit; padding: .45rem .6rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; min-height: 36px; font-size: 16px; }
.accounts-tools input:focus, .accounts-tools select:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.accounts-tools input[type=search] { flex: 1 1 260px; min-width: 0; }
.accounts-tools select { flex: 0 1 auto; }
.account-actions { white-space: nowrap; }
.account-actions .btn + .btn { margin-left: .3rem; }
@media (min-width: 640px) {
  .field-row { flex-direction: row; }
}
.pw-rules { list-style: none; padding: 0; margin: -4px 0 16px; font-size: .8rem; color: var(--muted); }
.pw-rules li { padding-left: 1.4rem; position: relative; margin: 3px 0; }
.pw-rules li[data-rule]::before { content: "○"; position: absolute; left: 0; }
.pw-rules li.ok { color: #15803d; }   /* contraste 5:1 sur blanc (--green : 3,3:1) */
.pw-rules li.ok::before { content: "✓"; font-weight: 700; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin: 0 0 10px; }

/* ---------------------------------------------------------------- pages légales, Mon compte */
a.user-name { color: inherit; text-decoration: none; }
a.user-name:hover { text-decoration: underline; }
.legal-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; padding: 24px 16px 32px; font-size: .8rem; }
.legal-footer a { color: var(--muted); text-decoration: none; }
.legal-footer .footer-logo { flex-basis: 100%; display: flex; justify-content: center; margin-bottom: 8px; }
.footer-logo img { display: block; height: 64px; width: auto; }
.legal-footer a:hover { color: var(--primary); text-decoration: underline; }
.legal { max-width: 860px; margin: 0 auto; line-height: 1.6; }
.legal h1 { margin: 12px 0 4px; }
.legal h2 { font-size: 1.1rem; margin: 28px 0 8px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
.legal code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 640px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px; border-bottom: 1px solid var(--line); }
.legal-table th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; }
.legal-updated { margin-top: 32px; }
mark.todo { background: var(--orange-soft); color: #b45309; padding: 0 4px; border-radius: 4px; font-weight: 600; }
.rgpd-notice { margin: 4px 0 14px; line-height: 1.5; }
.account .card { margin-bottom: 16px; }
.account h1 { margin-top: 0; font-size: 1.4rem; }
.danger-zone { border: 1px solid var(--red-soft); }

/* ---------------------------------------------------------------- espaces compte (candidat / entreprise) */
.account-space { max-width: 720px; }
.lock-note { background: var(--orange-soft); color: #8a4a06; border-radius: 12px; padding: 12px 14px;
  margin: 0 0 16px; font-size: .9rem; line-height: 1.5; }
.lock-note strong { display: block; color: #b45309; }
.lock-note.lock-closed { background: var(--red-soft); color: #8f1d1d; }
.lock-note.lock-closed strong { color: #b91c1c; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.plain:disabled input, fieldset.plain:disabled select, fieldset.plain:disabled textarea { background: var(--bg); color: var(--muted); }
.check-group { border: 0; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 0 18px; }
.check-group legend { font-size: .9rem; font-weight: 600; margin-bottom: 6px; padding: 0; }
.check-group .check { margin: 0 0 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
label.btn { cursor: pointer; }
label.btn.busy { opacity: .5; pointer-events: none; }
label.btn:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-top: 1px solid var(--line); }
.file-row:first-of-type { border-top: 0; }
.file-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.file-icon { font-size: 1.6rem; flex: 0 0 auto; }
.offer { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.offer h3 { font-size: 1rem; margin: 0 0 2px; }
.offer-desc { white-space: pre-line; }
.offer-edit, .offer-new { margin: 8px 0; }
.offer-edit > summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; margin-bottom: 8px; }
.offer-new > summary { list-style: none; display: inline-flex; margin-bottom: 12px; }
.offer-new > summary::-webkit-details-marker { display: none; }
.offer-new[open] > summary { display: none; }
.offer-form { padding-top: 4px; }
.offers-public { display: grid; gap: 10px; }

/* Champ piège anti-robots du formulaire d'inscription : hors de l'écran (pas display:none, que
   certains robots savent ignorer), inaccessible au clavier et aux lecteurs d'écran. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice-ok { background: var(--green-soft); color: var(--green); padding: 10px 12px; border-radius: 10px; font-size: .9rem; font-weight: 600; }
.reset-link { display: flex; gap: 8px; margin: 10px 0; }
.reset-link input { flex: 1; min-width: 0; font: inherit; font-size: .85rem; padding: 8px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------------------------------------------------------------- centre de notifications (notifications.js) */
.notif { position: relative; }
.notif-btn { position: relative; padding: .2rem .45rem; }
.notif-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 99px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700;
  line-height: 18px; text-align: center;
}
.notif-count[hidden] { display: none; }
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 480px); overflow-y: auto; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(20, 22, 40, .15); text-align: left;
}
.notif-head { display: flex; justify-content: space-between; align-items: baseline; padding: .7rem .9rem;
  border-bottom: 1px solid var(--line); }
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li { border-bottom: 1px solid var(--line); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a, .notif-list li > div { display: grid; gap: .1rem; padding: .6rem .9rem; color: inherit; text-decoration: none; }
.notif-list a:hover, .notif-list a:focus-visible { background: var(--bg); }
.notif-new { background: var(--primary-soft); }
.notif-title { font-weight: 600; font-size: .9rem; }
.notif-body { font-size: .85rem; }
.notif-empty { padding: .9rem; margin: 0; }
@media (max-width: 520px) { .notif-panel { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; } }

/* ---------------------------------------------------------------- Espace Organisation (organisation.js) */
.journal-filters { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: flex-end; margin: .5rem 0 1rem; }
.journal-filters label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
.journal-filters input, .journal-filters select { font: inherit; font-size: .9rem; padding: .3rem .4rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); }
.account-actions .reset-link { flex-wrap: wrap; }

/* ---------------------------------------------------------------- Espace Organisation : planning */
.plan-form { display: flex; flex-wrap: wrap; gap: .6rem .9rem; align-items: flex-end; }
.plan-form label { display: grid; gap: .2rem; font-size: .8rem; color: var(--muted); }
/* Régularisation (Jour J) : cases d'au moins 24 px (WCAG 2.5.8). */
[data-regul-companies] input[type=checkbox], input[data-regul-pick] { width: 24px; height: 24px; vertical-align: middle; }
.plan-form input, .plan-form select, .plan-table input, .plan-table select, .plan-unavail-form input, .plan-unavail-form select {
  font: inherit; font-size: .9rem; padding: .3rem .4rem; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); }
.plan-note { flex-basis: 100%; margin: 0; }
.plan-breaks { flex-basis: 100%; border: 1px dashed var(--line); border-radius: 10px; padding: .5rem .75rem; margin: 0; }
.plan-breaks legend { font-size: .8rem; color: var(--muted); padding: 0 .3rem; }
.plan-break { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.plan-actions { flex-basis: 100%; }
.plan-inline { margin-bottom: .75rem; }
.plan-table input[type=number] { width: 4.5rem; }
.plan-lanes div, .plan-unavail > div { display: flex; gap: .3rem; align-items: center; margin: .15rem 0; white-space: nowrap; }
.plan-unavail-form { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.plan-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .5rem; margin: .75rem 0; }
.plan-company { border-top: 1px solid var(--line); padding: .5rem 0; }
.plan-company summary { cursor: pointer; }
.stat-red span { color: var(--red); }

/* Espace Organisation, onglet Rendez-vous : choix d'un créneau (déplacement, inscription sur place, blocage). */
.slot-picker { display: flex; flex-wrap: wrap; gap: .35rem .5rem; margin: .4rem 0; }
.slot-picker .btn { white-space: normal; text-align: left; }
.slot-picker label { display: inline-flex; gap: .3rem; align-items: center; }
.rdv-table { min-width: 760px; }
.rdv-move { border: 1px solid var(--primary); border-radius: 10px; padding: .6rem .8rem; margin-bottom: .75rem; }

/* Plannings de secours (Espace Organisation) : écran et impression. */
.print-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.print-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.print-table th, .print-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.print-check { text-align: center; width: 4rem; }
@media print {
  .topbar, .legal-footer, .no-print, .page-head .badge, #toast { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-block { break-inside: auto; page-break-after: always; }
  .print-table tr { break-inside: avoid; }
  .print-block .table-wrap { overflow: visible; margin: 0; padding: 0; }
}

/* Fiches entreprises v2 (lot 5) */
.company-head { display: flex; gap: 16px; align-items: flex-start; }
.company-logo { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: #fff; flex: none; }
.offer-inactive { opacity: .75; }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.doc-upload { align-items: flex-end; }
@media (max-width: 560px) { .company-head { flex-direction: column; } }

/* Annonces de l'organisation (lot 7) */
.announce { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; background: var(--blue-soft);
  border: 1px solid var(--blue); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.scan-result { border-radius: 12px; padding: 12px 14px; margin: .75rem 0; font-size: 1.05rem; }
.scan-ok { background: var(--green-soft); border: 1px solid var(--green); }
.scan-warn { background: var(--orange-soft); border: 1px solid var(--orange); }
.scan-error { background: var(--red-soft); border: 1px solid var(--red); }
.scan-video { width: 100%; max-width: 420px; border-radius: 12px; background: #000; }

/* Favoris (lot 9) */
.fav { min-height: 30px; padding: 0 .5rem; color: var(--muted); }
.fav-on { color: #c08a00; border-color: #c08a00; }

/* Assistance à l'accueil (/assistance, onglet « Assistance » de l'Espace Organisation) */
.success-note { color: var(--green); font-weight: 600; }
.assist-code { font-size: 2.4rem; font-weight: 700; letter-spacing: .18em; margin: 12px 0; }
.assist-identity { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 12px 0; }
.assist-identity p { margin: 4px 0; }
.assist-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.assist-actions section { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.assist-actions h3 { margin-top: 0; font-size: 1rem; }

/* Pages légales : statut en attente de validation (app/legal.py) */
.legal-pending { border-left: 4px solid #b45309; background: #fffbeb; color: #78350f; padding: .6rem .8rem; border-radius: 4px; }

/* ---------------------------------------------------------------- en-tête commun, fenêtres, équipe, mon compte */
/* Trois zones : logo à gauche, navigation dans l'espace disponible (elle passe à la ligne plutôt que de se couper),
   notifications + compte + déconnexion toujours à droite. */
.topbar { min-height: 60px; flex-wrap: nowrap; gap: .75rem; }
.topbar .brand { flex: none; }
.topbar .admin-nav { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; overflow: visible; }
.admin-nav a { display: inline-flex; align-items: center; min-height: 34px; }
.topbar .live { flex: none; }
.topbar .live-spacer { display: none; }
.topbar .user-menu { flex: none; margin-left: auto; gap: .6rem; min-width: 0; }
.topbar .admin-nav + .user-menu { margin-left: 0; }
.topbar .live + .user-menu { margin-left: .4rem; }
.topbar .user-menu > * { flex: none; }
.topbar .user-name { display: inline-flex; align-items: center; gap: .5rem; color: var(--text); text-decoration: none;
  padding: .2rem .7rem .2rem .25rem; border-radius: 99px; min-height: 36px; max-width: 220px; }
.topbar .user-name:hover, .topbar .user-name.on { background: var(--primary-soft); color: var(--primary); }
.user-avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; background: var(--primary); color: #fff; font-size: .8rem; font-weight: 700; line-height: 1; }
.user-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 860px) {
  /* Téléphone et petite tablette : logo et compte sur la première ligne, tous les espaces visibles dessous. */
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .topbar:has(.admin-nav) { position: static; }
  .topbar .admin-nav { order: 10; flex: 1 1 100%; }
  .topbar .admin-nav + .user-menu, .topbar .user-menu { margin-left: auto; }
  .topbar .live + .user-menu { margin-left: .4rem; }
  .topbar .user-name { max-width: 150px; }
}
@media (max-width: 520px) {
  .topbar .user-name { padding: .2rem; min-width: 36px; justify-content: center; }
  .user-name-text { display: none; }
}

/* Fenêtres de confirmation (app/static/ui.js) et de saisie */
.ui-dialog { border: 0; padding: 0; border-radius: var(--radius); background: var(--card); color: var(--text);
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 12px 48px rgba(20, 22, 40, .28); }
.ui-dialog::backdrop { background: rgba(20, 22, 40, .5); }
.ui-dialog-box { padding: 20px; }
.ui-dialog-title { margin: 0 0 8px; font-size: 1.1rem; line-height: 1.35; }
.ui-dialog-body { margin: 0 0 14px; color: var(--muted); font-size: .92rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.ui-dialog-body[hidden] { display: none; }
.ui-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 16px; }
.ui-dialog .btn:focus-visible, .team-card .btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 520px) { .ui-dialog-actions .btn { flex: 1 1 100%; min-height: 44px; } }
.toast { max-width: calc(100vw - 32px); }

/* Badges de rôle */
.role-badge { white-space: nowrap; }
.role-total { background: var(--purple-soft); color: #5b21b6; }
.role-organisation { background: var(--blue-soft); color: #1d4ed8; }
.role-commercial { background: var(--green-soft); color: #15803d; }
.role-communication { background: var(--orange-soft); color: #b45309; }
.role-tresorerie { background: #dff5f5; color: #0f6a6e; }
.role-equipe { background: #eef0f4; color: #545a6e; }

/* Page Équipe */
.container:has(.team-card) { max-width: 1180px; }
.team-card h2 { margin-top: 0; }
.team-invite { display: grid; grid-template-columns: 1fr 1fr 1.5fr auto; gap: 12px; align-items: end; margin-top: 12px; }
.team-invite .field { margin: 0; }
.team-invite .btn { min-height: 44px; }
.team-invite + .form-error { margin-top: 12px; }
.team-link { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--green-soft); }
.team-link p { margin: 0 0 6px; overflow-wrap: anywhere; }
.team-link-row { display: flex; gap: .5rem; }
.team-link-row input { flex: 1; min-width: 0; font: inherit; font-size: .85rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.team-state-error { padding: 12px 14px; border-radius: 12px; background: var(--red-soft); color: #8f1d1d; }
.team-state-error p { margin: 0 0 8px; overflow-wrap: anywhere; }
.team-pending { list-style: none; margin: 0; padding: 0; }
.team-pending li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; padding: 10px 0; border-top: 1px solid var(--line); }
.team-pending li:first-child { border-top: 0; }
.team-pending-end { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.member-email { overflow-wrap: anywhere; font-weight: 400; }
.team-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.team-table th { text-align: left; font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; }
.team-table td { padding: 12px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.team-actions { text-align: right; }
.team-actions .btn { margin: 2px 0 2px 2px; }
.role-choice { display: flex; align-items: flex-start; gap: .6rem; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.role-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.role-choice input { margin-top: 4px; }
.role-help { display: block; margin-top: 3px; line-height: 1.35; }
.role-choices { border: 0; margin: 0 0 12px; padding: 0; }
.ui-dialog .warn { margin: 0 0 12px; }
@media (min-width: 1041px) {
  .team-actions { width: 316px; }
  .team-actions .btn { width: 150px; }
}
@media (max-width: 860px) {
  .team-invite { grid-template-columns: 1fr 1fr; }
  .team-invite .field:nth-of-type(3), .team-invite .btn { grid-column: 1 / -1; }
}
@media (max-width: 1040px) {
  /* Tableau en cartes : chaque membre reste lisible sans défilement horizontal. */
  .team-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .team-table, .team-table tbody, .team-table tr, .team-table td { display: block; width: 100%; }
  .team-table tr { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; margin-bottom: 10px; }
  .team-table td { border: 0; padding: 7px 0; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem .75rem; }
  .team-table td::before { content: attr(data-label); color: var(--muted); font-size: .75rem; font-weight: 600; }
  .team-table td[data-label="Membre"] { display: block; }
  .team-table td[data-label="Membre"]::before, .team-table td[data-label="Actions"]::before { display: none; }
  .team-actions { justify-content: flex-start; text-align: left; }
  .team-actions .btn { margin: 0; min-height: 40px; flex: 1 1 auto; }
}
@media (max-width: 520px) { .team-invite { grid-template-columns: 1fr; } .team-link-row { flex-wrap: wrap; } .team-link-row .btn { flex: 1 1 100%; min-height: 44px; } }

/* Mon compte */
.account-back { display: inline-block; margin-bottom: 12px; }
.account-team { max-width: 960px; }
.account-space .page-head { margin: 4px 0 16px; }
.account-space .page-head h1 { margin: 0; font-size: 1.5rem; }
.account-head { display: flex; align-items: center; gap: 16px; }
.account-avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 1.6rem; font-weight: 700; }
.account-head-text { min-width: 0; }
.account-name { margin: 0; font-size: 1.3rem; font-weight: 700; overflow-wrap: anywhere; }
.account-email { margin: 2px 0 0; overflow-wrap: anywhere; }
.account-role { margin: 8px 0 0; }
.field-row[hidden] { display: none; }

/* ---------- Offres à distance et candidatures (app/candidatures.py) ---------- */
.remote-offer { background: var(--card); padding: 16px 18px; }
.remote-offer:target { border-color: var(--primary); }
.remote-offer-applied { border-color: var(--green); background: var(--green-soft); }
.remote-offer-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: .5rem 1rem; }
.remote-offer-head h3 { font-size: 1.1rem; margin: 0; }
.remote-offer-company { margin: 0 0 2px; font-weight: 700; color: var(--primary); font-size: .9rem; overflow-wrap: anywhere; }
.remote-offer h4 { margin: 12px 0 2px; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.remote-offer .offer-desc { margin: 0; overflow-wrap: anywhere; }
.remote-offer-facts { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin: 10px 0 0; }
.remote-offer-facts div, .apply-list div { min-width: 0; }
.remote-offer-facts dt, .apply-list dt { font-size: .75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.remote-offer-facts dd { margin: 0; font-weight: 600; }
.remote-offer-action { margin: 14px 0 0; }
.remote-offer-done { margin: 14px 0 0; font-weight: 600; color: var(--green); }
.apply-list { display: grid; gap: 12px; grid-template-columns: 1fr; margin: 0 0 14px; }
.apply-list dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; }
.apply-list dd .muted { font-weight: 400; }
.apply-cv-actions { display: inline-flex; flex-wrap: wrap; gap: .4rem; }
.apply-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 14px; }
.apply-done .result { margin-top: 0; }
.readonly-note .btn { margin-left: .25rem; }
.applications-tools input[type=search] { flex: 1 1 220px; }
.applications-tools select { min-width: 0; max-width: 100%; flex: 0 1 auto; text-overflow: ellipsis; }
.ui-dialog-wide .optional { align-self: flex-start; margin-left: 0; }
.applications-table td[data-label="Offre"]::before { display: block; }
.applications-table td[data-label="Candidat"] strong { overflow-wrap: anywhere; }
.offer-form-grid { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
.ui-dialog-wide { width: min(680px, calc(100vw - 24px)); }
.ui-dialog-wide .field textarea { min-height: 84px; }
@media (min-width: 640px) {
  .apply-list { grid-template-columns: repeat(3, 1fr); }
  .apply-list div:last-child { grid-column: 1 / -1; }
  .offer-form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .apply-actions .btn, .remote-offer-action .btn { flex: 1 1 100%; display: flex; min-height: 44px; }
}
@media (max-width: 720px) {
  .applications-table td[data-label="Candidat"], .applications-table td[data-label="Offre"] { display: block; }
  .applications-table td[data-label="Candidat"]::before { display: none; }
}
