:root {
  --ink: #121820;
  --ink-soft: #3a4450;
  --muted: #66707c;
  --paper: #f4f5f7;
  --paper-2: #e9ebef;
  --white: #ffffff;
  --line: rgba(18, 24, 32, 0.1);
  --accent: #121820;
  --urgent: #b42318;
  --urgent-dark: #8f1c13;
  --ok: #1f6b4a;
  --warn: #8a6d1d;
  --shadow: 0 16px 40px rgba(18, 24, 32, 0.08);
  --font-display: "Newsreader", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --radius: 0.55rem;
  --header-h: 4rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, #e9eef4 0%, var(--paper) 28%, #f7f8fa 100%);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.container { width: min(960px, calc(100% - 2rem)); margin-inline: auto; }
.container--wide { width: min(1140px, calc(100% - 2rem)); }

.topbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand__mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.55rem;
  background: var(--ink); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem;
}
.brand__name { display: block; font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.1; }
.brand__sub { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 500; }

.main { flex: 1; padding: 1.75rem 0 3rem; }
.site-footer {
  background: #0a1220; color: rgba(255,255,255,0.7);
  padding: 1.25rem 0; font-size: 0.85rem; text-align: center;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 0.75rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h2 { font-size: 1.35rem; }
.lead { color: var(--ink-soft); margin: 0 0 1.5rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.75rem; padding: 0.55rem 1.1rem; border-radius: var(--radius);
  border: 1px solid transparent; font-weight: 700; cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--urgent { background: var(--urgent); color: #fff; }
.btn--urgent:hover { background: var(--urgent-dark); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--sm { min-height: 2.25rem; padding: 0.35rem 0.8rem; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.form-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .form-grid--2 { grid-template-columns: 1fr 1fr; }
}
label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 0.35rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.7rem 0.85rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff;
}
.field textarea { min-height: 120px; resize: vertical; }
.field--locked input { background: var(--paper-2); color: var(--ink-soft); }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; }
.checkbox {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: start;
  font-weight: 500;
  font-size: 0.92rem;
  line-height: 1.45;
  cursor: pointer;
}
.checkbox input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0.2rem 0 0;
  accent-color: var(--ink);
}
.checkbox span { min-width: 0; }

.file-field { display: inline-flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.file-field__input {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
.file-field__btn { cursor: pointer; max-width: 100%; }
.file-field__btn [data-file-label] {
  display: inline-block;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.btn i[data-lucide], .btn svg {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
}
.pdf-frame {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.pdf-viewer__toolbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.35rem 0 0.55rem;
  flex-wrap: wrap;
}
.pdf-viewer__zoom {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem;
}
.pdf-viewer__zoom-btn {
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.pdf-viewer__zoom-btn:active { background: var(--ink); color: #fff; }
.pdf-viewer__zoom-label {
  min-width: 3.5rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.pdf-viewer__scroller {
  display: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: min(72vh, 640px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e9ebef;
  touch-action: pan-x pan-y;
}
.pdf-viewer__pages {
  display: grid;
  gap: 0.75rem;
  padding: 0.65rem;
  width: max-content;
  min-width: 100%;
  transform-origin: 0 0;
}
.pdf-viewer__page {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: #fff;
  box-shadow: 0 6px 18px rgba(18, 24, 32, 0.06);
}
.pdf-viewer__mobile-cta { display: none; margin-top: 0.75rem; }
.pdf-viewer.is-mobile .pdf-viewer__embed { display: none; }
.pdf-viewer.is-mobile .pdf-viewer__toolbar { display: flex; }
.pdf-viewer.is-mobile .pdf-viewer__scroller { display: block; }
.pdf-viewer.is-mobile .pdf-viewer__mobile-cta { display: flex; }
.pdf-viewer.is-mobile .pdf-viewer__pages[hidden] { display: none !important; }
.pdf-viewer.is-mobile .pdf-viewer__pages:not([hidden]) { display: grid; }
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.5rem 0 0.75rem;
  flex-wrap: wrap;
}
.missing-list {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--ink);
}
.missing-list li { margin-bottom: 0.25rem; }
.sign-steps {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.sign-steps li { margin-bottom: 0.35rem; }
.pin-step { margin-top: 0.5rem; }

.alert {
  padding: 0.85rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 600; font-size: 0.92rem;
}
.alert--error { background: #fce8e6; color: var(--urgent-dark); border: 1px solid #f0c2bc; }
.alert--ok { background: #e6f4ed; color: var(--ok); border: 1px solid #b7dfcb; }
.alert--info { background: #eef3f8; color: var(--ink-soft); border: 1px solid #d0dae6; }

.e-seal {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--radius);
  background: #e8f6ee;
  border: 1px solid #b7dfcb;
  color: #1a7f4b;
}
.e-seal__icon {
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.12rem;
  stroke-width: 2.25;
}
.e-seal__body { min-width: 0; }
.e-seal__body p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.35;
}
.e-seal__title {
  font-weight: 700 !important;
  margin-bottom: 0.2rem !important;
}

.client-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 35;
  margin: -0.5rem 0 1.35rem;
}
.client-nav__bar { display: none; }
.client-nav__burger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(18, 24, 32, 0.06);
  cursor: pointer;
  text-align: left;
}
.client-nav__burger-icon,
.client-nav__burger-chevron {
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.client-nav__burger-icon svg,
.client-nav__burger-chevron svg,
.client-nav__link svg {
  width: 1.15rem;
  height: 1.15rem;
}
.client-nav__burger-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.client-nav__burger-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.client-nav__burger-current {
  font-size: 1rem;
  font-weight: 800;
}
.client-nav__burger-chevron {
  transition: transform 0.2s ease;
  color: var(--muted);
}
.client-nav.is-open .client-nav__burger-chevron { transform: rotate(180deg); }
.client-nav.is-open .client-nav__burger-icon i[data-lucide="menu"],
.client-nav.is-open .client-nav__burger-icon svg.lucide-menu { display: none; }

.client-nav__panel {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.45rem 0.35rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 4px 14px rgba(18, 24, 32, 0.05);
}
.client-nav__panel::-webkit-scrollbar { display: none; }
.client-nav__panel[hidden] { display: none !important; }

.client-nav__link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink-soft);
  white-space: nowrap;
  border: 1px solid transparent;
}
.client-nav__link:hover { background: var(--paper-2); }
.client-nav__link.is-active {
  background: var(--ink);
  color: #fff;
}

.client-nav__backdrop {
  display: none;
}

.page-head { margin-bottom: 1.25rem; }
.page-head__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.card--soft { background: #f8fafc; box-shadow: none; }
.timeline__hint {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}
.timeline__item.is-current .timeline__hint { color: var(--urgent); }
.timeline__item.is-done .timeline__hint { color: var(--ok); }

/* Frise étapes */
.timeline {
  display: grid; gap: 0;
  margin: 1rem 0 1.5rem;
}
.timeline__item {
  display: grid; grid-template-columns: 2rem 1fr; gap: 0.85rem;
  position: relative; padding-bottom: 1.1rem;
}
.timeline__item:not(:last-child)::before {
  content: ""; position: absolute; left: 0.9rem; top: 1.6rem; bottom: 0;
  width: 2px; background: var(--paper-2);
}
.timeline__item.is-done:not(:last-child)::before { background: var(--ok); }
.timeline__dot {
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  border: 2px solid var(--line); background: #fff;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; z-index: 1;
}
.timeline__item.is-done .timeline__dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.timeline__item.is-current .timeline__dot { background: var(--urgent); border-color: var(--urgent); color: #fff; box-shadow: 0 0 0 4px rgba(180,35,24,0.15); }
.timeline__label { font-weight: 700; padding-top: 0.25rem; }
.timeline__item.is-current .timeline__label { color: var(--urgent); }
.timeline__item.is-todo .timeline__label { color: var(--muted); }

.gauge {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 700;
}
.gauge__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.95rem;
}
.gauge__sep { color: var(--muted); font-weight: 500; }
.gauge__bar {
  position: relative;
  width: 100%;
  height: 0.65rem;
  background: var(--paper-2);
  border-radius: 99px;
  overflow: hidden;
}
.gauge__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 99px;
  transition: width .4s ease;
}
.gauge__fill--depose { background: #c9852a; z-index: 1; }
.gauge__fill--valide { background: var(--ok); z-index: 2; }
.gauge__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.gauge__legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.gauge__swatch {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 99px;
}
.gauge__swatch--depose { background: #c9852a; }
.gauge__swatch--valide { background: var(--ok); }

.status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
}
.status--depose { background: #f8efe0; color: #8a5a12; }
.status--valide { background: #e6f4ed; color: var(--ok); }
.status--refuse { background: #fce8e6; color: var(--urgent); }
.status--missing { background: #f7f7f7; color: var(--muted); }

.doc-list { display: grid; gap: 1rem; }
.doc-card__help { color: var(--muted); font-size: 0.88rem; margin: 0.25rem 0 0.75rem; }
.upload-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.progress {
  width: 100%; height: 0.45rem; background: var(--paper-2); border-radius: 99px; overflow: hidden; margin-top: 0.5rem; display: none;
}
.progress.is-on { display: block; }
.progress__bar { height: 100%; width: 0; background: var(--ink); transition: width .2s ease; }

.table-wrap { overflow-x: auto; }
.check-signe {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 0.3rem;
  background: var(--ok);
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  line-height: 1;
}
.check-signe--off {
  background: transparent;
  border: 2px solid var(--line);
  color: transparent;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.65rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }

.auth-box { max-width: 420px; margin: 2rem auto; }
.admin-layout .container { width: min(1140px, calc(100% - 2rem)); }

.sig-pad {
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: #fff; touch-action: none; width: 100%; height: 180px; cursor: crosshair;
}
.stack-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.etape-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}
.etape-form .field { margin: 0; }
.etape-form__submit {
  width: 100%;
  justify-content: center;
  min-height: 2.85rem;
  font-size: 1rem;
}

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }
.copy-box {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  background: var(--paper); padding: 0.75rem; border-radius: var(--radius); border: 1px solid var(--line);
}
.copy-box code { word-break: break-all; }

.refus-form {
  display: grid;
  gap: 0.4rem;
  min-width: min(280px, 100%);
  flex: 1;
}
.refus-form textarea {
  width: 100%;
  min-height: 4rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: vertical;
  font: inherit;
}

@media (max-width: 760px) {
  .brand__sub { display: none; }
  .client-nav__bar { display: block; margin-bottom: 0.35rem; }
  .client-nav__panel {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    overflow: visible;
    padding: 0.45rem;
    margin-top: 0.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 14px 32px rgba(18, 24, 32, 0.12);
  }
  .client-nav.is-open .client-nav__panel {
    display: flex;
  }
  .client-nav__panel[hidden] { display: none !important; }
  .client-nav.is-open .client-nav__panel[hidden] { display: flex !important; }
  .client-nav__link {
    width: 100%;
    justify-content: flex-start;
    border-radius: 0.45rem;
    padding: 0.85rem 0.95rem;
    font-size: 0.98rem;
  }
  .client-nav__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 34;
    background: rgba(18, 24, 32, 0.28);
  }
  .client-nav__backdrop[hidden] { display: none; }
}

@media (min-width: 761px) {
  .client-nav__panel[hidden] { display: flex !important; }
  .client-nav__backdrop { display: none !important; }
}
