/* ═══════════════════════════════════════════════════════════
   Ardoise — feuille de style
   Grammaire visuelle empruntée à ia-ora.com : bandeau pleine
   largeur, barre blanche flottante par-dessus, sections
   centrées à titre bicolore, cartes blanches à angles courts,
   boutons en pilule capitale. La couleur d'accent est un bleu
   lagon ; le rouge et le vert restent réservés aux soldes.
   ═══════════════════════════════════════════════════════════ */

/* ── 1. Jetons ─────────────────────────────────────────── */
:root {
  --paper:      #EDF2F5;
  --surface:    #FFFFFF;
  --surface-2:  #F5F8FA;
  --ink:        #17272E;
  --ink-soft:   #566A73;
  --ink-faint:  #93A3AB;
  --line:       #DCE5EA;
  --line-soft:  #E9EFF3;

  --accent:     #00768C;
  --accent-deep:#00566A;
  --accent-ink: #FFFFFF;
  --accent-wash:#E0F0F4;

  --jade:       #12795A;
  --jade-wash:  #D5EDE3;
  --rouge:      #C02B20;
  --rouge-wash: #F8DDDA;

  --display: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  --body:    'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Angles courts : c'est l'écart le plus visible avec l'ancienne version. */
  --r-s: 2px;
  --r-m: 3px;
  --r-l: 4px;

  --shadow:      0 1px 3px rgba(23,39,46,.07), 0 10px 30px -18px rgba(23,39,46,.30);
  --shadow-lift: 0 2px 6px rgba(23,39,46,.10), 0 30px 60px -28px rgba(23,39,46,.45);

  --rail-w: 268px;
  --topbar-h: 66px;

  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --paper:      #0E1A1F;
  --surface:    #15242A;
  --surface-2:  #1B2E35;
  --ink:        #E7EEF1;
  --ink-soft:   #9EB0B8;
  --ink-faint:  #6F838C;
  --line:       #263B43;
  --line-soft:  #1F323A;

  --accent:     #4FC3DB;
  --accent-deep:#7FD8EA;
  --accent-ink: #06232C;
  --accent-wash:#123540;

  --jade:       #4FCB9F;
  --jade-wash:  #14392F;
  --rouge:      #FF8B80;
  --rouge-wash: #3E211E;

  --shadow:      0 1px 3px rgba(0,0,0,.45), 0 10px 30px -18px rgba(0,0,0,.8);
  --shadow-lift: 0 2px 6px rgba(0,0,0,.55), 0 30px 60px -28px rgba(0,0,0,.95);
}

/* ── 2. Base ───────────────────────────────────────────── */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  overflow-x: hidden;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 8px; top: 8px; }

/* Le surtitre : capitales espacées, comme les intitulés de ia-ora. */
.eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* Le mot mis en couleur dans un titre bicolore. */
h1 em, h2 em, h3 em { font-style: normal; color: var(--accent); }

/* ── 3. Barre haute ────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 rgba(23,39,46,.03), 0 6px 18px -14px rgba(23,39,46,.35);
}

.topbar__menu { display: none; }
.topbar__menu svg, .iconbtn svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand__mark svg { width: 26px; height: 26px; fill: none; stroke-width: 1.5; stroke-linecap: round; }
.brand__mark .s { stroke: var(--accent); }
.brand__mark .c { stroke: var(--ink); stroke-width: 2; }
.brand__word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: .01em;
}

.topbar__ctx {
  display: flex; align-items: baseline; gap: 10px;
  min-width: 0; margin-left: 8px;
  padding-left: 16px; border-left: 1px solid var(--line);
}
.topbar__ctxname {
  font-weight: 600; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar__ctxmeta { font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.iconbtn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--accent-wash); color: var(--accent); }

/* ── 4. Coquille ───────────────────────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: calc(100dvh - var(--topbar-h));
}

/* ── 5. Rail ───────────────────────────────────────────── */
.rail {
  border-right: 1px solid var(--line-soft);
  background: var(--surface);
}
.rail__scroll {
  position: sticky; top: var(--topbar-h);
  max-height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 18px 40px;
  display: flex; flex-direction: column; gap: 28px;
}

.rail__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.rail__block > .eyebrow { display: block; margin-bottom: 12px; }

.ghostbtn {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent);
  padding: 4px 7px; margin: -4px -7px;
  border-radius: var(--r-s);
  transition: background .15s;
}
.ghostbtn:hover { background: var(--accent-wash); }

.tclist { display: flex; flex-direction: column; gap: 2px; }
.tcitem {
  width: 100%;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-m);
  border-left: 2px solid transparent;
  text-align: left;
  transition: background .15s, border-color .15s;
}
.tcitem:hover { background: var(--surface-2); }
.tcitem.is-on {
  background: var(--accent-wash);
  border-left-color: var(--accent);
  color: var(--accent-deep);
}
.tcitem__name { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcitem__meta { font-family: var(--mono); font-size: 10px; opacity: .65; }

.memlist { display: flex; flex-direction: column; }
.memrow {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: baseline;
  padding: 8px 2px;
  border-bottom: 1px dotted var(--line);
}
.memrow:last-child { border-bottom: 0; }
.memrow__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memrow__val { font-family: var(--mono); font-size: 12px; font-weight: 500; }

.toolgrid { display: flex; flex-direction: column; }
.toolbtn {
  text-align: left; padding: 9px 2px;
  font-size: 13px; color: var(--ink-soft);
  border-bottom: 1px dotted var(--line);
  transition: color .15s, padding-left .15s;
}
.toolbtn:last-child { border-bottom: 0; }
.toolbtn:hover { color: var(--accent); padding-left: 6px; }
.toolbtn--danger:hover { color: var(--rouge); }
.toolbtn--accent { color: var(--accent); font-weight: 500; }

.rail__note {
  margin-top: 12px; font-size: 11.5px; line-height: 1.5;
  color: var(--ink-faint);
}

.rail__veil { display: none; }

/* ── 6. Zone principale ────────────────────────────────── */
.main { padding: 0 0 140px; min-width: 0; }
.board, .empty { display: block; }
.board { padding: 30px clamp(18px, 4vw, 44px) 0; }

/* Tant qu'aucune ardoise n'existe, l'accueil prend toute la largeur :
   le rail n'aurait rien à montrer et couperait le bandeau en deux. */
.shell:has(#viewEmpty:not([hidden])):not(:has(.tcitem)) {
  grid-template-columns: minmax(0, 1fr);
}
.shell:has(#viewEmpty:not([hidden])):not(:has(.tcitem)) .rail { display: none; }

/* L'accueil descend jusqu'au pied de page, sans marge basse. */
.main:has(#viewEmpty:not([hidden])) { padding-bottom: 0; }

/* ── 7. Accueil : bandeau, barre flottante, sections ───── */
.empty { padding: 0; }

.hero {
  position: relative;
  min-height: clamp(340px, 46vh, 460px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px clamp(18px, 5vw, 60px) 96px;
  text-align: center;
  overflow: hidden;
  background: #01222F;
  color: #fff;
}

/* Deux voiles clairs qui suggèrent le lagon sans photo. */
.hero__media {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(68% 78% at 50% 46%, rgba(1,34,47,.62) 0%, rgba(1,34,47,.10) 72%, rgba(1,34,47,0) 100%),
    linear-gradient(180deg, rgba(1,34,47,.66) 0%, rgba(1,34,47,.52) 45%, rgba(1,34,47,.80) 100%),
    url("../assets/hero.jpg");
  background-size: cover, cover, cover;
  background-position: center center, center center, center 55%;
  background-repeat: no-repeat, no-repeat, no-repeat;
  pointer-events: none;
}
.hero__media::after { content: none; }



.hero__inner { position: relative; max-width: 46rem; }

.hero__eyebrow {
  font-size: 10.5px; font-weight: 600;
  letter-spacing: .22em; text-transform: uppercase;
  color: rgba(255,255,255,.78);
  margin-bottom: 18px;
}

.hero__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 5.2vw, 54px);
  line-height: 1.08;
  letter-spacing: -.012em;
}
.hero__title em { font-style: normal; color: #B8F0F0; }

.hero__lede {
  margin: 18px auto 0; max-width: 42ch;
  font-size: 16px; font-weight: 300; line-height: 1.6;
  color: rgba(255,255,255,.88);
}

/* La barre blanche qui chevauche le bas du bandeau. */
.hero__bar {
  position: relative;
  z-index: 2;
  margin: 0 auto -34px;
  transform: translateY(48px);
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: center;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
}

/* Une section, fond blanc ou fond bleuté selon l'alternance. */
.band {
  padding: 76px clamp(18px, 5vw, 60px) 72px;
  background: var(--surface);
}
.band--tint { background: var(--paper); }

.band__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.15;
  letter-spacing: -.012em;
  text-align: center;
}
.band__sub {
  margin: 12px auto 0; max-width: 46ch;
  font-size: 15px; font-weight: 300; line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
}

/* La grille de cartes : bandeau coloré, puis corps blanc. */
.cards {
  margin: 46px auto 0;
  max-width: 74rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 22px;
}

.card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }

.card__top {
  position: relative;
  height: 104px;
  background: linear-gradient(140deg, #00697F, #23A8B4);
}
.card__top--b { background: linear-gradient(140deg, #0A7F8C, #58C6C4); }
.card__top--c { background: linear-gradient(140deg, #005669, #109FB0); }
.card__top--d { background: linear-gradient(140deg, #128070, #7ED4C4); }
.card__top::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(75% 90% at 78% 110%, rgba(255,255,255,.34), rgba(255,255,255,0) 62%);
}

.card__badge {
  position: absolute; left: 0; top: 14px; z-index: 2;
  padding: 5px 11px 5px 12px;
  background: var(--accent-deep);
  color: #fff;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase;
}

.card__body { padding: 18px 18px 22px; }
.card__body h3 {
  font-family: var(--display);
  font-size: 15px; font-weight: 600;
  letter-spacing: .01em;
  text-transform: uppercase;
}
.card__body p {
  margin-top: 9px;
  font-size: 13.5px; font-weight: 300; line-height: 1.6;
  color: var(--ink-soft);
}

/* Le pied de l'accueil. */
.foot {
  padding: 30px clamp(18px, 5vw, 60px) 40px;
  background: var(--ink);
  color: rgba(255,255,255,.62);
  text-align: center;
  font-size: 12.5px; font-weight: 300;
}
.foot b { color: #fff; font-weight: 600; letter-spacing: .02em; }

/* ── 8. Boutons ────────────────────────────────────────── */
.btn {
  padding: 12px 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink);
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent);
}
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--accent-ink); }
.btn--danger { color: var(--rouge); border-color: var(--rouge-wash); background: transparent; }
.btn--danger:hover { background: var(--rouge-wash); border-color: var(--rouge); color: var(--rouge); }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn--quiet:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }

/* ── 9. Tête d'ardoise ─────────────────────────────────── */
.board__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
  margin-bottom: 26px;
}
.board__title h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(22px, 3vw, 32px); line-height: 1.1; letter-spacing: -.012em;
}
.board__sub { margin-top: 7px; font-size: 13px; font-weight: 300; color: var(--ink-soft); }

.board__total { text-align: right; }
.board__totallabel {
  display: block; font-size: 9.5px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 4px;
}
.board__totalval {
  display: block; font-size: 27px; font-weight: 700;
  letter-spacing: -.008em; color: var(--accent);
}

/* ── 10. Onglets ───────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 18px 13px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--accent); border-bottom-color: var(--accent); }

/* ── 11. Filtres ───────────────────────────────────────── */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
}
.field--search { flex: 1 1 220px; min-width: 180px; }

.filters input[type="search"],
.filters select {
  width: 100%;
  padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: 13.5px;
}
.filters input[type="search"]:focus,
.filters select:focus { border-color: var(--accent); background: var(--surface); }
.filters select { width: auto; cursor: pointer; }
.filters input[type="search"]::placeholder { color: var(--ink-faint); }
.filters__count {
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 12px;
}

/* ── 12. Liste des écritures ───────────────────────────── */
.entries {
  display: flex; flex-direction: column;
  padding: 4px 18px 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
}
.entries:empty { display: none; }

.daysep {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 0 8px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.daysep::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.daysep:first-child { padding-top: 14px; }

.entry {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center; gap: 13px;
  padding: 12px 10px;
  margin: 0 -10px;
  border-radius: var(--r-s);
  text-align: left; width: calc(100% + 20px);
  transition: background .13s;
}
.entry:hover { background: var(--surface-2); }
.entry:hover .entry__lead { border-color: var(--accent); color: var(--accent); }

.entry__lead {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px; font-weight: 600;
  color: var(--ink-soft);
  transition: border-color .13s, color .13s;
}
.entry--transfer .entry__lead { border-style: dashed; color: var(--accent); border-color: var(--accent); }

.entry__body { min-width: 0; }
.entry__title {
  font-size: 14.5px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entry__meta {
  margin-top: 3px;
  font-size: 12px; font-weight: 300; color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entry__tag {
  display: inline-block;
  font-size: 9px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 6px; margin-right: 7px;
  background: var(--accent-wash); color: var(--accent-deep);
  border-radius: var(--r-s);
}

.entry__amount { text-align: right; }
.entry__amountval { font-family: var(--mono); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.entry__share {
  display: block; margin-top: 2px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-faint);
}
.entry--transfer .entry__amountval { color: var(--accent); }

.pane__empty {
  color: var(--ink-soft); font-size: 14px; font-weight: 300;
  padding: 34px 24px; max-width: 48ch;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
}

/* ── 13. Soldes : l'élément signature ──────────────────── */
.section__title {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(20px, 2.4vw, 27px); letter-spacing: -.012em;
  text-align: center;
}
.section__title--gap { margin-top: 56px; }
.section__hint {
  margin: 10px auto 26px; max-width: 52ch;
  font-size: 13.5px; font-weight: 300; color: var(--ink-soft);
  text-align: center;
}

.balances {
  padding: 10px 22px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
}

.bal {
  display: grid;
  grid-template-columns: minmax(70px, 130px) minmax(0, 1fr) 92px;
  align-items: center; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dotted var(--line);
}
.bal:last-of-type { border-bottom: 0; }
.bal__name {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* La piste : un axe zéro au centre, la barre s'écarte des deux côtés */
.bal__track { position: relative; height: 26px; }
.bal__track::before {
  content: ""; position: absolute; left: 50%; top: -12px; bottom: -12px;
  width: 1px; background: var(--line);
}
.bal__bar {
  position: absolute; top: 5px; bottom: 5px;
  min-width: 2px;
  border-radius: 1px;
  transition: width .45s cubic-bezier(.2,.7,.2,1);
}
.bal__bar--neg { right: 50%; background: var(--rouge); }
.bal__bar--pos { left: 50%; background: var(--jade); }
.bal__bar--zero { left: calc(50% - 3px); width: 6px; height: 6px; top: 10px; bottom: auto; border-radius: 50%; background: var(--ink-faint); }

.bal__val {
  text-align: right;
  font-family: var(--mono); font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bal__val--pos { color: var(--jade); }
.bal__val--neg { color: var(--rouge); }
.bal__val--zero { color: var(--ink-faint); }

.bal__legend {
  display: flex; justify-content: space-between;
  font-size: 9px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 12px 106px 0 144px;
  border-top: 1px solid var(--line-soft);
  margin-top: 6px;
}

/* ── 14. Règlements ────────────────────────────────────── */
.settle { display: flex; flex-direction: column; gap: 10px; }
.settle__row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 15px 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
}
.settle__who { font-size: 14.5px; font-weight: 300; }
.settle__who b { font-weight: 600; }
.settle__arrow { color: var(--accent); }
.settle__amt { font-family: var(--mono); font-weight: 700; font-size: 16px; margin-left: auto; color: var(--accent); }
.settle__do { flex-shrink: 0; }
.settle__done { color: var(--jade); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

/* ── 15. Statistiques ──────────────────────────────────── */
.statgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}
.statcard {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
  padding: 20px 18px 22px;
  text-align: center;
}
.statcard__label {
  display: block;
  font-size: 9.5px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-faint);
}
.statcard__val {
  display: block;
  margin-top: 10px;
  font-family: var(--mono); font-size: 24px; font-weight: 700;
  letter-spacing: -.008em; color: var(--accent);
}
.statcard__sub { display: block; margin-top: 5px; font-size: 12px; font-weight: 300; color: var(--ink-soft); }

.bars {
  display: flex; flex-direction: column;
  padding: 12px 22px 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-m);
  box-shadow: var(--shadow);
}
.barrow {
  display: grid; grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) 96px;
  align-items: center; gap: 14px;
  padding: 9px 0;
}
.barrow__label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barrow__track { display: block; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.barrow__fill {
  display: block;
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width .45s cubic-bezier(.2,.7,.2,1);
}
.barrow__val { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.barrow__val span { color: var(--ink-faint); margin-left: 6px; }

/* ── 16. Boutons flottants ─────────────────────────────── */
.fabs {
  position: fixed; right: clamp(18px, 4vw, 44px); bottom: 26px; z-index: 50;
  display: flex; gap: 8px; align-items: center;
}
.fab {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  box-shadow: var(--shadow-lift);
  transition: transform .12s, background .15s;
}
.fab:active { transform: translateY(1px) scale(.99); }
.fab--primary { background: var(--accent); color: var(--accent-ink); }
.fab--primary:hover { background: var(--accent-deep); }
.fab--ghost {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
}
.fab--ghost:hover { border-color: var(--accent); color: var(--accent); }
.fab__plus { font-family: var(--mono); margin-right: 6px; }

/* ── 17. Modale ────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal__veil { position: absolute; inset: 0; background: rgba(10,32,40,.52); backdrop-filter: blur(3px); animation: fade .2s ease; }
html[data-theme="dark"] .modal__veil { background: rgba(0,0,0,.66); }

.modal__panel {
  position: relative;
  width: min(560px, 100%);
  max-height: min(88dvh, 820px);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-m);
  box-shadow: var(--shadow-lift);
  animation: pop .22s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.985) } }

.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--line-soft);
}
.modal__head h2 {
  font-family: var(--display); font-weight: 600; font-size: 17px;
  letter-spacing: .02em; text-transform: uppercase;
}
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot {
  display: flex; gap: 8px; align-items: center;
  padding: 15px 20px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}
.modal__foot .spacer { margin-left: auto; }

/* ── 18. Formulaires ───────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 16px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.lab { display: block; }
.lab__text {
  display: block; margin-bottom: 6px;
  font-size: 9.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-faint);
}
.inp {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: 14.5px;
}
.inp:focus { border-color: var(--accent); background: var(--surface); }
.inp--amount { font-family: var(--mono); font-size: 22px; font-weight: 700; padding: 13px; }
textarea.inp { resize: vertical; min-height: 62px; }

.hint { font-size: 12px; font-weight: 300; color: var(--ink-faint); margin-top: 6px; }
.hint--warn { color: var(--rouge); }
.hint--ok { color: var(--jade); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--surface);
  transition: all .13s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }

.splitlist { display: flex; flex-direction: column; margin-top: 4px; }
.splitrow {
  display: grid; grid-template-columns: 22px minmax(0,1fr) 96px 76px;
  align-items: center; gap: 10px;
  padding: 8px 8px; border-radius: var(--r-s);
  border-bottom: 1px dotted var(--line);
}
.splitrow:last-child { border-bottom: 0; }
.splitrow:hover { background: var(--surface-2); }
.splitrow.is-off { opacity: .42; }
.splitrow__name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.splitrow__inp {
  width: 100%; padding: 7px 9px; text-align: right;
  font-family: var(--mono); font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-s);
}
.splitrow__due { text-align: right; font-family: var(--mono); font-size: 12.5px; color: var(--ink-soft); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.splitsum {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; padding-top: 11px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px;
}

.memedit { display: flex; flex-direction: column; gap: 7px; }
.memedit__row { display: flex; gap: 8px; align-items: center; }
.memedit__row .inp { flex: 1; }
.memedit__del {
  width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--ink-faint);
}
.memedit__del:hover { background: var(--rouge-wash); color: var(--rouge); }
.memedit__del svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }

.detail { display: flex; flex-direction: column; gap: 16px; }
.detail__amount {
  font-family: var(--mono); font-size: 32px; font-weight: 700;
  letter-spacing: -.012em; color: var(--accent);
}
.detail__lines { display: flex; flex-direction: column; }
.detail__line {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.detail__line dt { color: var(--ink-faint); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; flex-shrink: 0; }
.detail__line dd { margin-left: auto; font-family: var(--mono); font-size: 13.5px; }
.detail__leader { flex: 1; border-bottom: 1px dotted var(--line); transform: translateY(-3px); }

/* ── 19. Toasts ────────────────────────────────────────── */
.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 20px;
  background: var(--ink); color: #fff;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow-lift);
  pointer-events: auto;
  animation: rise .25s cubic-bezier(.2,.8,.2,1);
}
.toast button {
  font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: #8FE3F0;
}
.toast button:hover { text-decoration: underline; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) } }

/* ── 20. Adaptatif ─────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar__menu { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-soft); }
  .topbar__menu:hover { background: var(--accent-wash); color: var(--accent); }

  .rail {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 70;
    width: min(300px, 84vw);
    background: var(--surface);
    transform: translateX(-101%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
    box-shadow: var(--shadow-lift);
  }
  .rail.is-open { transform: none; }
  .rail__scroll { max-height: none; height: 100%; }
  .rail__veil {
    display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 65;
    background: rgba(10,32,40,.45);
  }
  .main { padding-bottom: 150px; }
  .band { padding: 56px clamp(18px, 5vw, 40px) 52px; }
}

@media (max-width: 620px) {
  .topbar__ctx { display: none; }
  .hero { padding: 48px 18px 88px; min-height: 320px; }
  .hero__bar { width: 100%; border-radius: var(--r-m); flex-direction: column; }
  .hero__bar .btn { width: 100%; }
  .board { padding-left: 16px; padding-right: 16px; }
  .board__head { align-items: flex-start; padding: 18px; }
  .board__total { text-align: left; }
  .entries { padding-left: 14px; padding-right: 14px; }
  .balances, .bars { padding-left: 14px; padding-right: 14px; }
  .entry { grid-template-columns: 30px minmax(0,1fr) auto; gap: 10px; }
  .entry__lead { width: 30px; height: 30px; font-size: 10px; }
  .bal { grid-template-columns: minmax(60px, 96px) minmax(0,1fr) 80px; gap: 10px; }
  .bal__legend { padding-left: 106px; padding-right: 90px; }
  .barrow { grid-template-columns: minmax(70px, 110px) minmax(0,1fr) 84px; gap: 10px; }
  .form__row { grid-template-columns: 1fr; }
  .splitrow { grid-template-columns: 20px minmax(0,1fr) 80px 68px; gap: 7px; }
  .fabs { left: clamp(14px, 4vw, 44px); right: clamp(14px, 4vw, 44px); bottom: 16px; }
  .fab--primary { flex: 1; justify-content: center; }
  .modal { padding: 0; place-items: end center; }
  .modal__panel { max-height: 92dvh; border-radius: var(--r-m) var(--r-m) 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .card:hover { transform: none; }
}

/* ── 21. Impression ────────────────────────────────────── */
@media print {
  .topbar, .rail, .rail__veil, .fabs, .tabs, .filters, .toasts, .modal, .skip, .hero, .foot { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .main, .board { padding: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .board__head, .entries, .balances, .bars, .statcard, .settle__row {
    box-shadow: none; border-color: #ccc;
  }
  .pane, .pane[hidden] { display: block !important; page-break-inside: avoid; }
  .pane + .pane { margin-top: 22px; }
  .entry:hover { background: none; }
  .section__title { margin-top: 18px; }
}
