@import url('/vendor/lato/400.css');
@import url('/vendor/lato/700.css');
@import url('/vendor/caveat/600.css');

:root {
  --bg: #f4f4f8;
  --card: #fff;
  --text: #22223a;
  --muted: #6e6e8f;
  --line: #e4e4ee;
  --primary: #5b5ff5;
  --primary-dark: #4a4ee0;
  --green: #4fd1a5;
  --green-dark: #35b98d;
  --blue: #0b78bf;
  --red: #e5484d;
  --orange: #f2994a;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Lato, Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); }
[hidden] { display: none !important; }

/* Barre du haut */
.topbar { background: var(--primary); color: #fff; padding: 0 20px; height: 56px; display: flex; align-items: center; gap: 16px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: #fff; text-decoration: none; }
.topbar .brand img { height: 32px; border-radius: 6px; }
.topbar nav { display: flex; gap: 6px; margin-left: 12px; }
.topbar nav a { color: #fff; text-decoration: none; padding: 7px 14px; border-radius: 10px 10px 0 0; opacity: .85; }
.topbar nav a.active { background: var(--bg); color: var(--text); opacity: 1; font-weight: 700; margin-bottom: -12px; padding-bottom: 19px; }
.topbar .spacer { flex: 1; }
.topbar .link { color: #fff; background: none; border: 0; cursor: pointer; font: inherit; opacity: .9; }
.topbar .who { opacity: .8; font-size: 14px; }
.topbar .who:not(:empty)::before { content: '👤 '; }
input.totp { font-size: 22px; letter-spacing: 6px; text-align: center; font-weight: 700; }
.alert code { background: rgba(0, 0, 0, .06); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
h1.page { font-size: 28px; font-weight: 400; margin: 0 0 22px; color: var(--primary); }
h1.page small { color: var(--muted); font-size: 22px; }

.card { background: var(--card); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(20, 20, 60, .04); }
.card h2 { font-size: 17px; margin: 0 0 16px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1.5px solid transparent; border-radius: 999px; padding: 10px 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; background: var(--primary); color: #fff; transition: background .15s, opacity .15s; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--text); }
.btn.ghost:hover { background: #f1f1f6; }
.btn.light { background: #ececf8; color: var(--text); }
.btn.light:hover { background: #e0e0f2; }
.btn.danger { background: #fff; color: var(--red); border-color: #f3c4c5; }
.btn.danger:hover { background: #fff3f3; }
.btn.sm { padding: 6px 14px; font-size: 13px; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* Formulaires */
label.f { display: block; font-weight: 700; margin-bottom: 14px; font-size: 14px; }
label.f .req { color: var(--primary); }
label.f > input, label.f > textarea, label.f > select { margin-top: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], textarea, select {
  width: 100%; font: inherit; font-weight: 400; color: var(--text); background: #fff; border: 1px solid #d9d9e6; border-radius: 10px; padding: 10px 14px; outline: none; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 95, 245, .15); }
input[readonly] { background: #f6f6fa; color: var(--muted); }
textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 18px; }
.hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.seg { display: inline-flex; background: #ececf8; border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.seg button { border: 0; background: none; font: inherit; padding: 7px 18px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #fff; color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Tableaux */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 13px 12px; border-bottom: 1px solid var(--line); }
table.list tbody tr { cursor: pointer; }
table.list tbody tr:hover td { background: #fafaff; }
.r { text-align: right; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

table.lines-edit { width: 100%; border-collapse: collapse; }
table.lines-edit th { text-align: left; font-size: 13px; color: var(--muted); padding: 0 6px 8px; font-weight: 700; }
table.lines-edit td { padding: 4px 6px; vertical-align: top; }
table.lines-edit td.amount { width: 140px; }
table.lines-edit td.del { width: 40px; }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 20px; padding: 6px 8px; border-radius: 8px; line-height: 1; }
.iconbtn:hover { background: #fff0f0; color: var(--red); }
.total-line { text-align: right; margin-top: 12px; font-size: 16px; }
.total-line b { color: var(--blue); }

/* Badges */
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.badge.draft { background: #ececf2; color: #666; }
.badge.sent { background: #e3efff; color: #2a6fd6; }
.badge.viewed { background: #fff1e0; color: #c26a12; }
.badge.signed { background: #ddf7ec; color: #1d9466; }
.badge.cancelled { background: #fde8e8; color: #c23a3e; }

/* Import */
.drop { border: 2px dashed #cfcff0; border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: background .15s, border-color .15s; }
.drop:hover, .drop.over { background: #f5f5ff; border-color: var(--primary); }
.drop b { color: var(--primary); }

/* Messages */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert.err { background: #fdecec; color: #a32b2f; }
.alert.ok { background: #e2f8ef; color: #17714f; }
.alert.warn { background: #fff4e3; color: #95560f; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #22223a; color: #fff; padding: 12px 22px; border-radius: 999px; z-index: 100; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .2); }

/* Vue détail */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.docframe { background: #3a3a48; border-radius: var(--radius); padding: 14px; overflow: hidden; }
.docframe .sheet { background: #fff; transform-origin: 0 0; }
.docframe iframe { border: 0; display: block; width: 794px; background: #fff; }
dl.info { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; margin: 0; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline li.signed::before { background: var(--green); }
.timeline li.otp_failed::before { background: var(--red); }
.timeline .when { color: var(--muted); font-size: 12px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { font-size: 13px; }

/* Outbox */
.mail { border-bottom: 1px solid var(--line); padding: 14px 0; }
.mail pre { white-space: pre-wrap; font-family: inherit; background: #f7f7fb; border-radius: 10px; padding: 12px; margin: 8px 0 0; font-size: 14px; }

/* Connexion */
.login { max-width: 380px; margin: 12vh auto; }

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .topbar nav { display: none; }
  table.list .hide-sm { display: none; }
}
