:root {
  --paper: #f6f3ea; --surface: #fffdf8; --ink: #1d2a26; --muted: #5f6d67; --line: #e2dccd;
  --brand: #0f4c41; --brand-ink: #fbf8f0; --brand-soft: #e2eee9; --accent: #b9771f;
  --good: #1c7a54; --good-soft: #dff1e7; --warn: #9a5c00; --warn-soft: #fbeed3; --bad: #b2382c; --bad-soft: #f9e2de; --income: #0a8a6c; --expense: #b8741a;
  --radius: 10px; --sidebar: 232px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121816; --surface: #1a2320; --ink: #e9ece6; --muted: #9caaa3; --line: #2d3a35;
    --brand: #2c8a76; --brand-ink: #f3fbf8; --brand-soft: #1e3a33; --accent: #e0a24c;
    --good: #5fc79c; --good-soft: #17362a; --warn: #e5b45f; --warn-soft: #3a2d13; --bad: #ef8d80; --bad-soft: #40201b; --income: #4fbfa4; --expense: #dfa655;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 var(--font); }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .92rem; margin: 1rem 0 .4rem; color: var(--muted); }
p { margin: .3rem 0 .8rem; }
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { font-variant-numeric: tabular-nums; text-align: end; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }

/* Structure */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100dvh; }
.side { background: var(--surface); color: var(--ink); border-inline-end: 1px solid var(--line); padding: 1rem .7rem; display: flex; flex-direction: column; gap: .3rem; position: sticky; top: 0; z-index: 25; height: 100dvh; overflow-y: auto; }
.logo { padding: .1rem .55rem .7rem; }
.side a, .side summary { display: flex; align-items: center; gap: .75rem; min-height: 42px; color: inherit; text-decoration: none; padding: .42rem .6rem; border-radius: 9px; font-weight: 500; cursor: pointer; transition: background .15s; }
.side a > svg, .side summary > svg { width: 23px; height: 23px; flex: none; opacity: .75; }
.side a:hover, .side summary:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.side a.active, .side summary.active { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--brand); font-weight: 600; }
.side a.active > svg, .side summary.active > svg { opacity: 1; }
.side a.nav-achats.active { background: #fbe4f2; color: #6e1a55; }
.nav-badge { background: #fde3e1; color: #a3261c; border-radius: 99px; padding: .03rem .48rem; font-size: .76rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.side summary { list-style: none; }
.side summary::-webkit-details-marker { display: none; }
.side summary > svg:last-child { width: 17px; height: 17px; margin-inline-start: auto; transition: transform .15s; }
[dir="rtl"] .side summary > svg:last-child { transform: scaleX(-1); }
.side-menu { position: fixed; inset-inline-start: calc(var(--sidebar) + 6px); bottom: 12px; z-index: 40; width: 260px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .4rem; box-shadow: 0 14px 40px rgba(0, 0, 0, .18); display: flex; flex-direction: column; gap: .15rem; animation: side-menu .14s ease-out; }
@keyframes side-menu { from { opacity: 0; transform: translateX(-6px); } }
.side select { width: 100%; background: var(--surface); color: inherit; border: 1px solid var(--line); margin-bottom: .55rem; }
.side button.link { color: inherit; justify-content: flex-start; padding: .48rem .6rem; min-height: 40px; }
.side button.link:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
main { padding: 1.6rem clamp(1rem, 3vw, 2.4rem) 3rem; width: 100%; min-width: 0; }
.head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.head .actions { margin-inline-start: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.bottom-nav { display: none; }
.top-mobile { display: none; }

/* Blocs */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.kpis { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi b { display: block; font-size: 1.28rem; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.kpi span { color: var(--muted); font-size: .84rem; }
.hero { background: var(--brand); color: var(--brand-ink); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; display: flex; flex-wrap: wrap; gap: 1rem 2.4rem; align-items: center; }
.hero .big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero .label { opacity: .85; font-size: .88rem; }
.hero .split { display: flex; gap: 1.8rem; flex-wrap: wrap; font-size: .9rem; }
.hero .split b { display: block; font-variant-numeric: tabular-nums; font-size: 1.04rem; }
.notice { border: 1px solid var(--line); border-inline-start: 4px solid var(--accent); background: var(--warn-soft); padding: .7rem .9rem; border-radius: 7px; margin-bottom: 1rem; }
.notice.bad { border-inline-start-color: var(--bad); background: var(--bad-soft); }
.notice.good { border-inline-start-color: var(--good); background: var(--good-soft); }

/* Tableaux */
.table-wrap { overflow-x: auto; overflow-y: hidden; margin: 0 -1.1rem; padding: 0 1.1rem; }
table { border-collapse: collapse; width: 100%; }
th { text-align: start; font-size: .77rem; color: var(--muted); font-weight: 600; padding: .4rem .55rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num { text-align: end; }
td { padding: .55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--brand-soft); }
tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
tr.section td { font-weight: 700; background: var(--paper); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

.badge { display: inline-block; padding: .05rem .48rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--line); color: var(--ink); white-space: nowrap; }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

/* Formulaires */
label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: .7rem; }
label small { font-weight: 400; font-size: .75rem; color: var(--muted); display: block; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid #b8b09d; border-radius: 7px; padding: .5rem .6rem; width: 100%; min-height: 40px; margin-top: .18rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; min-height: 0; margin-inline-end: .4rem; }
input[type="file"] { padding: .35rem; }
.form-grid { display: grid; gap: 0 .9rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
button, .btn { font: inherit; font-weight: 600; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .5rem .85rem; min-height: 40px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
button:hover, .btn:hover { border-color: var(--muted); }
button.primary, .btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: var(--brand); font-weight: 500; }
button.mini, .btn.mini { min-height: 32px; padding: .2rem .55rem; font-size: .84rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
.tabs { display: flex; gap: .3rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: .5rem .8rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }

/* Éditeur de lignes */
.lines .line { display: grid; grid-template-columns: 2.4fr .7fr 1fr .8fr 1.5fr 1fr 34px; gap: .45rem; align-items: end; padding: .45rem 0; border-bottom: 1px dashed var(--line); }
.lines label { margin: 0; font-size: .75rem; font-weight: 500; color: var(--muted); }
.lines .line-total { text-align: end; padding-bottom: .6rem; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals { margin-inline-start: auto; max-width: 320px; }
.totals div { display: flex; justify-content: space-between; padding: .2rem 0; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--ink); margin-top: .25rem; padding-top: .35rem; }

/* Document imprimable */
.doc { background: #fff; color: #1a1a1a; border: 1px solid var(--line); border-radius: 4px; padding: clamp(1rem, 4vw, 2.6rem); margin-bottom: 1rem; }
.doc-head { display: flex; justify-content: space-between; gap: 1.4rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.doc-title { font-size: 1.5rem; font-weight: 700; color: var(--doc-accent, #0f4c41); }
.doc table th { color: #555; border-color: #ccc; }
.doc table td { border-color: #e5e5e5; }
.doc .words { margin-top: 1rem; font-style: italic; }
.doc .legal { margin-top: 1.5rem; border-top: 1px solid #ccc; padding-top: .55rem; font-size: .77rem; color: #555; text-align: center; }
.doc .totals .grand { border-color: #1a1a1a; }

/* Banque */
.bank-tabs { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); margin-bottom: 1rem; }
.bank-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .95rem; }
.bank-card.active { border: 2px solid var(--brand); }
.bank-card b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.tx { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: .2rem .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx .amount { font-weight: 700; font-variant-numeric: tabular-nums; text-align: end; }
.amount.in { color: var(--good); }
.tx .acts { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.suggestion { background: var(--brand-soft); color: var(--ink); border-color: transparent; }

/* Graphique */
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .3rem; align-items: end; height: 170px; }
.chart .m { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.chart .bars { display: flex; gap: 2px; align-items: flex-end; flex: 1; }
.chart .bars i { flex: 1; display: block; border-radius: 3px 3px 0 0; min-height: 1px; }
.chart .lbl { font-size: .75rem; color: var(--muted); text-align: center; padding-top: .2rem; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: .3rem; }

/* Connexion */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 1rem; }
.auth .panel { width: min(480px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.6rem; }
.auth .brand { font-size: 1.7rem; font-weight: 700; color: var(--brand); }

/* Scan */
.scan-zone { display: grid; gap: .7rem; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 12px; padding: 2rem 1rem; background: var(--surface); }
.scan-zone .btn { font-size: 1.05rem; padding: .85rem 1.3rem; width: min(320px, 100%); }
.scan-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; min-height: 0; padding: 0; margin: 0; }
.scan-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.scan-preview img { width: 100%; max-height: 72vh; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
progress { width: 100%; height: 10px; accent-color: var(--brand); }
.attachment-img { max-width: 100%; max-height: 520px; border: 1px solid var(--line); border-radius: 6px; }

/* Fenêtre et messages */
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 1.2rem; width: min(520px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(10, 20, 17, .5); }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 50; max-width: min(90vw, 560px); }
#toast div { background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 8px; margin-top: .4rem; }
#toast div.err { background: var(--bad); color: #fff; }

/* Téléphone */
@media (max-width: 820px) {
  .shell { display: block; }
  .side { position: fixed; z-index: 30; inset-block: 0; inset-inline: 0 25%; transform: translateX(-102%); transition: transform .18s; height: 100dvh; padding-top: max(1rem, env(safe-area-inset-top)); }
  .shell.open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); }
  .side-menu { position: static; width: auto; max-height: none; border: 0; box-shadow: none; padding: 0 0 0 .6rem; animation: none; }
  .side details[open] summary > svg:last-child { transform: rotate(90deg); }
  .top-mobile { display: flex; align-items: center; gap: .6rem; background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); position: sticky; top: 0; z-index: 20; }
  .top-mobile strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 1rem 1rem calc(88px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.3rem; }
  .hero .big { font-size: 1.65rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: .05rem; padding: .45rem 0; min-height: 56px; font-size: .75rem; font-weight: 600; text-decoration: none; color: var(--muted); background: none; border: 0; border-radius: 0; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .scan { color: var(--accent); }
  .bottom-nav .scan svg { background: var(--accent); color: #1c1305; border-radius: 50%; width: 34px; height: 34px; padding: 6px; margin-top: -14px; box-sizing: border-box; }
  .lines .line { grid-template-columns: 1fr 1fr; }
  .lines .line > :first-child { grid-column: 1 / -1; }
  .lines .line-total { text-align: start; padding: 0; align-self: center; }
  .scan-layout { grid-template-columns: minmax(0, 1fr); }
  .scan-preview img { max-height: 34vh; }
  .tx { grid-template-columns: minmax(0, 1fr) auto; }
  .tx .date { grid-column: 1 / -1; font-size: .78rem; }
  .tx .acts { grid-column: 1 / -1; }
  input, select, textarea { font-size: 16px; }
  #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* Impression d'une facture */
@media print {
  body { background: #fff; }
  .side, .top-mobile, .bottom-nav, .head, .no-print, #toast { display: none !important; }
  .shell { display: block; }
  main { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; }
}

/* Bandeaux, tâches et obligations */
:root { --tone-green: #bfe6c6; --tone-pink: #f5cfe0; --tone-violet: #d9d2f4; --tone-blue: #c6def2; --tone-ink: #14231e; }
.banner { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem 2.2rem; padding: 1rem 1.25rem; border-radius: 12px; margin-bottom: 1rem; color: var(--tone-ink); }
.banner h1 { font-size: 1.75rem; }
.tone-green { background: var(--tone-green); } .tone-pink { background: var(--tone-pink); } .tone-violet { background: var(--tone-violet); } .tone-blue { background: var(--tone-blue); }
.banner-kpis { display: flex; gap: 1.8rem; flex-wrap: wrap; }
.banner-kpis span { display: block; font-size: .78rem; }
.banner-kpis b { font-size: 1.22rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.banner .actions { margin-inline-start: auto; display: flex; gap: .45rem; flex-wrap: wrap; }
.banner .btn { background: rgba(255, 255, 255, .72); color: var(--tone-ink); border-color: transparent; }
.banner .btn.dark { background: var(--tone-ink); color: #fff; }
.tabs .count { font-weight: 600; color: var(--brand); margin-left: .15rem; }
.home-grid { display: grid; gap: 1rem; grid-template-columns: minmax(250px, 1fr) minmax(0, 2fr); }
.home-grid .card { margin: 0; }
.todo { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.todo:last-child { border-bottom: 0; }
.todo small { display: block; color: var(--muted); }
.available { font-size: 1.9rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-bottom: .6rem; }
.mini-kpis { display: flex; flex-wrap: wrap; gap: .5rem 1.8rem; margin-bottom: 1rem; }
.mini-kpis span { display: block; color: var(--muted); font-size: .8rem; }
.mini-kpis b { font-variant-numeric: tabular-nums; }
a.kpi { text-decoration: none; color: inherit; }
.obligations { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 1rem; }
.obligation { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .85rem; text-decoration: none; color: inherit; }
.obligation.active { border: 2px solid var(--brand); }
.obligation small { color: var(--muted); }
.hero { display: none; }
@media (max-width: 820px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .banner h1 { font-size: 1.4rem; width: 100%; }
  .banner .actions { margin-inline-start: 0; }
}

/* Choix d'envoi, langues et code */
.send-options { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.send-option { flex-direction: column; align-items: flex-start; text-align: start; gap: .15rem; padding: .85rem 1rem; border: 2px solid var(--brand); background: var(--brand-soft); }
.send-option b { font-size: 1.02rem; }
.send-option small { font-weight: 400; color: var(--muted); }
.lang-select { width: auto; min-width: 118px; }
.side .lang-select { width: 100%; margin: .2rem 0; }
.code { background: #17211e; color: #e6efe9; padding: .85rem 1rem; border-radius: 8px; overflow-x: auto; font-size: .82rem; line-height: 1.5; margin: .3rem 0 1rem; text-align: left; }
code { font-family: Consolas, "Courier New", monospace; font-size: .9em; }

/* Arabe : sens de lecture droite-gauche ; les montants restent lisibles de gauche à droite */
[dir="rtl"] body, [dir="rtl"] { font-family: "Segoe UI", Tahoma, "Noto Naskh Arabic", "Geeza Pro", Arial, sans-serif; }
[dir="rtl"] .num, [dir="rtl"] .kpi b, [dir="rtl"] .banner-kpis b, [dir="rtl"] .mini-kpis b, [dir="rtl"] .available, [dir="rtl"] .bank-card b, [dir="rtl"] .tx .amount, [dir="rtl"] .totals span:last-child { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] td.num, [dir="rtl"] th.num, [dir="rtl"] .tx .amount { text-align: left; }
[dir="rtl"] .kpi b, [dir="rtl"] .banner-kpis b, [dir="rtl"] .mini-kpis b, [dir="rtl"] .available, [dir="rtl"] .bank-card b { text-align: right; }
[dir="rtl"] input[type="email"], [dir="rtl"] input[type="date"], [dir="rtl"] input[inputmode="numeric"], [dir="rtl"] input[inputmode="decimal"] { direction: ltr; text-align: right; }
[dir="rtl"] .doc, .doc { text-align: left; }
@media (max-width: 820px) {
  [dir="rtl"] .side { transform: translateX(102%); }
  [dir="rtl"] .shell.open .side { transform: none; }
}

/* Modèles de documents : aperçu à l'écran */
.doc.tpl-moderne .doc-head { background: var(--doc-accent); color: #fff; margin: calc(-1 * clamp(1rem, 4vw, 2.6rem)) calc(-1 * clamp(1rem, 4vw, 2.6rem)) 1.5rem; padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 4vw, 2.6rem); border-radius: 4px 4px 0 0; }
.doc.tpl-moderne .doc-title { color: #fff; }
.doc.tpl-classique table th, .doc.tpl-moderne table th { background: var(--doc-accent); color: #fff; }
.doc.tpl-minimal .doc-title { color: #111; font-size: 1.1rem; letter-spacing: .12em; }
.doc.tpl-minimal table th { color: #111; border-bottom: 1px solid #111; }
.doc.tpl-elegant { border-left: 12px solid var(--doc-accent); }
.doc.tpl-elegant table th { color: var(--doc-accent); border-bottom: 1px solid var(--doc-accent); }
@media print { .doc.tpl-moderne .doc-head, .doc.tpl-classique table th, .doc.tpl-moderne table th, .doc.tpl-elegant { print-color-adjust: exact; -webkit-print-color-adjust: exact; } .doc.tpl-moderne .doc-head { margin: 0 0 1.5rem; } }

.tpl-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.tpl-card { border: 1px solid var(--line); border-radius: 10px; padding: .7rem; display: flex; flex-direction: column; gap: .5rem; background: var(--paper); }
.tpl-card:has(input:checked) { border: 2px solid var(--brand); }
.tpl-pick { margin: 0; cursor: pointer; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.tpl-pick input { width: auto; min-height: 0; margin: 0; align-self: flex-start; }
.tpl-pick small { font-weight: 400; color: var(--muted); }
.tpl-mock { display: flex; flex-direction: column; gap: 5px; height: 128px; padding: 9px; background: #fff; border: 1px solid #ddd; border-radius: 3px; position: relative; overflow: hidden; }
.tpl-mock i { display: block; background: #d9d9d9; border-radius: 1px; }
.tpl-mock .m-head { height: 15px; width: 45%; }
.tpl-mock .m-client { height: 18px; width: 48%; align-self: flex-end; background: #eee; }
.tpl-mock .m-table { height: 9px; background: var(--doc-accent); margin-top: 5px; }
.tpl-mock .m-row { height: 5px; background: #e6e6e6; }
.tpl-mock .m-total { height: 9px; width: 38%; align-self: flex-end; margin-top: 5px; background: #777; }
.mock-moderne { padding-top: 34px; }
.mock-moderne .m-head { position: absolute; top: 0; left: 0; right: 0; width: 100%; height: 28px; background: var(--doc-accent); border-radius: 0; }
.mock-minimal .m-table { height: 1px; background: #111; }
.mock-minimal .m-client { background: transparent; border-top: 1px solid #ccc; }
.mock-elegant { padding-left: 17px; }
.mock-elegant::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7px; background: var(--doc-accent); }
.mock-elegant .m-table { height: 1px; }
.mock-elegant .m-client { background: transparent; border-left: 2px solid var(--doc-accent); }
input[type="color"] { padding: .15rem; height: 42px; }

/* Recherche par ICE ou par nom */
.lookup { grid-column: 1 / -1; margin: -.4rem 0 .7rem; display: grid; gap: .3rem; }
.lookup-item { flex-direction: column; align-items: flex-start; text-align: start; gap: 0; min-height: 0; padding: .4rem .6rem; background: var(--brand-soft); border-color: transparent; }
.lookup-item small { font-weight: 400; color: var(--muted); }

/* Recherche de factures */
.search-bar { display: grid; gap: .3rem .8rem; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(110px, 1fr)) auto; align-items: end; }
.search-bar label { margin: 0; }
.search-actions { display: flex; gap: .4rem; }
.search-result { grid-column: 1 / -1; margin: .4rem 0 0; font-weight: 600; }
.banner button.btn { background: rgba(255, 255, 255, .72); color: var(--tone-ink); border-color: transparent; }
@media (max-width: 820px) { .search-bar { grid-template-columns: 1fr 1fr; } .search-bar label:first-of-type, .search-actions { grid-column: 1 / -1; } }

/* Récurrences et clients */
.name-search { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.name-search input { margin: 0; width: min(420px, 100%); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .table-wrap { margin: 0; padding: 0; }
.rec-table th, .rec-table td { padding: .85rem .95rem; vertical-align: middle; }
.rec-table th { font-size: .84rem; }
.rec-table .center { text-align: center; }
.rec-table .end { text-align: end; }
[dir="rtl"] .money { direction: ltr; unicode-bidi: isolate; }

/* Listes de documents */
.hidden { display: none !important; }
.search-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.search-row input[type="search"] { margin: 0; width: min(440px, 100%); }
.filter-panel { flex-basis: 100%; display: grid; gap: .4rem .8rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem; }
.filter-panel label { margin: 0; }
.search-result { flex-basis: 100%; margin: 0; font-weight: 600; }
.doc-table thead th { background: var(--paper); }
.type-cell { display: inline-flex; align-items: center; gap: .4rem; }
.type-cell svg, .recur-icon svg { width: 16px; height: 16px; color: var(--muted); display: block; }
.status-cell { position: relative; white-space: nowrap; }
.row-actions { display: none; position: absolute; inset-inline-start: 5.8rem; top: 50%; transform: translateY(-50%); gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .15rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); z-index: 2; }
tr:hover .row-actions, .row-actions:focus-within { display: inline-flex; }
.row-actions button { min-height: 30px; width: 30px; padding: 0; border: 0; background: none; }
.row-actions button:hover { background: var(--brand-soft); }
.row-actions svg { width: 17px; height: 17px; }
tr.click:hover td { background: var(--brand-soft); }

/* Éditeur de document */
.doc-editor { display: block; }
.editor-top { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap; }
.seg { display: inline-flex; gap: .15rem; background: var(--line); border-radius: 9px; padding: .18rem; margin-bottom: .8rem; }
.doc-editor > .seg { display: flex; width: fit-content; margin-inline: auto; }
.seg button { min-height: 32px; border: 0; background: none; padding: .2rem 1rem; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }
.editor-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.sheet { background: #fff; color: #1a1a1a; border: 1px solid var(--line); border-radius: 12px; padding: 1.8rem; min-height: 640px; overflow: hidden; }
.sheet input, .sheet select, .sheet textarea { background: #fff; color: #1a1a1a; }
.sheet a, .sheet .link { color: var(--doc-accent); }
.sheet-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.sheet-logo img { max-height: 64px; max-width: 200px; display: block; }
.sheet-meta { display: grid; gap: .2rem; width: min(300px, 100%); }
.sheet-meta label { display: grid; grid-template-columns: 1fr 150px; align-items: center; gap: .5rem; margin: 0; font-weight: 500; font-size: .8rem; }
.sheet-meta input { margin: 0; min-height: 32px; padding: .2rem .4rem; font-size: .85rem; }
.sheet-title { font-weight: 700; font-size: 1.1rem; color: var(--doc-accent); text-align: end; margin-bottom: .3rem; }
.sheet-parties { display: grid; gap: 1.5rem; grid-template-columns: 1fr 1fr; margin-bottom: 1.3rem; }
.party-label { font-size: .78rem; color: #666; margin-bottom: .3rem; }
.party-box { border: 1px dashed #bbb; border-radius: 8px; padding: .55rem; display: grid; gap: .3rem; justify-items: start; }
.party-box select { margin: 0; }
.party-box .small { color: #555; }
.lines-head { display: grid; grid-template-columns: 2.4fr .7fr 1fr .8fr 1.5fr 1fr 34px; gap: .45rem; background: var(--doc-accent); color: #fff; font-size: .78rem; font-weight: 600; padding: .4rem .6rem; border-radius: 8px; }
.lines-head .end { text-align: end; }
.sheet .line { border-bottom: 1px dashed #ddd; }
.sheet .totals div { color: #1a1a1a; }
.sheet .totals .grand { border-color: #1a1a1a; }
.sheet.tpl-minimal .lines-head { background: none; color: #111; border-bottom: 1px solid #111; border-radius: 0; }
.sheet.tpl-minimal .sheet-title { color: #111; letter-spacing: .1em; }
.sheet.tpl-elegant { border-inline-start: 12px solid var(--doc-accent); }
.sheet.tpl-elegant .lines-head { background: none; color: var(--doc-accent); border-bottom: 1px solid var(--doc-accent); border-radius: 0; }
.sheet.tpl-moderne .sheet-head { background: var(--doc-accent); color: #fff; margin: -1.8rem -1.8rem 1.3rem; padding: 1.4rem 1.8rem; }
.sheet.tpl-moderne .sheet-title { color: #fff; }
.product-pick { width: auto; margin: 0; }
.sheet-foot { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.5rem; font-size: .84rem; }
.sheet-foot > div:last-child { text-align: end; }
@media (min-width: 821px) {
  .sheet .lines label { font-size: 0; }
  .sheet .lines input, .sheet .lines select { font-size: 14px; margin: 0; }
  .sheet .lines .line { align-items: center; }
  .sheet .lines .line-total { padding: 0; }
}
.doc-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1rem; position: sticky; top: 1rem; }
.panel-row { display: flex; justify-content: space-between; gap: .6rem; align-items: flex-start; margin-bottom: .9rem; font-weight: 600; font-size: .86rem; }
.choice { display: flex; gap: .35rem; }
.choice button { flex-direction: column; gap: 0; width: 56px; min-height: 52px; padding: .2rem; }
.choice button small { font-weight: 400; color: var(--muted); font-size: .7rem; }
.choice button.on { border: 2px solid var(--brand); background: var(--brand-soft); }
.switch { display: flex; justify-content: space-between; align-items: center; gap: .5rem; background: var(--paper); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .5rem; font-weight: 500; }
.switch input { margin: 0; flex: none; width: 18px; height: 18px; accent-color: var(--brand); }
.tpl-grid.single { grid-template-columns: 1fr 1fr; margin-bottom: .7rem; }
.pdf-view iframe { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
@media (max-width: 980px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .doc-panel { position: static; }
  .lines-head { display: none; }
  .sheet { padding: 1rem; min-height: 0; }
  .sheet-parties { grid-template-columns: minmax(0, 1fr); }
  .sheet.tpl-moderne .sheet-head { margin: -1rem -1rem 1rem; padding: 1rem; }
}

/* Logo */
.visually-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0; margin: 0; min-height: 0; }
.logo-box { display: grid; place-items: center; min-height: 90px; max-width: 320px; border: 1px dashed var(--line); border-radius: 8px; padding: .7rem; margin-bottom: .8rem; background: #fff; }
.logo-box img { max-height: 80px; max-width: 280px; }
.doc-logo { display: block; max-height: 64px; max-width: 200px; margin-bottom: .6rem; }

/* Nouveaux modèles */
.doc.tpl-cercle, .sheet.tpl-cercle { background: radial-gradient(circle 230px at 8% 0, color-mix(in srgb, var(--doc-accent) 12%, #fff) 99%, transparent), radial-gradient(circle 170px at 100% 100%, color-mix(in srgb, var(--doc-accent) 12%, #fff) 99%, transparent), #fff; }
.doc.tpl-ruban, .sheet.tpl-ruban, .doc.tpl-cadre, .sheet.tpl-cadre { border-top: 12px solid var(--doc-accent); }
.doc.tpl-cadre, .sheet.tpl-cadre { border-bottom: 12px solid var(--doc-accent); }
.doc.tpl-cercle table th, .doc.tpl-ruban table th, .doc.tpl-compact table th { background: var(--doc-accent); color: #fff; }
.doc.tpl-cadre table th { color: var(--doc-accent); border-bottom: 1px solid var(--doc-accent); }
.sheet.tpl-cadre .lines-head { background: none; color: var(--doc-accent); border-bottom: 1px solid var(--doc-accent); border-radius: 0; }
.doc.tpl-compact .doc-title, .sheet.tpl-compact .sheet-title { font-size: 1rem; }
.mock-cercle::before, .mock-cercle::after { content: ""; position: absolute; border-radius: 50%; background: var(--doc-accent); opacity: .13; }
.mock-cercle::before { width: 90px; height: 90px; left: -30px; top: -30px; }
.mock-cercle::after { width: 70px; height: 70px; right: -20px; bottom: -20px; }
.mock-ruban { border-top: 7px solid var(--doc-accent); }
.mock-cadre { border-top: 7px solid var(--doc-accent); border-bottom: 7px solid var(--doc-accent); }
.mock-cadre .m-table { height: 1px; }
.mock-compact .m-head { height: 7px; width: 28px; }
.mock-compact .m-client { display: none; }
.mock-compact .m-row { height: 4px; }

/* Support */
.messages { display: grid; gap: .7rem; margin-bottom: 1rem; }
.message { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .95rem; max-width: 86%; }
.message.team { margin-inline-start: auto; background: var(--brand-soft); border-color: transparent; }
.message.internal { background: var(--warn-soft); border-style: dashed; border-color: var(--warn); }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: .25rem; }
.seg a { padding: .2rem 1rem; border-radius: 7px; text-decoration: none; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; min-height: 32px; }
.seg a.on { background: var(--surface); color: var(--ink); font-weight: 600; }
.name-search .seg { margin: 0; }

/* Fiche entreprise */
.info-grid { display: grid; gap: .8rem 1.4rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.info-item span { display: block; font-size: .78rem; color: var(--muted); }
.info-item b { font-weight: 600; overflow-wrap: anywhere; }
.admin-table select { margin: 0; }

/* Page de connexion */
.auth-page { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-page .auth { min-height: 0; }
.auth-visual {
  position: relative; overflow: hidden; color: #f6fbf8; background-color: #0f4c41; padding: clamp(1.6rem, 4vw, 3.4rem);
  display: flex; flex-direction: column; justify-content: center; gap: 1.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.08' stroke-width='1.4'%3E%3Cpath d='M48 12l10.5 25.5L84 48 58.5 58.5 48 84 37.5 58.5 12 48l25.5-10.5z'/%3E%3Crect x='26' y='26' width='44' height='44' transform='rotate(45 48 48)'/%3E%3Ccircle cx='48' cy='48' r='7'/%3E%3Cpath d='M0 0l12 12M96 0L84 12M0 96l12-12M96 96L84 84'/%3E%3C/g%3E%3C/svg%3E");
}
.auth-visual::after { content: ""; position: absolute; inset: auto -12% -32% auto; width: 60%; aspect-ratio: 1; border-radius: 50%; background: #d99a3e; opacity: .14; filter: blur(8px); pointer-events: none; }
.auth-intro { position: relative; z-index: 1; max-width: 560px; }
.auth-intro h1 { font-size: clamp(1.5rem, 2.6vw, 2.35rem); line-height: 1.16; color: #fff; }
.auth-intro p { margin: .7rem 0 0; font-size: 1.02rem; opacity: .86; }

.auth-scene { position: relative; z-index: 1; height: 330px; max-width: 600px; width: 100%; }
.scene-invoice { position: absolute; inset-inline-start: 0; top: 0; width: min(350px, 62%); background: #fffdf8; color: #1d2a26; border-radius: 12px; padding: 1.05rem 1.1rem 1.2rem; box-shadow: 0 18px 44px rgba(0, 0, 0, .32); transform: rotate(-1.6deg); animation: scene-float 7s ease-in-out infinite; overflow: hidden; }
.si-head { display: flex; justify-content: space-between; gap: .6rem; padding-bottom: .55rem; margin-bottom: .55rem; border-bottom: 3px solid #0f4c41; }
.si-head b { display: block; font-size: .92rem; color: #0f4c41; }
.si-head small { font-size: .75rem; color: #5f6d67; }
.si-ice { text-align: right; }
.si-ice b { font-size: .75rem; color: #1d2a26; font-variant-numeric: tabular-nums; }
.si-line, .si-total { display: flex; justify-content: space-between; gap: .6rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.si-line { padding: .34rem 0; border-bottom: 1px dashed #e2dccd; opacity: 0; animation: line-in 10s ease-out infinite; }
.si-line b { font-weight: 600; }
.si-l2 { animation-name: line-in-2; }
.si-l3 { animation-name: line-in-3; }
.si-total { padding-top: .55rem; font-weight: 700; font-size: .9rem; opacity: 0; animation: line-in-4 10s ease-out infinite; }
.si-stamp { position: absolute; right: 14px; bottom: 44px; padding: .12rem .55rem; border: 3px solid #1c7a54; border-radius: 6px; color: #1c7a54; font-weight: 800; font-size: 1.02rem; letter-spacing: .1em; transform: rotate(-12deg) scale(1.5); opacity: 0; animation: stamp-in 10s ease-out infinite; }

.scene-card { position: absolute; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px; padding: .75rem .9rem; backdrop-filter: blur(4px); box-shadow: 0 10px 28px rgba(0, 0, 0, .18); }
.scene-card small { display: block; font-size: .75rem; opacity: .88; }
.scene-chart { inset-inline-end: 0; top: 18px; width: min(240px, 44%); animation: scene-float 8s ease-in-out infinite reverse; }
.sc-bars { display: flex; align-items: flex-end; gap: 7px; height: 96px; margin-top: .5rem; }
.sc-col { flex: 1; display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.sc-col i { flex: 1; display: block; border-radius: 3px 3px 0 0; transform-origin: bottom; animation: bar-grow 5s ease-in-out infinite; animation-delay: var(--d); }
.bar-in { background: #7fdcc0; }
.bar-out { background: #e8b466; }
.scene-vat { inset-inline-end: 6%; top: 182px; width: min(236px, 44%); animation: scene-float 6s ease-in-out infinite; }
.scene-vat b { display: block; font-size: 1.22rem; color: #fff; font-variant-numeric: tabular-nums; margin: .1rem 0; text-align: start; }
.sc-trend { font-size: .75rem; color: #a7ecd6; }
.sc-trend::before { content: "✓ "; }
.scene-note { position: absolute; inset-inline-start: 0; bottom: 0; margin: 0; font-size: .75rem; opacity: .72; }

.auth-chips { position: relative; z-index: 1; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.auth-chips li { padding: .24rem .72rem; border: 1px solid rgba(255, 255, 255, .3); border-radius: 99px; font-size: .79rem; }

@keyframes scene-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes bar-grow { 0%, 100% { transform: scaleY(.82); } 50% { transform: scaleY(1); } }
@keyframes line-in { 0%, 4% { opacity: 0; transform: translateX(-8px); } 10%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes line-in-2 { 0%, 14% { opacity: 0; transform: translateX(-8px); } 20%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes line-in-3 { 0%, 24% { opacity: 0; transform: translateX(-8px); } 30%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes line-in-4 { 0%, 34% { opacity: 0; } 40%, 94% { opacity: 1; } 100% { opacity: 0; } }
@keyframes stamp-in { 0%, 48% { opacity: 0; transform: rotate(-12deg) scale(1.5); } 53%, 94% { opacity: .92; transform: rotate(-12deg) scale(1); } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .auth-visual * { animation: none !important; }
  .si-line, .si-total { opacity: 1; }
  .si-stamp { opacity: .92; transform: rotate(-12deg); }
}
@media (max-width: 980px) {
  .auth-page { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .auth-page .auth { min-height: 0; padding: 1rem 1rem 2rem; }
  .auth-visual { padding: 1.2rem 1rem; gap: .7rem; }
  .auth-intro h1 { font-size: 1.22rem; }
  .auth-intro p, .auth-scene { display: none; }
  .auth-chips li { font-size: .75rem; padding: .16rem .55rem; }
}

/* Effets de la page de connexion */
.scene-invoice { width: min(330px, 54%); z-index: 2; }
.scene-chart { width: min(250px, 40%); top: 0; }
.scene-vat { inset-inline-end: 0; top: 170px; width: min(250px, 40%); }
.auth-scene { transform: translate(calc(var(--mx, 0) * -18px), calc(var(--my, 0) * -14px)); transition: transform .25s ease-out; }
.scene-chart, .scene-vat { translate: calc(var(--mx, 0) * 14px) calc(var(--my, 0) * 10px); }

.auth-symbols { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.auth-symbols span { position: absolute; bottom: -40px; left: calc(4% + var(--i) * 9.6%); font-weight: 700; font-size: calc(.8rem + mod(var(--i), 3) * .28rem); color: #fff; opacity: 0; animation: symbol-rise calc(13s + var(--i) * .9s) linear infinite; animation-delay: calc(var(--i) * -2.1s); }
@keyframes symbol-rise { 0% { transform: translateY(0) rotate(-6deg); opacity: 0; } 12% { opacity: .2; } 85% { opacity: .14; } 100% { transform: translateY(-105vh) rotate(8deg); opacity: 0; } }

.si-scan { position: absolute; inset-inline: 0; top: 0; height: 46px; background: linear-gradient(180deg, transparent, rgba(44, 169, 135, .24), transparent); border-bottom: 2px solid rgba(28, 122, 84, .5); pointer-events: none; animation: invoice-scan 10s ease-in-out infinite; opacity: 0; }
@keyframes invoice-scan { 0%, 56% { top: -50px; opacity: 0; } 60% { opacity: 1; } 76% { top: 100%; opacity: 1; } 78%, 100% { top: 100%; opacity: 0; } }

.auth-intro { animation: rise-in .8s ease-out both; }
.auth-scene { animation: rise-in .9s .15s ease-out both; }
.auth-chips li { animation: rise-in .6s ease-out both; transition: background .2s, transform .2s; }
.auth-chips li:nth-child(1) { animation-delay: .35s; } .auth-chips li:nth-child(2) { animation-delay: .45s; }
.auth-chips li:nth-child(3) { animation-delay: .55s; } .auth-chips li:nth-child(4) { animation-delay: .65s; }
.auth-chips li:hover { background: rgba(255, 255, 255, .16); transform: translateY(-2px); }
@keyframes rise-in { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }

.auth-page .panel { animation: panel-in .7s .1s cubic-bezier(.2, .8, .2, 1) both; box-shadow: 0 18px 50px rgba(15, 76, 65, .13); transition: box-shadow .3s; }
.auth-page .panel:hover { box-shadow: 0 22px 60px rgba(15, 76, 65, .2); }
@keyframes panel-in { from { opacity: 0; transform: translateX(24px) scale(.985); } to { opacity: 1; transform: none; } }
[dir="rtl"] .auth-page .panel { animation-name: panel-in-rtl; }
@keyframes panel-in-rtl { from { opacity: 0; transform: translateX(-24px) scale(.985); } to { opacity: 1; transform: none; } }
.auth-page input { transition: border-color .2s, box-shadow .2s; }
.auth-page input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 76, 65, .14); outline: none; }
.auth-page button.primary { position: relative; overflow: hidden; transition: transform .15s, box-shadow .2s; }
.auth-page button.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15, 76, 65, .3); }
.auth-page button.primary:active { transform: translateY(0); }
.auth-page button.primary::after { content: ""; position: absolute; top: 0; bottom: 0; width: 60px; left: -90px; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .28), transparent); transform: skewX(-18deg); animation: button-shine 5s 1.2s ease-in-out infinite; }
@keyframes button-shine { 0%, 70% { left: -90px; } 100% { left: 110%; } }
.auth-page .brand { transition: letter-spacing .3s; }

@media (prefers-reduced-motion: reduce) {
  .auth-page *, .auth-page *::after, .auth-page *::before { animation: none !important; transition: none !important; }
  .auth-symbols { display: none; }
  .si-scan { display: none; }
}
@media (max-width: 980px) {
  .auth-symbols span { font-size: .7rem; }
}

/* Facture de la scène : position en arabe et place du tampon */
[dir="rtl"] .scene-invoice { left: auto; right: 0; }
.scene-invoice { padding-bottom: 3.3rem; }
.si-stamp { right: 14px; bottom: 10px; }

/* Tableau des dépenses */
.review-link { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: .8rem; color: var(--ink); text-decoration: none; font-weight: 500; }
.pill { display: inline-block; border: 1px solid var(--line); border-radius: 99px; padding: .02rem .5rem; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.pill-review { color: #a2256c; border-color: #eabfd8; background: #fdf1f8; }
.pill-info { color: #0b6f96; border-color: #8fd3ec; background: #effafe; }
.purchase-table tr.to-review td { background: #fdf4f9; }
.purchase-table tr.to-review:hover td { background: #f9e7f2; }
.clip svg { width: 18px; height: 18px; display: inline-block; vertical-align: middle; color: var(--muted); }
.clip:hover svg { color: var(--brand); }
.icon-btn { padding-inline: .6rem; }
.icon-btn svg { width: 18px; height: 18px; }
.search-row input[type="search"] { flex: 0 1 440px; }

/* Apparition des lignes */
.doc-table tbody tr { animation: row-in .35s ease-out both; }
.doc-table tbody tr:nth-child(1) { animation-delay: .02s; } .doc-table tbody tr:nth-child(2) { animation-delay: .05s; } .doc-table tbody tr:nth-child(3) { animation-delay: .08s; }
.doc-table tbody tr:nth-child(4) { animation-delay: .11s; } .doc-table tbody tr:nth-child(5) { animation-delay: .14s; } .doc-table tbody tr:nth-child(6) { animation-delay: .17s; }
.doc-table tbody tr:nth-child(7) { animation-delay: .2s; } .doc-table tbody tr:nth-child(8) { animation-delay: .23s; } .doc-table tbody tr:nth-child(n+9) { animation-delay: .26s; }
.doc-table td { transition: background .15s; }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Rapport */
.report-year { width: auto; margin: 0; min-height: 40px; }
.report-kpis .kpi { animation: rise-in .5s ease-out both; }
.report-kpis b small { font-weight: 500; font-size: .75rem; color: var(--muted); }
.report-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(4px, 1.4vw, 18px); height: 230px; }
.rc-col { position: relative; display: flex; flex-direction: column; height: 100%; min-width: 0; outline: none; border-radius: 6px; }
.rc-track { flex: 1; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--line); }
.rc-track i { display: block; width: min(100%, 34px); height: var(--h); min-height: 2px; border-radius: 4px 4px 0 0; transform-origin: bottom; animation: col-grow .7s calc(var(--i) * 45ms) cubic-bezier(.2, .8, .2, 1) both; }
.rc-track i.in { background: var(--income); }
.rc-track i.out { background: var(--expense); }
.rc-col small { text-align: center; color: var(--muted); font-size: .75rem; padding-top: .3rem; }
.rc-col:hover .rc-track i, .rc-col:focus-visible .rc-track i { filter: brightness(1.12); }
.rc-tip { position: absolute; bottom: calc(100% - 44px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .35rem .6rem; border-radius: 7px; font-size: .76rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 3; }
.rc-col:hover .rc-tip, .rc-col:focus-visible .rc-tip { opacity: 1; }
@keyframes col-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.stack { display: flex; gap: 2px; height: 22px; margin-bottom: .9rem; }
.stack i { display: block; width: var(--w); background: var(--c); transform-origin: left; animation: bar-in .7s calc(var(--i) * 90ms) cubic-bezier(.2, .8, .2, 1) both; }
.stack i:first-child { border-radius: 5px 0 0 5px; } .stack i:last-child { border-radius: 0 5px 5px 0; }
[dir="rtl"] .stack i { transform-origin: right; }
.state-table td { padding: .4rem .55rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: .45rem; }
.hbar { margin-bottom: .7rem; }
.hbar-head { display: flex; justify-content: space-between; gap: .8rem; font-size: .88rem; margin-bottom: .2rem; }
.hbar-head b { white-space: nowrap; font-weight: 600; }
.hbar-track { height: 7px; background: var(--paper); border-radius: 4px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; width: var(--w); background: var(--income); border-radius: 4px; transform-origin: left; animation: bar-in .8s cubic-bezier(.2, .8, .2, 1) both; }
[dir="rtl"] .hbar-track i { transform-origin: right; }
@keyframes bar-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Identité */
.logo img { display: block; height: 42px; width: auto; margin-bottom: .3rem; }
.brand-logo { height: 46px; width: auto; display: block; }
.choice-wide { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; margin-bottom: .9rem; }
.choice-wide button { min-height: 38px; font-size: .82rem; padding: .2rem; }
.choice-wide button.on { border: 2px solid var(--brand); background: var(--brand-soft); }
.rate-table td, .rate-table th { padding: .4rem .55rem; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { filter: brightness(0) invert(1); } }
@media (prefers-reduced-motion: reduce) {
  .doc-table tbody tr, .report *, .report-kpis .kpi { animation: none !important; }
}
@media print {
  .report .actions { display: none; }
  .report .banner { padding: 0; background: none; }
  .report * { animation: none !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Menu Plus */
.side-sep { border-top: 1px solid var(--line); margin: .25rem .4rem; }

/* Accès du comptable */
.access-choice { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); margin: .7rem 0; }
.access-card { position: relative; display: block; border: 1px solid var(--line); border-radius: 10px; padding: .75rem .85rem; cursor: pointer; }
.access-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, transparent); }
.access-card input { width: auto; margin-inline-end: .4rem; }
.access-card span { display: block; margin-top: .25rem; font-size: .84rem; font-weight: 400; color: var(--muted); }

/* Documents */
.docs-hero { display: flex; align-items: center; justify-content: center; gap: 1rem; text-align: center; margin: .3rem 0 1.3rem; flex-wrap: wrap; }
.docs-hero svg { width: 58px; height: 58px; flex: none; }
.docs-hero h1 { font-size: clamp(1.4rem, 3vw, 2.1rem); letter-spacing: -.02em; margin: 0; }
.docs-hero p { margin: .2rem 0 0; }
.docs-panels { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); margin-bottom: 1.1rem; }
.dropzone, .official-panel { border-radius: 12px; padding: 2rem 1.4rem; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; min-height: 340px; background: var(--surface); }
.dropzone { border: 1.5px dashed var(--muted); transition: background .15s, border-color .15s; }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.official-panel { border: 1px solid var(--brand); }
.dropzone h2, .official-panel h2 { margin: .3rem 0 0; font-size: 1.28rem; font-weight: 500; }
.dropzone p, .official-panel p { margin: 0; max-width: 56ch; }
.file-chips { display: flex; }
.file-chips i { font-style: normal; font-size: .75rem; font-weight: 700; background: #fff; color: #33433d; border: 1px solid var(--line); border-radius: 4px; padding: .55rem .3rem; margin-inline-start: -3px; box-shadow: 0 2px 5px rgba(0, 0, 0, .08); }
.file-chips i:nth-child(odd) { transform: rotate(-5deg); }
.file-chips i:nth-child(even) { transform: rotate(4deg); }
.drop-options { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; align-items: end; margin-top: .6rem; text-align: start; font-size: .85rem; }
.drop-options label { margin: 0; }
.drop-options .inline { display: flex; gap: .35rem; align-items: center; }
.drop-options .inline input { width: auto; }
.official-logos { display: flex; align-items: center; gap: .45rem; }
.official-logos svg { width: 42px; height: 42px; padding: 9px; border: 1px solid var(--line); border-radius: 50%; color: var(--brand); }
.official-logos i { width: 34px; border-top: 2px dotted var(--line); }
.center-row { justify-content: center; }

/* Export */
.export-layout { display: grid; gap: clamp(1rem, 3vw, 2.4rem); grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: start; }
.export-title { font-size: clamp(2rem, 4.6vw, 3.3rem); letter-spacing: -.03em; margin: .2rem 0 1rem; }
.accountant-box { background: var(--tone-violet); color: var(--tone-ink); border-radius: 10px; padding: 1.3rem 1.5rem; margin-top: 1.2rem; }
.accountant-box h2 { margin: 0 0 .4rem; }
.accountant-box .btn { background: #fff; color: var(--tone-ink); }
.export-group { border: 1px solid var(--line); border-radius: 10px; padding: .4rem 1rem .8rem; margin-bottom: .8rem; }
.check-row { display: flex; gap: .65rem; align-items: flex-start; padding: .5rem 0; margin: 0; cursor: pointer; font-weight: 400; }
.check-row input { width: 18px; height: 18px; flex: none; margin-top: .2rem; }
.check-row b { display: block; font-weight: 600; }
.check-row small { display: block; color: var(--muted); }
.export-period { border: 0; padding: 0; margin: .5rem 0 0; font-size: .9rem; }
.export-period legend { padding: 0; font-weight: 600; margin-bottom: .3rem; }
.export-period label { margin: 0; }
.export-go { justify-content: flex-end; }

/* Centre d'aide et coach */
.help-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(1rem, 3vw, 2.5rem); align-items: start; }
.help-nav { display: flex; flex-direction: column; gap: .15rem; position: sticky; top: 1rem; }
.help-nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .5rem; border-radius: 8px; color: inherit; text-decoration: none; font-size: .9rem; font-weight: 500; line-height: 1.3; }
.help-nav a:hover, .help-nav a.active { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.help-nav svg { width: 21px; height: 21px; flex: none; color: var(--brand); }
.help-nav svg:last-child { width: 15px; height: 15px; margin-inline-start: auto; color: var(--muted); }
[dir="rtl"] .help-nav svg:last-child { transform: scaleX(-1); }
.help-title { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.16; letter-spacing: -.01em; margin: .3rem 0 1.2rem; max-width: 22ch; }
.help-title.small { font-size: clamp(1.5rem, 3vw, 2.1rem); max-width: none; }
[dir="rtl"] .help-title { font-family: inherit; }
.help-lead { margin-top: -.6rem; }
.help-search { position: relative; max-width: 440px; margin-bottom: 1.6rem; }
.help-search svg { position: absolute; inset-inline-start: .75rem; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.help-search input { width: 100%; padding-inline-start: 2.4rem; min-height: 46px; border-radius: 9px; }
.help-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); margin-bottom: 1.2rem; }
.help-card { display: block; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 1rem 1.15rem; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.help-card:hover { border-color: var(--brand); box-shadow: 0 6px 18px rgba(0, 0, 0, .08); }
.help-card b { display: block; margin-bottom: .4rem; }
.help-card span { display: block; color: var(--muted); font-size: .88rem; }
.help-card.tile { padding: 0 0 1rem; }
.help-card.tile i { display: block; padding: .9rem 1.15rem; border-bottom: 1px solid var(--line); margin-bottom: .9rem; color: var(--brand); }
.help-card.tile i svg { width: 27px; height: 27px; display: block; }
.help-card.tile b, .help-card.tile span { padding-inline: 1.15rem; }
.help-article { max-width: 70ch; }
.help-article p { line-height: 1.7; }
.help-contact { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .92rem; }
.deadlines { list-style: none; padding: 0; margin: 0 0 .8rem; }
.deadlines li { display: flex; align-items: center; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.deadlines li > span:nth-child(2) { flex: 1; }
.deadlines small { display: block; }
.deadline-date { width: 104px; flex: none; }
.deadline-date small { color: var(--muted); }
.mini-table { margin-top: .4rem; font-size: .84rem; }
@media (max-width: 820px) {
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-nav { position: static; order: 2; border-top: 1px solid var(--line); padding-top: .8rem; }
}

/* Offres */
.notice.trial { background: color-mix(in srgb, var(--brand) 10%, var(--surface)); border-color: var(--brand); }
.offer-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); margin: 1.1rem 0; }
.offer { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; padding: 1.3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.offer h2 { margin: 0; }
.offer.featured { border: 2px solid var(--brand); }
.offer.current { background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.offer-price { margin: 0; }
.offer-price b { font-size: 1.9rem; letter-spacing: -.02em; }
.offer-list { padding-inline-start: 1.1rem; margin: .3rem 0 .8rem; flex: 1; }
.offer-list li { margin-bottom: .3rem; }
.order-panel { border: 2px solid var(--brand); }
.order-panel h3 { margin: 1rem 0 .5rem; }
.pay-details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0 0 1rem; padding: .9rem 1rem; background: var(--paper); border-radius: 8px; }
.pay-details dt { color: var(--muted); }
.pay-details dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pay-rib { font-family: Consolas, "Courier New", monospace; letter-spacing: .03em; }
.hp-field { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }

/* Connexion avec Google et données à compléter */
.google-btn { display: flex; width: 100%; justify-content: center; align-items: center; gap: .6rem; background: #fff; color: #1f1f1f; border: 1px solid #747775; font-weight: 600; margin: .7rem 0 .4rem; }
.google-btn svg { width: 18px; height: 18px; flex: none; }
.or-line { display: flex; align-items: center; gap: .7rem; margin: .8rem 0; color: var(--muted); font-size: .85rem; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.center-text { text-align: center; margin: .2rem 0; }
.complete-page { max-width: 820px; margin-inline: auto; }
.partner-ice { margin: .35rem 0; font-size: .82rem; display: flex; flex-wrap: wrap; gap: .3rem .5rem; align-items: center; }

/* Contrôle des factures */
.period-bar label { display: inline-flex; align-items: center; gap: .4rem; }
.period-bar input { width: auto; }
.issue { padding: .7rem 0; border-top: 1px solid var(--line); }
.issue:first-of-type { border-top: 0; }
.issue-list { margin: .4rem 0 0; padding-inline-start: 1.1rem; font-size: .9rem; }
.count-bad { color: #a3261c; }
.count-warn { color: #96590e; }

/* Accueil : graphiques */
.home-grid.three { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); align-items: start; }
.profit-card { margin-top: 1rem; }
.profit-svg { display: block; width: 100%; height: auto; max-height: 340px; margin-top: .7rem; }
.profit-svg .grid { stroke: var(--line); stroke-width: 1; }
.profit-svg .grid.zero { stroke: var(--muted); }
.profit-svg .tick { fill: var(--muted); font-size: 11px; }
.profit-svg .area { fill: var(--income); opacity: .1; animation: fade-in 1s ease-out .6s both; }
.profit-svg .line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.profit-svg .current { stroke: var(--income); stroke-width: 2.5; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw-line 1.4s ease-out forwards; }
.profit-svg .previous { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 5; opacity: .75; }
.profit-svg .dot { fill: var(--surface); stroke: var(--income); stroke-width: 2.5; animation: fade-in .3s ease-out 1.3s both; }
.profit-svg .hit { fill: transparent; }
.profit-svg .hit:hover, .profit-svg .hit:focus { fill: color-mix(in srgb, var(--income) 10%, transparent); outline: none; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } }
.key { display: inline-flex; align-items: center; gap: .35rem; font-size: .84rem; color: var(--muted); }
.key-line { width: 20px; border-top: 2.5px solid var(--income); }
.key-line.dashed { border-top: 2px dashed var(--muted); }
.home-bars { display: grid; gap: .25rem; margin-top: .5rem; }
.home-bar { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) 7.5rem; gap: .7rem; align-items: center; min-height: 28px; font-size: .88rem; color: inherit; text-decoration: none; }
.home-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-bar i { display: block; height: 8px; width: var(--v); min-width: 2px; background: var(--expense); border-start-end-radius: 4px; border-end-end-radius: 4px; transform-origin: left; animation: grow-x .9s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 60ms); }
[dir="rtl"] .home-bar i { transform-origin: right; }
.home-bar b { text-align: end; font-variant-numeric: tabular-nums; }
@keyframes grow-x { from { transform: scaleX(0); } }
@media (max-width: 820px) { .home-bar { grid-template-columns: minmax(0, 8rem) minmax(0, 1fr) 6.2rem; } }
@media (prefers-reduced-motion: reduce) {
  .profit-svg .current { animation: none; stroke-dashoffset: 0; stroke-dasharray: none; }
  .profit-svg .area, .profit-svg .dot, .home-bar i { animation: none; }
}
.complete-shell { min-height: 100dvh; padding: clamp(1rem, 3vw, 2.5rem) 1rem; background: var(--paper); }
.complete-page .brand-logo { height: 42px; width: auto; }
.complete-page h1 { margin-top: 0; }

/* Un element marque hidden reste cache, meme si un style lui donne un affichage. */
[hidden] { display: none !important; }

/* Champs obligatoires */
label:has(> input:required, > select:required, > textarea:required)::before { content: "* "; color: #e00000; font-weight: 800; font-size: 1.1em; }
.field-error { border-color: #b3261e !important; box-shadow: 0 0 0 2px color-mix(in srgb, #b3261e 20%, transparent); }
.field-msg { display: block; margin-top: .25rem; color: #b3261e; font-weight: 600; }

/* Téléphone, tablette et écrans tactiles */
@media (max-width: 640px) { .hide-mobile { display: none; } }
@media (max-width: 820px) {
  /* Sous 16 px, iOS zoome la page à chaque saisie. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px; }
}
@media (pointer: coarse) {
  button.mini, .btn.mini, .seg button, .seg a, .sheet-meta input { min-height: 40px; }
  button.link { min-height: 36px; }
  .tabs a { display: inline-flex; align-items: center; min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
}
/* Une carte seule sur sa ligne occupe toute la largeur au lieu de laisser un vide. */
.grid.two > :last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 1240px) { .home-grid.three > :last-child:nth-child(3) { grid-column: 1 / -1; } }
.auth { overflow-x: clip; }

/* Formulaire revendeur et projet : panneau plus large, champs et textes plus grands, deux colonnes sur ordinateur. */
/* 50 % de l'écran pour l'animation ; le formulaire prend 40 %, avec 5 % de marge de chaque côté. */
.auth-page.wide { grid-template-columns: 50% 50%; }
/* La colonne fait 50 % : 10 % de marge de chaque côté = 5 % de l'écran, le formulaire garde 80 % = 40 %. */
.auth-page.wide .auth { padding: 2rem 10%; place-items: center stretch; }
.auth-page.wide .panel { width: 100%; padding: clamp(1.4rem, 3vw, 2.4rem); }
.auth-page.wide .panel h2 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); margin-bottom: .4rem; }
.auth-page.wide .panel > p.muted { font-size: 1.02rem; }
.big-form label { font-size: 1rem; margin-bottom: 1rem; }
.big-form label small { font-size: .84rem; margin-top: .1rem; }
.big-form input, .big-form select, .big-form textarea { font-size: 1.06rem; min-height: 52px; padding: .75rem .9rem; border-radius: 10px; margin-top: .35rem; }
.big-form textarea { min-height: 150px; line-height: 1.5; }
.big-form input[type="file"] { min-height: 0; padding: .7rem; background: #fbfaf6; border-style: dashed; cursor: pointer; }
.big-form input:focus, .big-form select:focus, .big-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 76, 65, .14); outline: none; }
.big-form button.big { min-height: 54px; font-size: 1.08rem; }
.big-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
@media (max-width: 1100px) { .auth-page.wide { grid-template-columns: minmax(0, 1fr); } .auth-page.wide .auth { padding: 1rem 1rem 2rem; } .auth-page.wide .auth-scene { display: none; } }
@media (max-width: 620px) { .big-grid { grid-template-columns: minmax(0, 1fr); } }
/* Scènes de la page de connexion : la facture (6 s), puis chaque service (5 s), en fondu. */
.auth-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s .5s; }
.auth-slide.on { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.auth-slide-label { position: absolute; top: -2.1rem; inset-inline-start: 0; z-index: 3; font-size: .78rem; font-weight: 700; letter-spacing: .04em; color: #0f4c41; background: #f3c67c; border-radius: 99px; padding: .2rem .7rem; }
.auth-dots { position: absolute; inset-inline-end: 0; bottom: 0; display: flex; gap: .35rem; z-index: 3; }
.auth-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .35); transition: background .3s, transform .3s; }
.auth-dots i.on { background: #f3c67c; transform: scale(1.35); }
.auth-scene { margin-top: 2.1rem; }
/* Le document d'un service se remplit en 5 s : même animation que la facture, en plus court. */
.svc-slide .si-line, .svc-slide .si-total, .svc-slide .si-stamp, .svc-slide .si-scan { animation-duration: 8s; }
.svc-slide .si-head small { display: flex; align-items: center; gap: .35rem; }
.si-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2ca987; box-shadow: 0 0 0 0 rgba(44, 169, 135, .6); animation: live-dot 1.4s ease-out infinite; }
@keyframes live-dot { to { box-shadow: 0 0 0 9px rgba(44, 169, 135, 0); } }
.svc-slide .scene-vat b { font-size: 1.1rem; }
@media (prefers-reduced-motion: reduce) { .auth-dots, .auth-slide-label { display: none; } }
/* Menu du site en haut des pages de connexion et des formulaires, avec le choix de la langue. */
.auth-top { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 1.2rem; min-height: 64px; padding: .5rem clamp(1rem, 3vw, 2.4rem); background: rgba(255, 253, 248, .94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); box-shadow: 0 4px 18px rgba(15, 76, 65, .06); }
.auth-top-logo img { display: block; height: 36px; width: auto; }
.auth-top-nav { display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; margin-inline-start: auto; }
.auth-top-nav a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; padding: .3rem 0; border-bottom: 2px solid transparent; }
.auth-top-nav a:hover { color: var(--brand); border-bottom-color: #d99a3e; }
.auth-top-end { display: flex; align-items: center; gap: .6rem; }
.auth-top-end .lang-select { width: auto; min-height: 38px; margin: 0; padding: .3rem .5rem; }
.auth-top-end .btn { white-space: nowrap; }
.auth-top-more { display: none; position: relative; }
.auth-top-more summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--line); }
.auth-top-more summary::-webkit-details-marker { display: none; }
.auth-top-more summary span, .auth-top-more summary span::before, .auth-top-more summary span::after { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; }
.auth-top-more summary span::before, .auth-top-more summary span::after { content: ""; position: absolute; left: 0; }
.auth-top-more summary span::before { top: -6px; } .auth-top-more summary span::after { top: 6px; }
.auth-top-more nav { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); display: grid; min-width: 220px; padding: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 36px rgba(15, 76, 65, .18); }
.auth-top-more nav a { padding: .65rem .8rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.auth-top-more nav a:hover { background: #f1efe7; }
.auth-top ~ .auth-page { min-height: calc(100dvh - 64px); }
@media (max-width: 1180px) {
  .auth-top-nav { display: none; }
  .auth-top-end { margin-inline-start: auto; }
  .auth-top-more { display: block; }
}
@media (max-width: 560px) { .auth-top-end .btn { display: none; } .auth-top-logo img { height: 30px; } }
/* Assistant IA de my.m2m.ma : même fenêtre que sur les plateformes. */
.assistant { position: fixed; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 45; }
.assistant [hidden] { display: none; }
.assistant-open { display: flex; align-items: center; gap: .45rem; min-height: 50px; padding: .5rem 1.05rem; border: 0; border-radius: 99px; background: var(--brand); color: #fff; font-weight: 650; box-shadow: 0 10px 28px rgba(15, 76, 65, .35); cursor: pointer; }
.assistant-open svg { width: 22px; height: 22px; }
.assistant-panel { display: flex; flex-direction: column; width: min(390px, calc(100vw - 32px)); height: min(560px, calc(100dvh - 96px)); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.assistant-head { display: flex; align-items: center; justify-content: space-between; padding: .3rem .4rem .3rem 1rem; background: var(--brand); color: #fff; }
.assistant-close { width: 44px; height: 44px; border: 0; background: none; color: inherit; font-size: 1.5rem; cursor: pointer; }
.assistant-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; padding: .8rem; background: var(--paper, #f6f3ea); }
.assistant-msg { margin: 0; padding: .5rem .75rem; max-width: 88%; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .93rem; }
.assistant-msg.bot { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.assistant-msg.me { align-self: flex-end; background: var(--brand); color: #fff; }
.assistant-msg.wait { color: var(--muted); font-style: italic; }
.assistant-form { display: flex; gap: .4rem; padding: .55rem; border-top: 1px solid var(--line); }
.assistant-form input { flex: 1; min-width: 0; margin: 0; font-size: 16px; }
.assistant-form button { margin: 0; }
.assistant-note { margin: 0; padding: 0 .7rem .55rem; color: var(--muted); font-size: .75rem; line-height: 1.35; }
/* Sur téléphone, le bouton passe au-dessus de la barre de navigation du bas. */
@media (max-width: 900px) { .assistant { bottom: calc(84px + env(safe-area-inset-bottom)); } .assistant-open span { display: none; } .assistant-open { padding: .5rem .85rem; } }
@media print { .assistant, .app-badges { display: none !important; } }

/* Icônes des applications mobiles, en bas des pages. */
.app-badges { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .6rem 1rem; margin: 2rem 0 1rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
/* Seul le titre prend toute la largeur : les icônes « Bientôt sur » (aussi des span) restent côte à côte, centrées. */
.app-badges > .app-badges-title { width: 100%; text-align: center; }
.app-badge { justify-content: flex-start; }
.app-badge { display: inline-flex; align-items: center; gap: .6rem; min-width: 170px; padding: .5rem 1rem; border-radius: 12px; background: #10231e; color: #fff; text-decoration: none; transition: transform .15s, box-shadow .2s; }
.app-badge svg { width: 26px; height: 26px; flex: none; }
.app-badge small { display: block; font-size: .7rem; opacity: .8; line-height: 1.1; }
.app-badge b { display: block; font-size: 1.05rem; line-height: 1.15; }
a.app-badge:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16, 35, 30, .25); }
.app-badge.soon { background: #e9e5da; color: #4c5f58; }
.auth .app-badges { width: min(480px, 100%); margin-top: 1.4rem; }
.auth-page.wide .auth .app-badges { width: 100%; }
/* ---- Activités : chaque section a sa couleur, sur téléphone comme dans les bandeaux ---- */
.shell { --sec: #0f4c41; --sec-soft: #e7f0ec; --sec-ink: #10231e; }
.shell[data-section="accueil"] { --sec: #6d45c9; --sec-soft: #ece4fb; --sec-ink: #2b1660; }
.shell[data-section="banque"] { --sec: #2d7fc1; --sec-soft: #d6e9f8; --sec-ink: #0d2f4d; }
.shell[data-section="ventes"] { --sec: #3f8a1f; --sec-soft: #d9f2c8; --sec-ink: #173d0a; }
.shell[data-section="achats"] { --sec: #c42f8c; --sec-soft: #fadcee; --sec-ink: #4f0f37; }
.shell[data-section="tva"] { --sec: #7b5fd6; --sec-soft: #e6defb; --sec-ink: #2c1d66; }
.bottom-nav .nav-badge { position: absolute; top: .2rem; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 .3rem; border-radius: 99px; background: #fde2e1; color: #b3261e; font-size: .68rem; line-height: 18px; text-align: center; }

@media (max-width: 820px) {
  /* Barre du haut et bandeau de la page aux couleurs de l'activité. */
  .shell[data-section] .top-mobile { background: var(--sec); color: #fff; }
  .shell[data-section=""] .top-mobile { background: var(--brand); }
  .shell[data-section]:not([data-section=""]) .banner { background: var(--sec-soft); color: var(--sec-ink); flex-direction: column; align-items: center; text-align: center; border-radius: 0 0 22px 22px; margin: -1rem -1rem 1rem; padding: 1.2rem 1rem 1.4rem; }
  .shell[data-section]:not([data-section=""]) .banner h1 { font-size: 1.05rem; padding: .25rem .9rem; border-radius: 99px; background: rgba(255, 255, 255, .7); }
  .shell[data-section]:not([data-section=""]) .banner .banner-kpis { justify-content: center; }
  .shell[data-section]:not([data-section=""]) .banner .banner-kpis > div:first-child b { font-size: 1.9rem; }
  /* Menu du bas : cinq activités, l'active prend sa couleur. */
  .bottom-nav a { position: relative; text-transform: uppercase; font-size: .66rem; letter-spacing: .02em; }
  .bottom-nav a.active { color: var(--sec); }
  .bottom-nav a.active svg { stroke-width: 2.3; }
  .bottom-nav .sec-accueil.active { color: #6d45c9; } .bottom-nav .sec-banque.active { color: #2d7fc1; } .bottom-nav .sec-ventes.active { color: #3f8a1f; } .bottom-nav .sec-achats.active { color: #c42f8c; } .bottom-nav .sec-tva.active { color: #7b5fd6; }
  .quick { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .quick-sheet { inset: 0 0 calc(140px + env(safe-area-inset-bottom)); }
  /* L'assistant passe à gauche pour laisser la place au « + ». */
  .assistant { inset-inline-end: auto; inset-inline-start: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); }
}
/* Bouton « + » et feuille d'actions de l'activité, sur téléphone comme sur ordinateur.
   Sur ordinateur, il se place au-dessus de l'assistant, en bas à droite. */
.quick { position: fixed; inset-inline-end: 16px; bottom: 88px; z-index: 40; }
.quick-fab { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--sec), var(--sec-2, var(--sec))); color: #fff; box-shadow: 0 10px 24px color-mix(in srgb, var(--sec) 40%, transparent); cursor: pointer; transition: transform .2s; }
.quick-fab svg { width: 30px; height: 30px; stroke-width: 2.2; }
.quick.open .quick-fab { transform: rotate(45deg); background: #fff; color: var(--sec); border: 2px solid color-mix(in srgb, var(--sec) 30%, #fff); }
.quick-sheet { position: fixed; inset: 0 0 160px; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-end; gap: .9rem; padding: 1rem 16px; pointer-events: none; }
.quick-sheet:not([hidden]) { pointer-events: auto; }
.quick-item { display: flex; align-items: center; gap: 1rem; padding: 0; border: 0; background: none; color: var(--ink); text-decoration: none; font-size: 1rem; font-weight: 500; cursor: pointer; animation: quick-in .22s ease-out both; animation-delay: calc(var(--i) * 35ms); }
.quick-label { text-align: end; }
.quick-icon { display: grid; place-items: center; width: 56px; height: 56px; flex: none; border-radius: 50%; background: linear-gradient(135deg, var(--sec), var(--sec-2, var(--sec))); color: #fff; box-shadow: 0 8px 18px color-mix(in srgb, var(--sec) 35%, transparent); }
.quick-icon svg { width: 26px; height: 26px; }
.quick-item:hover .quick-icon { transform: scale(1.06); }
body.quick-open::before { content: ""; position: fixed; inset: 0; z-index: 39; background: color-mix(in srgb, var(--sec-soft, #fff) 70%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
body.quick-open { overflow: hidden; }
@media (min-width: 821px) { .quick { inset-inline-end: 24px; } .quick-sheet { padding-inline-end: 24px; } }
@keyframes quick-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .quick-item, .quick-fab { animation: none; transition: none; } }
/* ---- Page de connexion : Google, puis e-mail et mot de passe avec icônes ---- */
.login-form .google-btn { min-height: 54px; border: 0; border-radius: 12px; background: #eeeef0; color: #1f1f1f; font-size: 1.02rem; font-weight: 600; }
.login-form .google-btn:hover { background: #e4e4e8; }
.login-form .or-line { margin: 1.2rem 0; text-transform: capitalize; }
.login-form label { font-size: .98rem; font-weight: 600; margin-bottom: 1rem; }
.field-icon { position: relative; display: block; margin-top: .4rem; }
.field-icon > svg { position: absolute; inset-inline-start: .9rem; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field-icon input { margin: 0; min-height: 52px; padding-inline-start: 2.9rem; border-radius: 12px; font-size: 1.02rem; }
.field-icon .field-eye { position: absolute; inset-inline-end: .35rem; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.field-icon .field-eye svg { width: 22px; height: 22px; }
.field-icon .field-eye[aria-pressed="true"] { color: var(--brand); }
.field-icon:has(.field-eye) input { padding-inline-end: 3.2rem; }
.login-submit { width: 100%; min-height: 54px; margin-top: .4rem; border-radius: 12px; font-size: 1.05rem; }
.login-forgot, .login-new, .login-legal { text-align: center; margin: 1.1rem 0 0; }
.login-forgot a { color: var(--muted); }
.login-new { font-size: 1.02rem; color: var(--muted); margin-top: 1.8rem; }
.login-new a { font-weight: 700; color: var(--brand); text-decoration: none; }
.login-legal a { font-size: .85rem; color: var(--muted); }@media (max-width: 820px) {
  .auth-page .auth .panel:has(.login-form) { border: 0; background: transparent; box-shadow: none; padding: .4rem .2rem 1rem; }
  .auth-page .auth .panel:has(.login-form) > p.muted:first-child { display: none; }
}
.login-new a { white-space: nowrap; }
/* Bandeaux de l'accueil (mauve) et de la banque (bleu ciel), comme les autres activités. */
:root { --tone-mauve: #e6dcfb; --tone-sky: #d3e8f8; }
.tone-mauve { background: var(--tone-mauve); } .tone-sky { background: var(--tone-sky); }
/* ---- Palette des activités (v2) : un dégradé par activité, des couleurs bien distinctes ----
   Accueil violet · Banque bleu océan · Revenus émeraude · Dépenses rose corail · Taxes ambre. */
.shell[data-section="accueil"] { --sec: #6d4ae8; --sec-2: #a855f7; --sec-soft: #f1ebff; --sec-ink: #2e1a6e; }
.shell[data-section="banque"]  { --sec: #1b6fe0; --sec-2: #22b8f0; --sec-soft: #e6f3ff; --sec-ink: #0b2f5c; }
.shell[data-section="ventes"]  { --sec: #0e9f6e; --sec-2: #34d399; --sec-soft: #e3f9ef; --sec-ink: #063f2b; }
.shell[data-section="achats"]  { --sec: #e2376f; --sec-2: #fb7185; --sec-soft: #ffe9f0; --sec-ink: #5c0f29; }
.shell[data-section="tva"]     { --sec: #e07a0b; --sec-2: #fbbf24; --sec-soft: #fff4e2; --sec-ink: #5a3204; }

/* Ordinateur : bandeau clair aux couleurs de l'activité, avec un filet coloré. */
.shell[data-section]:not([data-section=""]) .banner { background: linear-gradient(120deg, var(--sec-soft), #ffffff 85%); color: var(--sec-ink); border: 1px solid color-mix(in srgb, var(--sec) 18%, transparent); border-inline-start: 5px solid var(--sec); }
.shell[data-section]:not([data-section=""]) .banner .btn.dark { background: linear-gradient(135deg, var(--sec), var(--sec-2)); color: #fff; border: 0; box-shadow: 0 6px 16px color-mix(in srgb, var(--sec) 35%, transparent); }

@media (max-width: 820px) {
  /* Barre du haut et bandeau en dégradé, textes en blanc. */
  .shell[data-section]:not([data-section=""]) .top-mobile { background: linear-gradient(120deg, var(--sec), var(--sec-2)); color: #fff; }
  .shell[data-section]:not([data-section=""]) .banner { background: linear-gradient(160deg, var(--sec) 0%, var(--sec-2) 100%); color: #fff; border: 0; border-radius: 0 0 28px 28px; box-shadow: 0 12px 28px color-mix(in srgb, var(--sec) 30%, transparent); position: relative; overflow: hidden; }
  .shell[data-section]:not([data-section=""]) .banner::after { content: ""; position: absolute; width: 220px; height: 220px; inset-inline-end: -70px; top: -90px; border-radius: 50%; background: rgba(255, 255, 255, .14); pointer-events: none; }
  .shell[data-section]:not([data-section=""]) .banner h1 { background: rgba(255, 255, 255, .2); color: #fff; backdrop-filter: blur(4px); }
  .shell[data-section]:not([data-section=""]) .banner .banner-kpis span { color: rgba(255, 255, 255, .85); }
  .shell[data-section]:not([data-section=""]) .banner .banner-kpis b { color: #fff; }
  .shell[data-section]:not([data-section=""]) .banner .btn { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .45); }
  .shell[data-section]:not([data-section=""]) .banner .btn.dark { background: #fff; color: var(--sec-ink); border: 0; box-shadow: 0 6px 16px rgba(0, 0, 0, .15); }
  /* Menu du bas : l'activité ouverte prend sa couleur, avec une pastille douce derrière l'icône. */
  .bottom-nav a svg { padding: 3px 14px; border-radius: 99px; box-sizing: content-box; transition: background .2s; }
  .bottom-nav .sec-accueil.active { color: #6d4ae8; } .bottom-nav .sec-accueil.active svg { background: #f1ebff; }
  .bottom-nav .sec-banque.active { color: #1b6fe0; } .bottom-nav .sec-banque.active svg { background: #e6f3ff; }
  .bottom-nav .sec-ventes.active { color: #0e9f6e; } .bottom-nav .sec-ventes.active svg { background: #e3f9ef; }
  .bottom-nav .sec-achats.active { color: #e2376f; } .bottom-nav .sec-achats.active svg { background: #ffe9f0; }
  .bottom-nav .sec-tva.active { color: #e07a0b; } .bottom-nav .sec-tva.active svg { background: #fff4e2; }
}/* Boutons principaux et éléments sélectionnés de la page : aux couleurs de l'activité. */
.shell[data-section]:not([data-section=""]) main button.primary,
.shell[data-section]:not([data-section=""]) main .btn.primary { background: linear-gradient(135deg, var(--sec), var(--sec-2)); border-color: transparent; color: #fff; }
.shell[data-section]:not([data-section=""]) .bank-card.active { border-color: var(--sec); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 15%, transparent); }
.shell[data-section]:not([data-section=""]) .tabs a.active { color: var(--sec); border-color: var(--sec); }
.shell[data-section]:not([data-section=""]) .todo .badge.brand { background: var(--sec-soft); color: var(--sec-ink); }
/* Graphique du bandeau de l'accueil : aux couleurs de l'activité sur ordinateur, en blanc sur le dégradé du téléphone. */
.banner-chart { flex-basis: 100%; width: 100%; max-width: 720px; margin-inline: auto; }
.banner-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.banner-legend { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; font-size: .9rem; margin-bottom: .3rem; }
.banner-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.banner-legend .faded { opacity: .7; }
.banner-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }
.dot-full { background: var(--sec, var(--brand)); }
.dot-dash { border: 2px dashed var(--sec, var(--brand)); box-sizing: border-box; }
.bc-zero { stroke: color-mix(in srgb, var(--sec, var(--brand)) 25%, transparent); stroke-width: 1; }
.bc-prev { fill: none; stroke: var(--sec, var(--brand)); stroke-width: 2; stroke-dasharray: 5 5; opacity: .45; }
.bc-area { fill: color-mix(in srgb, var(--sec, var(--brand)) 14%, transparent); }
.bc-cur { fill: none; stroke: var(--sec, var(--brand)); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: bc-draw 1.2s ease-out .2s forwards; }
.bc-dot { fill: #fff; stroke: var(--sec, var(--brand)); stroke-width: 3; }
.bc-month { fill: currentColor; opacity: .6; font-size: 10px; }
@keyframes bc-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .bc-cur { animation: none; stroke-dashoffset: 0; } }
@media (max-width: 820px) {
  .shell[data-section]:not([data-section=""]) .banner-chart { margin-top: .2rem; }
  .shell[data-section]:not([data-section=""]) .dot-full { background: #fff; }
  .shell[data-section]:not([data-section=""]) .dot-dash { border-color: #fff; }
  .shell[data-section]:not([data-section=""]) .bc-zero { stroke: rgba(255, 255, 255, .25); }
  .shell[data-section]:not([data-section=""]) .bc-prev { stroke: #fff; opacity: .55; }
  .shell[data-section]:not([data-section=""]) .bc-area { fill: rgba(255, 255, 255, .14); }
  .shell[data-section]:not([data-section=""]) .bc-cur { stroke: #fff; }
  .shell[data-section]:not([data-section=""]) .bc-dot { fill: var(--sec); stroke: #fff; }
}
/* Banque : choix du mode de mise à jour et état de la synchronisation automatique. */
fieldset.choice { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; margin: 0 0 .9rem; }
fieldset.choice legend { font-size: .84rem; font-weight: 600; padding: 0 .3rem; }
fieldset.choice label { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: .35rem 0; }
fieldset.choice input { width: auto; min-height: 0; margin: 0; }
.sync-status { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .8rem; margin-top: .7rem; padding: .55rem .8rem; border-radius: 10px; font-size: .9rem; }
.sync-status.good { background: #e3f9ef; color: #063f2b; } .sync-status.bad { background: #fde8e6; color: #7a1c12; }
.sync-status .link { margin-inline-start: auto; }
/* Flèche de retour dans la barre du haut (téléphone et application). */
.top-mobile .top-back { color: inherit; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-inline-start: -.4rem; border-radius: 50%; }
.top-back:active { background: rgba(255, 255, 255, .2); }
.top-back svg { width: 24px; height: 24px; }
[dir="rtl"] .top-back svg { transform: scaleX(-1); }
/* Choix du client ou du fournisseur : champ de recherche et suggestions juste en dessous. */
.combo { position: relative; }
.combo input#partner-search { width: 100%; min-height: 48px; font-size: 1rem; }
.combo-list { position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); margin: 0; padding: .3rem 0; list-style: none; max-height: 320px; overflow-y: auto; background: var(--surface, #fff); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 28px rgba(0, 0, 0, .14); }
.combo-list li { display: flex; flex-direction: column; gap: .1rem; padding: .7rem .95rem; cursor: pointer; }
.combo-list li small { color: var(--muted); }
.combo-list li:hover, .combo-list li.active { background: var(--sec-soft, #eef4f1); }
.combo-list .combo-empty { color: var(--muted); cursor: default; }
.combo-list .combo-empty:hover { background: none; }
.combo-list .combo-add { flex-direction: row; align-items: center; gap: .5rem; font-weight: 700; color: var(--sec, var(--brand)); border-top: 1px solid var(--line); }
.combo-list .combo-add svg { width: 20px; height: 20px; flex: none; }
.combo-list .combo-add q { font-weight: 600; }
.combo-list { min-width: min(92vw, 340px); }
.combo-list .combo-add { position: sticky; bottom: -.3rem; background: var(--surface, #fff); padding-block: .85rem; }
@media (max-width: 820px) {
  /* Recherche du client : le champ s'arrête sous la barre du haut, le menu du bas et le « + » s'effacent pendant la saisie. */
  #partner-search { scroll-margin-top: 96px; }
  .shell:has(.combo input:focus) .bottom-nav, .shell:has(.combo input:focus) .quick { display: none; }
}
/* Lignes de facture : nature (produit ou service) et remise en pourcentage. */
.lines .line, .lines-head { grid-template-columns: 2.2fr .65fr .95fr .7fr .75fr 1.4fr 1fr 34px; }
/* Produit ou service : au-dessus de la ligne, sur toute la largeur. */
.lines .line > .line-kind { grid-column: 1 / -1; justify-self: start; }
.line-kind { display: inline-flex; align-self: center; border: 1px solid var(--line); border-radius: 99px; padding: 2px; background: var(--surface, #fff); }
.line-kind button { border: 0; background: none; padding: .3rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; color: var(--muted); min-height: 0; cursor: pointer; }
.line-kind button.on { background: var(--sec, var(--brand)); color: #fff; }
.line-total s { font-weight: 400; font-size: .85em; }
@media (max-width: 820px) {
  .lines .line { grid-template-columns: 1fr 1fr; }
  .lines .line > :nth-child(2) { grid-column: 1 / -1; }
  .line-kind { justify-self: start; }
  .line-kind button { padding: .45rem 1rem; font-size: .9rem; }
}
/* Date d'une vente : celle du jour, affichée sans pouvoir être changée. */
input.locked-date { background: var(--bg, #f6f4ee); color: var(--ink); cursor: default; pointer-events: none; }
/* Inscription : choix de l'offre et des produits. */
.signup-offers { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem .8rem; margin: 0 0 .9rem; }
.signup-offers legend { font-weight: 700; padding: 0 .3rem; }
.signup-offers legend small { font-weight: 400; color: var(--muted); }
.offer-choice { display: flex; align-items: center; gap: .7rem; margin: .45rem 0 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 400; }
.offer-choice input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--brand); }
.offer-choice span { display: flex; flex-direction: column; }
.offer-choice small { color: var(--muted); }
.offer-choice:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }
/* Historique de connexion : appareil avec son icône ; la fenêtre s'élargit pour le tableau. */
.login-device { display: inline-flex; align-items: center; gap: .4rem; }
.login-device svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
#modal:has(.login-table) { width: min(960px, 96vw); max-width: 96vw; }
/* Paiement d'une facture : opérations trouvées dans les relevés, puis choix du mode. */
.pay-found { border: 1px solid color-mix(in srgb, var(--good, #1d7a4f) 35%, transparent); background: color-mix(in srgb, var(--good, #1d7a4f) 6%, transparent); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .6rem; }
.pay-found h3 { display: flex; align-items: center; gap: .4rem; margin: 0 0 .5rem; font-size: 1rem; }
.pay-found h3 svg { width: 20px; height: 20px; }
.pay-match { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.pay-match:first-of-type { border-top: 0; }
.pay-or { margin: .4rem 0 .6rem; }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; border: 0; padding: 0; margin: 0 0 .9rem; }
.pay-methods legend { font-weight: 600; margin-bottom: .4rem; padding: 0; }
.pay-method { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .7rem .4rem; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 600; margin: 0; text-align: center; }
.pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.pay-method svg { width: 24px; height: 24px; color: var(--muted); }
.pay-method:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--brand); }
.pay-method:has(input:checked) svg { color: var(--brand); }
.pay-method:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (max-width: 520px) { .pay-match { flex-direction: column; align-items: stretch; } }
/* Connecteurs e-commerce : grille des applications, accès à copier, mode d'emploi. */
.ecom-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.ecom-app { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .9rem .5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface, #fff); cursor: pointer; text-align: center; min-height: 0; }
.ecom-app:hover { border-color: var(--brand); box-shadow: 0 6px 16px rgba(0, 0, 0, .08); }
.ecom-app small { color: var(--muted); font-weight: 400; }
.ecom-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #22b8f0)); color: #fff; font-weight: 800; letter-spacing: .02em; }
.copy-field { display: block; margin-bottom: .6rem; }
.copy-field .row { gap: .4rem; flex-wrap: nowrap; }
.copy-field input { flex: 1; margin: 0; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.guide-steps li { margin-bottom: .45rem; }
#modal:has(.copy-field) { width: min(820px, 96vw); max-width: 96vw; }