@font-face { font-family: Inter; src: url(/fonts/inter.woff2) format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Inter; src: url(/fonts/inter-ext.woff2) format('woff2'); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #14282e; --ink-2: #47606a; --ink-3: #6f8690;
  --line: #dde6e9; --line-2: #eef3f5;
  --bg: #f2f6f7; --surface: #fff;
  --brand: #1a7a91; --brand-strong: #125f72; --brand-soft: #e2f2f6; --brand-mid: #bfe3ec;
  --side: #10303a; --side-2: #18414d; --side-ink: #bcd3da;
  --terra: #b4522a; --terra-soft: #fbeee7;
  --ok: #17785a; --ok-soft: #e3f4ee;
  --warn: #93600a; --warn-soft: #fdf3dc;
  --bad: #ad3327; --bad-soft: #fbe9e6;
  --radius: 10px; --radius-sm: 7px;
  --shadow-pop: 0 12px 32px rgba(16, 48, 58, .16), 0 2px 6px rgba(16, 48, 58, .08);
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: .867rem; }
.xs { font-size: .8rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.icon { width: 1.1em; height: 1.1em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.17em; }

/* ---------- Structure ---------- */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100dvh; background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; padding: 18px 12px 14px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: #fff; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { display: block; font-size: 1.15rem; letter-spacing: .02em; line-height: 1.1; }
.brand span { font-size: .76rem; color: var(--side-ink); }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--side-ink); font-weight: 500; }
.nav a:hover { background: var(--side-2); color: #fff; text-decoration: none; }
.nav a.on { background: var(--brand); color: #fff; }
.nav .n-short { display: none; }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .09); margin: 8px 6px; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 8px 0; border-top: 1px solid rgba(255, 255, 255, .09); font-size: .8rem; }
.side-foot button { background: none; border: 0; color: var(--side-ink); cursor: pointer; padding: 6px; border-radius: 6px; }
.side-foot button:hover { color: #fff; background: var(--side-2); }
.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 24px 28px 72px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: .867rem; margin-bottom: 6px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--line-2); border-color: #c9d6db; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn.accent { background: var(--terra); border-color: var(--terra); color: #fff; }
.btn.accent:hover { background: #99431f; border-color: #99431f; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #eec7c1; }
.btn.ghost { background: none; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: .867rem; }
.btn.lg { min-height: 46px; padding: 10px 18px; font-size: 1.04rem; }
.btn.icon-only { padding: 0; width: 34px; min-height: 34px; }
.btn.block { width: 100%; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 16px 18px; }
.card-title { font-size: 1rem; font-weight: 650; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.cols.wide-side { grid-template-columns: minmax(0, 1fr) 400px; }
.sticky-col { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-size: .84rem; font-weight: 550; color: var(--ink-2); }
.input, select.input, textarea.input { width: 100%; min-height: 38px; padding: 7px 10px; background: var(--surface); border: 1px solid #cbd8dd; border-radius: var(--radius-sm); }
textarea.input { resize: vertical; min-height: 64px; }
.input:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: var(--brand); }
.input[readonly], .input:disabled { background: var(--line-2); color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: span 3; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-weight: 550; color: var(--ink-2); cursor: pointer; min-height: 32px; }
.seg button.on { background: var(--surface); color: var(--brand-strong); box-shadow: 0 1px 2px rgba(16, 48, 58, .14); }
.searchbox { position: relative; flex: 1; min-width: 180px; max-width: 340px; }
.searchbox .icon { position: absolute; left: 10px; top: 11px; color: var(--ink-3); }
.searchbox input { padding-left: 32px; }

/* ---------- Pastilles ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--brand-soft); color: var(--brand-strong); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--line-2); color: var(--ink-2); font-size: .76rem; font-weight: 600; white-space: nowrap; }
.tag.terra { background: var(--terra-soft); color: var(--terra); }
.tag.brand { background: var(--brand-soft); color: var(--brand-strong); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 99px; padding: 4px 12px; cursor: pointer; font-size: .867rem; font-weight: 550; }
.pill.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill span { opacity: .7; margin-left: 3px; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .78rem; font-weight: 600; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: #f7fafb; }
.table th.right, .table td.right { text-align: right; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: .8rem; color: var(--ink-3); }
.progress { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.empty { text-align: center; padding: 44px 16px; color: var(--ink-2); }
.empty .icon { width: 30px; height: 30px; color: var(--ink-3); margin-bottom: 8px; }

/* ---------- Alertes ---------- */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .92rem; }
.banner .icon { margin-top: 2px; }
.banner.warn { background: var(--warn-soft); color: #6d4706; }
.banner.info { background: var(--brand-soft); color: var(--brand-strong); }
.banner.ok { background: var(--ok-soft); color: #0f5a43; }
.banner.bad { background: var(--bad-soft); color: #872419; }
.banner a { color: inherit; text-decoration: underline; font-weight: 600; }

/* ---------- Tableau de bord ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px; }
.kpi .k-label { font-size: .84rem; color: var(--ink-2); font-weight: 550; }
.kpi .k-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .k-sub { font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
.kpi .k-sub.bad { color: var(--bad); font-weight: 600; }
.chart { position: relative; height: 216px; display: flex; align-items: stretch; padding: 8px 0 22px 52px; }
.chart .grid-line { position: absolute; left: 52px; right: 0; border-top: 1px solid var(--line-2); }
.chart .grid-line span { position: absolute; left: -52px; top: -8px; width: 46px; text-align: right; font-size: .72rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart .baseline { position: absolute; left: 52px; right: 0; bottom: 22px; border-top: 1px solid #c3d1d6; }
.chart .col { position: relative; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; outline-offset: -2px; }
.chart .bar { width: min(58%, 34px); background: var(--brand); border-radius: 4px 4px 0 0; }
.chart .col:hover .bar, .chart .col:focus .bar { background: var(--brand-strong); }
.chart .col.now .bar { background: var(--terra); }
.chart .m { position: absolute; bottom: -19px; font-size: .74rem; color: var(--ink-3); }
.chart .peak { font-size: .72rem; color: var(--ink-2); margin-bottom: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart .tip { display: none; position: absolute; bottom: calc(100% - 26px); z-index: 3; background: var(--ink); color: #fff; font-size: .8rem; padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.chart .col:hover .tip, .chart .col:focus .tip { display: block; }
.todo-group { margin-bottom: 12px; }
.todo-group:last-child { margin-bottom: 0; }
.todo-group h3 { font-size: .8rem; font-weight: 600; color: var(--ink-3); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.todo { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 -10px; border-radius: 7px; color: var(--ink); }
.todo:hover { background: var(--line-2); text-decoration: none; }
.todo .t-main { flex: 1; min-width: 0; }
.todo .t-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo .t-sub { font-size: .8rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo .t-sub.bad { color: var(--bad); }
.todo .t-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Éditeur de lignes ---------- */
.lines-head, .line-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 80px 66px 92px 62px 76px 100px 30px; gap: 6px; align-items: start; }
.lines-head { font-size: .78rem; font-weight: 600; color: var(--ink-3); padding: 0 2px 6px; border-bottom: 1px solid var(--line); }
.lines-head .r { text-align: right; }
.line-row { padding: 6px 2px; border-bottom: 1px solid var(--line-2); }
.line-row.wide { grid-template-columns: 26px minmax(0, 1fr) 30px; }
.line-row .input { min-height: 34px; padding: 5px 7px; }
.line-row input.r { text-align: right; font-variant-numeric: tabular-nums; }
.line-row .total { text-align: right; padding-top: 7px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line-row .mover { display: flex; flex-direction: column; }
.line-row .mover button, .line-row .del { background: none; border: 0; padding: 1px; color: var(--ink-3); cursor: pointer; line-height: 1; border-radius: 4px; }
.line-row .mover button:hover { color: var(--ink); background: var(--line-2); }
.line-row .del { padding: 7px 5px; }
.line-row .del:hover { color: var(--bad); background: var(--bad-soft); }
.line-row .mlabel { display: none; }
.line-row.section .input { font-weight: 650; color: var(--brand-strong); }
.line-desc { margin-top: 4px; }
.add-desc { background: none; border: 0; padding: 2px 0 0; color: var(--ink-3); cursor: pointer; font-size: .78rem; }
.add-desc:hover { color: var(--brand-strong); }
.price-hint { display: block; font-size: .7rem; color: var(--brand-strong); text-align: right; margin-top: 2px; line-height: 1.15; }
.lines-tools { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 12px; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 30; top: calc(100% + 3px); left: 0; min-width: 100%; width: max-content; max-width: min(560px, 90vw); max-height: 310px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; box-shadow: var(--shadow-pop); padding: 4px; }
.combo-item { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 7px 9px; border-radius: 6px; cursor: pointer; }
.combo-item.on, .combo-item:hover { background: var(--brand-soft); }
.combo-item .c-main { min-width: 0; }
.combo-item .c-title { font-weight: 550; font-size: .92rem; white-space: normal; }
.combo-item .c-sub { font-size: .76rem; color: var(--ink-3); }
.combo-item .c-price { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.totalbar { position: sticky; bottom: 10px; z-index: 20; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(16, 48, 58, .1); padding: 9px 12px 9px 18px; font-variant-numeric: tabular-nums; }
.totalbar-item { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.totalbar-item span { font-size: .76rem; color: var(--ink-3); font-weight: 550; }
.totalbar-item b { font-weight: 650; white-space: nowrap; }
.totalbar-item.grand b { font-size: 1.2rem; font-weight: 750; }
.totals { font-variant-numeric: tabular-nums; }
.totals .row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.totals .row.grand { font-size: 1.2rem; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }

/* ---------- Document ---------- */
.paper { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px 28px; }
.paper-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.paper-title { font-size: 1.3rem; font-weight: 750; color: var(--brand); letter-spacing: .02em; }
.paper table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.paper th { background: var(--brand-soft); text-align: left; padding: 7px 9px; font-size: .8rem; font-weight: 650; white-space: nowrap; }
.paper td { padding: 7px 9px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.paper th.right, .paper td.right { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.paper td.sec { font-weight: 650; color: var(--brand-strong); }
.paper .desc { color: var(--ink-3); font-size: .82rem; margin-top: 2px; }
.paper-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.paper-foot .totals { width: min(300px, 100%); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: .92rem; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: .867rem; }
.timeline li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child { border: 0; }
.links { display: flex; flex-direction: column; gap: 2px; }
.links a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; margin: 0 -8px; border-radius: 6px; color: var(--ink); }
.links a:hover { background: var(--line-2); text-decoration: none; }
.sign-preview { background: #fff; border: 1px dashed var(--line); border-radius: 8px; padding: 6px; }
.sign-preview img { display: block; max-width: 100%; max-height: 90px; margin: auto; }

/* ---------- Fenêtres ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(16, 48, 58, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: var(--shadow-pop); }
.modal.wide { max-width: 680px; }
.modal.xl { max-width: min(1000px, 96vw); height: calc(100dvh - 32px); display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 1.1rem; font-weight: 650; }
.modal-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line-2); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.pdf-pages { flex: 1; min-height: 0; overflow-y: auto; background: #e3e9ec; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pdf-pages img { display: block; width: 100%; max-width: 760px; height: auto; background: #fff; box-shadow: 0 2px 10px rgba(16, 48, 58, .18); }
.choice { display: flex; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; align-items: flex-start; background: var(--surface); text-align: left; width: 100%; }
.choice:hover { border-color: var(--brand-mid); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.choice input { margin-top: 3px; accent-color: var(--brand); }
.choice b { display: block; font-weight: 600; }
.toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 9px; background: var(--ink); color: #fff; box-shadow: var(--shadow-pop); display: flex; align-items: flex-start; gap: 9px; font-size: .92rem; }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.pad-wrap { position: relative; border: 1px solid #cbd8dd; border-radius: 9px; background: #fff; touch-action: none; }
.pad-wrap canvas { display: block; width: 100%; height: 200px; border-radius: 9px; cursor: crosshair; }
.pad-wrap .pad-line { position: absolute; left: 22px; right: 22px; bottom: 44px; border-top: 1px dashed #c7d3d8; pointer-events: none; }
.pad-wrap .pad-hint { position: absolute; left: 22px; bottom: 22px; color: var(--ink-3); font-size: .8rem; pointer-events: none; }
.pad-clear { position: absolute; right: 8px; top: 8px; }

/* ---------- Import ---------- */
.drop { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 44px 20px; border: 2px dashed #b9cbd1; border-radius: 12px; background: var(--surface); cursor: pointer; }
.drop.on, .drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop .icon { width: 36px; height: 36px; color: var(--brand); }
.steps { display: flex; flex-direction: column; gap: 8px; }
.steps div { display: flex; align-items: center; gap: 9px; color: var(--ink-3); }
.steps div.on { color: var(--ink); font-weight: 550; }
.steps div.done { color: var(--ok); }
.spin { width: 16px; height: 16px; border: 2px solid var(--brand-mid); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.import-card { overflow: hidden; }
.import-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; flex-wrap: wrap; }
.import-head.saved { background: var(--ok-soft); }
.import-lines th, .import-lines td { padding: 5px 6px; font-size: .88rem; }
.import-lines .input { min-height: 30px; padding: 3px 6px; font-size: .88rem; }
.import-lines tr.flag td { background: var(--warn-soft); }
.ok-dot { color: var(--ok); }
.warn-dot { color: var(--warn); }

/* ---------- Connexion et signature ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--side); }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 14px; padding: 26px 24px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; }
.login-card .brand span { color: var(--ink-2); }
.sign-body { background: var(--bg); }
.sign-page { max-width: 760px; margin: 0 auto; padding: 18px 14px 56px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Tablette et téléphone ---------- */
@media (max-width: 1080px) {
  .cols, .cols.wide-side { grid-template-columns: minmax(0, 1fr); }
  .sticky-col { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .side { position: fixed; z-index: 40; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
  .side .brand, .side-foot, .nav .sep { display: none; }
  .nav { flex-direction: row; justify-content: space-between; overflow-x: auto; gap: 0; scrollbar-width: none; }
  .nav a { flex: 1; flex-direction: column; gap: 1px; padding: 5px 7px; font-size: .68rem; min-width: 54px; }
  .nav a .icon { width: 19px; height: 19px; }
  .nav .n-long { display: none; }
  .nav .n-short { display: inline; }
  .page { padding: 16px 14px 40px; }
  .lines-head { display: none; }
  .line-row { grid-template-columns: repeat(6, minmax(0, 1fr)); padding: 10px 0; position: relative; }
  .line-row.wide { grid-template-columns: 26px minmax(0, 1fr) 30px; }
  .line-row:not(.wide) .mover { grid-column: 1; grid-row: 1; flex-direction: row; }
  .line-row:not(.wide) .label-cell { grid-column: 1 / -1; grid-row: 2; }
  .line-row:not(.wide) .del { grid-column: 6; grid-row: 1; justify-self: end; }
  .line-row:not(.wide) .cell { grid-column: span 2; }
  .line-row:not(.wide) > :nth-child(3), .line-row:not(.wide) > :nth-child(4), .line-row:not(.wide) > :nth-child(5) { grid-row: 3; }
  .line-row:not(.wide) > :nth-child(6), .line-row:not(.wide) > :nth-child(7) { grid-row: 4; }
  .line-row:not(.wide) .total { grid-column: 5 / -1; grid-row: 4; padding-top: 22px; }
  .line-row .mlabel { display: block; font-size: .72rem; color: var(--ink-3); margin-bottom: 1px; }
  .hide-md { display: none !important; }
  .totalbar { bottom: calc(66px + env(safe-area-inset-bottom)); justify-content: space-between; }
}
@media (max-width: 640px) {
  html { font-size: 14.5px; }
  .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); }
  .span2, .span3 { grid-column: auto; }
  .hide-sm { display: none !important; }
  .totalbar-item:not(.grand) { display: none; }
  .page-head h1 { font-size: 1.3rem; }
  .paper { padding: 16px 12px; }
  .kpi .k-value { font-size: 1.25rem; }
  .btn { min-height: 42px; }
  .table td, .table th { padding: 10px 10px; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92dvh; }
  .modal.xl { height: 92dvh; max-width: 100vw; }
}
@media print {
  .side, .actions, .toasts { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .spin { animation-duration: 2.4s; }
}
