/* Budget Maison — v7 « Nuit » (direction choisie : B)
   Inspiration Revolut / Copilot Money : fond nuit, un halo bleu-violet en
   haut, gros chiffre centré posé sur la courbe du mois, boutons d'action
   ronds, catégories en pastilles carrées colorées.
   - Thème sombre uniquement (c'est l'identité de la direction).
   - Couleur de marque : dégradé pervenche → violet, réservé au logo, à
     l'avatar et à la courbe. Les catégories gardent leurs propres couleurs.
   - Inter Display pour les chiffres et titres, Inter pour le texte.
   - Animations discrètes : uniquement celles qui répondent à une action. */

@font-face { font-family: "Inter Display"; font-weight: 500; font-display: swap; src: url("/static/fonts/interdisplay-Medium.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 600; font-display: swap; src: url("/static/fonts/interdisplay-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter Display"; font-weight: 700; font-display: swap; src: url("/static/fonts/interdisplay-Bold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-Regular.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-Medium.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-SemiBold.woff") format("woff"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-Bold.woff") format("woff"); }

:root {
  --bg: #08090c;
  --halo: #1c2440;
  --card: #14161c;
  --card-2: #1b1e26;
  --fill: rgb(255 255 255 / .08);
  --fill-2: rgb(255 255 255 / .12);
  --line: rgb(255 255 255 / .07);
  --ink: #f2f4f8;
  --ink-2: #c6cbd8;
  --ink-3: #8a90a2;
  --accent: #9aa6ff;
  --accent-2: #7c8cff;
  --grad: linear-gradient(135deg, #6d7cff, #b06bff);
  --pos: #5fd99a;
  --pos-bg: rgb(95 217 154 / .14);
  --neg: #ff7b7b;
  --neg-bg: rgb(255 123 123 / .14);
  --warn: #ffc966;
  --warn-bg: rgb(255 201 102 / .14);

  --r-s: 12px;
  --r-m: 16px;
  --r-l: 22px;
  --display: "Inter Display", "Inter", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 66px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(120% 420px at 50% -60px, var(--halo), transparent 70%) no-repeat, var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dec { color: var(--ink-3); font-size: .5em; letter-spacing: -.01em; font-weight: 600; }
svg { display: block; }

/* ------------------------------------------------------------ structure */

.shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); }
.content { min-width: 0; }
.main { padding: 4px 16px calc(var(--nav-h) + 40px + env(safe-area-inset-bottom)); max-width: 760px; width: 100%; margin: 0 auto; }
#page { animation: page-in .18s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

html { overflow-x: clip; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
  max-width: 760px; margin: 0 auto;
}
/* Fond flou pleine largeur, qui s'estompe vers le bas : le contenu qui
   défile dessous se brouille sans masquer le halo bleu du haut. */
.topbar::before {
  content: ""; position: absolute; z-index: -1; top: 0; bottom: -14px; left: 50%; width: 100vw; transform: translateX(-50%);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent);
}
.top-row { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--grad); flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; text-decoration: none;
}
.month {
  flex: 1; height: 38px; border-radius: 999px; background: var(--fill);
  display: flex; align-items: center; justify-content: space-between; padding: 0 4px;
}
.month strong { font-weight: 600; font-size: 14.5px; text-transform: capitalize; white-space: nowrap; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn:disabled { opacity: .25; cursor: default; background: none; }
.icon-btn svg { width: 18px; height: 18px; }
.round { width: 38px; height: 38px; background: var(--fill); flex: none; }
.who-row { display: flex; justify-content: center; margin-top: 10px; }
.seg { display: inline-flex; background: var(--fill); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 5px 14px; border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg button[aria-pressed="true"] { background: var(--fill-2); color: var(--ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

.nav {
  position: fixed; z-index: 6; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom));
  height: var(--nav-h); padding: 7px; max-width: 520px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: rgb(22 24 31 / .82); border: 1px solid var(--line); border-radius: 24px;
  backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 18px 40px -16px rgb(0 0 0 / .8);
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); font-size: 11px; font-weight: 600; text-decoration: none; border-radius: 17px;
  transition: color .15s, background .15s;
}
.nav a svg { width: 21px; height: 21px; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--fill); }
.brand { display: none; }

@media (min-width: 980px) {
  .shell { grid-template-columns: 240px minmax(0, 1fr); }
  .nav {
    position: sticky; top: 0; left: auto; right: auto; bottom: auto; height: 100vh; max-width: none; margin: 0;
    padding: 22px 14px; grid-template-columns: 1fr; grid-auto-rows: 44px; align-content: start; gap: 4px;
    border: 0; border-right: 1px solid var(--line); border-radius: 0; background: rgb(14 15 20 / .7); box-shadow: none;
  }
  .nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; font-family: var(--display); font-weight: 700; font-size: 17px; }
  .nav .brand svg { width: 32px; height: 32px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
  .nav a:hover { background: var(--fill); color: var(--ink); }
}

/* ------------------------------------------------------------ blocs */

.panel { background: var(--card); border-radius: var(--r-l); padding: 18px; }
.stack { display: grid; gap: 14px; }
.stack > *, .grid-2 > * { min-width: 0; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.tiles2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.tiles2 > * { min-width: 0; }

h1, h2, h3 { margin: 0; }
h2 { font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 600; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head .muted, .panel-head a { font-size: 13px; font-weight: 500; }
.page-head { margin: 10px 2px 4px; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.025em; line-height: 1.1; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }

/* Héros : chiffre centré + courbe pleine largeur */
.hero { text-align: center; padding-top: 14px; }
.hero .lbl { color: var(--ink-3); font-size: 14px; font-weight: 500; }
.hero .big { font-family: var(--display); font-weight: 700; font-size: clamp(46px, 15vw, 62px); letter-spacing: -.045em; line-height: 1; margin-top: 6px; }
.hero .big.neg { color: var(--neg); }
.hero .big .dec { font-size: .48em; }
.hero .pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; background: var(--fill-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.hero .pill .up { color: var(--pos); }
.hero .pill .down { color: var(--neg); }
.curve { margin: 4px -16px 0; height: 132px; position: relative; }
.cv-dot { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 2.5px solid #fff; transform: translate(-50%, -50%); box-shadow: 0 0 0 5px rgb(124 140 255 / .18); }
.curve svg { width: 100%; height: 100%; overflow: visible; }
.curve-legend { display: flex; justify-content: space-between; margin: 2px 0 0; font-size: 11.5px; color: var(--ink-3); }

/* Boutons d'action ronds */
.acts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.act { display: grid; justify-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); font-weight: 500; border: 0; background: none; cursor: pointer; text-decoration: none; position: relative; }
.act i { width: 54px; height: 54px; border-radius: 50%; background: var(--fill); display: grid; place-items: center; transition: background .15s, transform .1s; }
.act:hover i { background: var(--fill-2); }
.act:active i { transform: scale(.94); }
.act i svg { width: 22px; height: 22px; color: var(--ink); }
.act .badge-n { position: absolute; top: -2px; left: calc(50% + 12px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--neg); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

/* Tuiles chiffrées */
.tile { background: var(--card); border-radius: 20px; padding: 14px 16px; min-width: 0; }
.tile span { color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
.tile b { display: block; font-family: var(--display); font-weight: 700; font-size: 23px; letter-spacing: -.02em; margin-top: 2px; white-space: nowrap; }
.tile small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.tile.link { text-decoration: none; color: inherit; display: block; }
.tile .prog { height: 6px; border-radius: 99px; background: var(--fill); margin-top: 10px; overflow: hidden; }
.tile .prog i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }

/* Barre empilée des catégories + lignes */
.stackbar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; gap: 3px; margin: 2px 0 10px; }
.stackbar i { display: block; border-radius: 2px; min-width: 3px; }
.line-row {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 0 12px; align-items: center;
  padding: 8px 4px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-radius: 14px; color: inherit;
}
.line-row:hover { background: var(--fill); }
.sq { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; background: var(--fill); }
.line-row .nm { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-row .nm small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.line-row .am { font-family: var(--display); font-weight: 600; font-size: 16px; white-space: nowrap; text-align: right; }
.line-row .am small { display: block; color: var(--warn); font-size: 11.5px; font-family: var(--sans); font-weight: 500; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 600; padding: 8px 4px 2px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

.notice {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-m);
  background: var(--card); font-size: 14px;
}
.notice::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.notice.info::before { background: var(--accent); }
.notice a { margin-left: auto; white-space: nowrap; flex: none; font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--fill); color: var(--ink); }

/* Liste « en attendant la paie » */
.todo { list-style: none; margin: 0; padding: 0; display: grid; }
.todo li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; padding-top: 0; }
.todo li > span { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--fill-2); flex: none; display: grid; place-items: center; }
.todo li.done > span { background: var(--grad); border-color: transparent; }
.todo li.done > span::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.todo li div { flex: 1; min-width: 0; }
.todo b { display: block; font-weight: 600; font-size: 14.5px; }
.todo li.done b { color: var(--ink-3); text-decoration: line-through; }
.todo small { color: var(--ink-3); font-size: 12.5px; }
.todo a { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--fill); color: var(--ink); flex: none; }

/* Épargne cumulée (page Maison) */
.cum-big { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.cum-sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.months { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.months div { background: var(--fill); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; }
.months span { color: var(--ink-3); text-transform: capitalize; margin-right: 4px; }
.months b { font-weight: 600; }
.chart { margin-top: 10px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ink-3); font-size: 10.5px; font-family: var(--sans); }
.chart .lbl-end { fill: var(--ink); font-weight: 700; font-size: 11.5px; }

/* ------------------------------------------------------------ opérations */

.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip {
  border: 0; background: var(--fill); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.search {
  width: 100%; height: 42px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--fill); outline: none; color: var(--ink);
}
.search::placeholder { color: var(--ink-3); }
.search:focus { background: var(--fill-2); }
.day { margin-top: 18px; }
.day h3 { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 0 6px 8px; display: flex; justify-content: space-between; }
.day h3:first-letter { text-transform: uppercase; }
.tx-list { background: var(--card); border-radius: var(--r-l); padding: 6px; overflow: hidden; }
.tx-list.flat { background: none; padding: 0; margin: 0 -4px; }
.tx {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 0 12px; align-items: center;
  padding: 8px 8px; border: 0; background: none; width: 100%; text-align: left; cursor: pointer; border-radius: 14px; color: inherit;
}
.tx:hover { background: var(--fill); }
.tx .badge { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 18px; grid-row: span 2; background: var(--fill); }
.tx .m { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx .sub { font-size: 12.5px; color: var(--ink-3); overflow: hidden; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.tx .sub .cn { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tx .sub .tag, .tx .sub .dot { flex: none; }
.tx .a { font-family: var(--display); font-weight: 600; font-size: 16px; text-align: right; grid-row: span 2; white-space: nowrap; }
.tx .a .dec { font-size: .75em; }
.tx .a.pos { color: var(--pos); }
.tx.dim .m, .tx.dim .a { color: var(--ink-3); }
.tx.dim .a { text-decoration: line-through; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--fill); color: var(--ink-2); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.save { background: var(--pos-bg); color: var(--pos); }
.tag.bad { background: var(--neg-bg); color: var(--neg); }
.empty { text-align: center; padding: 28px 16px; color: var(--ink-3); font-size: 14px; }

/* ------------------------------------------------------------ feuille (détail) */

.backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 20; animation: fade .15s ease; backdrop-filter: blur(4px); }
.sheet {
  position: fixed; z-index: 21; left: 0; right: 0; bottom: 0; max-height: 90vh; overflow: auto;
  background: var(--card); border-radius: 26px 26px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); animation: rise .24s cubic-bezier(.2,.8,.2,1);
}
.sheet .grip { width: 40px; height: 5px; background: var(--fill-2); border-radius: 5px; margin: 4px auto 16px; }
@media (min-width: 720px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(540px, 92vw); transform: translate(-50%, -50%); border-radius: 26px; border: 1px solid var(--line); box-shadow: 0 30px 70px -20px rgb(0 0 0 / .8); animation: pop .16s ease; }
  .sheet .grip { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%); } }

.tx-head { display: flex; gap: 14px; align-items: center; }
.tx-head .badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 24px; flex: none; background: var(--fill); }
.tx-head h2 { font-size: 19px; overflow: hidden; text-overflow: ellipsis; }
.sheet .amount-big { font-family: var(--display); font-size: 38px; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; margin-top: 16px; }
.raw { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; color: var(--ink-3); background: var(--fill); padding: 10px 12px; border-radius: var(--r-s); word-break: break-word; margin: 10px 0 0; }
.cat-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-pick {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 0; background: var(--fill); cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2);
}
.cat-pick[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-weight: 600; }
.switch > div { min-width: 0; flex: 1; }
.switch small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.toggle { position: relative; width: 48px; height: 28px; flex: none; }
.toggle input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle span { position: absolute; inset: 0; background: var(--fill-2); border-radius: 999px; transition: background .15s; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .3); transition: transform .18s; }
.toggle input:checked + span { background: var(--accent-2); }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle.sm { width: 38px; height: 22px; }
.toggle.sm span::after { width: 16px; height: 16px; }
.toggle.sm input:checked + span::after { transform: translateX(16px); }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number], input[type=month], input[type=date], select, textarea {
  padding: 11px 14px; border-radius: 14px; border: 1px solid transparent; background: var(--fill); width: 100%; outline: none; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); background: var(--fill-2); }
select option { background: var(--card); color: var(--ink); }
textarea { min-height: 70px; resize: vertical; }
.btn {
  border: 0; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 14px; cursor: pointer;
  background: var(--ink); color: var(--bg); display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
  transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--fill); color: var(--ink); }
.btn.ghost:hover { background: var(--fill-2); }
.btn.danger { background: var(--neg-bg); color: var(--neg); }
.btn.small { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: progress; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------ maison */

.house-card { background: var(--card); border-radius: var(--r-l); padding: 22px 18px; }
.house-hero { display: grid; gap: 18px; align-items: center; }
@media (min-width: 640px) { .house-hero { grid-template-columns: 200px 1fr; gap: 28px; } }
.house { width: 100%; max-width: 190px; margin: 0 auto; }
@media (prefers-reduced-motion: reduce) { .house .water { transition: none !important; } }
.house-nums .lbl { font-size: 13px; font-weight: 600; color: var(--accent); }
.house-nums .big { font-family: var(--display); font-size: clamp(36px, 10vw, 46px); font-weight: 700; letter-spacing: -.04em; line-height: 1.1; margin: 4px 0; }
.house-nums p { margin: 2px 0; color: var(--ink-2); }
.progress { height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; margin: 12px 0 8px; }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 999px; }
.eta { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: 13px; color: var(--pos); background: var(--pos-bg); padding: 6px 12px; border-radius: 999px; margin-top: 6px; }
.eta.bad { color: var(--neg); background: var(--neg-bg); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; }
.kv dd.hl { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--accent); }
.kv .total { padding-top: 10px; border-top: 1px solid var(--line); }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-plain li:first-child { border-top: 0; }
.list-plain .grow { flex: 1; min-width: 0; }
.list-plain .grow b { font-weight: 600; }
.ico-round { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--fill); color: var(--accent); }
.loan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ------------------------------------------------------------ réglages */

.bank-logo { width: 32px; height: 32px; border-radius: 10px; object-fit: contain; background: #fff; }
.bank-list { max-height: 50vh; overflow: auto; display: grid; gap: 2px; margin-top: 10px; }
.bank-item { display: flex; align-items: center; gap: 12px; padding: 9px; border-radius: 12px; border: 0; background: none; cursor: pointer; text-align: left; color: inherit; }
.bank-item:hover { background: var(--fill); }
.rule { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.rule code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--fill); padding: 2px 7px; border-radius: 6px; }
details summary { cursor: pointer; }
.mini-toggles { display: grid; gap: 6px; justify-items: end; }
.mini-toggles label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); }

/* ------------------------------------------------------------ login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); display: grid; gap: 14px; }
.login .lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.login .lockup svg { width: 52px; height: 52px; }
.login .lockup .wordmark { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.login h1 { font-family: var(--display); font-weight: 700; font-size: 30px; letter-spacing: -.025em; }
.login .btn { height: 48px; }
.error { color: var(--neg); font-size: 13px; min-height: 1.2em; }

/* ------------------------------------------------------------ toast */

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 30px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(10px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 30; max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%); }
@media (min-width: 980px) { #toast { bottom: 28px; } }

.spin { width: 20px; height: 20px; border: 2px solid var(--fill-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

@media (max-width: 380px) {
  .acts i { width: 48px; height: 48px; }
  .tile b { font-size: 20px; }
}

/* Réglages : étapes Enable Banking et valeurs à copier */
.steps { margin: 12px 0 14px; padding-left: 20px; display: grid; gap: 8px; color: var(--ink-2); }
.steps a { color: var(--accent); }
.copy-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; background: var(--fill); padding: 6px 8px; border-radius: 8px; }
.field input[type=file] { padding: 10px 0; background: none; border: 0; color: var(--ink-2); font: inherit; }
.field input[type=file]::file-selector-button { margin-right: 10px; padding: 8px 14px; border: 0; border-radius: 999px; background: var(--fill-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }

/* Sécurité */
.ico { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--fill); color: var(--accent); }
.btn svg { margin-right: 8px; vertical-align: -3px; }
.qr { width: min(220px, 70%); margin: 4px auto 0; padding: 10px; background: #fff; border-radius: 16px; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-size: 12px; letter-spacing: .04em; overflow-wrap: anywhere; }
.code-input { font-family: var(--display); font-size: 22px !important; letter-spacing: .3em; text-align: center; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 4px; }
.codes code { text-align: center; padding: 10px 6px; border-radius: 10px; background: var(--fill); font-size: 14px; letter-spacing: .04em; }
.list-plain li.wrap { flex-wrap: wrap; }
.li-actions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; padding-left: 44px; }

/* Analyses */
.tile small { display: block; margin-top: 8px; color: var(--ink-3); font-size: 13px; }
.insights { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.insights li { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.sq-ico { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--fill); font-size: 18px; }
.delta { font-family: var(--display); font-weight: 700; font-size: 15px; padding: 4px 10px; border-radius: 999px; }
.delta.neg { color: var(--neg); background: var(--neg-bg); }
.delta.pos { color: var(--pos); background: var(--pos-bg); }
.seg.mini { padding: 3px; }
.seg.mini button { padding: 5px 10px; font-size: 12px; }
.pay-row { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: 12px; padding: 7px 0; }
.pay-row .who { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-row .bar { height: 8px; border-radius: 99px; background: var(--fill); overflow: hidden; }
.pay-row .bar i { display: block; height: 100%; border-radius: 99px; }
.settle { margin: 12px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--fill); }
.subs .r { text-align: right; }
.price-max { margin-top: 16px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, rgb(109 124 255 / .18), rgb(176 107 255 / .14)); display: grid; gap: 4px; }
.price-max span { color: var(--ink-2); font-size: 13px; }
.price-max b { font-family: var(--display); font-size: 32px; letter-spacing: -.02em; }
.price-max small { color: var(--ink-2); font-size: 12.5px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.checks > li { display: flex; gap: 12px; align-items: flex-start; }
.checks .ck { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; font-weight: 800; font-size: 13px; }
.checks .ok .ck { background: var(--pos-bg); color: var(--pos); }
.checks .warn .ck { background: var(--warn-bg); color: var(--warn); }
.checks .bad .ck { background: var(--neg-bg); color: var(--neg); }
.checks p { margin: 2px 0 0; }
.checks ul { margin: 6px 0 0; padding-left: 16px; color: var(--ink-2); }
.checks.compact { gap: 10px; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.tbl th { text-align: right; color: var(--ink-3); font-weight: 600; font-size: 12px; padding: 6px 4px; }
.tbl td { text-align: right; padding: 8px 4px; border-top: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.dossier-head h1 { font-family: var(--display); font-size: 28px; margin: 14px 0 4px; letter-spacing: -.02em; }
.dossier-head .lockup { display: flex; align-items: center; gap: 10px; }
.dossier-head .lockup svg { width: 36px; height: 36px; }
.dossier-head .wordmark { font-family: var(--display); font-weight: 700; font-size: 18px; }
@page { margin: 14mm; }
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #111; --ink-2: #333; --ink-3: #666; --fill: #f1f1f4; --line: #ddd; }
  html, body { background: #fff !important; color: #111; }
  body::before, .topbar, .nav, .no-print, #sheet-root, .toast { display: none !important; }
  .main, .page, main { padding: 0 !important; margin: 0 !important; }
  .panel { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; background: #fff !important; }
  .dossier { max-width: none; }
}
.inline-num { width: 76px !important; display: inline-block; padding: 4px 8px !important; height: auto !important; font-size: 13px !important; margin: 0 2px; }

/* Accueil : tuiles à gauche, graphiques à droite */
.home-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.home-left { display: grid; gap: 12px; align-content: start; }
@media (min-width: 720px) {
  .home-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr); align-items: stretch; }
  .home-left .tiles2 { grid-template-columns: 1fr; }
  .home-left { grid-template-rows: auto 1fr; }
  .chart-card { margin: 0; }
}
@media (min-width: 1180px) { .main, .topbar { max-width: 1000px; } }
.donut { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 520px) { .donut { grid-template-columns: 1fr; justify-items: center; gap: 14px; } .dn-legend { width: 100%; } }
.chart-card { display: flex; flex-direction: column; } .chart-card .donut { flex: 1; }
.dn-wrap { position: relative; width: 148px; height: 148px; }
.dn-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.dn-seg { fill: none; stroke-width: 15; stroke-linecap: butt; transition: opacity .2s, stroke-width .2s; cursor: pointer; }
.dn-seg.dim { opacity: .25; }
.dn-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 0 30px; }
.dn-center small { color: var(--ink-3); font-size: 11.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; }
.dn-center b { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.dn-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; min-width: 0; }
.dn-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 13.5px; cursor: pointer; transition: background .15s; }
.dn-legend li.on, .dn-legend li:hover { background: var(--fill); }
.dn-legend i { width: 10px; height: 10px; border-radius: 3px; }
.dn-legend .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.dn-legend .pc { color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.dn-legend b { font-variant-numeric: tabular-nums; font-weight: 600; }
.hbars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; height: 150px; padding-top: 22px; }
.hb { display: grid; grid-template-rows: 1fr auto; gap: 6px; outline: none; cursor: default; }
.hb-plot { position: relative; }
.hb-zero { position: absolute; left: -4px; right: -4px; height: 1px; background: var(--line); }
.hb i { position: absolute; left: 50%; transform: translateX(-50%); width: min(34px, 60%); background: var(--accent); opacity: .42; border-radius: 4px 4px 0 0; transition: opacity .15s; }
.hb i.neg { background: var(--neg); opacity: .8; border-radius: 0 0 4px 4px; }
.hb i.cur, .hb:hover i, .hb:focus i { opacity: 1; }
.hb em { position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%); font-style: normal; font-family: var(--display); font-size: 11.5px; font-weight: 700; white-space: nowrap; color: var(--ink); opacity: 0; transition: opacity .15s; pointer-events: none; }
.hb i.neg em { bottom: auto; top: calc(100% + 4px); }
.hb i.cur em, .hb:hover em, .hb:focus em { opacity: 1; }
.hb-m { text-align: center; font-size: 11.5px; color: var(--ink-3); }
