/* LiveRecettes — feuille de style partagée (accueil, outil, mentions légales).
   Layout : une page de registre. La zone de travail est une seule feuille lignée, avec la
   marge rouge des cahiers de comptes ; le montant à retenir est passé au surligneur. */

@font-face { font-family: "Bricolage Grotesque"; src: url("assets/fonts/bricolage-grotesque.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("assets/fonts/ibm-plex-sans.woff2") format("woff2"); font-weight: 100 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/fonts/ibm-plex-mono-500.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/fonts/ibm-plex-mono-600.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #edf1eb;      /* le bureau : gris-vert des papiers comptables */
  --sheet: #fbfcfa;      /* la feuille */
  --sheet-2: #f1f5ef;    /* en-têtes de tableaux, champs */
  --ink: #13211b;
  --ink-2: #4d5e56;
  --rule: #d2dbd3;       /* lignage */
  --green: #0e5a45;      /* action principale, liens */
  --green-ink: #ffffff;
  --green-soft: #dcebe4;
  --margin: #d5433a;     /* marge rouge, point « live » */
  --hl: #ffe566;         /* surligneur */
  --hl-ink: #13211b;
  --good: #1a7449;
  --warn: #8f5407;
  --bad: #b3261e;
  --warn-soft: #fbf0d6;
  --shadow: 0 1px 0 rgba(19, 33, 27, .04), 0 14px 34px -18px rgba(19, 33, 27, .28);
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0c1411; --sheet: #141e1a; --sheet-2: #1a2722; --ink: #e4ece7; --ink-2: #9cada5; --rule: #2b3b34;
    --green: #72d1b0; --green-ink: #062019; --green-soft: #17332b; --margin: #ee7469; --hl: #f2d84b; --hl-ink: #13211b;
    --good: #62c795; --warn: #e3a84f; --bad: #f08a80; --warn-soft: #35290f;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -18px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0c1411; --sheet: #141e1a; --sheet-2: #1a2722; --ink: #e4ece7; --ink-2: #9cada5; --rule: #2b3b34;
  --green: #72d1b0; --green-ink: #062019; --green-soft: #17332b; --margin: #ee7469; --hl: #f2d84b; --hl-ink: #13211b;
  --good: #62c795; --warn: #e3a84f; --bad: #f08a80; --warn-soft: #35290f;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 34px -18px rgba(0, 0, 0, .7);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.12; letter-spacing: -0.01em; }
h2 { font-size: 28px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 650; }
p { margin: 0; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--font-num); font-size: 12.5px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
mark { background: var(--hl); color: var(--hl-ink); padding: 0 .14em; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.wrap { max-width: 1200px; margin: 0 auto; padding-inline: 24px; }

/* ---------- En-tête ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 28px; padding-block: 20px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 750; font-size: 22px; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.logo i { width: 10px; height: 10px; border-radius: 50%; background: var(--margin); box-shadow: 0 0 0 4px color-mix(in srgb, var(--margin) 20%, transparent); }
.nav { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 15px; }
.nav a { color: var(--ink-2); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.local-note { display: none; font-size: 13.5px; color: var(--ink-2); }
.has-data .nav { display: none; }
.has-data .local-note { display: block; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); border-radius: 7px; padding: 9px 15px; cursor: pointer; font-weight: 550; font-size: 15px; line-height: 1.2; text-decoration: none; transition: border-color .12s, background-color .12s, transform .12s; }
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn.primary:hover { background: color-mix(in srgb, var(--green) 88%, var(--ink)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--rule); }
.btn.big { padding: 13px 20px; font-size: 16.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Accueil : en-tête de page et dépôt ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 36px 56px; align-items: center; padding-block: 28px 56px; }
.hero-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.hero-copy { display: flex; flex-direction: column; gap: 16px; }
.hero h1 { font-size: clamp(36px, 5.4vw, 62px); font-weight: 750; line-height: 1.02; letter-spacing: -0.025em; }
.hero .lede { font-size: 18.5px; color: var(--ink-2); max-width: 54ch; }
.has-data .hero { grid-template-columns: minmax(0, 1fr); padding-block: 4px 18px; }
.has-data .landing-only, .has-data #empty { display: none; }

.drop { background: var(--sheet); border: 1.5px dashed color-mix(in srgb, var(--ink-2) 55%, var(--rule)); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 14px; transition: border-color .12s, background-color .12s; }
.drop.over { border-color: var(--green); background: var(--green-soft); }
.droptext { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.droptext strong { font-family: var(--font-display); font-size: 19px; font-weight: 650; }
.has-data .drop { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; padding: 14px 18px; }
.has-data .drop .droptext { flex: 1 1 320px; }
.has-data .drop .droptext strong { font-size: 16.5px; }
.has-data .drop .btn.big { padding: 9px 15px; font-size: 15px; }

.notice { border-radius: 8px; padding: 11px 15px; font-size: 14.5px; }
.notice.sample { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent); }
.notice.error { background: var(--sheet); border: 1px solid var(--bad); color: var(--bad); }
#storage-conflict .btn { margin-top: 10px; }

.workspace-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; font-size: 14.5px; }
.workspace-bar strong { font-weight: 600; }
html:not(.has-data) .workspace-bar #backup, html:not(.has-data) .workspace-bar #clear { display: none; }
html:not(.has-data) .workspace-bar .btn { padding: 6px 11px; font-size: 14px; }

/* Le bordereau d'exemple, à droite du titre */
.slip { position: relative; background: var(--sheet); box-shadow: var(--shadow); border-radius: 4px; padding: 26px 26px 24px 54px; transform: rotate(1.4deg); display: flex; flex-direction: column; gap: 14px; background-image: linear-gradient(var(--margin), var(--margin)); background-size: 1.5px 100%; background-position: 36px 0; background-repeat: no-repeat; }
.slip-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.slip-rows { display: flex; flex-direction: column; margin: 0; }
.slip-rows div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--rule); }
.slip-rows dt { color: var(--ink-2); font-size: 14.5px; }
.slip-rows dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.slip-rows .total { border-bottom: 0; padding-top: 14px; }
.slip-rows .total dt { color: var(--ink); font-weight: 600; font-size: 15.5px; }
.slip-rows .total dd { font-size: 27px; font-weight: 600; }
.slip-foot { font-size: 13.5px; color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: 12px; }
.stamp { flex: none; transform: rotate(-5deg); border: 2px solid var(--margin); color: var(--margin); font-family: var(--font-num); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; opacity: .85; }

/* ---------- Accueil : sections ---------- */
#empty { display: flex; flex-direction: column; gap: 72px; padding-bottom: 72px; }
.band { display: flex; flex-direction: column; gap: 24px; scroll-margin-top: 20px; }
.band-head { display: flex; flex-direction: column; gap: 8px; max-width: 62ch; }
.band-head p { color: var(--ink-2); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.steps li { border-top: 2px solid var(--ink); padding-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.steps .n { font-family: var(--font-num); font-size: 13px; font-weight: 600; color: var(--ink-2); letter-spacing: .06em; }
.steps p { color: var(--ink-2); font-size: 15.5px; }

.compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px 56px; align-items: center; background: var(--sheet); border-radius: 4px; box-shadow: var(--shadow); padding: 34px 36px; }
.compare-text { display: flex; flex-direction: column; gap: 12px; }
.compare-text p { color: var(--ink-2); }
.ledger { margin: 0; display: flex; flex-direction: column; }
.ledger div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.ledger dt { color: var(--ink-2); }
.ledger dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.ledger .strike dd { text-decoration: line-through; text-decoration-color: var(--margin); text-decoration-thickness: 2px; }
.ledger .keep { border-bottom: 0; }
.ledger .keep dt { color: var(--ink); font-weight: 600; }
.ledger .keep dd { font-size: 22px; font-weight: 600; }

.outputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
.outputs div { border-top: 1px solid var(--rule); padding: 18px 0 22px; display: flex; flex-direction: column; gap: 6px; }
.outputs p { color: var(--ink-2); font-size: 15.5px; max-width: 52ch; }

.price { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px 40px; align-items: center; border: 1.5px solid var(--ink); border-radius: 12px; padding: 28px 32px; }
.price .amount { font-family: var(--font-num); font-size: 54px; font-weight: 600; line-height: 1; white-space: nowrap; }
.price .amount small { display: block; font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--ink-2); margin-top: 8px; }
.price-text { display: flex; flex-direction: column; gap: 6px; }
.price-text p { color: var(--ink-2); }
.price-text strong { color: var(--ink); }

.faq { border-bottom: 1px solid var(--rule); max-width: 820px; }
.faq details { border-top: 1px solid var(--rule); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 34px 16px 0; font-family: var(--font-display); font-size: 18px; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-family: var(--font-num); font-size: 22px; font-weight: 500; color: var(--ink-2); }
.faq details[open] summary::after { content: "–"; }
.faq details p { color: var(--ink-2); padding: 0 34px 18px 0; max-width: 70ch; }

/* ---------- La feuille de travail ---------- */
.sheet { position: relative; background: var(--sheet); border-radius: 4px; box-shadow: var(--shadow); padding: 34px 36px 40px 76px; display: flex; flex-direction: column; gap: 40px; margin-bottom: 56px; background-image: linear-gradient(var(--margin), var(--margin)); background-size: 1.5px 100%; background-position: 52px 0; background-repeat: no-repeat; }
.section { display: flex; flex-direction: column; gap: 12px; min-width: 0; scroll-margin-top: 16px; }
.section-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.section-head h2 { font-size: 21px; }
.section > p { max-width: 110ch; }

.scope-note { font-size: 14px; color: var(--ink-2); }
.scope-note strong { color: var(--ink); font-weight: 600; }

.summary { display: flex; flex-direction: column; gap: 20px; }
.summary-controls { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field .lab { font-family: var(--font-num); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); font-weight: 500; }
.field select, .field input[type="number"] { border: 1px solid var(--rule); background: var(--sheet-2); border-radius: 6px; padding: 7px 9px; min-width: 0; }
.field select { min-width: 168px; }
.field label.check, label.check { display: flex; gap: 8px; align-items: flex-start; font-family: var(--font-body); font-size: 14.5px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 400; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--green); }

.declare { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px 48px; align-items: end; }
.declare .lab { font-family: var(--font-num); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.declare .big { display: inline; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: clamp(34px, 6.4vw, 60px); font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; background: var(--hl); color: var(--hl-ink); padding: 0 .16em; border-radius: 5px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.declare #decl-sub { margin-top: 12px; color: var(--ink-2); font-size: 14px; }
.declare .side { display: flex; flex-direction: column; font-size: 15px; }
.declare .side div { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; border-bottom: 1px solid var(--rule); padding: 9px 0; }
.declare .side div:first-child { border-top: 1px solid var(--rule); }
.declare .side span:first-child { color: var(--ink-2); }
.declare .side .num { font-weight: 500; white-space: nowrap; }

.settings { display: flex; flex-wrap: wrap; gap: 14px 36px; align-items: flex-start; background: var(--sheet-2); border-radius: 8px; padding: 14px 18px; }
.rates { display: flex; flex-wrap: wrap; gap: 8px; }
.rates div { display: flex; flex-direction: column; gap: 3px; flex: 1 1 86px; max-width: 120px; }
.rates input { width: 100%; font-family: var(--font-num); background: var(--sheet) !important; }
.rates span { font-size: 12px; color: var(--ink-2); }

/* Tableaux : posés sur la feuille, lignés, première colonne fixe au défilement */
.tablebox { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--rule); background: var(--sheet); }
th { font-family: var(--font-num); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); font-weight: 500; vertical-align: bottom; white-space: normal; min-width: 86px; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; z-index: 1; padding-left: 0; }
td.wrapcell { white-space: normal; min-width: 220px; max-width: 320px; }
td.wrapcell .small { font-weight: 400; }
tbody tr:hover td { background: var(--sheet-2); }
tfoot td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--ink); }
td.key { font-weight: 600; }
td.neg { color: var(--bad); }
td.pos { color: var(--good); }
td input.cost { width: 98px; text-align: right; border: 1px solid var(--rule); background: var(--sheet-2); border-radius: 6px; padding: 6px 8px; font-family: var(--font-num); }
td input[data-cost]:placeholder-shown, td input[data-override]:placeholder-shown { background: color-mix(in srgb, var(--hl) 34%, var(--sheet)); border-color: color-mix(in srgb, var(--warn) 45%, var(--rule)); }
td input.cost::placeholder, td input.note::placeholder { color: var(--ink-2); opacity: .9; font-size: 13px; }
td input.note { width: 210px; text-align: left; border: 1px solid var(--rule); background: var(--sheet-2); border-radius: 6px; padding: 6px 8px; }
.cost-control { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.cost-control .btn, td .btn { padding: 5px 10px; font-size: 13.5px; }
.cost-hint { display: block; font-size: 12.5px; min-width: 132px; max-width: 190px; margin: 4px 0 0 auto; white-space: normal; color: var(--warn); line-height: 1.35; }
.cost-hint.muted { color: var(--ink-2); }
.reference-note { display: block; margin: 5px 0 0 auto; }
.pill { display: inline-block; font-family: var(--font-num); font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--rule); color: var(--ink-2); margin-left: 8px; white-space: nowrap; }
.pill.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.status-warn { color: var(--warn); }
.status-good { color: var(--good); }
.compact-select { border: 1px solid var(--rule); background: var(--sheet-2); border-radius: 6px; padding: 5px 8px; }
.live-details { display: none; }

.meters { display: flex; flex-direction: column; gap: 16px; }
.meter { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 5px 12px; align-items: baseline; }
.meter .bar { flex: 1 0 100%; height: 10px; border-radius: 99px; background: var(--sheet-2); border: 1px solid var(--rule); overflow: hidden; }
.meter .bar i { display: block; height: 100%; min-width: 3px; background: var(--green); border-radius: 99px; }
.meter.warn .bar i { background: var(--warn); }
.meter.bad .bar i { background: var(--bad); }

.exports { display: flex; flex-direction: column; }
.export { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.export h3 { font-size: 17px; }
.export p { max-width: 70ch; margin-top: 3px; }
.toast { font-size: 13.5px; color: var(--good); min-height: 1.2em; }
#export-status a { color: inherit; font-weight: 600; }

.checks { display: flex; flex-wrap: wrap; gap: 8px 10px; font-size: 13.5px; color: var(--ink-2); }
.checks span { border: 1px solid var(--rule); border-radius: 99px; padding: 3px 12px; background: var(--sheet-2); }
.checks span.status-warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, var(--rule)); background: var(--warn-soft); }
.checks b { color: var(--ink); font-weight: 600; font-family: var(--font-num); }
.beta-note { font-size: 14px; color: var(--ink-2); }

/* ---------- Pied de page ---------- */
.foot { border-top: 1px solid var(--rule); padding-block: 28px 48px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px 56px; font-size: 13.5px; color: var(--ink-2); }
.foot .legal { display: flex; flex-direction: column; gap: 8px; max-width: 78ch; }
.foot-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.foot-links strong { color: var(--ink); font-family: var(--font-display); font-size: 16px; }

/* ---------- Pages de texte (mentions légales) ---------- */
.prose { max-width: 760px; padding-block: 20px 64px; display: flex; flex-direction: column; gap: 14px; }
.prose h1 { font-size: clamp(30px, 4.6vw, 44px); font-weight: 750; letter-spacing: -0.02em; margin-bottom: 6px; }
.prose h2 { font-size: 22px; margin-top: 22px; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- Écrans étroits ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-block: 12px 44px; }
  .slip { transform: none; }
  .compare { grid-template-columns: minmax(0, 1fr); padding: 26px 22px; }
  .price { grid-template-columns: minmax(0, 1fr); padding: 24px 22px; }
  .foot { grid-template-columns: minmax(0, 1fr); }
  .declare { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .wrap { padding-inline: 16px; }
  h2 { font-size: 24px; }
  .top { padding-block: 14px; }
  .nav { gap: 4px 16px; font-size: 14.5px; }
  .hero .lede { font-size: 17px; }
  .drop { padding: 18px 16px; }
  .drop .actions .btn { flex: 1 1 auto; }
  #empty { gap: 52px; padding-bottom: 52px; }
  .steps { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .outputs { grid-template-columns: minmax(0, 1fr); }
  .slip { padding: 22px 18px 20px 38px; background-position: 24px 0; }
  .sheet { padding: 22px 16px 28px; gap: 32px; background-image: none; margin-bottom: 40px; }
  .section-head h2 { font-size: 19px; }
  .workspace-bar .actions { width: 100%; }
  .has-data .workspace-bar .btn { flex: 1 1 auto; }
  .export { grid-template-columns: minmax(0, 1fr); }
  .settings { padding: 12px 14px; gap: 14px 24px; }
  .field select { min-width: 0; }
  .has-data .drop .droptext .small { display: none; }
  .has-data .drop { padding: 12px 14px; }
  .summary-controls .field { flex: 1 1 140px; }
  td.wrapcell { min-width: 132px; max-width: 170px; }
  th, td { padding: 9px 9px; }
  th:first-child, td:first-child { box-shadow: 1px 0 0 var(--rule); padding-right: 8px; }
  /* One live per card, with the editable costs and result always visible. */
  #live-tablebox { overflow: visible; }
  #t-live, #t-live tbody, #t-live tfoot { display: block; width: 100%; }
  #t-live thead { display: none; }
  #t-live tr { display: grid; margin-bottom: 14px; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
  #t-live td { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; width: 100%; min-width: 0; max-width: none; padding: 10px 12px; text-align: right; white-space: normal; font-size: 14px; }
  #t-live td::before { content: attr(data-label); text-align: left; color: var(--ink-2); font-family: var(--font-body); font-weight: 400; }
  #t-live td:first-child { display: block; position: static; padding: 12px; background: var(--sheet-2); box-shadow: none; text-align: left; }
  #t-live td:first-child::before { display: none; }
  #t-live .live-details { display: inline-flex; margin-top: 8px; background: var(--sheet); }
  #t-live tbody tr:not(.details-open) td:not(:first-child):not([data-live-field]) { display: none; }
  #t-live [data-live-field="cost"] { order: 1; }
  #t-live [data-live-field="expense"] { order: 2; }
  #t-live [data-live-field="profit"] { order: 3; border-bottom: 0; }
  #t-live tbody td:not(:first-child):not([data-live-field]) { order: 4; }
  #t-live .cost-hint { grid-column: 1 / -1; max-width: none; min-width: 0; margin: 0; text-align: left; }
  #t-live .cost-control { flex-wrap: wrap; max-width: 140px; }
  #t-live input.cost { width: 104px; min-height: 38px; font-size: 16px; }
  #t-live tfoot tr { margin-bottom: 0; }
  #t-live tfoot td { border-top: 0; border-bottom: 1px solid var(--rule); }
  #t-live tfoot td:last-child { border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .btn { transition: none; } }
@media print { .top .nav, .drop, .workspace-bar, .foot-links, .btn { display: none !important; } body { background: #fff; } .sheet { box-shadow: none; } }
