/* Style repris de la maquette Claude Design « Facturation 3doubleV ». */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url(/fonts/sans/ibm-plex-sans-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url(/fonts/sans/ibm-plex-sans-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url(/fonts/sans/ibm-plex-sans-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-display: swap; src: url(/fonts/sans/ibm-plex-sans-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url(/fonts/mono/ibm-plex-mono-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url(/fonts/mono/ibm-plex-mono-latin-500-normal.woff2) format('woff2'); }

:root {
  --bg: #F4F5F3;
  --ink: #17212B;
  --ink-2: #4A5561;
  --muted: #5D6873;
  --muted-2: #6B7680;
  --muted-3: #8A949D;
  --line: #E3E6E8;
  --line-2: #EEF0F1;
  --field: #D5DADE;
  --green: #0F8A4E;
  --green-dark: #0B7340;
  --green-soft: rgba(15, 138, 78, 0.15);
  --navy: #13222E;
  --navy-2: #24394A;
  --nav-fg: #C9D3D9;
  --nav-muted: #8FA1AC;
  --red: #E0483A;
  --red-soft: #FDECEA;
  --amber-soft: #FFF6E5;
  --amber: #9A6B12;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* Un élément masqué (attribut hidden) reste masqué, même si sa classe lui donne un affichage (ex. .btn). */
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 14px;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: var(--green); text-decoration: none; }
a:hover { color: var(--green-dark); text-decoration: underline; }
input, select, textarea, button { font-family: inherit; }
h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.3px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- Structure : barre latérale + contenu ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--navy); color: var(--nav-fg);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 14px;
}
.sidebar .brand { display: flex; flex-direction: column; gap: 8px; padding: 0 0 22px; }
.sidebar .brand .logo { background: #fff; border-radius: 9px; padding: 10px 14px; display: flex; justify-content: center; }
.sidebar .brand .logo img { height: 62px; width: auto; display: block; }
.sidebar .brand span { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--nav-muted); padding: 0 8px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px; border-radius: 7px;
  color: var(--nav-fg); font-size: 14px; font-weight: 500; text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar nav a.active { background: rgba(15, 138, 78, 0.22); color: #fff; }
.sidebar nav a .label { flex: 1; }
.sidebar nav a .soon { font-size: 10.5px; color: var(--nav-muted); }
.sidebar nav a .count { font-size: 11px; font-weight: 600; background: var(--red); color: #fff; border-radius: 9px; padding: 1px 7px; }
.sidebar .section { margin: 26px 10px 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: #6E808B; }
.sidebar nav.secondary a { height: 36px; font-size: 13.5px; }
.sidebar .user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy-2); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex: none;
}
.sidebar .user .who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.sidebar .user .who strong { color: #fff; font-size: 13px; font-weight: 500; }
.sidebar .user form button {
  border: none; background: none; padding: 0; color: var(--nav-muted); font-size: 11.5px; cursor: pointer; text-align: left;
}
.sidebar .user form button:hover { color: #fff; text-decoration: underline; }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1360px; width: 100%; }
.page.narrow { max-width: 1200px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.page-head .back { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  height: 40px; padding: 0 18px; border: none; border-radius: 7px; background: var(--green); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--green-dark); color: #fff; text-decoration: none; }
.btn.secondary { border: 1px solid var(--field); background: #fff; color: var(--ink); font-weight: 500; padding: 0 16px; }
.btn.secondary:hover { background: #F3F5F6; }
.btn.danger { background: #fff; border: 1px solid #F1C4BF; color: #B4362B; font-weight: 500; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { height: 34px; font-size: 13px; padding: 0 12px; }
.linklike { border: none; background: none; padding: 0; color: var(--green); cursor: pointer; font-size: inherit; }

/* ---------- Onglets de filtre (pastilles, comme les statuts de la maquette) ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--field); background: #fff; color: var(--ink-2);
  font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.tab:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab span { font-size: 11.5px; opacity: 0.75; }

/* ---------- Cartes, tableaux ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.card.pad { padding: 18px 20px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.card .toolbar { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 10px; }
.search input { height: 36px; width: 100%; padding: 0 12px 0 34px; border: 1px solid var(--field); border-radius: 7px; font-size: 13.5px; outline: none; }
.search input:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  padding: 12px 16px; font-weight: 600; text-align: left; font-size: 11.5px; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--muted-2); white-space: nowrap;
}
table.list td { padding: 13px 16px; border-top: 1px solid var(--line-2); vertical-align: top; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover, table.list tr.selected { background: #F8F9F9; }
table.list td a.rowlink { color: inherit; text-decoration: none; display: block; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.list-foot { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; align-items: start; }
.grid-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); row-gap: 11px; column-gap: 12px; font-size: 13.5px; }
.kv > span:nth-child(odd) { color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.stats > div { padding: 16px 20px; border-left: 1px solid var(--line-2); }
.stats > div:first-child { border-left: none; }
.stats .k { font-size: 12.5px; color: var(--muted); }
.stats .v { font-size: 20px; font-weight: 600; margin-top: 4px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 11px;
  background: #EEF0F1; color: var(--ink-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.green { background: #E3F4EA; color: #0B7340; }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.grey { background: #EEF0F1; color: var(--muted); }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--field); border-radius: 7px; font-size: 13.5px;
  outline: none; background: #fff; color: var(--ink); width: 100%;
}
.field select { padding: 0 8px; }
.field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.field input.mono { font-family: var(--mono); }
.field input[readonly] { background: var(--bg, #F4F6F8); color: var(--ink-2); cursor: not-allowed; }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); }
.field .error { font-size: 12px; color: #B4362B; font-weight: 500; }
.fixed-value { height: 36px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.fixed-value span { font-size: 12px; color: var(--muted); font-weight: 400; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; }

.alert { padding: 12px 14px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; }
.alert.error { background: var(--red-soft); color: #9B2C22; }
.alert.success { background: #E3F4EA; color: #0B5E35; }
.alert.info { background: #EAF2FB; color: #24476B; }
.alert.warn { background: var(--amber-soft); color: #7A5310; }

.flash { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(19, 34, 46, 0.3); z-index: 50; }

/* ---------- Fenêtres (dialog) ---------- */
dialog.modal { width: 640px; max-width: calc(100% - 32px); padding: 0; border: none; border-radius: 12px; box-shadow: 0 24px 64px rgba(19, 34, 46, 0.3); color: var(--ink); }
dialog.modal::backdrop { background: rgba(19, 34, 46, 0.45); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 24px 14px; border-bottom: 1px solid var(--line-2); }
.modal-head .title { font-size: 18px; font-weight: 600; }
.modal-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.modal-close { width: 32px; height: 32px; border: none; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 20px; }
.modal-close:hover { background: #F3F5F6; }
.modal-body { padding: 18px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--navy); }
.login-card { width: 380px; max-width: 100%; background: #fff; border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.3); }
.login-card .logo { display: flex; justify-content: center; }
.login-card .logo img { height: 72px; }
.login-card h1 { font-size: 18px; text-align: center; }
.login-card .btn { width: 100%; justify-content: center; }

/* ---------- Écran « bientôt » ---------- */
.soon-card { padding: 40px 24px; text-align: center; color: var(--muted); line-height: 1.6; }

/* ---------- Petits écrans ---------- */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; flex: none; }
  .page { padding: 20px 16px 32px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .stats { grid-template-columns: 1fr; }
  .stats > div { border-left: none; border-top: 1px solid var(--line-2); }
}

/* ---------- Actions de ligne (liste des factures) ---------- */
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; list-style: none;
}
.icon-btn:hover { border-color: var(--green); color: var(--green); }
details.menu { position: relative; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: 36px; z-index: 20; min-width: 200px; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(19, 34, 46, 0.15); padding: 6px; text-align: left;
}
.menu-list button { width: 100%; text-align: left; border: none; background: none; padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; color: var(--ink); }
.menu-list button:hover, .menu-list a:hover { background: #F3F5F6; }
.menu-list a { display: block; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; color: var(--ink); text-decoration: none; }
.menu-list button.danger { color: #B4362B; }

/* ---------- Éditeur de facture ---------- */
.editor-page { padding: 22px 32px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1500px; width: 100%; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 560px); gap: 18px; align-items: start; }
.editor-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.step { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.step span { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.picker { position: relative; }
.picker-btn {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--field); border-radius: 8px;
  background: #fff; cursor: pointer; text-align: left; color: var(--ink);
}
.picker-btn:hover { border-color: var(--green); }
.picker-btn.invalid { border-color: var(--red); }
.picker-btn .initials { width: 36px; height: 36px; border-radius: 8px; background: #E3F4EA; color: var(--green-dark); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; flex: none; }
.picker-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.picker-text span { font-size: 12.5px; }
.picker-panel { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(19, 34, 46, 0.15); padding: 8px; }
.picker-panel input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--field); border-radius: 7px; font-size: 13.5px; outline: none; }
.picker-panel input:focus { border-color: var(--green); }
.picker-list { max-height: 260px; overflow: auto; margin: 6px 0; }
.picker-list button { width: 100%; display: flex; justify-content: space-between; gap: 10px; border: none; background: none; padding: 9px 10px; border-radius: 6px; cursor: pointer; text-align: left; font-size: 13.5px; color: var(--ink); }
.picker-list button:hover { background: #F3F5F6; }
.picker-new { width: 100%; border: none; border-top: 1px solid var(--line-2); background: none; padding: 10px; color: var(--green); font-weight: 600; cursor: pointer; text-align: left; }
details.coords { border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; background: #FAFBFB; }
details.coords summary { cursor: pointer; font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
details.coords summary .muted { font-size: 12.5px; }

.lines-grid { display: grid; grid-template-columns: 22px minmax(230px, 1fr) 76px 92px 78px 90px 26px; gap: 6px; align-items: start; min-width: 680px; }
.lines-head { font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); font-weight: 600; padding: 0 0 6px; }
.line-row { padding: 10px 0; border-top: 1px solid var(--line-2); }
.line-row .desc { gap: 6px; position: relative; }
.label-row { display: flex; gap: 6px; }
.label-row input { flex: 1; min-width: 0; }
.label-row .btn.small { height: 36px; padding: 0 10px; font-size: 12.5px; }
textarea.autosize { overflow: hidden; resize: none; }
.catalogue-filter { height: 36px; padding: 0 10px; border: 1px solid var(--field); border-radius: 7px; font-size: 13.5px; width: 100%; outline: none; }
.catalogue-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.catalogue-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; border: none; background: none; text-align: left; padding: 9px 10px; border-radius: 7px; font: inherit; font-size: 13.5px; cursor: pointer; color: var(--ink); }
.catalogue-item:hover, .catalogue-item:focus { background: var(--green-soft); outline: none; }
.catalogue-item .muted { font-size: 12.5px; }
.line-row textarea { min-height: 36px; }
.line-row .qty { gap: 4px; }
.line-row .unit { height: 28px; font-size: 12.5px; color: var(--muted); }
.line-row .move { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.line-row .move button, .line-row .remove { border: none; background: none; color: var(--muted-3); cursor: pointer; padding: 2px; border-radius: 4px; }
.line-row .move button:hover, .line-row .remove:hover { color: var(--ink); background: #F3F5F6; }
.line-row .remove { margin-top: 6px; }
.line-row .remove:hover { color: #B4362B; }
.line-total { padding-top: 9px; font-weight: 600; white-space: nowrap; }
.lines-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.totals-box { min-width: 280px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.totals-box > div, #t-vat > div { display: flex; justify-content: space-between; gap: 18px; }
#t-vat { display: flex; flex-direction: column; gap: 6px; color: var(--muted); }
.totals-box .ttc { border-top: 1px solid var(--line); padding-top: 8px; font-size: 18px; font-weight: 700; }

.editor-preview { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.preview-head { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 500; }
.preview-head .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 7px; }
.preview-frame { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; box-shadow: 0 4px 18px rgba(19, 34, 46, 0.08); }
.preview-frame iframe { width: 794px; height: 1123px; border: 0; transform-origin: 0 0; display: block; }

@media (max-width: 1200px) {
  .editor { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
}
@media (max-width: 900px) {
  .editor-page { padding: 20px 16px 32px; }
}

/* ---------- Pastille « À vérifier » (documents et clients importés douteux) ---------- */
.badge.review { background: #FFE8B3; color: #7A4A00; border: 1px solid #F2C14E; margin-left: 6px; vertical-align: 1px; }
.tab.review { border-color: #F2C14E; color: #7A4A00; background: #FFF6E0; }
.tab.review.on { background: #7A4A00; border-color: #7A4A00; color: #fff; }
.review-note { font-size: 12px; font-weight: 400; color: #7A4A00; margin-top: 3px; max-width: 420px; }
.review-banner { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 10px; background: #FFF6E0; border: 1px solid #F2C14E; }
.review-banner .review-text { color: #5C3800; font-size: 14px; line-height: 1.45; }
.review-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.review-actions input { flex: 1; min-width: 220px; height: 34px; padding: 0 10px; border: 1px solid #E6C77A; border-radius: 7px; font-size: 13.5px; background: #fff; }

.next-numbers { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.next-numbers > div { border: 1px solid var(--line-2); background: #FAFBFB; border-radius: 8px; padding: 10px 12px; }
.next-numbers .k { font-size: 12px; color: var(--muted); }
.next-numbers .v { font-size: 15px; font-weight: 500; margin-top: 3px; }

.validate-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; background: #F4F5F3; border-radius: 8px; padding: 12px 14px; }
.validate-summary .k { font-size: 12px; color: var(--muted); }
.validate-summary .v { font-size: 17px; font-weight: 600; margin-top: 3px; }

/* ---------- Fiche facture ---------- */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.doc-side { display: flex; flex-direction: column; gap: 18px; }
.timeline { display: flex; flex-direction: column; gap: 12px; }
.timeline .ev { display: grid; grid-template-columns: 12px 1fr; gap: 10px; font-size: 13px; }
.timeline .ev .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-top: 4px; }
.timeline .ev .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lock-note { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
@media (max-width: 1200px) { .doc-layout { grid-template-columns: 1fr; } }

.demo-banner { position: sticky; top: 0; z-index: 100; background: #B4362B; color: #fff; text-align: center; font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; padding: 6px 12px; }

/* ---------- Page publique (QR code) ---------- */
.portal { min-height: 100vh; background: var(--bg); }
.portal-example { background: var(--navy); color: #fff; text-align: center; font-size: 13px; padding: 8px 16px; }
.portal-example a { color: #9FE0BC; }
.portal-top { max-width: 720px; margin: 0 auto; padding: 22px 16px 6px; display: flex; align-items: center; gap: 12px; }
.portal-top img { height: 48px; }
.portal-safe { margin-left: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.portal-safe::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.portal-main { max-width: 720px; margin: 0 auto; padding: 10px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.portal-head { display: flex; flex-direction: column; gap: 18px; }
.portal-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.portal-num { font-size: 20px; font-weight: 500; margin-top: 4px; }
.portal-amount { font-size: 30px; font-weight: 700; margin-top: 2px; }
.portal-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid var(--line-2); padding-top: 14px; font-size: 13.5px; }
.portal-dates .muted { font-size: 12px; margin-bottom: 2px; }
.portal-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13.5px; border-top: 1px solid var(--line-2); }
.portal-line:first-of-type { border-top: none; }
.portal-line.total { margin-top: 6px; font-weight: 600; }
.portal-line.ttc { font-weight: 700; font-size: 16px; }
.portal-foot { text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
@media (max-width: 560px) { .portal-dates { grid-template-columns: 1fr 1fr; } }
.pdf-frame { width: 100%; height: 1150px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.badge.blue { background: #E6EFFB; color: #2C5D9C; }
.badge.red { background: var(--red-soft); color: #9B2C22; }
.badge.navy { background: #E3E9EF; color: #2C4A66; }

.payment { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.payment.cancelled > div:first-child > div:first-child { text-decoration: line-through; color: var(--muted); }

/* ---------- Tableau de bord ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; color: var(--ink); text-decoration: none; display: block; }
a.kpi:hover { border-color: var(--green); text-decoration: none; color: var(--ink); }
.kpi .k { font-size: 12.5px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 600; margin-top: 6px; letter-spacing: -0.3px; }
.kpi .s { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi.late.on { border-color: #F1C4BF; background: #FFF7F6; }
.kpi.late.on .v, .kpi.late.on .s { color: #B4362B; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; height: 220px; align-items: end; margin-top: 16px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; }
.bar-val { font-size: 10.5px; color: var(--muted); text-align: center; min-height: 14px; }
.bar { background: #BFE3CE; border-radius: 4px 4px 0 0; }
.bar.current { background: var(--green); }
.bar-label { font-size: 11px; color: var(--muted); text-align: center; margin-top: 6px; }
.top { display: block; padding: 7px 0; color: var(--ink); text-decoration: none; }
.top:hover { text-decoration: none; color: var(--green); }
.top > div:first-child { display: flex; justify-content: space-between; font-size: 13.5px; gap: 10px; }
.top .track { height: 6px; background: #EEF0F1; border-radius: 3px; margin-top: 5px; }
.top .track div { height: 100%; background: var(--green); border-radius: 3px; }
.export-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 20px; border-top: 1px solid var(--line-2); }
.export-row:first-child { border-top: none; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: 1fr; } }

.credit-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); color: var(--ink); text-decoration: none; font-size: 13px; }
.credit-row:hover { text-decoration: none; background: #F8F9F9; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--field); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--green); background: #F3FBF6; }
.choice label > span { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

/* ---------- E-mails et relances (lot 9) ---------- */
a.modal-close { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.email-grid { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; align-items: center; }
.email-grid > span { font-size: 13px; color: var(--muted); }
.email-grid input { height: 36px; padding: 0 10px; border: 1px solid var(--field); border-radius: 7px; font-size: 13.5px; outline: none; width: 100%; }
.email-grid input:focus, .email-body:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.email-body { width: 100%; padding: 12px 14px; border: 1px solid var(--field); border-radius: 7px; font: inherit; font-size: 13.5px; line-height: 1.55; resize: vertical; outline: none; color: var(--ink); }
.attachment { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border: 1px solid #E3E6E8; border-radius: 7px; background: #F8F9F9; font-size: 13px; }
.pdf-tag { font-size: 10px; font-weight: 700; color: #fff; background: #B42318; border-radius: 3px; padding: 2px 4px; }
.email-row { border-top: 1px solid var(--line-2); padding: 8px 0; font-size: 13px; }
.email-row:first-of-type { border-top: none; }
.email-row summary { cursor: pointer; list-style: none; }
.email-row summary::-webkit-details-marker { display: none; }
.email-row.failed { opacity: .85; }
.email-sent { margin-top: 8px; padding: 10px 12px; background: #F8F9F9; border-radius: 7px; font-size: 12.5px; line-height: 1.5; }
.settings-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.settings-link:hover { border-color: var(--green); text-decoration: none; }
.settings-link > span { font-size: 20px; color: var(--green); }
.chip { display: inline-block; background: #F3F5F6; border-radius: 5px; padding: 1px 6px; margin: 2px 0; }
.backup-warning { margin: 16px 28px 0; padding: 10px 14px; border-radius: 8px; background: var(--red-soft); color: #9B2C22; font-size: 13px; line-height: 1.5; }
/* ---------- Tri des listes (clic sur le titre d'une colonne) ---------- */
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.th-sort:hover { color: var(--ink); text-decoration: none; }
.th-sort .arrow { font-size: 9px; opacity: 0.35; }
.th-sort.on { color: var(--ink); }
.th-sort.on .arrow { opacity: 1; color: var(--green); }
th.right .th-sort { flex-direction: row; }

/* ---------- Coordonnées des contacts ---------- */
.contact-card { grid-template-columns: 96px 1fr; font-size: 13px; }
.contact-line { font-size: 12px; color: var(--muted); font-weight: 400; line-height: 1.45; margin-top: 2px; }
a.to-complete { color: #9A6B12; font-style: italic; text-decoration: underline dotted; white-space: nowrap; }
a.to-complete:hover { color: var(--ink); }
.contact-line a.to-complete { margin-left: 4px; }

/* ---------- Coordonnées modifiées sur un document (« Enregistrer dans la fiche contact ») ---------- */
.field.coord-changed input { background: #FFF8E1; border-color: #E0B44C; }
.sync-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: #FFFBEF; border: 1px solid #F1DFA6; }
.sync-box[hidden] { display: none; }
.sync-note { font-size: 12.5px; color: #7A5310; flex: 1; min-width: 200px; }
/* « à compléter » : même police que les autres champs, même dans les champs en police à chasse fixe (SIRET, TVA) */
.field input.mono::placeholder { font-family: 'IBM Plex Sans', system-ui, sans-serif; }

/* ---------- Paramètres : onglets, aperçu du bas de page ---------- */
.settings-tabs { margin: 0 0 16px; }
.footer-preview { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px 0 4px; overflow-x: auto; }
.footer-preview > div { min-width: 760px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

/* Fiche contact et produit modifiables directement : « Enregistrer » et « Annuler les modifications »
   restent visibles en bas de l'écran pendant la saisie, et n'apparaissent qu'au premier changement. */
.save-bar { position: sticky; bottom: 0; background: #fff; margin-top: 14px; padding: 12px 0 2px; border-top: 1px solid var(--line-2); z-index: 2; }
.save-bar:not(:has(> :not([hidden]))) { display: none; }
/* Relances à faire sur le tableau de bord */
.dash-reminders .kpi-line { display: flex; gap: 22px; flex-wrap: wrap; padding: 0 20px 12px; font-size: 13px; color: var(--muted); }
.dash-reminders .kpi-line strong { font-size: 18px; color: var(--ink); margin-right: 4px; }
/* Cases à cocher et boutons radio dans un champ : taille normale (pas étirés comme une case de saisie). */
.field input[type=checkbox], .field input[type=radio] { width: auto; height: auto; padding: 0; margin: 2px 0 0; flex: none; accent-color: var(--green); }
.dash-reminders .recent-line { padding: 11px 20px; border-top: 1px solid var(--line-2); font-size: 13px; }
/* « Aide à la mise en forme » (Markdown simple) */
.md-help { font-size: 12.5px; }
.md-help summary { cursor: pointer; color: var(--green); width: max-content; list-style: none; }
.md-help summary::-webkit-details-marker { display: none; }
.md-help summary::before { content: '? '; font-weight: 700; }
.md-help-body { margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #FAFBFA; display: flex; flex-direction: column; gap: 6px; }
.md-help table { border-collapse: collapse; }
.md-help th, .md-help td { text-align: left; vertical-align: top; padding: 3px 14px 3px 0; font-weight: 400; }
.md-help th { color: var(--muted); font-size: 12px; }
.md-help code { font-family: var(--mono); font-size: 12px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 4px; display: inline-block; }
.md-help ul, .md-help ol { margin: 0; padding-left: 18px; }
.payment-line-preview { font-family: Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 700; padding: 10px 12px; background: #FAFBFA; border: 1px solid var(--line); border-radius: 8px; }
.zip-choices { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13.5px; }
.zip-choices label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.zip-choices input { accent-color: var(--green); }
