@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800;900&display=swap');

:root {
  --nuit: #140a2b;
  --nuit-2: #1d1140;
  --nuit-3: #261654;
  --violet: #7c3aed;
  --violet-clair: #a78bfa;
  --corail: #ff4d6d;
  --corail-fonce: #e63a58;
  --texte: #f4f1ff;
  --texte-doux: #b3a7d6;
  --trait: rgba(255, 255, 255, 0.12);
  --trait-fort: rgba(255, 255, 255, 0.24);
  --menthe: #34d399;
  --ambre: #fbbf24;
  --papier: #ffffff;
  --rayon: 10px;
  --rayon-carte: 16px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--nuit);
  color: var(--texte);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
p { margin: 0 0 12px; }
a { color: var(--violet-clair); }

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--violet-clair); outline-offset: 2px; }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: var(--corail);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--rayon);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.btn:hover { background: var(--corail-fonce); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.06);
  color: var(--texte);
  border: 1px solid var(--trait-fort);
  font-weight: 500;
}
.btn.ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.link {
  border: 0; background: none; padding: 4px 6px; color: var(--texte-doux);
  font-weight: 500; text-decoration: underline; text-underline-offset: 3px;
}
.btn.link:hover { color: var(--texte); background: none; }
.btn.link.danger { color: #fb7185; }

/* ---------- Champs ---------- */

label { display: block; font-size: 12.5px; color: var(--texte-doux); margin-bottom: 6px; font-weight: 500; }

input[type=text], input[type=email], input[type=password], select, textarea, input[type=file] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 11px 13px;
  color: var(--texte);
}
input::placeholder, textarea::placeholder { color: #7d6fa8; }
input:focus, select:focus, textarea:focus { border-color: var(--violet-clair); outline: none; }
select option { background: var(--nuit-2); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 15px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.notice {
  padding: 11px 14px;
  border-radius: var(--rayon);
  border: 1px solid var(--trait);
  background: rgba(255, 255, 255, 0.05);
  font-size: 13.5px;
  margin-bottom: 15px;
}
.notice.error { border-color: rgba(251, 113, 133, 0.5); background: rgba(251, 113, 133, 0.12); color: #fda4af; }
.notice.ok { border-color: rgba(52, 211, 153, 0.45); background: rgba(52, 211, 153, 0.12); color: #6ee7b7; }

/* ---------- Connexion ---------- */

.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(124, 58, 237, 0.45), transparent 60%),
    var(--nuit);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--nuit-2);
  border: 1px solid var(--trait);
  border-radius: var(--rayon-carte);
  padding: 36px 34px;
}
.login-card .mark { margin-bottom: 26px; }
.login-card h1 { font-size: 30px; margin-bottom: 8px; font-weight: 900; }
.login-card .sub { color: var(--texte-doux); font-size: 14px; margin-bottom: 26px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- Marque ---------- */

.mark {
  display: flex; align-items: center; gap: 10px;
  font-weight: 900; letter-spacing: -0.04em; font-size: 19px;
}
.mark i {
  width: 28px; height: 28px; flex: none; border-radius: 8px;
  /* Le logo DocuTalent remplace le carré générique d'origine. */
  background: url('/marque.png') center / contain no-repeat;
}

/* Écran de connexion : le logo en grand, au-dessus de la carte. */
.logo-accueil {
  display: block;
  width: 112px;
  height: auto;
  margin: 0 auto 22px;
}

/* ---------- Structure admin ---------- */

.topbar {
  background: var(--nuit-2);
  border-bottom: 1px solid var(--trait);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .who { font-size: 13px; color: var(--texte-doux); display: flex; align-items: center; gap: 14px; }

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: calc(100vh - 58px);
}

.rail { background: var(--nuit-2); border-right: 1px solid var(--trait); padding: 20px; }
.rail h2 { font-size: 12.5px; color: var(--texte-doux); font-weight: 600; margin-bottom: 14px; letter-spacing: 0; }
.client-list { list-style: none; margin: 0 0 20px; padding: 0; }
.client-list li { margin-bottom: 6px; }
.client-list button {
  width: 100%; text-align: left; background: none; border: 1px solid transparent; cursor: pointer;
  padding: 11px 13px; border-radius: 12px;
}
.client-list button:hover { background: rgba(255, 255, 255, 0.05); }
.client-list button.on { background: var(--nuit-3); border-color: var(--violet); }
.client-list .nom { display: block; font-weight: 700; letter-spacing: -0.01em; }
.client-list .meta { display: block; font-size: 12px; color: var(--texte-doux); }

.rail form { background: var(--nuit-3); padding: 16px; border-radius: var(--rayon-carte); border: 1px solid var(--trait); }
.rail form h3 { font-size: 15px; margin-bottom: 14px; }

.work { padding: 30px 34px 70px; max-width: 1060px; }

.empty {
  background: var(--nuit-2); border: 1px dashed var(--trait-fort); border-radius: var(--rayon-carte);
  padding: 48px; text-align: center; color: var(--texte-doux);
}
.empty h2 { color: var(--texte); font-size: 22px; }

.client-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 26px; }
.client-head h1 { font-size: 38px; font-weight: 900; }
.client-head .sub { color: var(--texte-doux); font-size: 13.5px; margin-top: 8px; }

.panel {
  background: var(--nuit-2);
  border: 1px solid var(--trait);
  border-radius: var(--rayon-carte);
  padding: 24px;
  margin-bottom: 22px;
}
.panel > h2 { font-size: 17px; margin-bottom: 18px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--texte-doux);
  padding: 0 10px 10px; border-bottom: 1px solid var(--trait);
}
td { padding: 15px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td .titre { font-weight: 700; letter-spacing: -0.01em; }
td .ref { font-size: 12px; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 20px; border: 1px solid;
}
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.pending { color: var(--ambre); border-color: rgba(251, 191, 36, 0.4); background: rgba(251, 191, 36, 0.12); }
.tag.signed { color: var(--menthe); border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.12); }

.timeline { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0 7px 16px; border-left: 2px solid var(--violet); color: var(--texte-doux); }
.timeline li b { color: var(--texte); font-weight: 600; }

.linkbox {
  display: flex; gap: 8px; align-items: center; margin-top: 11px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 8px 11px;
}
.linkbox code { font-size: 12px; color: var(--violet-clair); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

/* ---------- Page de signature ---------- */

.sign-top { background: var(--nuit-2); border-bottom: 1px solid var(--trait); padding: 18px 26px; }
.sign-wrap { max-width: 820px; margin: 0 auto; padding: 32px 20px 80px; }
.doc-card { background: var(--nuit-2); border: 1px solid var(--trait); border-radius: var(--rayon-carte); overflow: hidden; }
.doc-card header {
  padding: 30px 30px 24px; border-bottom: 1px solid var(--trait);
  background: radial-gradient(600px 260px at 0% 0%, rgba(124, 58, 237, 0.4), transparent 70%);
}
.doc-card header h1 { font-size: 30px; font-weight: 900; margin-bottom: 10px; }
.doc-card header .meta { color: var(--texte-doux); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.doc-card .body { padding: 26px 30px 30px; }
.message { border-left: 3px solid var(--corail); padding: 4px 0 4px 15px; margin-bottom: 22px; color: var(--texte-doux); }
.viewer { width: 100%; height: 540px; border: 1px solid var(--trait); border-radius: 12px; background: var(--papier); }

.pad-wrap {
  margin-top: 6px; border: 1px solid var(--trait-fort); border-radius: 12px;
  background: var(--papier); position: relative;
}
.pad-wrap canvas { display: block; width: 100%; height: 176px; touch-action: none; cursor: crosshair; }
.pad-wrap .baseline { position: absolute; left: 24px; right: 24px; bottom: 44px; border-top: 1px solid #cbd5e1; }
.pad-wrap .hint { position: absolute; left: 26px; bottom: 20px; font-size: 12px; color: #64748b; pointer-events: none; }
.consent { display: flex; gap: 12px; align-items: flex-start; margin: 20px 0; font-size: 13.5px; }
.consent input { width: 17px; height: 17px; margin-top: 2px; flex: none; accent-color: var(--violet); }
.consent label { margin: 0; font-size: 13.5px; color: var(--texte); font-weight: 400; }

.done { text-align: center; padding: 54px 30px; }
.done .seal {
  width: 62px; height: 62px; border-radius: 50%; background: rgba(52, 211, 153, 0.14);
  border: 1px solid rgba(52, 211, 153, 0.45); color: var(--menthe);
  display: grid; place-items: center; margin: 0 auto 20px; font-size: 28px;
}
.done h1 { font-size: 32px; font-weight: 900; margin-bottom: 12px; }
.done p { color: var(--texte-doux); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--trait); }
  .work { padding: 22px 16px 60px; }
  .client-head h1 { font-size: 28px; }
  .doc-card header h1 { font-size: 24px; }
  .grid2 { grid-template-columns: 1fr; }
  table, thead, tbody, tr, td, th { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--trait); padding: 10px 0; }
  td { border: 0; padding: 5px 0; }
  .actions { justify-content: flex-start; }
  .viewer { height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Mot de passe : afficher / masquer ---------- */

.champ-mdp { position: relative; }
.champ-mdp input { padding-right: 88px; }

.bascule-mdp {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: var(--texte-doux);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.bascule-mdp:hover { background: rgba(255, 255, 255, 0.16); color: var(--texte); }
.bascule-mdp:focus-visible { outline: 2px solid var(--violet-clair); outline-offset: 2px; }

.aide-mdp {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--texte-doux);
}
