:root {
  --brand: #0f766e;
  --brand-600: #115e59;
  --brand-50: #e9f5f2;
  --brand-100: #cfe9e3;
  --bg: #f6f5f0;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --ink: #1f2a2e;
  --ink-2: #3d4b50;
  --muted: #62727a;
  --line: #e7e4da;
  --green: #15803d; --green-bg: #ddf3e4;
  --amber: #a16207; --amber-bg: #fcf0cc;
  --red: #b91c1c; --red-bg: #fde6e3;
  --blue: #1d4ed8; --blue-bg: #e1ebfb;
  --gray-bg: #efede6;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(31,42,46,.04), 0 4px 14px rgba(31,42,46,.05);
  --shadow-lg: 0 16px 40px rgba(31,42,46,.14);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --nav-h: 68px;
  --focus: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5eead4; --brand-600: #99f6e4; --brand-50: #12302d; --brand-100: #1b4742;
    --bg: #0f1514; --surface: #172120; --surface-2: #1b2726;
    --ink: #eef4f2; --ink-2: #cfdcd9; --muted: #98aaa6; --line: #26343280;
    --green: #4ade80; --green-bg: #14532d66;
    --amber: #fbbf24; --amber-bg: #78350f55;
    --red: #f87171; --red-bg: #7f1d1d55;
    --blue: #7db1ff; --blue-bg: #1e3a8a55;
    --gray-bg: #212e2c;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg: 0 16px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; }
h2 { font-size: 19px; font-weight: 680; }
h3 { font-size: 16px; font-weight: 640; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .92em; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 22px 16px; background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; overflow-y: auto; scrollbar-width: thin;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; font-weight: 750; font-size: 19px; color: var(--ink); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #0f766e, #14b8a6); display: grid; place-items: center; color: #fff; box-shadow: 0 4px 12px rgba(15,118,110,.3); }
.nav-link {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 14px; color: var(--ink-2); font-weight: 560; font-size: 16px;
}
.nav-link svg { width: 22px; height: 22px; flex: none; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--brand-50); color: var(--brand); font-weight: 680; }
.sidebar .spacer { flex: 1; }
.sidebar-cta { margin-bottom: 14px; }
.peppol-pill { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; }
.dot.amber { background: var(--amber); }

.main { min-width: 0; padding: 36px 44px 72px; max-width: 1200px; width: 100%; }
.topbar { display: none; }
.bottom-nav { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 15.5px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--brand) 32%, transparent); }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0b0d14; } }
.btn.primary:hover { background: var(--brand-600); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--red); }
.btn.peppol { background: linear-gradient(135deg, #15803d, #22a55b); border-color: transparent; color: #fff; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14.5px; border-radius: 12px; }
.btn.icon { width: 46px; padding: 0; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.block { width: 100%; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 26px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); gap: 12px; }
.grid { display: grid; gap: 20px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 22px 24px; }
.kpi .label { color: var(--muted); font-size: 14.5px; font-weight: 560; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 30px; font-weight: 740; margin-top: 8px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 14px; color: var(--muted); margin-top: 2px; }
.kpi .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.kpi .ic svg { width: 20px; height: 20px; }
.kpi.alert .ic { background: var(--red-bg); color: var(--red); }
.kpi.ok .ic { background: var(--green-bg); color: var(--green); }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }

.banner { display: flex; gap: 14px; align-items: center; padding: 18px 20px; border-radius: var(--radius); background: var(--brand-50); border: 1px solid var(--brand-100); margin-bottom: 18px; }
.banner.warn { background: var(--amber-bg); border-color: transparent; }
.banner .grow { flex: 1; }

/* ---------- Chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 20px 20px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 38px; border-radius: 8px 8px 3px 3px; background: var(--brand); opacity: .85; min-height: 2px; position: relative; }
.bar:hover { opacity: 1; }
.bar-col.current .bar { background: linear-gradient(180deg, #2dd4bf, var(--brand)); opacity: 1; }
.bar-label { font-size: 12px; color: var(--muted); padding-bottom: 12px; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13.5px; font-weight: 620; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.draft { background: var(--gray-bg); color: var(--muted); }
.badge.issued { background: var(--blue-bg); color: var(--blue); }
.badge.sent { background: var(--brand-50); color: var(--brand); }
.badge.paid { background: var(--green-bg); color: var(--green); }
.badge.overdue { background: var(--red-bg); color: var(--red); }
.badge.cancelled { background: var(--gray-bg); color: var(--muted); }
.badge.peppol { background: var(--green-bg); color: var(--green); }
.badge.peppol-no { background: var(--amber-bg); color: var(--amber); }
.badge.peppol-unknown { background: var(--gray-bg); color: var(--muted); }
.tag { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* ---------- Lists ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 560; font-size: 15px; cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.chip:hover { border-color: var(--brand-100); background: var(--brand-50); }
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
@media (prefers-color-scheme: dark) { .chip.active { color: #0f1514; } }
.search { position: relative; flex: 1; min-width: 200px; max-width: 320px; margin-left: auto; }
.search input { padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

.list { overflow: hidden; }
.row {
  display: grid; grid-template-columns: 130px 1.6fr 110px 110px 130px 120px; gap: 12px; align-items: center;
  padding: 18px 24px; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
.row.head { cursor: default; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: 11px; padding-bottom: 11px; background: var(--surface-2); }
.row .amount { text-align: right; font-weight: 620; font-variant-numeric: tabular-nums; }
.row .client { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .num-col { font-weight: 600; }
.row .peppol-ic { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-size: 12px; font-weight: 600; }
.empty { padding: 64px 24px; font-size: 16px; text-align: center; color: var(--muted); }
.empty svg { width: 56px; height: 56px; color: var(--brand); opacity: .7; margin-bottom: 14px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.client-card { padding: 22px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.client-card:hover { border-color: var(--brand-100); box-shadow: var(--shadow-lg); }
.client-card .top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.client-card .meta { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; color: var(--muted); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 14.5px; font-weight: 640; color: var(--ink-2); }
.field .help { font-size: 13.5px; color: var(--muted); }
.field .help.ok { color: var(--green); }
.field .help.err { color: var(--red); }
input, select, textarea {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px; border: 1.5px solid #d8d4c8; background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea { height: auto; min-height: 48px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: var(--focus); }
input.invalid { border-color: var(--red); }
.section { margin-bottom: 20px; }
.section .card-pad h2 { margin-bottom: 14px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title .n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-size: 13px; font-weight: 700; display: grid; place-items: center; }

/* Éditeur */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.summary { position: sticky; top: 20px; }
.line { display: grid; grid-template-columns: 1fr 86px 110px 120px 140px 110px 40px; gap: 8px; align-items: start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.line textarea { min-height: 48px; height: 48px; }
.line .total { height: 48px; display: flex; align-items: center; justify-content: flex-end; font-weight: 620; font-variant-numeric: tabular-nums; }
.lines-head { display: grid; grid-template-columns: 1fr 86px 110px 120px 140px 110px 40px; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.lines-head span:nth-child(6) { text-align: right; }
.line .lbl { display: none; }
.sum-row { display: flex; justify-content: space-between; padding: 6px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sum-row.total { font-size: 22px; font-weight: 750; color: var(--ink); border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; }

/* Aperçu document */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.paper { background: #fff; color: #111827; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 44px 44px 36px; position: relative; overflow: hidden; font-size: 13.5px; }
.paper::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--doc-brand, #4f46e5); }
.paper .p-head { display: flex; justify-content: space-between; gap: 20px; }
.paper .p-title { color: var(--doc-brand, #4f46e5); font-size: 24px; font-weight: 800; letter-spacing: .02em; text-align: right; }
.paper .p-company { font-weight: 750; font-size: 17px; }
.paper .p-small { color: #6b7280; font-size: 12.5px; line-height: 1.55; }
.paper .p-meta { display: grid; grid-template-columns: auto auto; gap: 2px 14px; justify-content: end; margin-top: 8px; font-size: 13px; }
.paper .p-meta dt { color: #6b7280; text-align: right; }
.paper .p-meta dd { margin: 0; font-weight: 650; text-align: right; }
.paper .p-client { margin: 26px 0 22px auto; width: min(300px, 100%); background: #f9fafb; border-radius: 8px; padding: 14px 16px; }
.paper table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.paper th { background: var(--doc-brand, #4f46e5); color: #fff; font-size: 12px; text-align: left; padding: 8px 10px; font-weight: 650; }
.paper th:first-child { border-radius: 6px 0 0 6px; } .paper th:last-child { border-radius: 0 6px 6px 0; }
.paper td { padding: 9px 10px; border-bottom: 1px solid #e5e7eb; vertical-align: top; white-space: pre-line; }
.paper .r { text-align: right; white-space: nowrap; }
.paper .p-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 18px; flex-wrap: wrap; }
.paper .p-totals { min-width: 260px; margin-left: auto; }
.paper .p-totals div { display: flex; justify-content: space-between; padding: 3px 0; color: #374151; }
.paper .p-totals .grand { font-size: 17px; font-weight: 800; color: #111827; border-top: 2px solid #111827; margin-top: 6px; padding-top: 8px; }
.paper .p-pay { margin-top: 22px; border: 1px solid #e5e7eb; border-radius: 10px; padding: 14px 16px; display: grid; grid-template-columns: 110px 1fr; gap: 3px 10px; font-size: 13px; }
.paper .p-pay h4 { grid-column: 1 / -1; margin: 0 0 6px; color: var(--doc-brand, #4f46e5); font-size: 13.5px; }
.paper .ogm { font-family: var(--mono); font-weight: 700; letter-spacing: .02em; }
.paper .draft-stamp { position: absolute; top: 34px; left: 50%; transform: translateX(-50%) rotate(-8deg); border: 3px solid #d1d5db; color: #d1d5db; font-weight: 800; font-size: 22px; padding: 2px 14px; border-radius: 8px; letter-spacing: .15em; }

.side-stack { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 20px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 560; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tdot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--green-bg); color: var(--green); }
.timeline .tdot svg { width: 13px; height: 13px; }
.timeline .tdot.failed { background: var(--red-bg); color: var(--red); }
.timeline .tdot.queued { background: var(--amber-bg); color: var(--amber); }
.checklist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; color: var(--red); }
.checklist li.ok { color: var(--green); }
.checklist svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.peppol-card { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.peppol-head { display: flex; align-items: center; gap: 10px; }
.peppol-logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #059669, #34d399); display: grid; place-items: center; color: #fff; }
.peppol-logo svg { width: 18px; height: 18px; }

/* Toasts & dialogs */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--ink); color: var(--surface); padding: 14px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); font-weight: 560; font-size: 15.5px; max-width: 400px; animation: pop .2s ease-out; }
.toast.error { background: var(--red); color: #fff; }
.toast.success { background: var(--green); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
dialog { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(20, 30, 30, .45); backdrop-filter: blur(2px); }
dialog .d-body { padding: 28px; }
dialog .d-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- Tablette ---------- */
@media (max-width: 1440px) { .main { padding: 32px 32px 64px; } }
@media (max-width: 1500px) and (min-width: 1101px) { .editor, .doc-layout { grid-template-columns: minmax(0, 1fr); } .summary, .side-stack { position: static; } }
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .editor, .doc-layout { grid-template-columns: 1fr; }
  .summary, .side-stack { position: static; }
  .row { grid-template-columns: 120px 1.5fr 100px 120px 120px; }
  .row .due { display: none; }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .app { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 10px;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line);
  }
  .topbar .logo { padding: 0; font-size: 18px; }
  .topbar .logo-mark { width: 30px; height: 30px; }
  .main { padding: 20px 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 28px); }
  h1 { font-size: 25px; }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .desktop-only { display: none !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid var(--line);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 640; color: var(--muted); }
  .bottom-nav a svg { width: 24px; height: 24px; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .fab { position: relative; }
  .bottom-nav .fab span.circle {
    width: 52px; height: 52px; border-radius: 16px; margin-top: -22px; background: linear-gradient(135deg, #0f766e, #14b8a6); color: #fff;
    display: grid; place-items: center; box-shadow: 0 8px 20px rgba(15, 118, 110, .4);
  }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .value { font-size: 23px; }
  .kpi .label { font-size: 13.5px; }
  .kpi .hint { font-size: 13px; }
  .two-col { grid-template-columns: 1fr; }
  .chart { height: 140px; gap: 4px; padding: 14px 12px 0; }
  .search { max-width: none; order: -1; flex-basis: 100%; }
  .row.head { display: none; }
  .row { grid-template-columns: 1fr auto; grid-template-areas: "client amount" "num status"; gap: 4px 10px; padding: 14px 16px; }
  .row .client { grid-area: client; }
  .row .amount { grid-area: amount; }
  .row .num-col { grid-area: num; font-weight: 500; color: var(--muted); font-size: 13.5px; }
  .row .st { grid-area: status; justify-self: end; }
  .row .date, .row .due { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .card-pad { padding: 20px; }
  .lines-head { display: none; }
  .line { grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
  .line .desc { grid-column: 1 / -1; }
  .line .lbl { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
  .line .total { justify-content: flex-start; font-size: 16px; }
  .line .rm { grid-column: 2; justify-self: end; align-self: end; }
  .paper { padding: 28px 18px 22px; font-size: 12.5px; border-radius: 10px; }
  .paper .p-head { flex-direction: column; }
  .paper .p-title, .paper .p-meta { text-align: left; justify-content: start; }
  .paper .p-meta dt { text-align: left; } .paper .p-meta dd { text-align: left; }
  .paper table .hide-sm { display: none; }
  .paper .p-client { margin-left: 0; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--nav-h) + 16px); }
  .sticky-actions {
    position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 25; padding: 10px 16px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
    display: flex; gap: 8px;
  }
  .sticky-actions .btn { flex: 1; }
  .has-sticky { padding-bottom: 72px; }
  dialog { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom); }
}
@media (min-width: 761px) { .mobile-only { display: none !important; } }
@media print {
  .sidebar, .topbar, .bottom-nav, .side-stack, .page-head, .sticky-actions { display: none !important; }
  .app, .doc-layout { display: block; } .main { padding: 0; } .paper { box-shadow: none; }
}

/* ---------- Comptes, équipe, abonnement ---------- */
body.auth .sidebar, body.auth .topbar, body.auth .bottom-nav, body.auth #trial-bar { display: none !important; }
body.auth .app { display: block; }
body.auth .main { max-width: none; padding: 0; }
.auth-wrap { display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(400px, 1fr); min-height: 100vh; }
.auth-side { position: relative; overflow: hidden; background: radial-gradient(900px 500px at 85% -10%, rgba(94,234,212,.35), transparent 60%), linear-gradient(155deg, #0a4a45, #0f766e); color: #fff; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between; gap: 28px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand b { display: block; font-size: 21px; letter-spacing: -0.01em; line-height: 1.1; }
.auth-brand small { display: block; font-size: 12.5px; opacity: .8; letter-spacing: .02em; }
.auth-brand .logo-mark { background: rgba(255,255,255,.18); width: 40px; height: 40px; }
.auth-pitch { display: flex; flex-direction: column; gap: 20px; max-width: 470px; }
.auth-pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 8px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 13px; font-weight: 600; }
.auth-pill svg { width: 16px; height: 16px; }
.auth-side h2 { font-size: 34px; line-height: 1.14; letter-spacing: -0.025em; margin: 0; }
.auth-benefits { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-benefits li { display: flex; gap: 12px; align-items: flex-start; }
.auth-benefits li > svg { flex: none; width: 34px; height: 34px; padding: 8px; background: rgba(255,255,255,.16); border-radius: 10px; }
.auth-benefits b { display: block; font-size: 15.5px; }
.auth-benefits span { display: block; font-size: 13.5px; opacity: .82; line-height: 1.4; }
.auth-mock { position: absolute; right: -14px; bottom: 96px; width: 232px; padding: 14px 16px; border-radius: 16px; background: #fff; color: #12302d; box-shadow: 0 24px 60px rgba(6,40,36,.45); transform: rotate(-3deg); display: none; }
.mock-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #64748b; font-weight: 600; }
.mock-badge { display: inline-flex; align-items: center; gap: 4px; background: #dcfce7; color: #15803d; border-radius: 999px; padding: 2px 8px 2px 5px; }
.mock-badge svg { width: 12px; height: 12px; }
.mock-client { margin-top: 10px; font-weight: 650; font-size: 14px; }
.mock-amount { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; margin: 2px 0 8px; }
.mock-line { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #64748b; border-top: 1px solid #e2e8f0; padding-top: 8px; }
.mock-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; }
@media (min-width: 1180px) { .auth-mock { display: block; } .auth-pitch { max-width: 420px; } }
.auth-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; opacity: .92; }
.auth-trust span { display: inline-flex; align-items: center; gap: 6px; }
.auth-trust svg { width: 16px; height: 16px; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 32px 20px; background: var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 32px; letter-spacing: -0.02em; }
.auth-sub { margin: 6px 0 22px; }
.auth-foot { margin-top: 22px; color: var(--muted); text-align: center; line-height: 1.9; }
.auth-legal { margin: 0; font-size: 12.5px; color: var(--muted); }
.small-link { font-size: 13.5px; align-self: flex-end; margin-top: -6px; }
.btn.lg { height: 52px; font-size: 17px; border-radius: 14px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { color: var(--ink); background: var(--brand-50); }
.pw-toggle svg { width: 19px; height: 19px; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; align-items: center; margin-top: 8px; }
.pw-meter i { height: 4px; border-radius: 2px; background: var(--line); }
.pw-meter span { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pw-meter[data-level="1"] i:nth-child(-n+1) { background: #ef4444; }
.pw-meter[data-level="2"] i:nth-child(-n+2) { background: #f59e0b; }
.pw-meter[data-level="3"] i:nth-child(-n+3) { background: #65a30d; }
.pw-meter[data-level="4"] i { background: #22c55e; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--brand-50); border-radius: 12px; margin-bottom: 18px; }
.seg a { display: flex; align-items: center; justify-content: center; gap: 7px; height: 38px; border-radius: 9px; font-weight: 600; font-size: 14.5px; color: var(--ink-2); text-decoration: none; }
.seg a svg { width: 17px; height: 17px; }
.seg a.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(31,42,46,.14); }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; min-height: 0; }
  .auth-side { padding: 22px 20px 26px; gap: 14px; }
  .auth-brand .logo-mark { width: 34px; height: 34px; }
  .auth-brand b { font-size: 18px; }
  .auth-pitch { gap: 0; }
  .auth-pill, .auth-benefits, .auth-trust, .auth-mock { display: none; }
  .auth-side h2 { font-size: 21px; line-height: 1.2; }
  .auth-main { justify-content: flex-start; padding-top: 26px; min-height: 60vh; }
  .auth-card h1 { font-size: 26px; }
}

.company-switch { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); cursor: pointer; text-align: left; }
.company-switch .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.company-switch .cs-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.company-switch .cs-text b, .company-switch.compact b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.company-switch .cs-text span { font-size: 12px; color: var(--muted); }
.company-switch > svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.company-switch.compact { width: auto; max-width: 70vw; margin: 0; padding: 4px 10px 4px 4px; background: transparent; border: 0; }
.company-switch.compact .avatar { width: 30px; height: 30px; }
.user-row { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.user-link { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.3; }
.user-link span { font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.access-bar { display: flex; align-items: center; gap: 10px; padding: 10px 36px; background: var(--brand-50); color: var(--ink-2); font-size: 14px; border-bottom: 1px solid var(--brand-100); }
.access-bar span { flex: 1; }
.access-bar svg { width: 18px; height: 18px; color: var(--brand); flex: none; }
.access-bar.blocked { background: var(--amber-bg); border-color: transparent; }
.access-bar.blocked svg { color: var(--amber); }
.company-list { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.company-item { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; }
.company-item > span { flex: 1; display: flex; flex-direction: column; }
.company-item.current { border-color: var(--brand); background: var(--brand-50); }
.company-item > svg { color: var(--brand); width: 18px; }
.tabs .chip { display: inline-flex; align-items: center; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.member-row:last-child { border-bottom: 0; }
.member-row .grow { flex: 1; min-width: 0; }
.member-row .avatar svg { width: 18px; }
.role-help { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan { padding: 24px 22px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.plan.featured { border: 2px solid var(--brand); }
.plan-flag { position: absolute; top: -12px; left: 22px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.plan p { margin: 0; }
.plan .price { color: var(--muted); margin: 8px 0; }
.plan .price span { font-size: 34px; font-weight: 750; color: var(--ink); letter-spacing: -0.02em; }
.plan ul { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; font-size: 14px; }
.plan li { display: flex; gap: 8px; align-items: flex-start; }
.plan li svg { width: 16px; height: 16px; color: var(--green); flex: none; margin-top: 3px; }
.meter { height: 8px; border-radius: 99px; background: var(--gray-bg); overflow: hidden; margin-top: 8px; }
.meter span { display: block; height: 100%; background: var(--brand); }
.row.admin-row { grid-template-columns: 1.6fr 1.3fr 100px 150px 90px; }
.row.admin-user-row { grid-template-columns: 1.3fr 1.6fr 110px 140px 110px; cursor: default; }
.row.admin-user-row a { color: var(--ink); }
.admin-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 16px; margin-top: 16px; align-items: start; }
.admin-grid .stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.admin-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px; margin: 16px -20px -20px; border-top: 1px solid var(--line); }
.admin-quick .muted { margin-right: auto; }
.activity-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 14px; }
@media (max-width: 1000px) { .admin-grid { grid-template-columns: 1fr; } }
.read-only .write-only { display: none !important; }
@media (max-width: 1100px) { .plans { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .access-bar { padding: 10px 16px; flex-wrap: wrap; }
  .row.admin-row { grid-template-columns: 1fr auto; grid-template-areas: none; }
  .row.admin-row > span:nth-child(2), .row.admin-row > span:nth-child(3), .row.admin-row > span:nth-child(5) { display: none; }
  .row.admin-user-row { grid-template-columns: 1fr auto; }
  .row.admin-user-row > span:nth-child(2), .row.admin-user-row > span:nth-child(3), .row.admin-user-row > span:nth-child(4) { display: none; }
}

/* ---------- Devis, catalogue, e-mail ---------- */
.badge.accepted { background: var(--green-bg); color: var(--green); }
.badge.refused { background: var(--red-bg); color: var(--red); }
.badge.invoiced { background: var(--brand-50); color: var(--brand); }
.badge.expired { background: var(--amber-bg); color: var(--amber); }
.section-tabs { margin-bottom: 14px; }
@media (min-width: 761px) { .section-tabs { display: none; } }
.row.product-row { grid-template-columns: 1.8fr 120px 110px 170px 120px; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); }
.row.product-row .client { white-space: normal; text-align: left; min-width: 0; }
.row .desc-sm { display: block; font-size: 12.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list { max-height: 46vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.pick { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink); }
.pick:has(input:checked) { border-color: var(--brand); background: var(--brand-50); }
.pick input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.pick .grow { flex: 1; min-width: 0; }
.quote-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.qstep { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 999px; background: var(--gray-bg); color: var(--muted); font-size: 12.5px; font-weight: 600; }
.qstep svg { width: 13px; height: 13px; }
.qstep.done { background: var(--green-bg); color: var(--green); }
.peppol-logo.quote-logo { background: linear-gradient(135deg, #2563eb, #60a5fa); }
.peppol-logo.mail-logo { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.timeline .tdot.sent { background: var(--blue-bg); color: var(--blue); }
@media (max-width: 1100px) { .row.product-row { grid-template-columns: 1.8fr 110px 110px 120px; } }
@media (max-width: 760px) {
  .row.product-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "client amount"; }
  .row.product-row .unit { display: none; }
}

/* ---------- Relances et factures récurrentes ---------- */
label.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--ink); cursor: pointer; margin: 6px 0; line-height: 1.4; }
label.check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--brand); }
.row.recur-row { grid-template-columns: 1.8fr 120px 130px 150px 120px; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.row.recur-row.head { cursor: default; background: var(--surface-2); }
.row.recur-row .client { white-space: normal; text-align: left; min-width: 0; }
.row.recur-row .desc-sm svg { width: 13px; height: 13px; vertical-align: -2px; }
.row.inactive { opacity: .6; }
@media (max-width: 1100px) { .row.recur-row { grid-template-columns: 1.8fr 110px 120px 120px; } .row.recur-row .st { display: none; } }
@media (max-width: 760px) {
  .row.recur-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "client amount" "due amount"; }
  .row.recur-row .client { grid-area: client; } .row.recur-row .amount { grid-area: amount; }
  .row.recur-row .due { grid-area: due; display: block; font-size: 13px; color: var(--muted); }
  .row.recur-row:not(.inactive) .due::before { content: "Prochaine : "; }
  .row.recur-row .date, .row.recur-row .st { display: none; }
}

/* ---------- Personnalisation, double authentification ---------- */
.paper .p-logo { max-width: 170px; max-height: 56px; object-fit: contain; display: block; margin-bottom: 10px; }
.logo-drop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 180px; height: 72px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; background: #fff; overflow: hidden; color: var(--muted); font-size: 13px; }
.logo-preview img { max-width: 160px; max-height: 60px; object-fit: contain; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6); }
.swatch.active { border-color: var(--ink); }
.swatches input[type=color] { width: 38px; height: 32px; padding: 2px; border-radius: 8px; }
.qr-img { border-radius: 8px; background: #fff; padding: 6px; }
.recovery { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.recovery code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; padding: 8px; text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; }
.lang-tag { font-size: 11.5px; font-weight: 650; padding: 2px 7px; border-radius: 6px; background: var(--gray-bg); color: var(--muted); }

/* ---------- Dépenses et rapports TVA ---------- */
.kpis.kpis-3 { grid-template-columns: repeat(3, 1fr); margin-bottom: 16px; }
.kpi.warn .ic { background: var(--amber-bg); color: var(--amber); }
.chip-select { height: 34px; width: auto; padding: 0 34px 0 14px; border-radius: 999px; font-weight: 540; font-size: 14px; background-position: right 12px center; }
.chip-select.sm { height: 30px; font-size: 13px; }
.row.expense-row { grid-template-columns: minmax(0, 1.8fr) 120px 190px 100px 130px; width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.row.expense-row.head { cursor: default; background: var(--surface-2); }
.row.expense-row .client { white-space: normal; min-width: 0; }
.clip-ic svg { width: 14px; height: 14px; vertical-align: -2px; color: var(--muted); }
.attach { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.attach img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.attach .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.attach.drop { border-style: dashed; cursor: pointer; color: var(--ink); }
.attach.drop > svg { width: 28px; height: 28px; color: var(--brand); margin: 0 8px; }
.attach.drop:hover { border-color: var(--brand); background: var(--brand-50); }
.attach-pdf { width: 56px; height: 56px; border-radius: 8px; background: var(--red-bg); color: var(--red); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.attach-pdf svg { width: 20px; height: 20px; margin-bottom: -10px; }
.reports { grid-template-columns: 1.3fr 1fr; margin-top: 0; }
.reports .stack { display: flex; flex-direction: column; gap: 16px; }
.grids { padding: 6px 0 4px; }
.grid-sec h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 14px 20px 6px; font-weight: 650; }
.grid-row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 10px; padding: 7px 20px; font-size: 14px; }
.grid-row .gnum { justify-self: start; min-width: 32px; text-align: center; padding: 2px 6px; border-radius: 6px; background: var(--brand-50); color: var(--brand); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.grid-row .glabel { color: var(--ink-2); }
.grid-row .gval { font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-row.zero { opacity: .5; }
.grid-row.total { margin-top: 2px; border-top: 1px solid var(--line); padding-top: 10px; font-size: 15px; }
.grid-row.total .gnum { background: var(--ink); color: var(--surface); }
.grid-row.total .gval { font-size: 17px; font-weight: 720; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); }
.mini-table > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.mini-table > div:last-child { border-bottom: 0; }
.mini-table .amount { font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-table b { display: block; }
.peppol-logo.export-logo { background: linear-gradient(135deg, #0f766e, #14b8a6); }
@media (max-width: 1100px) {
  .row.expense-row { grid-template-columns: minmax(0, 1.8fr) 110px 100px 120px; }
  .row.expense-row .due { display: none; }
  .reports { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .kpis.kpis-3 { grid-template-columns: 1fr 1fr; }
  .kpis.kpis-3 .kpi:first-child { grid-column: 1 / -1; }
  .row.expense-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "client amount" "date status"; }
  .row.expense-row .client { grid-area: client; } .row.expense-row .amount { grid-area: amount; }
  .row.expense-row .date { grid-area: date; display: block; font-size: 13px; }
  .row.expense-row .st { grid-area: status; justify-self: end; }
  .page-head .actions .chip-select { width: 100%; }
  .grid-row { padding: 7px 16px; grid-template-columns: 40px 1fr auto; font-size: 13.5px; }
  .grid-sec h3 { margin-left: 16px; }
  .mini-table > div, .card-foot { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Banque et paiement en ligne ---------- */
.bank-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 130px minmax(0, auto); gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.bank-row:last-child { border-bottom: 0; }
.bank-row .b-main { min-width: 0; }
.bank-row .b-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-row .b-amount { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bank-row .b-amount.in { color: var(--green); }
.bank-row .b-act { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; max-width: 520px; }
.bank-row .b-act .badge svg { width: 12px; height: 12px; }
.bank-row .b-act .badge { text-decoration: none; display: inline-flex; gap: 4px; align-items: center; }
.bank-row .auto { font-size: 12px; }
.bank-row.ignored { opacity: .6; }
.peppol-logo.pay-logo { background: linear-gradient(135deg, #c2410c, #fb923c); }
.pay-link { display: flex; gap: 8px; }
.pay-link input { flex: 1; min-width: 0; font-size: 13px; height: 34px; color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; }
.ok-text { color: var(--green); }
.err-text { color: var(--red); }
@media (max-width: 1100px) {
  .bank-row { grid-template-columns: 90px minmax(0, 1fr) 120px; }
  .bank-row .b-act { grid-column: 2 / -1; justify-content: flex-start; max-width: none; }
}
@media (max-width: 760px) {
  .bank-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main amount" "date date" "act act"; gap: 4px 10px; padding: 14px 16px; }
  .bank-row .b-main { grid-area: main; } .bank-row .b-amount { grid-area: amount; } .bank-row .b-date { grid-area: date; font-size: 13px; }
  .bank-row .b-act { grid-area: act; margin-top: 6px; }
}

/* ---------- Espace cabinet comptable ---------- */
.cab-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.cab-row:last-child { border-bottom: 0; }
.cab-main, .cab-vat { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cab-main .desc-sm, .cab-vat .desc-sm { font-size: 12.5px; }
.cab-vat b { font-variant-numeric: tabular-nums; }
.cab-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cab-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card.requests { margin-bottom: 16px; border-color: var(--brand-100); }
.card.requests h2 { display: flex; align-items: center; gap: 8px; }
.card.requests h2 svg { width: 18px; height: 18px; color: var(--brand); }
.request-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.request-row:first-of-type { margin-top: 12px; }
.request-row .desc-sm { font-size: 12.5px; margin-top: 2px; }
@media (max-width: 900px) {
  .cab-row { grid-template-columns: 1fr; gap: 10px; }
  .cab-actions { justify-content: flex-start; }
}
.request-row .grow { flex: 1; min-width: 0; }
.banner > svg { width: 20px; height: 20px; flex: none; color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* Aide : assistant */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 380px; min-height: 80px; overflow-y: auto; padding: 4px 2px; }
.chat-msg { display: flex; }
.chat-msg > div { max-width: 88%; padding: 9px 13px; border-radius: 14px; font-size: 14.5px; line-height: 1.45; background: var(--brand-50); color: var(--ink); overflow-wrap: anywhere; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.user > div { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant > div { border-bottom-left-radius: 4px; }
.chat-msg.typing > div { opacity: .6; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 44px; }
.chat-suggest .chip { height: auto; min-height: 34px; padding: 6px 14px; white-space: normal; text-align: left; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.check input { width: auto; height: auto; }
.chat-suggest { flex-wrap: wrap; }
.chat-suggest .chip { border-radius: 14px; }
@media (max-width: 700px) { .chat-suggest { flex-direction: column; align-items: stretch; } .chat-form { flex-direction: column; align-items: stretch; } }

/* ---------- Sélecteur de langue ---------- */
.lang-switch { position: relative; display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.lang-switch svg { width: 18px; height: 18px; flex: none; pointer-events: none; }
.lang-switch select { width: auto; height: 38px; padding: 0 12px; border-radius: 12px; font-size: 14.5px; font-weight: 560; cursor: pointer; background: var(--surface); }
.lang-switch.side { margin: 8px 4px 0; }
.lang-switch.side select { flex: 1; }
.lang-switch.block select { flex: 1; }
.lang-switch.block { width: 100%; }
.lang-switch.compact { width: 44px; height: 44px; justify-content: center; }
.lang-switch.compact select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.lang-switch.auth { align-self: flex-end; margin: -8px 4px 0 0; }
@media (min-width: 861px) { .auth-main { position: relative; } .lang-switch.auth { position: absolute; top: 22px; right: 28px; margin: 0; } }
