/* Turandot. Rice paper, lacquer brown ink, a vermilion seal; jade for what is settled,
   ochre for what waits. One upright sans, Inter, for titles and figures alike, with
   tabular digits so amounts line up. No italics. Light only. */

:root {
  --paper: #fbf6ec;
  --sheet: #fffdf8;
  --sheet-2: #fdf5e8;
  --ink: #5a3329;
  --ink-2: #6f4a3d;
  --muted: #8a685a;
  --faint: #a88d7f;
  --rule: #efe2cf;
  --rule-strong: #e0cbb1;
  --seal: #b8402c;
  --seal-strong: #9f3322;
  --on-seal: #fffaf4;
  --seal-soft: #fbe6dc;
  --ochre: #8f6420;
  --ochre-soft: #f8ead0;
  --jade: #2f6d55;
  --jade-soft: #e2f0e6;
  --bar-rev: #3f8a6c;
  --bar-chg: #d2a368;
  --hover: #f9efe0;
  --shadow: 0 1px 0 rgba(120, 72, 48, 0.04), 0 12px 30px -24px rgba(120, 72, 48, 0.35);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  font-optical-sizing: auto;
}
body.panel-open { overflow: hidden; }
@media (min-width: 1100px) { body.panel-open { overflow: auto; } }

a { color: inherit; }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; margin: 0; letter-spacing: -0.015em; }
p { margin: 0; }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--seal); }
.in { color: var(--jade); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.quiet { color: var(--muted); font-size: 13.5px; }
.r { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -40px; background: var(--seal); color: var(--on-seal); padding: 6px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 12px clamp(16px, 3vw, 40px);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.brand img { flex: none; transform: rotate(-3deg); }
.brand-text { display: grid; line-height: 1.1; }
.brand-name { font: 600 19px/1 var(--sans); letter-spacing: -0.015em; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.nav { display: flex; gap: 2px; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.nav a:hover { color: var(--ink); background: var(--hover); }
.nav a[aria-current="page"] { color: var(--seal-strong); background: var(--seal-soft); }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  font: 600 11.5px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  background: var(--ochre-soft);
  color: var(--ochre);
}
.badge.late { background: var(--seal); color: var(--on-seal); }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

/* Controls */
select, input, button, textarea { font: inherit; color: inherit; }
select, input[type="text"], input[type="date"], input[type="search"], textarea {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: 9px;
  padding: 8px 11px;
  min-height: 38px;
  min-width: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:hover, input:hover, textarea:hover { border-color: var(--faint); }
select:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--seal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--seal) 18%, transparent);
}
input:disabled { opacity: 0.5; }
textarea { resize: vertical; width: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--seal);
  background: var(--seal);
  color: var(--on-seal);
  border-radius: 9px;
  padding: 7px 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--seal-strong); border-color: var(--seal-strong); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn.ghost:hover { border-color: var(--seal); color: var(--seal-strong); background: var(--hover); }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: 13.5px; }
.btn.icon { background: transparent; color: var(--ink-2); border-color: var(--rule-strong); padding: 0; width: 38px; }
.btn.icon:hover { color: var(--ink); background: var(--hover); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

kbd {
  font: 500 11px/1 var(--sans);
  padding: 3px 6px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--muted);
}

/* Page */
main { max-width: 1320px; margin: 0 auto; padding: 36px clamp(16px, 3vw, 40px) 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px 28px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.15; letter-spacing: -0.025em; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; }
.lead { margin-top: 10px; color: var(--ink-2); max-width: 68ch; font-size: 16px; }
.lead strong { font-weight: 600; }
.loading { color: var(--faint); padding: 80px 0; text-align: center; font: 500 15px var(--sans); }
.empty-state { text-align: center; padding: 56px 16px; color: var(--muted); display: grid; gap: 14px; justify-items: center; }

.sheet {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.sheet h2 { font-size: 16px; margin-bottom: 14px; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; }
.sheet-head a { font-size: 13.5px; color: var(--muted); text-underline-offset: 3px; }
.sheet-head a:hover { color: var(--ink); }

/* Pills: the word carries the meaning, the colour only repeats it. */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font: 600 12px/1.6 var(--sans);
  white-space: nowrap;
  border: 1px solid transparent;
  vertical-align: middle;
}
.pill.s-en_retard { background: var(--seal); color: var(--on-seal); }
.pill.s-a_faire { background: var(--ochre-soft); color: var(--ochre); border-color: color-mix(in srgb, var(--ochre) 30%, transparent); }
.pill.s-a_venir { color: var(--ink-2); border-color: var(--rule-strong); }
.pill.s-deposee, .pill.s-payee { background: var(--jade-soft); color: var(--jade); }
.pill.s-late-done { background: var(--seal-soft); color: var(--seal-strong); border-color: color-mix(in srgb, var(--seal) 30%, transparent); }
.ob-note { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill.s-non_due { background: #ece9e5; color: #6b625b; }

/* Ledger tables */
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ledger td, .ledger th { padding: 8px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: baseline; }
.ledger td:last-child, .ledger th:last-child { text-align: right; padding-left: 16px; white-space: nowrap; }
.ledger tr.head th, .ledger tr.head th:last-child { text-align: left; padding-left: 0; font: 600 12.5px var(--sans); color: var(--muted); padding-top: 16px; border-bottom-color: var(--rule-strong); }
.ledger tr.head:first-child th { padding-top: 0; }
.ledger tr.total td { border-bottom: 0; border-top: 1px solid var(--rule-strong); font-weight: 600; padding-top: 10px; }
.ledger tr.grand td { font: 600 16px var(--sans); border-top: 3px double var(--seal); padding-top: 12px; }
.ledger tr.grand td .num { font-family: var(--sans); font-weight: 600; font-size: 17px; }
.ledger.compact td, .ledger.compact th { padding: 5px 0; font-size: 13.5px; }
.ledger.compact th:nth-child(2), .ledger.compact td:nth-child(2) { text-align: right; }

/* Overview: what to do, then cash, result and taxes at a glance, then the detail. */
.todo { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: -8px 0 20px; }
.todo-title { font-size: 14px; color: var(--ink-2); }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.todo-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid color-mix(in srgb, var(--ochre) 30%, var(--rule-strong));
  border-radius: 10px;
  background: var(--ochre-soft);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.todo-item:hover { border-color: var(--ochre); background: color-mix(in srgb, var(--ochre-soft) 70%, var(--ochre) 12%); }
.todo-item:active { transform: translateY(1px); }
.todo-count { font-weight: 700; color: var(--ochre); }
.todo-item.is-zero { background: var(--sheet); border-color: var(--rule); color: var(--muted); font-weight: 400; }
.todo-item.is-zero:hover { background: var(--hover); border-color: var(--rule-strong); }
.todo-item.is-zero .todo-count { color: var(--faint); font-weight: 600; }

.glance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; margin-bottom: 20px; }
.glance-card { display: grid; gap: 4px; align-content: start; }
.glance-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; min-height: 26px; }
.sheet .glance-head h2 { margin: 0; font-size: 14px; color: var(--ink-2); }
.glance-head a { font-size: 13px; color: var(--muted); text-underline-offset: 3px; }
.glance-head a:hover { color: var(--ink); }
.figure { font-size: clamp(26px, 2.4vw, 32px); font-weight: 600; letter-spacing: -0.025em; line-height: 1.1; }
.figure-word { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.figure-sub { font-size: 13px; color: var(--muted); }
.figure-alert { margin-top: 10px; font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--ochre-soft); color: var(--ochre); }
.figure-alert a { color: inherit; font-weight: 600; text-underline-offset: 2px; }

.spark { position: relative; margin: 16px 0 0; }
.spark svg { display: block; width: 100%; height: 64px; overflow: visible; }
.spark-area { fill: var(--jade); opacity: 0.09; }
.spark-line { fill: none; stroke: var(--jade); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.spark-hit { fill: transparent; }
.spark-end { position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 2px var(--sheet); pointer-events: none; }
.spark-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: 6px; }
.spark-note { font-size: 13px; color: var(--muted); margin-top: 6px; }
.glance-card .chart-table { margin-top: 4px; font-size: 13px; }

.glance-rows { margin: 14px 0 0; display: grid; }
.glance-rows div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.glance-rows dt { color: var(--ink-2); }
.glance-rows dd { margin: 0; font-weight: 500; }
.glance-bars { margin: 16px 0 0; display: grid; gap: 10px; }
.glance-bars div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.glance-bars dt { color: var(--ink-2); }
.glance-bars dd { margin: 0; font-weight: 500; }
.glance-sub { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0; margin: 16px 0 4px; }
.top-lines { list-style: none; margin: 0; padding: 0; display: grid; }
.top-lines li { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; gap: 10px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--rule); font-size: 13.5px; }
.top-lines .line-label { min-width: 0; display: block; overflow-wrap: anywhere; }
.top-lines .line-label .dot { margin-right: 8px; }
.top-lines .share { color: var(--muted); text-align: right; font-size: 12.5px; }
.meter { grid-column: 1 / -1; display: block; height: 6px; border-radius: 3px; background: var(--sheet-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; }
.meter .b-rev { background: var(--bar-rev); }
.meter .b-chg { background: var(--bar-chg); }

.tax-line {
  display: grid;
  gap: 2px;
  padding: 10px 8px 12px;
  margin: 0 -8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.tax-line + .tax-line, .figure-alert + .tax-line { border-top: 1px solid var(--rule); border-radius: 0 0 8px 8px; margin-top: 4px; padding-top: 14px; }
.tax-line:hover { background: var(--hover); }
.tax-title { font-size: 13px; color: var(--muted); }
.tax-figure { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.tax-figure .in { color: var(--jade); }
.tax-note { font-size: 13px; color: var(--ink-2); }
.tax-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 13px; }
.glance-card .glance-head + .tax-line { margin-top: -8px; }

.overview-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.overview-row.is-even { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }

.due-list, .missing-list { list-style: none; margin: 0; padding: 0; }
.due-list li + li { border-top: 1px solid var(--rule); }
.due-list a {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 11px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.due-list a:hover { background: var(--hover); }
.due-days { display: grid; justify-items: center; align-content: center; min-height: 46px; border: 1px solid var(--rule-strong); border-radius: 9px; line-height: 1; color: var(--ink); }
.due-days b { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.due-days small { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: center; }
.due-days.is-soon { border-color: var(--ochre); color: var(--ochre); background: var(--ochre-soft); }
.due-days.is-soon small { color: var(--ochre); }
.due-days.is-late { border-color: var(--seal); color: var(--on-seal); background: var(--seal); }
.due-days.is-late small { color: var(--on-seal); }
.due-days.is-done { border-color: color-mix(in srgb, var(--jade) 40%, var(--rule)); color: var(--jade); background: var(--jade-soft); }
.due-main { display: grid; gap: 2px; min-width: 0; }
.due-title { font-weight: 500; }
.due-when { font-size: 13px; color: var(--muted); }
.due-side { display: grid; justify-items: end; align-content: center; gap: 4px; font-size: 14px; text-align: right; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .tick { fill: var(--faint); }
.chart .axis { stroke: var(--rule-strong); }
.chart .grid { stroke: var(--rule); stroke-dasharray: 3 3; }
.chart .b-rev { fill: var(--bar-rev); }
.chart .b-chg { fill: var(--bar-chg); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.b-rev { background: var(--bar-rev); }
.legend i.b-chg { background: var(--bar-chg); }
.chart-table { margin-top: 12px; font-size: 13.5px; }
.chart-table summary { cursor: pointer; color: var(--muted); width: max-content; max-width: 100%; }
.chart-table summary:hover { color: var(--ink); }
.chart-table table { margin-top: 8px; }
.ledger.compact.months th:not(:first-child), .ledger.compact.months td { text-align: right; padding-left: 12px; }

@media (max-width: 1099px) {
  .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glance > :last-child { grid-column: 1 / -1; }
  .overview-row, .overview-row.is-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .glance { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .todo { margin-top: -12px; }
  .todo-list { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; gap: 6px; }
  .todo-list li:has(.is-zero) { display: none; }
  .todo-item { width: 100%; min-height: 44px; padding: 9px 14px; }
  .todo-count { min-width: 2.2em; font-size: 16px; }
  .due-list a { grid-template-columns: 46px minmax(0, 1fr); }
  .due-side { grid-column: 2; justify-items: start; text-align: left; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
}
.sheet .btn.small { margin-top: 14px; }

/* Tax desk */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--sheet-2); border: 1px solid var(--rule); margin: 0; }
.segmented legend { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0; margin-bottom: 6px; float: left; width: 100%; }
fieldset.segmented { display: flex; padding: 0; border: 0; background: none; }
fieldset.segmented label { position: relative; }
fieldset.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
fieldset.segmented span, .segmented .seg {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
fieldset.segmented { gap: 6px; }
fieldset.segmented span:hover, .segmented .seg:hover { color: var(--ink); border-color: var(--faint); }
fieldset.segmented input:checked + span, .segmented .seg[aria-current="true"] { background: var(--seal); color: var(--on-seal); border-color: var(--seal); }
fieldset.segmented input:focus-visible + span { outline: 2px solid var(--seal); outline-offset: 2px; }
.segmented.compact .seg { border-color: transparent; background: transparent; }
.segmented.compact .seg[aria-current="true"] { background: var(--sheet); color: var(--seal-strong); border-color: var(--rule-strong); box-shadow: var(--shadow); }

.desk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 28px; align-items: start; }
.desk-main { display: grid; gap: 30px; min-width: 0; }
.desk-side { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius); min-width: 0; scrollbar-width: thin; }

.leaf {
  display: grid;
  justify-items: center;
  align-content: center;
  width: 64px;
  min-height: 64px;
  padding: 6px 4px;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: var(--sheet);
  line-height: 1;
  flex: none;
}
.leaf b { font: 600 24px/1 var(--sans); letter-spacing: -0.02em; }
.leaf span { font-size: 11.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

.desk-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 220px);
  gap: 22px;
  padding: 26px 28px;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.desk-hero .leaf { width: 84px; min-height: 92px; align-self: start; }
.desk-hero .leaf b { font-size: 34px; }
.desk-hero.s-en_retard { border-color: color-mix(in srgb, var(--seal) 45%, var(--rule)); }
.desk-hero.s-en_retard .leaf { border-color: var(--seal); color: var(--seal); }
.desk-hero.s-en_retard .leaf span { color: var(--seal); }
.desk-hero.calm { grid-template-columns: 1fr; }
.desk-hero.calm h2 { font-size: 21px; }
.desk-hero.calm p { color: var(--muted); margin-top: 6px; }
.desk-hero-body { min-width: 0; display: grid; gap: 8px; align-content: start; }
.desk-hero h2 { font-size: clamp(21px, 2.2vw, 26px); line-height: 1.2; }
.desk-hero h2 a { text-decoration: none; }
.desk-hero h2 a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.desk-hero-meta { color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.desk-hero-when { font-size: 16px; color: var(--ink-2); }
.desk-hero-amount { font-size: 22px; font-weight: 600; display: grid; gap: 2px; margin: 4px 0 6px; }
.desk-hero-amount small { font-size: 13px; font-weight: 400; color: var(--muted); }
.desk-hero-after { border-left: 1px solid var(--rule); padding-left: 20px; min-width: 0; }
.desk-hero-after h3 { font: 600 13px var(--sans); color: var(--muted); margin-bottom: 8px; }
.desk-hero-after ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.desk-hero-after a { text-decoration: none; display: grid; font-size: 14px; }
.desk-hero-after a:hover { text-decoration: underline; text-underline-offset: 3px; }
.desk-hero-after time { font-size: 12.5px; color: var(--muted); }

.ob-group h2 { font-size: 18px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ob-group h2 .count { font: 500 13px var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.ob-list { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.ob {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto minmax(104px, auto);
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  text-decoration: none;
  border-top: 1px solid var(--rule);
  transition: background-color 0.12s ease;
}
.ob:first-child { border-top: 0; }
.ob:hover { background: var(--hover); }
.ob[aria-current="true"] { background: var(--seal-soft); }
.ob .leaf { width: 56px; min-height: 54px; }
.ob .leaf b { font-size: 21px; }
.ob .leaf span { font-size: 11px; }
.ob-main { display: grid; min-width: 0; }
.ob-title { font-weight: 500; }
.ob-meta { font-size: 13px; color: var(--muted); }
.ob-amount { text-align: right; font-size: 14.5px; white-space: nowrap; }
.ob .pill { justify-self: end; }
.ob.s-en_retard .leaf { border-color: var(--seal); color: var(--seal); }
.ob.s-a_faire .leaf, .desk-hero.s-a_faire .leaf { border-color: var(--ochre); color: var(--ochre); }
.ob.s-deposee .leaf, .ob.s-payee .leaf { border-color: color-mix(in srgb, var(--jade) 45%, var(--rule)); }
.ob.s-deposee .leaf b, .ob.s-payee .leaf b { color: var(--jade); }
.ob.s-non_due .leaf { border-style: dashed; }
.ob-meta .tag, .desk-hero-meta .tag, .fiche-meta .tag, .due-title .tag { margin: 0 4px 0 0; }
.line-label { display: inline-flex; align-items: baseline; gap: 9px; }
.line-label .dot { flex: none; transform: translateY(-1px); }
.ob.s-non_due { color: var(--muted); }
.ob.s-non_due .ob-title { font-weight: 400; }
#g-done + .ob-list .ob .leaf { background: transparent; }

/* Fiche */
.fiche { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px 24px 26px; box-shadow: var(--shadow); min-width: 0; }
.fiche > h2 { font-size: 21px; }
.fiche-head { display: grid; gap: 6px; padding-bottom: 18px; border-bottom: 1px solid var(--rule); }
.fiche-head h2 { font-size: 22px; line-height: 1.2; }
.fiche-head h2:focus { outline: none; }
.fiche-meta { color: var(--muted); }
.fiche-when { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.back { font-size: 13.5px; color: var(--muted); text-underline-offset: 3px; width: max-content; }
.back::before { content: "\2039\00a0"; }
.fiche-part { padding: 18px 0 0; display: grid; gap: 10px; min-width: 0; }
.fiche-part + .fiche-part { margin-top: 18px; border-top: 1px solid var(--rule); }
.fiche-part h3 { font-size: 15px; }
.fiche-part h4 { font: 600 13px var(--sans); color: var(--ink-2); margin-top: 6px; }
.fiche-amount { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.fiche .btn { width: max-content; max-width: 100%; }
.summary .fiche-part:first-of-type { border-top: 0; margin-top: 0; }
.summary h2 { margin-bottom: 4px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.links a { text-underline-offset: 3px; }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 10px; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  font: 600 12px var(--sans);
  color: var(--ink-2);
}

.boxes { width: 100%; border-collapse: collapse; font-size: 14px; }
.boxes th { text-align: left; font: 500 12.5px var(--sans); color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--rule-strong); }
.boxes td { padding: 4px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.boxes td:not(:last-child) { padding-right: 10px; }
.boxes .box { font: 600 12.5px var(--sans); color: var(--ochre); font-variant-numeric: tabular-nums; width: 44px; }
.boxes tr.sub td:nth-last-child(2) { padding-left: 14px; color: var(--muted); }
.copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 8px 4px 10px;
  margin-right: -8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.copy:hover { background: var(--hover); border-color: var(--rule-strong); }
.copy-hint { font-size: 11.5px; font-weight: 500; color: var(--muted); min-width: 40px; text-align: left; }
.copy:hover .copy-hint { color: var(--ink-2); }
.copy.copied { border-color: var(--jade); background: var(--jade-soft); }
.copy.copied .copy-hint { color: var(--jade); }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; margin: 0; }
.facts div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: 12.5px; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.record { gap: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.form-error { color: var(--seal); font-size: 14px; font-weight: 500; }
.notice { font-size: 13.5px; padding: 10px 12px; border-radius: 9px; background: var(--ochre-soft); color: var(--ochre); }

/* Operations */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.counters { display: flex; flex-wrap: wrap; gap: 8px; }
.counter {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  color: var(--ink-2);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.counter .num { font: 600 15px var(--sans); color: var(--ink); }
.counter.has .num { color: var(--ochre); }
.counter:hover { border-color: var(--faint); }
.counter[aria-pressed="true"] { background: var(--seal); border-color: var(--seal); color: var(--on-seal); }
.counter[aria-pressed="true"] .num { color: var(--on-seal); }
.search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 0; }
.search svg { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; padding-right: 36px; }
.search kbd { position: absolute; right: 10px; pointer-events: none; }
.search input:not(:placeholder-shown) ~ kbd { display: none; }
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); opacity: 0.6; cursor: pointer; }
.small-search input { padding-left: 11px; padding-right: 11px; }
.list-count { margin: 4px 0 10px; }

.ops-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.op-list { min-width: 0; }
.ops { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14.5px; }
.ops thead th { position: sticky; top: 63px; z-index: 2; background: var(--sheet); text-align: left; font: 500 12.5px var(--sans); color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--rule-strong); }
.ops thead th:first-child { border-top-left-radius: var(--radius); }
.ops thead th:last-child { border-top-right-radius: var(--radius); }
.ops thead th.r { text-align: right; }
.ops td { padding: 9px 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.ops tbody:last-child tr:last-child td { border-bottom: 0; }
.ops tr.month th { background: var(--sheet-2); padding: 9px 12px; border-bottom: 1px solid var(--rule); font: 600 14px var(--sans); text-align: left; }
.month-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.month-total { font: 500 14px var(--sans); }
.ops tr.month .muted { font: 400 12.5px var(--sans); margin-left: 8px; }
.ops tr.op { cursor: pointer; transition: background-color 0.1s ease; }
.ops tr.op:hover { background: var(--hover); }
.ops tr.op:focus-visible { outline: 2px solid var(--seal); outline-offset: -2px; }
.ops tr.op[aria-selected="true"] { background: var(--seal-soft); }
.ops .c-date { white-space: nowrap; color: var(--muted); width: 72px; }
.ops .c-who { min-width: 0; }
.ops .who { font-weight: 500; }
.ops .c-who small { display: block; color: var(--muted); font-size: 12.5px; }
.ops .c-cat { color: var(--ink-2); }
.ops .c-vat { width: 92px; }
.ops .c-rc { width: 112px; }
.ops .c-amt { white-space: nowrap; font-weight: 500; width: 120px; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--rule-strong); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.tag.rule { color: var(--ochre); border-color: color-mix(in srgb, var(--ochre) 40%, transparent); background: var(--ochre-soft); }

/* Edit panel */
.op-panel {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 22px 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-nav { display: flex; align-items: center; gap: 6px; }
.panel-nav .btn.icon { width: 32px; min-height: 32px; }
.op-panel h2 { font-size: 20px; line-height: 1.2; overflow-wrap: anywhere; }
.op-panel h2:focus { outline: none; }
.panel-amount { font-size: 24px; font-weight: 600; margin-top: 6px; }
.panel-meta { font-size: 14px; margin-top: 4px; overflow-wrap: anywhere; }
.panel-receipt { margin: 16px 0; }
.preview { border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--paper); }
.preview img { display: block; width: 100%; height: 320px; object-fit: contain; background: #fff; }
.preview iframe { display: block; width: 100%; height: 380px; border: 0; background: #fff; }
.receipt-files { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12.5px; display: grid; gap: 6px; }
.receipt-files li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.receipt-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.receipt-add .form-error { flex-basis: 100%; }
.receipt-pick { flex: 1 1 200px; min-width: 0; }
.receipt-pick input { width: 100%; font-size: 13px; }
.receipt-pick input::file-selector-button { font: inherit; font-weight: 500; margin-right: 8px; padding: 4px 10px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--sheet); color: var(--ink); cursor: pointer; }
.receipt-files a { color: var(--muted); overflow-wrap: anywhere; text-underline-offset: 2px; }
.no-receipt { font-size: 14px; color: var(--muted); padding: 14px; border: 1px dashed var(--rule-strong); border-radius: 10px; }
.no-receipt.missing { color: var(--seal); border-color: color-mix(in srgb, var(--seal) 45%, transparent); }
.alloc { display: grid; gap: 14px; padding-top: 16px; border-top: 1px solid var(--rule); }
.alloc select { width: 100%; }
.vat-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.vat-row .field { flex: 1 1 140px; }
.rates { display: flex; gap: 6px; }
.rates .btn.small { min-height: 38px; }
.ht-line { font-size: 13.5px; }
.keys { margin-top: 14px; }
.panel-scrim { display: none; }

@media (min-width: 1100px) {
  .ops-layout.with-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); }
  .op-panel { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .ops-layout.with-panel .c-vat, .ops-layout.with-panel .c-rc { display: none; }
}
@media (max-width: 1099px) {
  .op-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(520px, 100vw);
    border-radius: 0;
    border-width: 0 0 0 1px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.panel-open .panel-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(120, 72, 48, 0.22); }
}

/* Receipts */
main > .sheet + .sheet { margin-top: 24px; }
.missing-list li + li { border-top: 1px solid var(--rule); }
.missing-list a {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.2fr) minmax(0, 1fr) 110px;
  gap: 14px;
  align-items: baseline;
  padding: 9px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  text-decoration: none;
}
.missing-list a:hover { background: var(--hover); }
.missing-list a > :last-child { text-align: right; }
.missing-list .who { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.missing-list .cat { font-size: 13.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.file { display: grid; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); overflow: hidden; text-decoration: none; min-width: 0; transition: border-color 0.15s ease, transform 0.15s ease; }
.file:hover { border-color: var(--faint); transform: translateY(-1px); }
.thumb { display: grid; place-items: center; height: 150px; background: var(--paper); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb.pdf span { font: 600 13px var(--sans); color: var(--seal); border: 1.5px solid currentColor; border-radius: 4px; padding: 10px 8px; letter-spacing: 0.04em; }
.meta { display: grid; gap: 1px; padding: 8px 10px 10px; font-size: 12.5px; min-width: 0; }
.meta b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Documents */
.nav .short { display: none; }
.vault { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 28px; align-items: start; }
.vault-side { display: grid; gap: 20px; position: sticky; top: 84px; min-width: 0; }
.vault-main { min-width: 0; }
.cat-filters { display: grid; gap: 2px; }
.cat-filter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  min-height: 38px;
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.cat-filter:hover { background: var(--hover); color: var(--ink); }
.cat-filter .num { font-size: 13px; color: var(--muted); }
.cat-filter.is-zero { color: var(--muted); font-weight: 400; }
.cat-filter[aria-pressed="true"] { background: var(--tag-bg); color: var(--tag-fg); }
.cat-filter[aria-pressed="true"] .num { color: var(--tag-fg); }

.doc-lists { display: grid; gap: 26px; min-width: 0; }
.doc-year h2 { font-size: 18px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.doc-year h2 .count { font: 500 13px var(--sans); color: var(--muted); }
.doc-list { list-style: none; margin: 0; padding: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.doc { display: flex; align-items: center; gap: 8px; padding-right: 12px; border-top: 1px solid var(--rule); transition: background-color 0.12s ease; }
.doc:first-child { border-top: 0; }
.doc:hover { background: var(--hover); }
.doc.is-selected { background: var(--seal-soft); }
.doc-open {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 110px 70px;
  gap: 14px;
  align-items: center;
  padding: 11px 4px 11px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.doc-open:focus-visible { outline-offset: -2px; }
.doc-type { display: inline-grid; place-items: center; height: 26px; min-width: 40px; padding: 0 6px; border-radius: 6px; font: 600 10.5px var(--sans); letter-spacing: 0.03em; background: var(--tag-bg, var(--sheet-2)); color: var(--tag-fg, var(--ink-2)); }
.cat-name { display: inline-flex; align-items: baseline; gap: 7px; }
.doc-main { display: grid; min-width: 0; }
.doc-title { font-weight: 500; overflow-wrap: anywhere; }
.doc-meta { font-size: 13px; color: var(--muted); }
.doc-source { font-size: 13px; color: var(--ink-2); }
.doc-size { font-size: 13px; color: var(--muted); text-align: right; }
.doc-dl { flex: none; }
.doc-panel h2 { font-size: 19px; margin: 4px 0 12px; }
.doc-actions { margin-bottom: 14px; }
.doc-preview iframe { height: 520px; }
.doc-preview img { height: auto; max-height: 520px; }
.text-preview { margin: 0; padding: 12px; max-height: 420px; overflow: auto; font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-2); background: var(--sheet); white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-facts { margin-top: 16px; }
.no-preview { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.upload-form { display: grid; gap: 14px; }
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 18px;
  border: 1.5px dashed var(--rule-strong);
  border-radius: 12px;
  background: var(--sheet-2);
  text-align: center;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover, .dropzone.over { border-color: var(--seal); background: var(--seal-soft); }
.dropzone:focus-within { outline: 2px solid var(--seal); outline-offset: 2px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone b { color: var(--seal-strong); font-weight: 600; }
.upload-files { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.upload-files li { display: flex; align-items: end; gap: 8px; }
.upload-files .field { flex: 1; }
.upload-files .field > span { overflow-wrap: anywhere; }
.drop-veil { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(251, 246, 236, 0.86); border: 3px dashed var(--seal); pointer-events: none; }
.drop-veil p { font: 600 24px var(--sans); color: var(--seal-strong); }

@media (min-width: 1100px) {
  .doc-panel { position: sticky; }
  .vault-main .ops-layout.with-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 480px); }
  .vault-main .ops-layout.with-panel .doc-source, .vault-main .ops-layout.with-panel .doc-size { display: none; }
  .vault-main .ops-layout.with-panel .doc-open { grid-template-columns: 46px minmax(0, 1fr); }
}
@media (max-width: 1099px) {
  .vault { grid-template-columns: minmax(0, 1fr); }
  .vault { gap: 20px; }
  .vault-side { display: contents; }
  .vault-main { order: 1; }
    .cat-filters { display: flex; flex-wrap: wrap; gap: 6px; }
  .cat-filter { border: 1px solid var(--rule-strong); background: var(--sheet); }
}
@media (max-width: 760px) {
  .doc-open { grid-template-columns: 40px minmax(0, 1fr); padding-left: 12px; }
  .doc-source, .doc-size { display: none; }
  .doc { padding-right: 10px; }
  .doc-dl { padding: 4px 9px; }
}

/* Destructive actions: armed state of the two-step confirmation */
.btn.danger { color: var(--seal-strong); border-color: color-mix(in srgb, var(--seal) 35%, var(--rule-strong)); background: transparent; }
.btn.danger:hover { background: var(--seal-soft); border-color: var(--seal); }
.btn.armed, .btn.danger.armed { background: var(--seal); border-color: var(--seal); color: var(--on-seal); }

/* Official documents and generated accounting files */
.books { margin-bottom: 26px; }
.books .sheet-head { align-items: center; }
.exports { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.exports.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 12px; }
.export { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); min-width: 0; }
.export-main { display: grid; gap: 2px; min-width: 0; flex: 1 1 230px; }
.export-main b { font-weight: 600; }
.export-main small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: none; }
.fmt { min-height: 30px; padding: 3px 10px; font-size: 12.5px; }
.fmt-pdf { color: var(--seal-strong); }
.fmt-xlsx { color: var(--jade); }
.fmt-txt { color: var(--ink-2); }
.official { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.official li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet-2); }
.official-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 240px; }
.official-main > span:last-child { display: grid; min-width: 0; }
.official-main b { font-weight: 500; overflow-wrap: anywhere; }
.official-main small { color: var(--muted); font-size: 12.5px; }
.official-actions { display: flex; gap: 6px; flex: none; }
.attach-form { display: grid; gap: 10px; margin-top: 6px; padding: 12px; border: 1.5px dashed var(--rule-strong); border-radius: 10px; }
.attach-title { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.attach-file input { width: 100%; font-size: 13.5px; }
.attach-file input::file-selector-button { font: inherit; font-weight: 500; margin-right: 10px; padding: 5px 11px; border: 1px solid var(--rule-strong); border-radius: 8px; background: var(--sheet); color: var(--ink); cursor: pointer; }
.form-table .code { color: var(--ink-2); font-weight: 500; }
.doc-for { font-size: 12.5px; color: var(--ochre); font-weight: 500; overflow-wrap: anywhere; }

@media (max-width: 1099px) { .exports.two-col { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .export, .official li { flex-direction: column; align-items: stretch; }
  .export-main, .official-main { flex-basis: auto; }
  .boxes .copy-hint { display: none; }
  .boxes .copy { padding: 4px 6px; margin-right: -6px; }
  .export-actions, .official-actions { justify-content: flex-start; }
}

/* Colour families: soft ground, deep text of the same hue, AA contrast */
.h-coral { --tag-bg: #fbe3d6; --tag-fg: #8a3b1d; }
.h-teal { --tag-bg: #d9eeee; --tag-fg: #1d5e61; }
.h-indigo { --tag-bg: #e5e3f6; --tag-fg: #433d85; }
.h-plum { --tag-bg: #f5dfea; --tag-fg: #7c2d55; }
.h-slate { --tag-bg: #e2e8ee; --tag-fg: #3a5163; }
.h-olive { --tag-bg: #e8ebd2; --tag-fg: #4f561a; }
.h-gold { --tag-bg: #f6eacb; --tag-fg: #6f4f17; }
.h-sienna { --tag-bg: #f0e0d4; --tag-fg: #6c3e26; }
.h-jade { --tag-bg: var(--jade-soft); --tag-fg: var(--jade); }
.h-neutral { --tag-bg: #efe8df; --tag-fg: #6a594e; }
.h-grey { --tag-bg: #ece9e5; --tag-fg: #6b625b; }
.h-warn { --tag-bg: var(--seal-soft); --tag-fg: var(--seal-strong); }
.tag[class*="h-"] { background: var(--tag-bg); color: var(--tag-fg); border-color: transparent; }
.tag.q { background: transparent; color: var(--muted); border-color: var(--rule-strong); font-weight: 500; }
.tag.mini { font-size: 10.5px; padding: 0 6px; }
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tag-fg); vertical-align: 1px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag.fam { font-size: 12.5px; font-weight: 500; padding: 1px 9px; white-space: normal; border-radius: 7px; }
.tag.dir { margin-right: 4px; vertical-align: 1px; }
.families { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 4px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--sheet);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.fchip .num { color: var(--muted); font-size: 12px; }
.fchip:hover { border-color: var(--tag-fg, var(--faint)); }
.fchip[aria-pressed="true"] { background: var(--tag-bg); border-color: var(--tag-fg); color: var(--tag-fg); }
.fchip[aria-pressed="true"] .num { color: var(--tag-fg); }
.fchip.reset { color: var(--seal-strong); border-style: dashed; }
.family-select { display: none; }
@media (max-width: 760px) {
  .families .fchip { display: none; }
  .family-select { display: grid; width: 100%; }
  .family-select select { width: 100%; }
}

/* Receipt capture */
.fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 30;
  display: none;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--seal);
  color: var(--on-seal);
  font-weight: 600;
  box-shadow: 0 10px 24px -12px rgba(159, 51, 34, 0.7);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.fab:hover { background: var(--seal-strong); }
.fab:active { transform: scale(0.97); }
body.panel-open .fab { display: none !important; }
.badge-offer { margin-top: 12px; }

.capture {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: var(--sheet);
  color: var(--ink);
  box-shadow: 0 24px 60px -30px rgba(120, 72, 48, 0.55);
}
.capture::backdrop { background: rgba(120, 72, 48, 0.25); }
.capture-form, .capture-result { display: grid; gap: 14px; }
.capture-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.capture-head h2 { font-size: 19px; line-height: 1.2; }
.capture-head h2:focus { outline: none; }
.shot {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 16px;
  border: 1.5px dashed var(--rule-strong);
  border-radius: 14px;
  background: var(--sheet-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.shot:hover { border-color: var(--seal); background: var(--seal-soft); }
.shot:focus-within { outline: 2px solid var(--seal); outline-offset: 2px; }
.shot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.shot-empty, .shot-done { display: grid; justify-items: center; gap: 4px; color: var(--ink-2); min-width: 0; }
.shot-empty svg { color: var(--seal); margin-bottom: 4px; }
.shot-empty b { color: var(--seal-strong); font-size: 16px; }
.shot-empty span { font-size: 13.5px; color: var(--muted); }
.shot-done img { max-height: 180px; max-width: 100%; border-radius: 8px; object-fit: contain; }
.shot-name { font-size: 13px; overflow-wrap: anywhere; }
.capture-actions .btn[type="submit"], .capture-actions [data-capture-again] { width: 100%; min-height: 46px; }
.capture-result.ok h2 { color: var(--jade); }
.capture-op { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }

.inbox { margin-bottom: 24px; }
.inbox h2 .count { font: 500 13px var(--sans); color: var(--muted); margin-left: 6px; }
.inbox-list { display: grid; gap: 14px; }
.inbox-item { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 18px; padding: 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet-2); min-width: 0; }
.inbox-thumb { display: grid; place-items: center; height: 150px; border-radius: 8px; overflow: hidden; background: #fff; border: 1px solid var(--rule); text-decoration: none; }
.inbox-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.inbox-thumb.pdf span { font: 600 13px var(--sans); color: var(--seal); border: 1.5px solid currentColor; border-radius: 4px; padding: 10px 8px; }
.inbox-body { display: grid; gap: 8px; align-content: start; min-width: 0; }
.inbox-amount { font-size: 20px; font-weight: 600; }
.inbox-label { font-size: 13px; font-weight: 500; color: var(--ink-2); margin-top: 4px; }
.inbox-suggestions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.inbox-suggestions li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 9px; background: var(--sheet); }
.sugg-main { display: grid; min-width: 0; }
.sugg-main .who { font-weight: 500; overflow-wrap: anywhere; }
.inbox-other { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 4px; }
.inbox-other .field { flex: 1 1 240px; }
.inbox-remove { display: flex; justify-content: flex-end; margin-top: 2px; }
.inbox-other select { width: 100%; }

@media (max-width: 860px) {
  .fab { display: inline-flex; }
  .page-head > [data-capture] { display: none; }
  main { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .capture { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; }
  .inbox-item { grid-template-columns: 72px minmax(0, 1fr); gap: 6px 12px; padding: 12px; }
  .inbox-body { display: contents; }
  .inbox-thumb { height: 88px; grid-row: 1 / span 2; }
  .inbox-amount { grid-column: 2; align-self: end; }
  .inbox-body > p.small { grid-column: 2; align-self: start; }
  .inbox-body > :nth-child(n + 3) { grid-column: 1 / -1; }
  .inbox-suggestions li { grid-template-columns: minmax(0, 1fr) auto; }
  .inbox-suggestions li .btn { grid-column: 1 / -1; width: 100%; }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  background: var(--jade);
  color: #fbfffc;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 60;
  box-shadow: var(--shadow);
  font-weight: 500;
}
.toast[data-tone="error"] { background: var(--seal); color: var(--on-seal); }

/* Responsive */
@media (max-width: 1099px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk-side { position: static; max-height: none; overflow: visible; }
  .desk.has-selection .desk-side { order: -1; }
  .desk.has-selection .desk-main { display: none; }
}
@media (min-width: 1100px) {
  .back { display: none; }
}
@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 10px 12px; padding-top: 10px; padding-bottom: 0; }
  .nav { order: 3; width: 100%; display: flex; justify-content: space-between; margin: 0 -4px; }
  .nav a { flex: 1 1 auto; justify-content: center; padding: 10px 4px 11px; border-radius: 0; font-size: 13.5px; }
  .nav a[aria-current="page"] { background: transparent; box-shadow: inset 0 -2px 0 var(--seal); }
  .desk-hero { grid-template-columns: auto minmax(0, 1fr); padding: 20px; gap: 16px; }
  .desk-hero-after { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--rule); padding: 14px 0 0; }
  .ops thead th { top: 103px; }
}
@media (max-width: 760px) {
  .nav .long { display: none; }
  .nav .short { display: inline; }
  main { padding-top: 24px; }
  .brand-sub { display: none; }
  .ops thead { display: none; }
  .ops, .ops tbody, .ops tr, .ops td, .ops th { display: block; }
  .ops tr.month th { padding: 9px 14px; }
  .ops tbody:first-of-type tr.month th { border-radius: var(--radius) var(--radius) 0 0; }
  .ops tr.op {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who amt" "cat rc" "date date";
    gap: 2px 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--rule);
  }
  .ops tbody:last-child tr.op:last-child { border-bottom: 0; }
  .ops tr.op td { padding: 0; border: 0; width: auto; }
  .ops .c-who { grid-area: who; }
  .ops .c-amt { grid-area: amt; text-align: right; }
  .ops .c-cat { grid-area: cat; font-size: 13px; min-width: 0; }
  .ops .c-rc { grid-area: rc; text-align: right; }
  .ops .c-date { grid-area: date; font-size: 12.5px; }
  .ops .c-vat { display: none; }
  .ops .c-who small { display: none; }
  .search { flex-basis: 100%; }
  .search kbd { display: none; }
  .search input { padding-right: 11px; }
  .keys { display: none; }
  .ob { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "leaf main main" "leaf amt pill"; gap: 6px 14px; }
  .ob .leaf { grid-area: leaf; }
  .ob-main { grid-area: main; }
  .ob-amount { grid-area: amt; text-align: left; }
  .ob .pill { grid-area: pill; }
  .missing-list a { grid-template-columns: 56px minmax(0, 1fr) 90px; }
  .missing-list .cat { display: none; }
  .missing-list .who { white-space: normal; overflow: visible; }
  .meta b { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .fiche, .sheet, .op-panel { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 480px) {
  .top-actions select { max-width: 132px; font-size: 14px; padding: 6px 8px; min-height: 36px; }
  .top-actions .btn.icon { width: 36px; min-height: 36px; }
  .brand img { width: 30px; height: 30px; }
  .brand-name { font-size: 18px; }
  .counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .counter { justify-content: flex-start; text-align: left; }
  .desk-hero { grid-template-columns: minmax(0, 1fr); }
  .desk-hero .leaf { min-height: 0; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 8px; padding: 8px 12px; width: max-content; }
  .desk-hero .leaf span { margin-top: 0; }
  .desk-hero .leaf b { font-size: 22px; }
  .files { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .thumb { height: 120px; }
  .counter { padding: 6px 11px; font-size: 13.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
.shortcut-copy { margin-top: 8px; }
.inbox-outcome { margin: 6px 0 0; font-size: 13.5px; color: var(--ochre); }
.capture-more summary { cursor: pointer; color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.proof { display: inline-block; margin-top: 4px; font-size: 12.5px; font-weight: 500; }
.proof.ok { color: var(--jade); }
.proof.missing { color: var(--ochre); }
.proof-filter { margin: 8px 0 0; font-size: 14px; }
.proof-filter .counter.warn { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 999px; background: var(--ochre-soft); color: var(--ochre); text-decoration: none; }
.proof-filter .counter.warn:hover { filter: brightness(0.97); }
