:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #66738a;
  --line: #e1e6ef;
  --brand: #1f5fbf;
  --brand-dark: #174a97;
  --brand-soft: #e8f0fc;
  --ok: #1d8a4e;
  --ok-soft: #e6f6ed;
  --warn: #b26a00;
  --warn-soft: #fff3df;
  --err: #c0392b;
  --err-soft: #fdeceb;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Structure */
.app { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side { background: #12233f; color: #cdd8ec; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.side .brand { color: #fff; font-weight: 700; font-size: 1.05rem; margin-bottom: 1.5rem; line-height: 1.25; }
.side .brand small { display: block; color: #8fa3c7; font-weight: 400; font-size: .78rem; }
.side nav a { display: block; color: #cdd8ec; padding: .55rem .75rem; border-radius: 8px; margin-bottom: 2px; }
.side nav a:hover { background: #1c3560; text-decoration: none; }
.side nav a.on { background: var(--brand); color: #fff; }
.side .foot { margin-top: auto; font-size: .8rem; color: #8fa3c7; }
.side .foot button { background: none; border: 0; color: #cdd8ec; padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
main { padding: 1.5rem; max-width: 1100px; width: 100%; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pagehead .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cartes et grilles */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1.1rem; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }

/* Formulaires */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .2rem; color: #33405a; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid #c9d2e2; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: .85rem; }
.row { display: grid; gap: .85rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.row > * { min-width: 0; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; }
.c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; } .c2 { grid-column: span 2; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; font-size: .95rem; }
.check input { margin-top: .3rem; }
.hint { color: var(--muted); font-size: .8rem; margin-top: .2rem; }

/* Boutons */
.btn, button.btn { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: .55rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-align: center; }
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.alt { background: #fff; color: var(--brand); border: 1px solid #b8c7e3; }
.btn.alt:hover { background: var(--brand-soft); }
.btn.ok { background: var(--ok); }
.btn.danger { background: #fff; color: var(--err); border: 1px solid #e7b9b4; }
.btn.danger:hover { background: var(--err-soft); }
.btn.sm { padding: .3rem .65rem; font-size: .85rem; }
.btn:disabled, button.btn:disabled { background: #e4e7ec; color: #8a93a3; border: 1px solid #d3d8e0; cursor: not-allowed; }
.btn:disabled:hover { background: #e4e7ec; }
form.inline { display: inline; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:hover td { background: #fafbfe; }
.tablewrap { overflow-x: auto; }

/* Badges / messages */
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #edf0f6; color: #46536b; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b9e3cb; color: #14633a; }
.flash.err { background: var(--err-soft); border-color: #f0c2bd; color: #962c20; }
.notice { background: var(--warn-soft); border: 1px solid #f1d9a8; color: #6e4300; padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.notice.info { background: var(--brand-soft); border-color: #c4d7f5; color: #143d7a; }

/* Éditeur de lignes */
.lines th, .lines td { padding: .35rem .3rem; }
.lines input, .lines select { padding: .4rem .5rem; }
.lines .del { background: none; border: 0; color: var(--err); font-size: 1.2rem; cursor: pointer; }
.totals { margin-left: auto; width: 100%; max-width: 360px; }
.totals td { border: 0; padding: .25rem .4rem; }
.totals .big td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--ink); }

/* Autocomplétion communes */
.ac { position: relative; }
.ac ul { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #c9d2e2; border-radius: 8px; margin: 2px 0 0; padding: 0; list-style: none; box-shadow: 0 8px 24px rgba(20,35,63,.15); max-height: 260px; overflow: auto; }
.ac li { padding: .5rem .7rem; cursor: pointer; }
.ac li:hover, .ac li.on { background: var(--brand-soft); }

/* Document (aperçu / impression) */
.doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 2rem; max-width: 820px; margin: 0 auto 1rem; }
.doc .head { display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap; }
.doc .title { text-align: right; }
.doc .title h1 { font-size: 1.6rem; color: var(--brand-dark); letter-spacing: .02em; text-transform: uppercase; }
.doc .party { margin: 1.5rem 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.doc .party h3 { font-size: .75rem; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; }
.doc table.items th { background: #f1f4fa; }
.doc .legal { font-size: .8rem; color: #4a566d; margin-top: 1.25rem; }
.doc .sigbox { border: 1px dashed #aab6cc; border-radius: 8px; min-height: 110px; padding: .6rem .8rem; }
.doc .sigbox img { max-height: 90px; display: block; }
.doc .aibox { background: var(--ok-soft); border: 1px solid #b9e3cb; border-radius: 8px; padding: .7rem .9rem; margin-top: 1rem; }

.sigpad { border: 2px dashed #9fb0cf; border-radius: 10px; background: #fff; touch-action: none; width: 100%; height: 180px; display: block; }

/* Connexion */
.center { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.authbox { width: 100%; max-width: 420px; }
.publicwrap { max-width: 900px; margin: 0 auto; padding: 1rem; }
.publictop { text-align: center; padding: 1rem 0; color: var(--muted); }

/* Mobile */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: .6rem .75rem; gap: .5rem; }
  .side .brand { margin: 0 .5rem 0 0; }
  .side .brand small { display: none; }
  .side nav { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 100%; order: 3; }
  .side nav a { padding: .4rem .6rem; margin: 0; font-size: .9rem; }
  .side .foot { margin: 0 0 0 auto; }
  main { padding: 1rem; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .row > * { grid-column: span 12 !important; }
  .row > .half { grid-column: span 6 !important; }
  .doc { padding: 1rem; }
  .doc table.items th, .doc table.items td { padding: .45rem .3rem; font-size: .88rem; }
  .doc .party { grid-template-columns: 1fr; }
  .doc .title { text-align: left; }
}
@media (max-width: 480px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

@media print {
  body { background: #fff; }
  .side, .noprint, .flash { display: none !important; }
  .app { display: block; }
  main { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; margin: 0; max-width: none; }
  .publicwrap { padding: 0; max-width: none; }
}

/* Fiche client */
.cf-head { display: flex; align-items: flex-start; gap: 1.25rem; flex-wrap: wrap; padding: 1.25rem 1.5rem; }
.cf-avatar { width: 84px; height: 84px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 1.9rem; font-weight: 700; letter-spacing: .02em; flex: none; }
.cf-avatar.sm { width: 36px; height: 36px; font-size: .85rem; display: inline-grid; vertical-align: middle; margin-right: .6rem; }
.cf-id { flex: 1 1 320px; min-width: 0; }
.cf-name { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.cf-name h1 { margin: 0; font-size: 1.35rem; }
.cf-kpis { display: flex; gap: .75rem; flex-wrap: wrap; }
.cf-kpi { border: 1px dashed #cdd5e3; border-radius: 8px; padding: .45rem .9rem; min-width: 120px; }
.cf-kpi b { display: block; font-size: 1.15rem; }
.cf-kpi span { color: var(--muted); font-size: .85rem; }

.cf-menu { position: relative; margin-left: auto; }
.cf-menu summary { list-style: none; cursor: pointer; user-select: none; }
.cf-menu summary::-webkit-details-marker { display: none; }
.cf-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(20,35,63,.16); padding: .35rem; }
.cf-pop a, .cf-pop button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: .5rem .7rem; font: inherit; font-size: .92rem; color: var(--ink); cursor: pointer; }
.cf-pop a:hover, .cf-pop button:hover:not(:disabled) { background: var(--brand-soft); text-decoration: none; }
.cf-pop button:disabled { color: #9aa4b5; cursor: not-allowed; }
.cf-pop form { margin: 0; }
.cf-pop .cf-danger { color: var(--err); }

.cf-tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); margin: 0 0 1.1rem; padding: 0 .4rem; overflow-x: auto; }
.cf-tabs a { padding: .7rem .1rem; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.cf-tabs a:hover { color: var(--ink); text-decoration: none; }
.cf-tabs a.on { color: var(--ink); border-bottom-color: var(--brand); }

.cf-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.cf-col { min-width: 0; }
.cf-f { margin-bottom: .7rem; }
.cf-l { font-weight: 600; font-size: .88rem; }
.cf-v { color: #4b5870; word-break: break-word; }
.cf-btns { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .9rem; }
.cf-btns form { margin: 0; }

.cf-years { display: flex; gap: .4rem; margin-bottom: .9rem; }
.cf-years a { padding: .25rem .8rem; border-radius: 99px; background: #edf0f6; color: #46536b; font-weight: 600; font-size: .9rem; }
.cf-years a.on { background: var(--brand); color: #fff; }
.cf-years a:hover { text-decoration: none; }
.cf-credit { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.cf-blue { background: linear-gradient(160deg, #1f5fbf, #174a97); color: #fff; border-radius: var(--radius); padding: 1.4rem; }
.cf-big { font-size: 2.1rem; font-weight: 700; line-height: 1.15; }
.cf-sub { margin-top: .7rem; font-size: .92rem; opacity: .92; }
.cf-bar { height: 7px; border-radius: 99px; background: rgba(255,255,255,.25); margin-top: 1.1rem; overflow: hidden; }
.cf-bar i { display: block; height: 100%; background: #fff; border-radius: 99px; min-width: 2px; }
.cf-bar-l { display: flex; justify-content: space-between; font-size: .85rem; margin-top: .35rem; opacity: .92; }
.cf-act { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: #fff3df; border: 1px solid #f1d9a8; border-radius: 8px; padding: .8rem 1rem; margin-bottom: .6rem; }
.cf-act-amt { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }

.cf-sec summary { cursor: pointer; list-style: none; }
.cf-sec summary::-webkit-details-marker { display: none; }
.cf-sec summary h2 { margin: 0; }
.cf-sec[open] summary { margin-bottom: .75rem; }

.cf-who { display: inline-flex; align-items: center; color: var(--ink); }
.cf-who:hover { text-decoration: none; }
.cf-who:hover strong { color: var(--brand); }
.cf-count { display: inline-block; min-width: 1.5rem; text-align: center; border-radius: 99px; background: #edf0f6; color: #46536b; font-weight: 600; font-size: .8rem; padding: .05rem .4rem; }
.cf-count.on { background: var(--brand); color: #fff; }

@media (max-width: 980px) { .cf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cf-credit { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .cf-grid { grid-template-columns: 1fr; } .cf-avatar { width: 64px; height: 64px; font-size: 1.4rem; } .cf-menu { margin-left: 0; } }

/* Listes des devis et des factures */
.dl-card { padding: 1.4rem 1.5rem; }
.dl-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.dl-head h1 { margin: 0; font-size: 1.35rem; }
.dl-tools { display: flex; align-items: center; gap: .6rem; }
.dl-tools input[type=text] { width: 250px; max-width: 100%; }
.dl-plus { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 1.5rem; line-height: 1; font-weight: 600; }
.dl-plus:hover { background: var(--brand-dark); text-decoration: none; }

.dl-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: 1.1rem 0 .6rem; }
.dl-pills { display: flex; gap: .45rem; flex-wrap: wrap; }
.dl-pill { padding: .28rem .95rem; border-radius: 99px; font-size: .86rem; font-weight: 600; background: #eef0f5; color: #46536b; }
.dl-pill:hover { text-decoration: none; filter: brightness(.97); }
.dl-pill.p-all.on { background: #131c2b; color: #fff; }
.dl-pill.p-brouillon { background: #f1f3f7; color: #5d6a80; }
.dl-pill.p-envoye, .dl-pill.p-emise { background: #efe9fd; color: #6b3fd4; }
.dl-pill.p-signe, .dl-pill.p-payee { background: #e3f6ec; color: #1d8a4e; }
.dl-pill.p-refuse { background: #fdeaed; color: #d6384a; }
.dl-pill.p-facture { background: #e6f0fe; color: #2f7df0; }
.dl-pill.p-retard { background: #fdeedd; color: #d9741a; }
.dl-pill.on:not(.p-all) { box-shadow: inset 0 0 0 2px currentColor; }
.dl-sums { display: flex; gap: .45rem; }
.dl-count, .dl-total { padding: .28rem .85rem; border-radius: 99px; font-size: .86rem; font-weight: 600; }
.dl-count { background: #e7eaf0; color: #46536b; }
.dl-total { background: #131c2b; color: #fff; }

.dl-table thead th { background: #f4f6fa; border-bottom: 0; padding: .7rem .6rem; }
.dl-table thead th a { color: var(--muted); }
.dl-table thead th.dl-on a { color: var(--brand); }
.dl-table thead th a:hover { text-decoration: none; color: var(--ink); }
.dl-table td { padding: .8rem .6rem; vertical-align: middle; border-bottom: 1px dashed var(--line); }
.dl-num { font-weight: 700; color: #1b4fa0; }
.dl-client { font-weight: 700; color: var(--ink); }
.dl-client:hover { color: var(--brand); text-decoration: none; }
.dl-tags { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-top: .25rem; }
.dl-tag { font-size: .72rem; font-weight: 600; color: #1d6a8a; background: #e5f4fa; border-radius: 6px; padding: .05rem .4rem; }
.dl-st { display: inline-block; padding: .25rem .95rem; border-radius: 99px; color: #fff; font-weight: 600; font-size: .85rem; background: #8a93a3; white-space: nowrap; }
.dl-st.st-envoye, .dl-st.st-emise { background: #6b3fd4; }
.dl-st.st-signe, .dl-st.st-payee { background: #1d8a4e; }
.dl-st.st-refuse { background: #d6384a; }
.dl-st.st-facture { background: #2f7df0; }
.dl-st.st-retard { background: #e8872a; }
.dl-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #eef2fa; color: var(--brand); font-weight: 700; margin-left: .25rem; }
.dl-ic:hover { background: var(--brand-soft); text-decoration: none; }
@media (max-width: 640px) { .dl-tools { width: 100%; } .dl-tools input[type=text] { flex: 1; width: auto; } }

/* Mon entreprise, activités SAP, catalogue */
[hidden] { display: none !important; }
.ent-sw { display: flex; align-items: center; gap: .65rem; margin: .5rem 0; cursor: pointer; font-weight: 500; }
.ent-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.ent-sw i { flex: none; width: 36px; height: 20px; border-radius: 99px; background: #cfd6e2; position: relative; transition: background .15s; }
.ent-sw i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ent-sw input:checked + i { background: var(--brand); }
.ent-sw input:checked + i::after { transform: translateX(16px); }
.ent-sw input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.ent-act { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin-bottom: .75rem; background: #fbfcfe; }
.ent-act > input[type=text] { font-weight: 600; margin-bottom: .5rem; }
.ent-act-new { border-style: dashed; background: transparent; }
.ent-act-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.ent-radio { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.ct-act { font-size: .8rem; font-weight: 600; color: #1d6a8a; margin-top: .15rem; }
.dl-table form.inline { display: inline; }
.dl-del { border: 0; cursor: pointer; font-size: .9rem; background: #fdeaed; color: #d6384a; }
.dl-del:hover { background: #fbd5da; }

/* Modèle de devis / facture (inspiré UniPros) */
.doc.dm { max-width: 860px; padding: 2.2rem 2.4rem; color: #1b2430; }
.dm-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.dm-title { font-size: 2.1rem; font-weight: 500; line-height: 1.15; margin: 0; }
.dm-date { font-size: 1.35rem; color: #4a566d; margin-top: .35rem; }
.dm-co { font-size: 1.35rem; font-weight: 700; color: var(--brand-dark); text-align: right; max-width: 45%; }
.dm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2.4rem; margin-bottom: 1.2rem; }
.dm-sec h2, .dm-h2 { font-size: 1.2rem; font-weight: 500; margin: 0 0 .55rem; text-transform: none; letter-spacing: 0; color: #1b2430; }
.dm-h2 { margin-top: 1.4rem; }
.dm-kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; font-size: .88rem; }
.dm-kv dt { color: #66738a; font-size: .8rem; padding-top: .08rem; }
.dm-kv dd { margin: 0; }
.dm-cond dt { color: #1b2430; font-weight: 700; font-size: .85rem; }
.dm-credit { margin: .8rem 0 0; font-size: .88rem; }
.dm-line { margin: .55rem 0 0; font-size: .85rem; }
.dm-items { width: 100%; border-collapse: collapse; font-size: .88rem; }
.dm-items th { text-align: left; font-weight: 400; color: #66738a; font-size: .8rem; padding: .45rem .6rem; }
.dm-items td { padding: .6rem .6rem; vertical-align: top; background: #f1f1f1; border-left: 2px solid #fff; }
.dm-items td:first-child { border-left: 0; }
.dm-items .num { text-align: right; white-space: nowrap; }
.dm-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem 2.4rem; margin-top: 1.1rem; align-items: start; }
.dm-recap { border-collapse: collapse; font-size: .8rem; width: 100%; max-width: 330px; }
.dm-recap th { text-align: left; font-weight: 400; color: #66738a; padding: .35rem .6rem; }
.dm-recap td { background: #f1f1f1; padding: .4rem .6rem; border-left: 2px solid #fff; }
.dm-recap td:first-child { border-left: 0; }
.dm-tot { margin-left: auto; border-collapse: collapse; font-size: .95rem; }
.dm-tot td { padding: .2rem .4rem; text-align: right; border: 0; }
.dm-tot td:last-child { white-space: nowrap; }
.dm-tot td:first-child { font-weight: 700; padding-right: .9rem; }
.dm-tot .dm-net td { font-size: 1.05rem; padding-top: .35rem; }
.dm-pay { margin-top: 1.4rem; }
.doc.dm .legal { margin-top: 1.4rem; display: grid; gap: .3rem; }
@media (max-width: 640px) {
  .doc.dm { padding: 1.1rem; }
  .dm-grid, .dm-sum { grid-template-columns: 1fr; }
  .dm-co { text-align: left; max-width: none; }
  .dm-title { font-size: 1.6rem; }
}
@media print {
  .doc.dm { padding: 0; }
  .dm-items td, .dm-recap td { background: #f1f1f1 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- Tableau de bord façon UniPros ---- */
.db-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.db-tile { position: relative; overflow: hidden; border-radius: 12px; color: #fff; padding: 1.1rem 1.2rem; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; text-decoration: none; }
.db-tile:hover { text-decoration: none; filter: brightness(1.05); color: #fff; }
.db-tile.t-violet { background: #6a2df0; } .db-tile.t-orange { background: #ff8a3d; } .db-tile.t-blue { background: #2f80f5; }
.db-tile.t-red { background: #ff4d5e; } .db-tile.t-green { background: #0fc468; }
.db-top { display: flex; align-items: center; gap: .6rem; position: relative; z-index: 1; }
.db-top span { font-weight: 600; line-height: 1.25; font-size: .95rem; }
.db-n { font-size: 2.1rem; line-height: 1; font-weight: 700; }
.db-big { font-size: 2rem; line-height: 1.1; font-weight: 700; }
.db-lab { font-weight: 600; position: relative; z-index: 1; margin-top: .2rem; }
.db-amt { text-align: right; font-size: 1.5rem; font-weight: 700; position: relative; z-index: 1; }
.db-deco { position: absolute; left: 14px; bottom: -22px; font-style: normal; font-size: 5.5rem; line-height: 1; opacity: .16; pointer-events: none; }
.db-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.db-left, .db-right { display: grid; gap: 1rem; min-width: 0; }
.db-chead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .4rem; }
.db-chead h2 { margin: 0; padding: 0; border: 0; }
.db-tot { text-align: right; font-weight: 700; display: grid; gap: .1rem; }
.db-tot .c1 { color: #3aa6ee; } .db-tot .c2 { color: #3fc983; }
.db-svg { width: 100%; height: auto; display: block; }
.db-grid { stroke: #e6eaf1; stroke-width: 1; }
.db-ax { fill: #6b7587; font-size: 12px; }
.db-l1 { fill: none; stroke: #3aa6ee; stroke-width: 3; stroke-linecap: round; }
.db-l2 { fill: none; stroke: #6fdca0; stroke-width: 3; stroke-linecap: round; }
.db-a1 { fill: #3aa6ee; fill-opacity: .12; stroke: none; }
.db-dot { fill: #fff; stroke: #3aa6ee; stroke-width: 2.5; }
.db-chip { fill: #3aa6ee; } .db-chipt { fill: #fff; font-size: 12px; font-weight: 700; }
.db-k1 { fill: #3aa6ee; } .db-k2 { fill: #6fdca0; }
.db-row { display: grid; grid-template-columns: 9rem minmax(0, 1fr) auto 2rem; gap: .8rem; align-items: center; padding: .8rem 0; border-top: 1px dashed var(--line); }
.db-row:first-of-type { border-top: 0; }
.db-c1 .dl-num { font-weight: 700; display: inline-block; margin-bottom: .25rem; }
.db-c3 { text-align: right; white-space: nowrap; }
.db-r { position: absolute; opacity: 0; pointer-events: none; }
.db-week { padding-bottom: 1rem; }
.db-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; margin-bottom: 1rem; }
.db-day { display: grid; justify-items: center; gap: .1rem; padding: .45rem .1rem; border-radius: 10px; cursor: pointer; color: #6b7587; font-size: .8rem; font-weight: 600; user-select: none; }
.db-day b { font-size: 1.05rem; color: var(--ink); }
.db-day:hover { background: #eef2fa; }
.db-pp { display: none; min-height: 3.5rem; }
.db-none { text-align: center; color: #8a93a3; margin: 1.2rem 0 .4rem; }
.db-ev { display: grid; gap: .1rem; padding: .6rem .8rem; border-radius: 10px; background: #f3f6fb; margin-bottom: .4rem; color: var(--ink); }
.db-ev:hover { background: #e9eefa; text-decoration: none; }
.db-evk { font-size: .75rem; font-weight: 700; color: #2f80f5; text-transform: uppercase; letter-spacing: .03em; }
.db-t { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .7rem 0; border-top: 1px dashed var(--line); color: var(--ink); }
.db-t:first-of-type { border-top: 0; }
.db-t:hover { text-decoration: none; background: #f7f9fd; }
.db-tr { text-align: right; white-space: nowrap; }
@media (max-width: 900px) { .db-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .db-row { grid-template-columns: minmax(0, 1fr) auto; } .db-row .dl-ic { display: none; } .db-c1 { grid-column: 1 / 2; } }
#dbd0:checked ~ .db-days label[for=dbd0] { background: #2f80f5; color: #fff; }
#dbd0:checked ~ .db-days label[for=dbd0] b { color: #fff; }
#dbd0:checked ~ .db-dayp .db-pp0 { display: block; }
#dbd1:checked ~ .db-days label[for=dbd1] { background: #2f80f5; color: #fff; }
#dbd1:checked ~ .db-days label[for=dbd1] b { color: #fff; }
#dbd1:checked ~ .db-dayp .db-pp1 { display: block; }
#dbd2:checked ~ .db-days label[for=dbd2] { background: #2f80f5; color: #fff; }
#dbd2:checked ~ .db-days label[for=dbd2] b { color: #fff; }
#dbd2:checked ~ .db-dayp .db-pp2 { display: block; }
#dbd3:checked ~ .db-days label[for=dbd3] { background: #2f80f5; color: #fff; }
#dbd3:checked ~ .db-days label[for=dbd3] b { color: #fff; }
#dbd3:checked ~ .db-dayp .db-pp3 { display: block; }
#dbd4:checked ~ .db-days label[for=dbd4] { background: #2f80f5; color: #fff; }
#dbd4:checked ~ .db-days label[for=dbd4] b { color: #fff; }
#dbd4:checked ~ .db-dayp .db-pp4 { display: block; }
#dbd5:checked ~ .db-days label[for=dbd5] { background: #2f80f5; color: #fff; }
#dbd5:checked ~ .db-days label[for=dbd5] b { color: #fff; }
#dbd5:checked ~ .db-dayp .db-pp5 { display: block; }
#dbd6:checked ~ .db-days label[for=dbd6] { background: #2f80f5; color: #fff; }
#dbd6:checked ~ .db-days label[for=dbd6] b { color: #fff; }
#dbd6:checked ~ .db-dayp .db-pp6 { display: block; }

/* ---- Formulaire devis / facture façon UniPros ---- */
.df-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.2rem; align-items: start; }
.df-main, .df-side { display: grid; gap: 1rem; min-width: 0; align-content: start; }
.df-card h2 { margin: 0 0 .8rem; padding: 0; border: 0; font-size: 1.15rem; }
.df-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px dashed var(--line); }
.df-head h1 { margin: 0; text-align: center; font-size: 1.7rem; font-weight: 700; }
.df-back { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #ff8a3d; color: #fff; font-weight: 700; text-decoration: none; }
.df-back:hover { background: #f07a2a; text-decoration: none; color: #fff; }
.df-save { border: 0; border-radius: 8px; background: #10c46a; color: #fff; font-weight: 600; padding: .6rem 1.1rem; cursor: pointer; white-space: nowrap; }
.df-save:hover { background: #0ea85b; }
.df-lab { display: block; font-size: .82rem; color: #6b7587; margin-bottom: .3rem; }
.df-req { color: #e5384a; }
.df-in { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: .6rem .8rem; font: inherit; color: var(--ink); }
.df-in:focus { outline: 2px solid #cfe0fb; border-color: #2f80f5; }
textarea.df-in { resize: vertical; }
.df-act-sel { max-width: 380px; margin-bottom: 1rem; }
.df-lines { display: grid; }
.df-lh, .df-line { display: grid; grid-template-columns: minmax(0, 2.3fr) minmax(5.5rem, .7fr) minmax(8.5rem, .95fr) 6.2rem 6.2rem 4.8rem; gap: .9rem; align-items: start; }
.df-lh { padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b7587; }
.df-line { padding: 1rem 0; border-bottom: 1px dashed var(--line); }
.df-art { display: grid; gap: .5rem; }
.df-desc { min-height: 4.2rem; background: #f3f6fb; }
.df-qty, .df-pu { display: grid; gap: .5rem; align-content: start; }
.df-unit { background: #f7f9fd; }
.df-mini { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: #6b7587; }
.df-mini .df-in { width: 4.2rem; padding: .35rem .5rem; }
.df-chk { line-height: 1.2; }
.df-chk input { margin: 0; }
.df-tt { padding-top: .65rem; font-weight: 700; white-space: nowrap; }
.r { text-align: right; }
.df-ac { padding-top: .35rem; white-space: nowrap; }
.df-ic { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: #eef2fa; color: #2f80f5; cursor: pointer; margin-left: .25rem; font-size: .95rem; }
.df-ic:hover { background: #dfe8fb; }
.df-del { background: #f1f2f5; color: #8a93a3; }
.df-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.df-add { border: 0; border-radius: 8px; background: #2f80f5; color: #fff; font-weight: 600; padding: .7rem 1.1rem; cursor: pointer; }
.df-add:hover { background: #226ae0; }
.df-cat { min-width: min(100%, 360px); flex: 0 1 380px; }
.df-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.df-check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.df-check input { margin-top: .25rem; }
.df-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.df-net { border-radius: 14px; background: #e3e6ec; text-align: center; padding: 1.6rem 1rem 3.4rem; color: #fff; }
.df-net.on { background: linear-gradient(135deg, #6a2df0, #2f80f5); }
.df-netl { font-weight: 700; font-size: 1.05rem; opacity: .9; }
.df-netv { font-size: 2.1rem; font-weight: 800; margin-top: .3rem; }
.df-sums { background: #fff; border-radius: 14px; box-shadow: 0 2px 10px rgba(30, 40, 70, .08); margin: -2.6rem 1.2rem 0; padding: 1rem 1.2rem; display: grid; gap: .4rem; position: relative; }
.df-sums > div { display: flex; justify-content: space-between; gap: 1rem; }
.df-newcl { margin-top: .5rem; font-size: .85rem; }
.df-info { display: grid; gap: .6rem; }
.df-iname { font-size: 1.15rem; font-weight: 700; }
.df-pill { display: inline-block; justify-self: start; border-radius: 99px; padding: .3rem .9rem; font-weight: 600; font-size: .85rem; color: #fff; background: #8a93a3; }
.df-pill.p-ok { background: #10c46a; } .df-pill.p-warn { background: #e8872a; } .df-pill.p-err { background: #e5384a; } .df-pill.p-info { background: #2f80f5; }
.df-meta { font-size: .85rem; color: #6b7587; display: grid; gap: .15rem; }
.df-sec { border-top: 1px solid var(--line); padding-top: .7rem; display: grid; gap: .15rem; }
.df-ik { font-weight: 700; margin-top: .35rem; }
.df-iv { color: #4b5566; font-size: .9rem; overflow-wrap: anywhere; }
.df-flink { font-size: .85rem; margin-top: .3rem; }
.df-warn { border: 1px solid #f6d9b7; background: #fff6ec; border-radius: 12px; padding: .9rem 1rem; color: #7a4a10; }
.df-warn b { display: block; color: #3d2a12; margin-bottom: .3rem; }
.df-warn p { margin: 0; font-size: .9rem; line-height: 1.4; }
@media (max-width: 1100px) { .df-grid { grid-template-columns: minmax(0, 1fr); } .df-side { order: -1; } }
@media (max-width: 760px) {
  .df-lh { display: none; }
  .df-line { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .df-art { grid-column: 1 / -1; }
  .df-tt { text-align: left; }
  .df-ac { grid-column: 1 / -1; text-align: right; }
  .df-two, .df-dates { grid-template-columns: minmax(0, 1fr); }
  .df-head h1 { font-size: 1.25rem; }
}


/* Formulaire document : colonnes de conditions, dates d'intervention */
.df-col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.df-col .card { margin: 0; }
.df-h2tip { display: flex; justify-content: space-between; align-items: center; }
.df-h2tip h2 { margin: 0 0 .8rem; }
.df-tip { width: 1.7rem; height: 1.7rem; border-radius: 8px; background: #eaf2ff; color: #2f80f5; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; cursor: help; margin-bottom: .8rem; }
.df-sub { margin: -.5rem 0 .8rem; color: #6b7587; font-size: .85rem; }
.df-sp { margin-top: .8rem; }
.df-datebar { display: flex; gap: .6rem; }
.df-datebar .df-in { flex: 1; }
.df-valid { border: 0; border-radius: 10px; background: #00c26b; color: #fff; padding: 0 1.2rem; cursor: pointer; font: inherit; font-weight: 600; }
.df-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.df-chip { border: 1px solid var(--line); border-radius: 99px; padding: .2rem .4rem .2rem .8rem; font-size: .82rem; display: inline-flex; gap: .4rem; align-items: center; color: #4a5568; }
.df-chip button { border: 0; background: none; cursor: pointer; color: #8a93a3; font-size: 1.05rem; line-height: 1; padding: 0 .2rem; }
.df-who { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: .25rem .8rem; font-size: .78rem; font-weight: 600; color: #4a5568; margin: .8rem 0 0; }
.df-durs { display: grid; gap: .6rem; }

.df-h2tip { border-bottom: 1px solid var(--line); margin-bottom: .8rem; }
.df-h2tip h2 { border: 0; margin: 0; padding-bottom: .6rem; }
.df-h2tip .df-tip { margin-bottom: .5rem; }

button.df-tip { border: 0; font: inherit; font-weight: 700; font-size: .85rem; }
.df-modal { position: fixed; inset: 0; background: rgba(20, 28, 45, .45); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.df-modal[hidden] { display: none; }
.df-mbox { background: #fff; border-radius: 16px; width: min(560px, 100%); padding: 1.5rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.df-mhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.df-mhead h2 { margin: 0; border: 0; padding: 0; font-size: 1.15rem; }
.df-mx { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1.2rem; line-height: 1; }
.df-mb { text-align: center; line-height: 1.5; color: #4a5568; margin: .8rem 0; }
.df-mfoot { text-align: right; margin-top: 1rem; }
.df-mclose { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: .5rem 1.1rem; cursor: pointer; font: inherit; font-weight: 600; }


/* Menu latéral : sections Gestion / Finances */
.side nav .nav-sec { margin: 1.2rem .9rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: inherit; opacity: .5; }
.side nav .nav-sec:first-child { margin-top: .3rem; }

/* Menu latéral : petites icônes */
.side nav a { display: flex; align-items: center; gap: .7rem; }
.side nav a .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.side nav a.on .ico, .side nav a:hover .ico { opacity: 1; }
