:root {
  color-scheme: light;
  --bg: #f3efe7;
  --paper: #fffdf9;
  --ink: #1c1915;
  --muted: #6b645b;
  --line: #e4dcd0;
  --sidebar: #1f2c28;
  --sidebar-ink: #f6f1e8;
  --sidebar-muted: #d5ddd6;
  --gold: #c6a15b;
  --ok: #0f6b3c;
  --ok-bg: #e7f4ec;
  --bad: #9f2b2b;
  --bad-bg: #fde8e6;
  --warn: #8a5a00;
  --warn-bg: #fff4d8;
  --link: #1d4e3a;
  --shadow: 0 1px 2px rgba(48, 38, 24, 0.04), 0 10px 28px rgba(48, 38, 24, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", "Noto Sans", Helvetica, Arial, sans-serif;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: #143728; }

button, input, select { font: inherit; color: inherit; }

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px;
  flex: none;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px 16px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}

.brand-name {
  margin: 4px 0 0;
  font-family: Palatino, "Palatino Linotype", "Iowan Old Style", "Liberation Serif", Georgia, serif;
  font-size: 28px;
  line-height: 1.1;
}

.brand-note { margin: 6px 0 0; color: var(--sidebar-muted); font-size: 13px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 28px; }
.nav a {
  color: var(--sidebar-ink);
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 10px;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); }
.nav a.is-active { background: rgba(198, 161, 91, 0.18); box-shadow: inset 3px 0 0 var(--gold); }

.sidebar-foot {
  margin-top: auto;
  color: var(--sidebar-muted);
  font-size: 12px;
  line-height: 1.4;
}

.main { flex: 1; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 32px 0;
}
h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; font-weight: 650; }
.content { padding: 8px 32px 64px; max-width: 1180px; }
.lede { color: var(--muted); margin: 8px 0 18px; max-width: 68ch; }

.segmented {
  display: flex;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow);
}
.segmented a {
  text-decoration: none;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
}
.segmented a.is-active { background: var(--sidebar); color: var(--sidebar-ink); }

.demo {
  background: #fff6df;
  border: 1px solid #ead7a4;
  color: #6d5314;
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 0 16px;
  font-size: 14px;
}

.stack { display: flex; flex-direction: column; gap: 14px; }
.card, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.card { padding: 16px 18px 14px; border-left-width: 4px; }
.card.tone-ok { border-left-color: var(--ok); }
.card.tone-bad { border-left-color: var(--bad); }
.card.tone-muted { border-left-color: #c8c0b4; }
.card-head, .panel-head, .title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.card h2, .panel h2, .subhead { margin: 0; font-size: 18px; }
.card h2 a { color: inherit; text-decoration: none; }
.card h2 a:hover { text-decoration: underline; }
.masked { margin: 2px 0 0; color: var(--muted); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.panel { margin-top: 18px; padding: 8px 8px 12px; }
.panel-head { padding: 10px 10px 4px; }
.panel-head p, .footnote { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.footnote { margin-top: 16px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 8px;
}
.stats div { min-width: 0; }
.stats dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.stats dd { margin: 3px 0 0; font-size: 16px; }
.stats small, .num small { color: var(--muted); font-size: 12px; font-weight: 500; }
.split { margin: 8px 0 0; font-size: 14px; }

.metrics { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 140px;
}
.metric span { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.metric strong { display: block; margin-top: 4px; font-size: 18px; font-weight: 650; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: end;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.filters input, .filters select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 8px;
  min-width: 140px;
}
.filter-actions { display: flex; gap: 10px; align-items: center; padding-bottom: 2px; }
button, .button {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
}
.button-quiet { background: transparent; color: var(--link); padding-left: 0; }
button:hover, .button:hover { filter: brightness(1.08); }

.totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.totals div {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.totals span { display: block; color: var(--muted); font-size: 12px; }
.totals strong { font-size: 16px; }
.count { color: var(--muted); margin: 10px 0 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  position: sticky;
  top: 0;
  background: #f7f3ec;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gl { font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #fbf8f2; }
tr.is-target td, tr:target td { background: #fbf3df; }
.clip { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.muted { background: #f1ece4; color: #5e584f; }

.callout {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 10px;
  padding: 8px 12px;
}
.empty { color: var(--muted); padding: 12px; }
.back { margin: 0; }
.period { margin: 4px 0 0; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; justify-content: space-between; padding: 10px; }
.pager-links { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pager-links a, .pager-links span { min-width: 2em; padding: 3px 7px; text-align: center; border-radius: 4px; }
.pager-links a:hover { background: #efe9df; }
.pager .current { font-weight: 600; background: #2f2a24; color: #fff; }
.pager .ellipsis { color: #8b8378; }
.pager form { display: flex; gap: 6px; align-items: center; margin: 0; }
.pager input[type=number] { width: 5em; }
.js .pager .nojs { display: none; }
.pager .disabled { color: #b3aa9e; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; }
  .nav { flex-direction: row; flex-wrap: wrap; margin-top: 16px; }
  .sidebar-foot { margin-top: 12px; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .stats, .totals { grid-template-columns: 1fr 1fr; }
}
.doc { white-space: nowrap; }
.doc + .doc { margin-top: 2px; }
.doc .pdf { font-size: 0.8em; margin-left: 4px; }
details.doc summary { cursor: pointer; }
details.doc ul { margin: 4px 0 0 16px; padding: 0; }
.gl span { white-space: normal; display: inline-block; max-width: 240px; }

/* Layout v2: full-width, compact, responsive tables */
.content { max-width: none; padding: 8px 24px 48px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 160px); border-radius: 12px; }
table { font-size: 13px; }
th, td { padding: 6px 8px; }
th { position: sticky; top: 0; z-index: 2; white-space: nowrap; box-shadow: inset 0 -1px 0 var(--line); }
th:first-child, td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper, #fffdf9); white-space: nowrap; }
th:first-child { z-index: 3; background: #f7f3ec; }
td.label { min-width: 220px; max-width: 420px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; cursor: help; }
td.label:hover .clamp, td.label:focus-within .clamp { -webkit-line-clamp: unset; }
.badge { white-space: nowrap; overflow: visible; max-width: none; }
td:has(> .badge) { white-space: nowrap; }
.gl span { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.doc a { white-space: nowrap; }
.filters { gap: 10px 14px; padding: 14px 16px; }
.filters label { min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.filters input, .filters select { min-width: 0; width: 100%; box-sizing: border-box; }
.filters input.date { font-variant-numeric: tabular-nums; }
.filter-actions { flex: 1 0 100%; }
.totals { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
@media (max-width: 980px) {
  .content { padding: 8px 12px 32px; }
  .filters label { flex-basis: 45%; max-width: none; }
  td.label { min-width: 180px; }
}
td.label { min-width: 200px; max-width: 300px; }
td.docs { max-width: 200px; }
td.docs .doc { overflow: hidden; text-overflow: ellipsis; }
.gl span { max-width: 170px; }
td .clip { max-width: 160px; }
td.status { white-space: nowrap; }

/* Document side panel */
.doc-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 45vw; max-width: 90vw;
  background: var(--paper, #fffdf9); border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(0,0,0,.12); z-index: 50;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s ease; visibility: hidden;
}
.doc-panel.is-open { transform: none; visibility: visible; }
.doc-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.doc-title { flex: 1; margin: 0; font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-head a { font-size: 13px; white-space: nowrap; }
.doc-close { background: transparent; color: inherit; font-size: 22px; line-height: 1; padding: 2px 8px; }
.doc-body { flex: 1; min-height: 0; background: #e9e5de; overflow: auto; }
.doc-body iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.doc-body img { display: none; max-width: 100%; margin: 0 auto; }
.doc-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; }
body.doc-resizing { user-select: none; cursor: col-resize; }
body.doc-resizing iframe { pointer-events: none; }
body.doc-open .main { margin-right: var(--doc-panel-w, 45vw); }
a.doc-active { font-weight: 700; background: #fbf3df; border-radius: 4px; }
@media (max-width: 980px) { .doc-panel { width: 100vw !important; } body.doc-open .main { margin-right: 0; } }

/* UX pass */
.topbar { gap: 16px; }
.topbar h1 { flex: 0 0 auto; }
.global-search { flex: 1; max-width: 420px; margin-left: auto; }
.global-search input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: #fff; font: inherit; }
.attention { margin: 4px 0 18px; }
.attention h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.att { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--paper, #fffdf9); border: 1px solid var(--line); border-left: 4px solid #c8c0b4; border-radius: 12px; color: inherit; text-decoration: none; transition: transform .1s, box-shadow .1s; }
.att:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.att strong { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.att span { font-weight: 600; }
.att small { color: var(--muted); }
.att.tone-warn { border-left-color: #d98a1c; }
.att.tone-bad { border-left-color: var(--bad); }
.att.tone-ok { border-left-color: var(--ok); }
.chips { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-row > span { width: 56px; font-size: 12px; color: var(--muted); }
.chip { padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: inherit; text-decoration: none; font-size: 12.5px; white-space: nowrap; }
.chip:hover { border-color: #b9ae9e; }
.chip.is-on { background: var(--sidebar); color: var(--sidebar-ink); border-color: var(--sidebar); }
.badge.warn { background: #fdebd3; color: #a35a00; }
tr.has-doc { cursor: pointer; }
tr.is-kbd td { background: #f3ead6 !important; box-shadow: inset 0 0 0 0 transparent; }
tr.is-kbd td:first-child { box-shadow: inset 3px 0 0 #b07a12; }
.empty { padding: 24px 8px; color: var(--muted); text-align: center; }
@media (max-width: 980px) { .global-search { order: 3; flex-basis: 100%; max-width: none; } .topbar { flex-wrap: wrap; } }

/* Notes de frais */
.ndf-list { display: flex; flex-direction: column; }
details.ndf { border-bottom: 1px solid var(--line); }
details.ndf > summary { display: grid; grid-template-columns: 96px 80px 120px 110px 1fr auto; gap: 12px; align-items: center; padding: 9px 8px; cursor: pointer; list-style: none; font-size: 13px; }
details.ndf > summary::-webkit-details-marker { display: none; }
details.ndf > summary:hover { background: #fbf8f2; }
details.ndf[open] > summary { background: #f7f3ec; }
.ndf-rep { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.ndf .table-wrap { margin: 4px 8px 12px 40px; max-height: none; }
table.sub { font-size: 12.5px; }
@media (max-width: 980px) { details.ndf > summary { grid-template-columns: 1fr 1fr; } }

/* Déclarations */
.decl-group { padding: 4px 8px 10px; }
.decl-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 6px; }
.decl-doc { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.decl-name { display: flex; flex-direction: column; gap: 2px; }
.decl-name small, .muted { color: var(--muted); }
ul.figs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 18px; font-size: 12.5px; }
ul.figs li { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted var(--line); padding: 2px 0; }
ul.figs li a { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 980px) { .decl-doc { grid-template-columns: 1fr; } }

/* Comments */
.cmt-cell { width: 1%; white-space: nowrap; text-align: right; }
.cmt-btn { border: 1px solid transparent; background: none; color: #9aa3ad; cursor: pointer; border-radius: 6px; padding: 1px 6px; font-size: 13px; line-height: 1.4; opacity: .55; }
tr:hover .cmt-btn, .cmt-btn:focus-visible, .cmt-btn.has-open, .cmt-btn.has-resolved, li:hover .cmt-btn, summary:hover .cmt-btn { opacity: 1; }
.cmt-btn:hover { border-color: #cfd6dd; color: #344; }
.cmt-btn.has-open { color: #a05a00; background: #fff4e0; border-color: #f3c98b; }
.cmt-btn.has-resolved { color: #2f7d4f; background: #eaf6ee; }
.cmt-n { margin-left: 3px; font-size: 11px; font-weight: 600; }
tr:has(.cmt-btn.has-open) > td:first-child { box-shadow: inset 3px 0 0 #f0a640; }
.figs li .cmt-btn { margin-left: 4px; }
.cmt-pop { position: fixed; z-index: 60; width: min(380px, calc(100vw - 16px)); max-height: 70vh; overflow: auto; background: #fff; border: 1px solid #d5dbe1; border-radius: 10px; box-shadow: 0 12px 32px rgba(20,30,40,.18); padding: 10px 12px; font-size: 13px; }
.cmt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.cmt-close { border: none; background: none; font-size: 18px; cursor: pointer; color: #667; }
.cmt-snap { color: #667; font-size: 12px; margin: 0 0 8px; word-break: break-word; }
.cmt-item { border-left: 3px solid #f0a640; padding: 4px 8px; margin-bottom: 8px; background: #fffaf2; border-radius: 4px; }
.cmt-item.is-resolved { border-color: #6fbf8b; background: #f3faf5; }
.cmt-meta { font-size: 11px; color: #778; }
.cmt-body { margin: 2px 0 4px; white-space: pre-wrap; word-break: break-word; }
.cmt-actions { display: flex; gap: 10px; }
.cmt-pop textarea { width: 100%; box-sizing: border-box; font: inherit; border: 1px solid #cfd6dd; border-radius: 6px; padding: 6px; margin: 4px 0; }
.linkish { border: none; background: none; color: #2b5d9b; cursor: pointer; padding: 0; font-size: 12px; }
.linkish.danger { color: #b33; }
.cmt-text { max-width: 360px; white-space: pre-wrap; word-break: break-word; }

/* Bilan & CR */
table.bilan td:first-child { min-width: 260px; }
table.bilan .gl-code { display: inline-block; min-width: 40px; color: #667; font-variant-numeric: tabular-nums; }
table.bilan tr.sub-head td { background: #f3f5f8; font-weight: 600; text-transform: uppercase; font-size: 12px; letter-spacing: .03em; color: #556; }
table.bilan tr.total-row td { font-weight: 600; border-top: 1px solid #cfd6dd; background: #fafbfc; }
td.nc { color: #99a; font-style: italic; cursor: help; }
.gap { border-radius: 4px; padding: 0 4px; }
.gap-ok { color: #2f7d4f; background: #eaf6ee; }
.gap-warn { color: #8a5a00; background: #fff4e0; }
.gap-bad { color: #a12b2b; background: #fdeaea; }
.cmt-pop .btn { border: 1px solid var(--sidebar); background: var(--sidebar); color: var(--sidebar-ink); border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 12.5px; }

/* Simple VAT table */
table.vat-simple th.grp { text-align: center; border-bottom: 1px solid var(--line); }
table.vat-simple td.gap { cursor: help; font-weight: 600; }
details.vat-details > summary { cursor: pointer; font-weight: 600; margin: 12px 0; }


/* TVA page v2 */
.vat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.vat-card { background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.vat-card.is-ok { border-left-color: var(--ok); } .vat-card.is-warn { border-left-color: #d99a2b; } .vat-card.is-bad { border-left-color: var(--bad); }
.vat-card .k { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.vat-card .v { margin: 4px 0 6px; font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vat-card ul { margin: 0; padding-left: 16px; font-size: 13px; } .vat-card li { margin: 2px 0; }
.vlegend { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 4px 0 0; }
.vyears { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
details.vyear { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
details.vyear[open] { box-shadow: var(--shadow); }
details.vyear > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 170px repeat(3, minmax(0, 1fr)) auto; gap: 14px; align-items: center; padding: 10px 14px; }
details.vyear > summary::-webkit-details-marker { display: none; }
details.vyear > summary:hover { background: #fbf8f2; }
.vhead { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.vhead .vfy { font-size: 18px; font-weight: 650; } .vhead .vfy::before { content: "▸ "; color: var(--muted); font-size: 13px; }
details.vyear[open] .vhead .vfy::before { content: "▾ "; }
.vblock .vt { margin: 0; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.vblock .vn { margin: 2px 0 4px; font-variant-numeric: tabular-nums; font-size: 13.5px; display: flex; gap: 6px; flex-wrap: wrap; }
.vblock .sep { color: var(--muted); }
.vbars { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }
.vb { display: inline-block; height: 5px; border-radius: 3px; min-width: 2px; }
.vb.decl { background: #8d9ea4; } .vb.due { background: var(--gold); }
.vbars .vb { display: block; }
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; } .w25 { width: 25%; } .w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; } .w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }
.vlegend .vb { width: 18px; }
.gchip { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px; cursor: help; font-variant-numeric: tabular-nums; }
.gchip.gap-ok { color: var(--ok); background: var(--ok-bg); } .gchip.gap-warn { color: var(--warn); background: var(--warn-bg); }
.gchip.gap-bad { color: var(--bad); background: var(--bad-bg); } .gchip.muted { color: var(--muted); background: #f1ede6; }
.vside { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.vdetail { border-top: 1px solid var(--line); padding: 10px 14px 14px; display: grid; gap: 12px; }
.vexplain { margin: 0; padding-left: 18px; font-size: 13.5px; } .vexplain li { margin: 4px 0; }
.vsub h4 { margin: 0 0 4px; font-size: 13px; }
@media (max-width: 860px) {
  details.vyear > summary { grid-template-columns: 1fr 1fr; }
  .vhead { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 8px; }
  .vside { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; }
}
@media (max-width: 520px) { details.vyear > summary { grid-template-columns: 1fr; } }
details.vyear > summary { grid-template-columns: 190px repeat(3, minmax(0, 1fr)) auto; }
.vhead .badge { white-space: normal; line-height: 1.3; }
.main, .content, .vyears, details.vyear, .vat-cards, .vat-card { min-width: 0; }
@media (max-width: 860px) {
  .app { overflow-x: hidden; }
  .main { max-width: 100vw; }
  details.vyear > summary { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) { details.vyear > summary { grid-template-columns: 1fr; } }
.vdetail, .vsub, .vexplain { min-width: 0; overflow-wrap: anywhere; } details.vyear { overflow: hidden; }

/* TVA v3 — minimal */
.kn { display: flex; flex-wrap: wrap; gap: 48px; margin: 8px 0 36px; }
.kn > div { display: flex; flex-direction: column; gap: 2px; }
.kn-l { font-size: 13px; color: var(--muted); }
.kn-v { font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kn-sub { font-size: 12.5px; color: var(--muted); }
.tyears h2 { font-size: 15px; font-weight: 600; margin: 0 0 8px; color: var(--muted); }
details.tyear { border-top: 1px solid var(--line); }
details.tyear:last-of-type { border-bottom: 1px solid var(--line); }
details.tyear > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 120px 1fr 1fr 130px 1fr 32px; align-items: center; gap: 16px; padding: 18px 4px; }
details.tyear > summary::-webkit-details-marker { display: none; }
details.tyear > summary:hover { background: rgba(0,0,0,.015); }
.ty-fy { font-size: 17px; font-weight: 600; }
.ty-fy::before { content: "›"; display: inline-block; width: 14px; color: var(--muted); transition: transform .15s; }
details.tyear[open] .ty-fy::before { transform: rotate(90deg); }
.ty-v { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; font-size: 15px; }
.ty-l { font-size: 11.5px; color: var(--muted); }
.tchip { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--muted); }
.tchip.is-ok { color: var(--ok); }
.tchip.is-bad { color: var(--bad); font-weight: 600; }
.tbadge { font-size: 12px; color: var(--muted); }
.tbadge.is-due { color: var(--warn); font-weight: 600; }
.tdetail { padding: 4px 4px 28px 30px; max-width: 760px; }
.texp { margin: 0 0 18px; font-size: 14px; }
.tsplit { display: grid; grid-template-columns: 90px 1fr 160px 110px; gap: 12px; align-items: center; font-size: 13.5px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.ts-n { color: var(--muted); }
.ts-b { display: flex; flex-direction: column; gap: 2px; }
.ts-b .vb { display: block; }
.tsec { margin-top: 22px; }
.tsec h4 { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin: 0 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.tsec h4 span { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.tlist { list-style: none; margin: 0; padding: 0; }
.tlist li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; }
.tl-l { min-width: 0; overflow-wrap: anywhere; }
.tl-a { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tfoot { margin-top: 28px; font-size: 13px; }
@media (max-width: 760px) {
  .kn { gap: 24px; }
  details.tyear > summary { grid-template-columns: 1fr 1fr 32px; row-gap: 6px; }
  .ty-fy { grid-column: 1 / 3; }
  .ty-c, .ty-b { grid-column: span 1; }
  .tdetail { padding-left: 8px; }
  .tsplit { grid-template-columns: 80px 1fr; }
  .ts-b { display: none; }
}
details.tmonth > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr 110px 110px 110px 100px; gap: 10px; padding: 6px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; border-bottom: 1px solid #f0ebe2; }
details.tmonth > summary::-webkit-details-marker { display: none; }
details.tmonth > summary:hover { background: rgba(0,0,0,.015); }
.tm-v { text-align: right; } details.tmonth > summary .tchip { text-align: right; }
details.tmonth .tlist { padding: 4px 0 10px 16px; }
.tnote { font-size: 12.5px; margin: 0 0 6px; }
@media (max-width: 760px) { details.tmonth > summary { grid-template-columns: 1fr 80px 80px 80px; } details.tmonth > summary .tm-v:first-of-type { display: none; } }
@media (max-width: 760px) {
  details.tyear > summary { grid-template-columns: 1fr 1fr 28px; gap: 6px 12px; padding: 14px 2px; }
  .ty-fy, .ty-b { grid-column: 1 / -1; }
  .ty-b:empty { display: none; }
  .ty-c { grid-column: 1 / 3; }
  details.tyear > summary .cmt-cell { grid-column: 3; grid-row: 1; }
  details.tmonth > summary { grid-template-columns: 1fr 64px 64px 64px 64px; font-size: 12px; gap: 4px; }
  details.tmonth > summary .tm-v:first-of-type { display: block; }
  .tsplit { grid-template-columns: 74px 1fr auto; }
}
.ty-c { display: flex; flex-direction: column; gap: 2px; } .ty-cum { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 6px; border-radius: 9px; background: var(--gold); color: #1b1b1b; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }

/* Login and users */
.login { min-height: 100vh; display: grid; place-items: center; background: #f5f5f2; }
.login-card { display: grid; gap: 12px; width: min(340px, 90vw); padding: 28px; background: #fff; border: 1px solid #ddd; border-radius: 10px; }
.login-card h1 { margin: 0 0 6px; font-size: 1.4rem; }
.login-card label { display: grid; gap: 4px; font-size: .9rem; }
.login-card input { padding: 8px; font: inherit; }
.login-card button { padding: 9px; font: inherit; cursor: pointer; }
.login-error { color: #a32020; margin: 0; }
.user-box { margin: 12px 0; font-size: .85rem; display: grid; gap: 2px; }
.user-box .user-name { font-weight: 600; }
.user-box button { justify-self: start; padding: 0; }
form.inline { display: inline; }
form.inline input[type=password] { width: 12em; }
.notice { padding: 8px 12px; border-radius: 6px; }
.notice.ok { background: #e8f5e9; }
.notice.bad { background: #fdecea; }
.badge.ndf { background: #e8eefc; color: #23408e; text-decoration: none; }
tr.is-ndf td { background: #fafbff; }

.badge.orange { background: #fff1e0; color: #a65300; border-color: #f0c08a; }
tr.no-receipt td { background: #fffaf3; }
tr.ndf-report td { background: #f6f7fb; font-size: 12px; }

.cmt-reply { margin-top: 6px; padding: 6px 8px; background: #eef6ee; border-left: 3px solid #4a8f4a; border-radius: 4px; font-size: 12px; }

.tmonth summary .tm-c { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: #555; }
.tmonth.is-none summary > span:first-child { color: #8a5a00; }
.tmonth.is-period summary { font-weight: 600; background: #f3f1ea; }
.tchip.is-none { background: #fff1e0; color: #a65300; }

th.sortable a { color: inherit; text-decoration: none; white-space: nowrap; }
th.sortable a:hover { text-decoration: underline; }
th.is-sorted, th .sort-alt.is-sorted { color: #1f4f8f; }
.sort-arrow { font-size: 10px; }
th .sort-alt { margin-left: 4px; font-weight: 400; color: #777; text-decoration: none; }

/* NDF: link to the NOTE sheet that converts a foreign-currency line into euros */
a.conv { font-size: .85em; margin-left: .4em; color: #6b6b6b; white-space: nowrap; }

/* NDF receipts in Écritures: aligned TTC / HT / TVA columns, wrapping names (no cut-off line) */
td.docs:has(details.ndf-doc[open]) { max-width: none; min-width: 420px; }
td.docs details.ndf-doc { overflow: visible; white-space: normal; }
details.ndf-doc summary { white-space: normal; }
ul.ndf-recs { list-style: none; margin: 6px 0 0; padding: 0; display: grid; grid-template-columns: minmax(140px, 1fr) auto auto auto; gap: 2px 10px; font-size: 12px; }
ul.ndf-recs li { display: contents; }
ul.ndf-recs li > span { padding: 2px 0; border-bottom: 1px solid var(--line); }
ul.ndf-recs .r-name { white-space: normal; word-break: break-word; }
ul.ndf-recs .r-name a { white-space: normal; }
ul.ndf-recs .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
ul.ndf-recs .r-head > span { font-weight: 650; color: var(--muted, #6b6359); }
.unk { color: var(--muted, #6b6359); font-style: italic; }
td.num.derived { color: #4a5a6a; }
td.num.derived .unk-mark { color: #b06a00; font-weight: 700; margin-left: 1px; }
