/* JOV Factures — feuille de style */
:root {
    --bg: #f4f3ef;
    --surface: #ffffff;
    --surface-2: #faf9f6;
    --ink: #17181c;
    --ink-2: #4a4d57;
    --muted: #7d808c;
    --line: #e6e4dd;
    --line-strong: #d3d0c6;
    --accent: #4338ca;
    --accent-ink: #ffffff;
    --accent-soft: #ecebfd;
    --success: #0f7a4f;
    --success-soft: #def5e9;
    --warning: #a15c07;
    --warning-soft: #fdf0d5;
    --danger: #b4232c;
    --danger-soft: #fde7e7;
    --info: #1d5fae;
    --info-soft: #e1eefc;
    --sidebar: #15161b;
    --sidebar-ink: #a5a8b5;
    --sidebar-active: #ffffff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(20, 20, 30, .04), 0 8px 24px -12px rgba(20, 20, 30, .12);
    --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color-scheme: light;
}
:root[data-theme="dark"] {
    --bg: #0f1014;
    --surface: #181a20;
    --surface-2: #1e2028;
    --ink: #eeeff3;
    --ink-2: #c3c6d1;
    --muted: #8a8e9c;
    --line: #2a2d37;
    --line-strong: #3a3e4b;
    --accent: #8b83ff;
    --accent-ink: #0f1014;
    --accent-soft: #25234a;
    --success: #4fd39a;
    --success-soft: #12332a;
    --warning: #f0b458;
    --warning-soft: #3a2c12;
    --danger: #ff7a80;
    --danger-soft: #3d1a1d;
    --info: #7db7ff;
    --info-soft: #152a45;
    --sidebar: #0b0c0f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14.5px/1.5 var(--font);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
}
h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }
small { display: block; color: var(--muted); font-size: 12.5px; font-weight: 400; }
em { font-style: normal; color: var(--muted); font-weight: 400; }
code { font: 12.5px ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.danger { color: var(--danger); }
.warning { color: var(--warning); }
.link { color: var(--accent); font-weight: 550; }
.link:hover { text-decoration: underline; }
.inline { display: inline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > form { flex: 1; }
.stack { display: grid; gap: 20px; align-content: start; }

/* ---------- Structure ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-ink);
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6d5efc, #b15cf5 60%, #f0719a);
    color: #fff; font-weight: 800; font-size: 18px; letter-spacing: -.02em;
    box-shadow: 0 6px 16px -6px rgba(124, 92, 252, .7);
}
.brand-text strong { display: block; color: #fff; font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--sidebar-ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: grid; gap: 2px; }
.nav a, .ghost {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 10px;
    color: var(--sidebar-ink); font-weight: 500; font-size: 14px;
    transition: background .15s, color .15s;
}
.nav a:hover, .ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .1); color: var(--sidebar-active); box-shadow: inset 3px 0 0 #8b7dff; }
.sidebar-foot { margin-top: auto; display: grid; gap: 2px; }
.ghost { background: none; border: 0; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; width: 100%; text-align: left; }

.main { padding: 26px clamp(16px, 3vw, 40px) 60px; min-width: 0; display: grid; gap: 20px; align-content: start; }
.topbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; min-height: 42px; }
.topbar h1 { font-size: 25px; font-weight: 700; letter-spacing: -.025em; margin-right: auto; overflow-wrap: anywhere; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn.menu-btn { display: none; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 14px; min-height: 38px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
    transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -8px var(--accent); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-dashed { border-style: dashed; background: transparent; color: var(--ink-2); width: 100%; margin-top: 10px; }
.btn-block { width: 100%; }
.icon-btn {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cartes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2.single { grid-template-columns: minmax(0, 760px); }
.grid-2.reverse { grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); }
.sticky { position: sticky; top: 20px; }

.callout {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 16px 20px; border-radius: var(--radius);
    background: linear-gradient(120deg, var(--accent-soft), transparent 70%), var(--surface);
    border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
}
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); font-weight: 550; animation: drop .25s ease-out; }
.flash-success { background: var(--success-soft); color: var(--success); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Indicateurs ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi-icon { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.tone-accent { background: var(--accent-soft); color: var(--accent); }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-danger { background: var(--danger-soft); color: var(--danger); }
.tone-success { background: var(--success-soft); color: var(--success); }
.kpi-label { color: var(--ink-2); font-size: 13px; font-weight: 550; padding-right: 44px; }
.kpi-label small { display: inline; }
.kpi-value { font-size: 27px; font-weight: 720; letter-spacing: -.03em; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12.5px; }

/* ---------- Graphique ---------- */
.chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(4px, 1vw, 12px); height: 230px; }
.chart-col { display: grid; grid-template-rows: 18px 1fr 22px; gap: 4px; text-align: center; min-width: 0; }
.chart-val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chart-track { position: relative; background: repeating-linear-gradient(to top, transparent 0 24.5%, var(--line) 24.5% 25%); border-radius: 8px; }
.chart-bar { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 7px 7px 3px 3px; background: color-mix(in srgb, var(--accent) 38%, var(--surface)); transition: background .15s; min-height: 0; }
.chart-bar.current { background: var(--accent); }
.chart-col:hover .chart-bar { background: var(--accent); }
.chart-label { font-size: 11.5px; color: var(--muted); align-self: end; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px -20px; border-radius: 0 0 var(--radius) var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover, .table tr.selected { background: var(--surface-2); }
.table tfoot td { padding: 12px 14px; background: var(--surface-2); border-top: 1px solid var(--line); font-weight: 650; color: var(--ink-2); }
.row-actions { white-space: nowrap; text-align: right; }
.with-avatar { display: flex; align-items: center; gap: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; flex: none; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 4px; overflow-x: auto; max-width: 100%; }
.tabs a { padding: 6px 13px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.tabs a:hover { background: var(--surface-2); }
.tabs a.active { background: var(--ink); color: var(--bg); }
.search { position: relative; display: flex; align-items: center; min-width: min(280px, 100%); }
.search .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 38px; }

.list { list-style: none; margin: 0 -8px; padding: 0; display: grid; }
.list li > a, .list li > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 8px; border-radius: 10px; }
.list li > a:hover { background: var(--surface-2); }
.list li + li { border-top: 1px solid var(--line); }
.list .right { display: flex; align-items: center; gap: 12px; }
.list.compact li > a, .list.compact li > div { padding: 8px; }

.empty { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 44px 20px; color: var(--ink-2); }
.empty > .icon { width: 44px; height: 44px; padding: 11px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); box-sizing: content-box; }
.empty p { max-width: 440px; }
.empty.small { padding: 22px 12px; }

/* ---------- Formulaires ---------- */
.form-grid { display: grid; gap: 14px 16px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.field { display: grid; gap: 6px; min-width: 0; align-content: end; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; gap: 6px; justify-content: space-between; flex-wrap: wrap; }
input, select, textarea {
    width: 100%; padding: 9px 12px; min-height: 40px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink);
    font: inherit; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); flex: none; }
input[type="file"] { padding: 7px; }
select.compact { width: auto; max-width: 100%; min-height: 36px; padding: 6px 10px; font-size: 13px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check.block { align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); margin-bottom: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.doc-form > .form-actions { margin-top: 0; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 12px; }
.hint.success { color: var(--success); display: flex; align-items: center; gap: 6px; font-weight: 600; }
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.logo-row img { max-height: 56px; max-width: 180px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }

/* ---------- Édition d'un document ---------- */
.doc-form { display: grid; gap: 20px; }
.lines { display: grid; gap: 8px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 76px 84px 124px 92px 116px 34px; gap: 8px; align-items: start; }
.line-head { font-size: 11.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0 2px; }
.line textarea { min-height: 40px; resize: none; overflow: hidden; }
.line [data-qty], .line [data-price] { text-align: right; font-variant-numeric: tabular-nums; }
.line output { align-self: center; font-weight: 650; }
.doc-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px); gap: 28px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.totals { display: grid; gap: 2px; align-content: start; font-variant-numeric: tabular-nums; }
.totals-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; color: var(--ink-2); }
.totals-row.grand { margin-top: 8px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); font-size: 17px; font-weight: 720; }
.inline-input { width: 64px; min-height: 32px; padding: 4px 8px; text-align: right; display: inline-block; margin: 0 4px; }

/* ---------- Consultation d'un document ---------- */
.doc-view { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.doc-main { min-width: 0; overflow-x: auto; }
.doc-side { display: grid; gap: 16px; position: sticky; top: 20px; }
.side-status { display: grid; gap: 6px; justify-items: start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.side-amount { font-size: 28px; font-weight: 740; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.side-amount small { display: inline; font-size: 13px; font-weight: 500; }
.side-actions { display: grid; gap: 8px; }
.side-actions .hint { margin: 0 0 4px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--success); border-radius: 99px; }
.pay-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.pay-form .btn { grid-column: span 2; }

/* La feuille reste « papier » quel que soit le thème. */
.sheet {
    --ink: #17181c; --ink-2: #4a4d57; --muted: #737682; --line: #e3e1da;
    position: relative; background: #fff; color: var(--ink);
    width: 100%; max-width: 820px; min-height: 1100px; margin: 0 auto;
    padding: 56px 60px 90px; border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 20px 50px -20px rgba(0, 0, 0, .25);
    font-size: 13.5px; display: flex; flex-direction: column; gap: 26px; overflow: hidden;
}
.sheet.is-draft::after { content: "BROUILLON"; position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font-size: 110px; font-weight: 800; letter-spacing: .06em; color: rgba(23, 24, 28, .05); pointer-events: none; white-space: nowrap; }
.sheet span, .sheet small { display: block; }
.sheet small { color: var(--muted); }
.sheet-head { display: flex; justify-content: space-between; gap: 32px; }
.sheet-company { display: grid; gap: 1px; color: var(--ink-2); align-content: start; }
.sheet-company strong { color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.sheet-logo { max-height: 64px; max-width: 220px; margin-bottom: 12px; object-fit: contain; object-position: left; }
.sheet-title { text-align: right; flex: none; }
.sheet-title h2 { font-size: 30px; font-weight: 760; letter-spacing: -.03em; text-transform: uppercase; color: #4338ca; }
.sheet-number { font-size: 15px; font-weight: 650; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.sheet dl { display: grid; grid-template-columns: auto auto; gap: 3px 16px; margin: 0; justify-content: end; }
.sheet dt { color: var(--muted); text-align: left; }
.sheet dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.sheet-client { align-self: flex-end; width: 46%; min-width: 250px; padding: 16px 18px; border-radius: 10px; background: #f6f5f1; display: grid; gap: 1px; color: var(--ink-2); }
.sheet-client small { text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; font-weight: 650; margin-bottom: 4px; }
.sheet-client strong { color: var(--ink); font-size: 15px; }
.sheet-table { width: 100%; border-collapse: collapse; }
.sheet-table th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); text-align: left; padding: 9px 10px; border-bottom: 2px solid var(--ink); }
.sheet-table th.num { text-align: right; }
.sheet-table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet-table td small { margin-top: 2px; font-size: 12px; }
.sheet-summary { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; break-inside: avoid; }
.sheet-pay { flex: 1; }
.sheet-pay small { text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; font-weight: 650; margin-bottom: 6px; }
.sheet-pay dl { justify-content: start; }
.sheet-pay dd { text-align: left; }
.sheet-pay .comm { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; letter-spacing: .02em; }
.sheet-totals { border-collapse: collapse; min-width: 300px; }
.sheet-totals td { padding: 6px 10px; color: var(--ink-2); }
.sheet-totals tr.grand td { background: #17181c; color: #fff; font-weight: 720; font-size: 15.5px; padding: 11px 12px; }
.sheet-totals tr.grand td:first-child { border-radius: 8px 0 0 8px; }
.sheet-totals tr.grand td:last-child { border-radius: 0 8px 8px 0; }
.sheet-notes { display: grid; gap: 10px; color: var(--ink-2); font-size: 12.5px; break-inside: avoid; }
.sheet-notes .fine { font-size: 11px; color: var(--muted); }
.sheet-sign { margin-top: 10px; width: 320px; height: 96px; border: 1px dashed #c9c6bb; border-radius: 8px; padding: 8px 12px; color: var(--muted); font-size: 11.5px; }
.sheet-foot { position: absolute; left: 60px; right: 60px; bottom: 32px; padding-top: 12px; border-top: 1px solid var(--line); text-align: center; font-size: 10.5px; color: var(--muted); }

/* ---------- Comptes et droits ---------- */
.user-chip { gap: 10px; padding: 8px; }
.user-chip .avatar { width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, .1); color: #fff; font-size: 13px; }
.user-chip strong { display: block; color: #fff; font-size: 13.5px; font-weight: 600; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { color: var(--sidebar-ink); font-size: 12px; }
.user-chip.active { background: rgba(255, 255, 255, .1); }
.sidebar-foot form { display: contents; }
.readonly-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning); font-size: 13.5px; }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.plain:disabled input, fieldset.plain:disabled textarea, fieldset.plain:disabled select { background: var(--surface-2); color: var(--ink-2); cursor: default; }
.auth-form { display: grid; gap: 14px; width: 100%; }
.hint.center { text-align: center; margin: 0; }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent), var(--bg); }
.login-card { width: min(380px, 100%); display: grid; gap: 16px; justify-items: center; padding: 32px; }
.login-card h1 { font-size: 21px; letter-spacing: -.02em; text-align: center; }
.login-card .flash { width: 100%; }
.login-card .field { width: 100%; }

/* ---------- Adaptatif ---------- */
@media (max-width: 1180px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .doc-view { grid-template-columns: minmax(0, 1fr); }
    .doc-side { position: static; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
    .grid-2, .grid-2.reverse { grid-template-columns: minmax(0, 1fr); }
    .sticky { position: static; }
}
@media (max-width: 860px) {
    .app { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 30; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0, 0, 0, .5); }
    .sidebar.open { transform: none; }
    .icon-btn.menu-btn { display: inline-grid; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
    .topbar h1 { font-size: 21px; }
    .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .span-3 { grid-column: span 2; }
    .doc-bottom { grid-template-columns: minmax(0, 1fr); }
    .line-head { display: none; }
    .line { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
    .line textarea { grid-column: 1 / -1; }
    .line output { grid-column: 1 / 4; text-align: right; }
    .line [data-remove] { justify-self: end; }
    .line select { padding-left: 8px; padding-right: 4px; }
    .sheet { padding: 32px 24px 90px; min-width: 640px; }
    .sheet-foot { left: 24px; right: 24px; }
}
@media (max-width: 560px) {
    .kpis, .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); }
    .span-2, .span-3 { grid-column: auto; }
    .main { padding-top: 16px; }
    .topbar-actions { width: 100%; }
    .topbar-actions .btn { flex: 1; }
}

/* ---------- Impression : seule la feuille sort ---------- */
@page { size: A4; margin: 0; }
@media print {
    html, body { background: #fff !important; }
    .sidebar, .topbar, .doc-side, .flash, .callout, .readonly-banner { display: none !important; }
    .app, .main, .doc-view, .doc-main { display: block; padding: 0; margin: 0; overflow: visible; }
    .sheet { max-width: none; width: 210mm; min-height: 297mm; min-width: 0; padding: 16mm 17mm 24mm; border-radius: 0; box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .sheet-foot { left: 17mm; right: 17mm; bottom: 10mm; }
    .sheet-table tr { break-inside: avoid; }
}
