/* Vision : minimaliste, clair, chaleureux. Une seule couleur d'accent (l'encre) ; la couleur vient des projets. */
:root {
  color-scheme: light;
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f0efeb;
  --line: #e9e7e1;
  --line-2: #dcdad3;
  --ink: #121211;
  --ink-2: #5d5c57;
  --ink-3: #8b8983;
  --pos: #12775a;
  --neg: #c2410c;
  --warn: #a15c00;
  --in: #1baf7a;
  --out: #eb6834;
  --buy: #6250d6;
  --perso: #6250d6;
  --agence: #2a78d6;
  --accent: #121211;
  --accent-ink: #ffffff;
  --logo-ink: #f6f6f3;
  --glass: rgba(255, 255, 255, 0.78);
  --shadow: 0 1px 2px rgba(18, 18, 17, 0.04), 0 6px 20px rgba(18, 18, 17, 0.05);
  --shadow-lg: 0 12px 40px rgba(18, 18, 17, 0.16);
  --r: 20px;
  --r-s: 12px;
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e0d; --surface: #181816; --surface-2: #222120; --line: #2a2926; --line-2: #3a3935;
    --ink: #f2f1ed; --ink-2: #b6b4ad; --ink-3: #87857e; --pos: #4fd1a1; --neg: #ff8a5c; --warn: #f0b04a;
    --in: #199e70; --out: #d95926; --buy: #9085e9; --perso: #9085e9; --agence: #3987e5;
    --accent: #f2f1ed; --accent-ink: #121211; --logo-ink: #121211; --glass: rgba(24, 24, 22, 0.72);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0d; --surface: #181816; --surface-2: #222120; --line: #2a2926; --line-2: #3a3935;
  --ink: #f2f1ed; --ink-2: #b6b4ad; --ink-3: #87857e; --pos: #4fd1a1; --neg: #ff8a5c; --warn: #f0b04a;
  --in: #199e70; --out: #d95926; --buy: #9085e9; --perso: #9085e9; --agence: #3987e5;
  --accent: #f2f1ed; --accent-ink: #121211; --logo-ink: #121211; --glass: rgba(24, 24, 22, 0.72);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.ico { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.pos { color: var(--pos); }
.neg { color: var(--neg) !important; }
.dim { opacity: 0.45; }
.strong { font-weight: 650; }

/* ---------------------------------------------------------------- démarrage */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.6); opacity: 0.4; } }

/* ---------------------------------------------------------------- barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding: 0 max(24px, calc((100vw - 1168px) / 2)); padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; justify-self: start; }
.logo { display: inline-flex; color: var(--ink); }
.topnav { display: flex; gap: 4px; background: var(--surface-2); padding: 3px; border-radius: 12px; }
.topnav-link { padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 550; color: var(--ink-2); transition: color .15s, background .15s; }
.topnav-link:hover { color: var(--ink); }
.topnav-link.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.top-right { display: flex; align-items: center; gap: 10px; justify-self: end; }
.top-gear.on { background: var(--surface-2); }

.main { max-width: 1168px; margin: 0 auto; padding: 12px 24px 96px; }
.view { display: grid; gap: 16px; }
.view.enter { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0.6; transform: translateY(4px); } }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 8px 0 4px; }
.view-title { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.view-head .muted { margin-top: 4px; }

/* ---------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border: 0; border-radius: var(--r-s);
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform .1s, background .15s, opacity .15s; background: transparent;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { opacity: 0.88; }
.btn.soft { background: var(--surface-2); color: var(--ink); }
.btn.soft:hover:not(:disabled) { background: var(--line); }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: #d13b3b; color: #fff; }
.btn.danger-text { color: var(--neg); }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn.spin .ico { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; color: var(--ink-2); font-size: 14px; font-weight: 550; cursor: pointer; }
.link-btn:hover { color: var(--ink); }
.link-btn.center { justify-self: center; }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-end.gap { margin-top: 16px; justify-content: space-between; }

/* ---------------------------------------------------------------- choix segmenté, puces, interrupteur */
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; }
.seg-btn { height: 36px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 550; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.seg-btn:hover { color: var(--ink); }
.seg-btn.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg.small .seg-btn { height: 30px; padding: 0 12px; font-size: 13px; }
.form .seg, .money .seg { display: flex; }
.form .seg-btn, .money .seg-btn { flex: 1; padding: 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { width: 38px; height: 22px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + .switch-ui { background: var(--in); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--ink); outline-offset: 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: color-mix(in srgb, var(--in) 16%, transparent); color: var(--pos); }
.badge.glass { background: var(--glass); color: var(--ink); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.count { min-width: 24px; height: 24px; padding: 0 8px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------------------------------------------------------------- cartes et lignes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.section-title { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.mini-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 4px 0 2px; }
.sub-block { margin-top: 14px; }
.sub-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.rows { display: grid; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 2px; border: 0; border-bottom: 1px solid var(--line);
  background: none; text-align: left; min-height: 56px;
}
.row:last-child { border-bottom: 0; }
button.row { cursor: pointer; border-radius: 0; }
button.row:hover { background: linear-gradient(90deg, transparent, var(--surface-2) 12%, var(--surface-2) 88%, transparent); }
.row-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .ico { color: var(--ink-3); }
.space-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink-3); }
.space-dot.perso { background: var(--perso); }
.space-dot.agence { background: var(--agence); }
.src { width: 24px; height: 24px; border-radius: 7px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--surface-2); color: var(--ink-2); margin: 0 -7px; }
.empty { text-align: center; padding: 28px 12px; display: grid; gap: 8px; justify-items: center; }
.alert { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 12px; border-radius: var(--r-s); background: color-mix(in srgb, var(--neg) 10%, transparent); color: var(--neg); font-size: 13.5px; font-weight: 500; }

/* ---------------------------------------------------------------- accueil */
.hero { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(0, 2fr); gap: 24px; align-items: end; padding: 20px 0 8px; }
.eyebrow { font-size: 15px; font-weight: 550; color: var(--ink-2); }
.hero-figure {
  display: block; margin: 6px 0 6px -2px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left;
  font-size: clamp(44px, 6.4vw, 64px); font-weight: 700; letter-spacing: -0.045em; line-height: 1.02;
}
.hero-figure:hover { opacity: 0.8; }
.hero-sub { color: var(--ink-2); font-size: 14px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tile {
  display: grid; gap: 6px; align-content: start; text-align: left; padding: 16px 18px; border-radius: 18px; border: 1px solid var(--line);
  background: var(--surface); min-height: 128px; transition: transform .15s, box-shadow .15s;
}
button.tile { cursor: pointer; }
button.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.tile-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.tile-label::first-letter { text-transform: uppercase; }
.tile-value { font-size: 23px; font-weight: 700; letter-spacing: -0.025em; display: inline-flex; align-items: center; gap: 6px; }
.tile-value.up .ico { color: var(--pos); }
.tile-value.down .ico { color: var(--neg); }
.tile-sub { font-size: 12.5px; color: var(--ink-3); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--in); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.tile .progress { margin: 4px 0 2px; }

.onboard .steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.step { width: 100%; height: 100%; display: grid; gap: 2px; text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px dashed var(--line-2); background: none; cursor: pointer; transition: border-color .15s, background .15s; }
.step:hover { border-color: var(--ink-3); background: var(--surface-2); }
.step span { font-size: 13px; color: var(--ink-3); }

.board-wrap { padding-top: 8px; }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-2); border-radius: 22px; padding: 12px; transition: background .15s, box-shadow .15s; min-height: 180px; }
.col.drop { box-shadow: inset 0 0 0 2px var(--ink-3); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px 10px; gap: 8px; }
.col-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.col-hint { font-size: 12px; color: var(--ink-3); }
.col-total { font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.col-cards { display: grid; gap: 12px; }
.pcard {
  background: var(--surface); border-radius: 16px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s; outline-offset: 3px;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.pcard.dragging { opacity: 0.4; transform: rotate(-1.5deg); }
.pcard-cover { position: relative; aspect-ratio: 2 / 1; background-size: cover; background-position: center; display: grid; place-items: center; }
.cover-emoji { font-size: 40px; line-height: 1; filter: drop-shadow(0 4px 10px rgba(0,0,0,.12)); }
.cover-emoji.big { font-size: 64px; }
.pcard-cover .badge { position: absolute; top: 10px; }
.pcard-cover .funded { left: 10px; color: var(--pos); }
.pcard-cover .sp { right: 10px; }
.pcard-body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.pcard-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pcard-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.3; }
.pcard-amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pcard-saved { display: grid; gap: 5px; }
.reach { font-size: 14px; font-weight: 550; color: var(--ink-2); }
.reach.small { font-size: 12.5px; }
.reach.good { color: var(--pos); }
.reach.warn { color: var(--warn); }
.reach.muted { color: var(--ink-3); }
.reach-sub { color: var(--ink-3); font-weight: 500; }
.add-card {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 48px; border-radius: 14px; border: 1.5px dashed var(--line-2);
  background: none; color: var(--ink-3); font-size: 14px; font-weight: 550; cursor: pointer; transition: all .15s;
}
.add-card:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface); }
.done-wall { padding-top: 4px; }
.done-row { display: flex; gap: 12px; overflow-x: auto; padding: 6px 2px 10px; scrollbar-width: none; }
.done-row::-webkit-scrollbar { display: none; }
.done-card { flex: none; width: 140px; display: grid; gap: 4px; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; font-size: 13px; }
.done-cover { aspect-ratio: 1; border-radius: 16px; background-size: cover; background-position: center; display: grid; place-items: center; font-size: 34px; position: relative; }
.done-cover::after { content: "✓"; position: absolute; right: 8px; bottom: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--pos); font-size: 12px; font-weight: 800; display: grid; place-items: center; box-shadow: var(--shadow); }
.done-title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- courbe */
.chart-card .muted.small { margin-top: 2px; }
.chart { position: relative; margin: 6px -4px 0; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .grid.zero { stroke: var(--ink-3); stroke-dasharray: 4 4; }
.chart .axis { fill: var(--ink-3); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-top { stop-color: var(--ink); stop-opacity: 0.09; }
.chart .area-bottom { stop-color: var(--ink); stop-opacity: 0; }
.chart .buy { fill: var(--buy); stroke: var(--surface); stroke-width: 2; }
.chart .now { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hover-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.chart-tip {
  position: absolute; z-index: 2; min-width: 180px; max-width: 260px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); font-size: 13px; pointer-events: none; opacity: 0; transition: opacity .12s; display: grid; gap: 3px;
}
.chart-tip.show { opacity: 1; }
.tip-title { color: var(--ink-3); font-size: 12.5px; }
.tip-value { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; }
.tip-row { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.tip-row b { margin-left: auto; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.sw { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.sw.in { background: var(--in); } .sw.out { background: var(--out); } .sw.buy { background: var(--buy); border-radius: 50%; }

/* ---------------------------------------------------------------- prévisions */
.mtable { display: grid; }
.mrow {
  display: grid; grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)); gap: 8px; align-items: center; width: 100%; padding: 12px 6px; border: 0;
  border-bottom: 1px solid var(--line); background: none; text-align: left; font-variant-numeric: tabular-nums; cursor: pointer; border-radius: 8px;
}
.mrow:last-child { border-bottom: 0; }
button.mrow:hover { background: var(--surface-2); }
.mhead { cursor: default; font-size: 12.5px; color: var(--ink-3); font-weight: 550; padding-top: 0; }
.mname { font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; }
.mbuy { font-size: 13px; }
.num { text-align: right; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 4px 0 8px; }
.kpis.two { grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; }
.kpi { background: var(--surface-2); border-radius: var(--r-s); padding: 10px 12px; display: grid; gap: 2px; min-width: 0; }
.kpi b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-cover { width: 36px; height: 36px; border-radius: 10px; background-size: cover; background-position: center; display: grid; place-items: center; font-size: 18px; flex: none; }
.month-nav { display: flex; justify-content: space-between; align-items: center; margin: -6px -8px 10px; }
.day-title { font-size: 13px; font-weight: 600; color: var(--ink-3); margin: 16px 0 0; }
.day-title::first-letter { text-transform: uppercase; }
.pending { border-color: color-mix(in srgb, var(--in) 40%, var(--line)); }

/* ---------------------------------------------------------------- formulaires */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 550; color: var(--ink-2); }
.field-hint { font-size: 12.5px; color: var(--ink-3); margin-top: -6px; }
.form > .field-hint { margin-top: -8px; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  font: 16px var(--font); transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
textarea.input { height: auto; padding: 11px 14px; resize: vertical; line-height: 1.4; }
.input:focus { outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 8%, transparent); }
.input::placeholder { color: var(--ink-3); }
input[type="date"].input, input[type="month"].input { min-height: 46px; line-height: 46px; }
.amount-wrap { position: relative; }
.amount-wrap .input { padding-right: 40px; }
.amount-big { height: 72px; font-size: 36px; font-weight: 700; letter-spacing: -0.03em; border-radius: 16px; }
.amount-cur { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 600; font-size: 18px; pointer-events: none; }
.amount-wrap:has(.amount-big) .amount-cur { font-size: 26px; right: 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stack { display: grid; gap: 10px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.form-actions .btn.wide, .form-actions .btn.primary { flex: 1; }
.more { margin-top: 12px; }
.more summary { cursor: pointer; font-size: 14px; color: var(--ink-2); font-weight: 550; padding: 6px 0; }
.more .form { margin-top: 10px; }
.inline-add { display: flex; gap: 8px; flex: 1 1 200px; }
.inline-add .input { height: 34px; font-size: 14px; border-radius: 999px; }
.inline-add .btn { height: 34px; border-radius: 999px; }

/* couverture d'un projet */
.cover-edit { display: grid; gap: 10px; }
.cover-preview { aspect-ratio: 16 / 7; border-radius: 16px; background-size: cover; background-position: center; display: grid; place-items: center; }
.cover-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.emoji-in { width: 64px; height: 36px; text-align: center; font-size: 18px; padding: 0 6px; border-radius: 10px; }

/* ---------------------------------------------------------------- fenêtre (feuille) */
.sheet-back {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(14, 14, 13, 0.36); opacity: 0; transition: opacity .2s;
}
.sheet-back.open { opacity: 1; }
.sheet {
  width: min(500px, 100%); max-height: min(88vh, 860px); overflow-y: auto; overscroll-behavior: contain; background: var(--surface);
  border-radius: 24px; box-shadow: var(--shadow-lg); transform: translateY(12px) scale(0.98); transition: transform .22s cubic-bezier(.2,.8,.2,1);
}
.sheet.wide { width: min(720px, 100%); }
.sheet-back.open .sheet { transform: none; }
.sheet-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 16px 12px 8px 22px; background: var(--surface); }
.sheet-grip { display: none; }
.sheet-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; flex: 1; }
.sheet-x { margin-left: auto; }
.sheet-body { padding: 4px 22px 24px; }
.sheet-body > p.muted { margin-bottom: 4px; }
.project-sheet .sheet-head { position: absolute; right: 0; left: auto; background: none; padding: 12px; }
.project-sheet .sheet-x { background: var(--glass); backdrop-filter: blur(10px); color: var(--ink); }
.project-sheet .sheet-body { padding: 0 0 24px; }
.project-detail > *:not(.detail-cover) { margin-left: 22px; margin-right: 22px; }
.detail-cover { position: relative; aspect-ratio: 16 / 9; background-size: cover; background-position: center; display: grid; place-items: center; }
.detail-badges { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; }
.detail-head { padding: 18px 0 6px; display: grid; gap: 2px; }
.detail-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
.detail-amount { font-size: 18px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.detail-note { color: var(--ink-2); font-style: italic; margin-top: 4px; }
.saved-box { margin-top: 14px; padding: 16px; border-radius: 18px; background: var(--surface-2); display: grid; gap: 12px; }
.saved-box .progress { background: var(--line); height: 8px; }
.saved-line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.saved-line b { font-size: 16px; }
.save-chips .chip { background: var(--surface); }
.history { margin-top: 14px; }
.hist-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hist-row:last-child { border-bottom: 0; }
.detail-actions { margin-top: 18px; }
.month-detail { display: grid; gap: 8px; }

/* bouton « + » */
.quick { display: grid; gap: 10px; }
.quick-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; transition: background .15s, transform .1s; }
.quick-opt:hover { background: var(--surface-2); }
.quick-opt:active { transform: scale(0.99); }
.quick-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.quick-ic.in { background: color-mix(in srgb, var(--in) 15%, transparent); color: var(--pos); }
.quick-ic.out { background: color-mix(in srgb, var(--out) 15%, transparent); color: var(--neg); }
.quick-ic.plan { background: color-mix(in srgb, var(--agence) 14%, transparent); color: var(--agence); }
.quick-ic.proj { background: color-mix(in srgb, var(--buy) 14%, transparent); color: var(--buy); }
.quick-txt { display: grid; gap: 1px; }
.quick-txt b { font-size: 15.5px; font-weight: 650; }
.quick-txt span { font-size: 13px; color: var(--ink-3); }

/* ---------------------------------------------------------------- message, confettis */
.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translate(-50%, 16px); opacity: 0; transition: all .22s cubic-bezier(.2,.8,.2,1);
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg);
  font-size: 14.5px; font-weight: 550; box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #b42318; color: #fff; }
.toast-action { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* ---------------------------------------------------------------- connexion */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(380px, 100%); display: grid; gap: 14px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 4px; }
.auth-title { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; text-align: center; }
.auth .form { margin-top: 10px; }

/* ---------------------------------------------------------------- barre d'onglets (mobile) */
.tabbar { display: none; }

@media (max-width: 800px) {
  .topbar { grid-template-columns: auto 1fr; height: 56px; padding-left: 16px; padding-right: 12px; }
  .topnav, .hide-s, .top-gear { display: none !important; }
  .brand-name { font-size: 17px; }
  .main { padding: 4px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
  .view-title { font-size: 26px; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tab { display: grid; justify-items: center; gap: 3px; font-size: 10.5px; font-weight: 550; color: var(--ink-3); padding-top: 4px; }
  .tab.on { color: var(--ink); }
  .tab-add { justify-self: center; width: 52px; height: 52px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(18,18,17,.22); cursor: pointer; transition: transform .1s; }
  .tab-add:active { transform: scale(0.94); }
  .has-sheet .tabbar { visibility: hidden; }

  .hero { grid-template-columns: 1fr; gap: 16px; padding-top: 12px; }
  .tiles { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 6px; gap: 10px; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 72%; scroll-snap-align: start; min-height: 120px; }
  .onboard .steps { grid-template-columns: 1fr; }
  .board { display: block; }
  .col { background: none; padding: 0; margin-bottom: 18px; min-height: 0; }
  .col-head { padding: 0 0 8px; }
  .col-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 10px; gap: 12px; scrollbar-width: none; }
  .col-cards::-webkit-scrollbar { display: none; }
  .pcard { flex: 0 0 74%; max-width: 300px; scroll-snap-align: start; }
  .add-card { flex: 0 0 auto; width: 110px; height: auto; min-height: 120px; flex-direction: column; }
  .col-cards:not(:has(.pcard)) .add-card { width: 100%; min-height: 64px; flex-direction: row; }
  .card { padding: 16px; border-radius: 18px; }
  .mrow { grid-template-columns: 1.2fr repeat(3, minmax(0, 1fr)); padding: 11px 2px; font-size: 14px; gap: 6px; }
  .hide-s { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpis.two { grid-template-columns: repeat(3, 1fr); }
  .kpis.two .kpi b { font-size: 14px; }

  .sheet-back { align-items: flex-end; padding: 0; }
  .sheet { width: 100%; max-height: 92vh; border-radius: 24px 24px 0 0; padding-bottom: env(safe-area-inset-bottom); transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
  .sheet.wide { width: 100%; }
  .sheet-head { padding: 22px 10px 6px 20px; }
  .sheet-grip { display: block; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 38px; height: 5px; border-radius: 9px; background: var(--line-2); }
  .sheet-body { padding: 4px 20px 20px; }
  .project-sheet .sheet-grip { background: rgba(255,255,255,.7); }
  .project-detail > *:not(.detail-cover) { margin-left: 20px; margin-right: 20px; }
  .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); }
  .has-sheet .toast { bottom: 24px; }
  .top-right .space-seg .seg-btn { padding: 0 10px; }
}
@media (max-width: 380px) {
  .grid2 { grid-template-columns: 1fr; }
  .top-right .space-seg .seg-btn { padding: 0 8px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.sheet { position: relative; }
/* une grille ne doit jamais s'élargir à cause d'une rangée qui défile (cartes du haut, projets) */
.view > *, .hero > *, .board > * { min-width: 0; }
@media (max-width: 800px) {
  .tiles, .col-cards { scroll-padding-inline: 16px; }
}
.saved-box .btn.soft { background: var(--surface); }
.project-sheet .sheet-grip { display: none !important; }
.detail-actions .btn { padding: 0 14px; }
.detail-actions .btn.soft { flex: none; }
.detail-actions .btn.ghost { width: 44px; padding: 0; flex: none; }
/* un seul compte : le point indique seulement si l'argent rentre (vert) ou sort (orange) */
.space-dot.in { background: var(--in); }
.space-dot.out { background: var(--out); }
/* banques */
.src.bank { color: var(--agence); background: color-mix(in srgb, var(--agence) 12%, transparent); }
.banks { display: grid; gap: 14px; margin: 6px 0 12px; }
.bank { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 4px; }
.bank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bank .row { min-height: 52px; }
.bank .switch { margin-left: 4px; }
.guide { margin: 8px 0 16px; padding-left: 20px; display: grid; gap: 10px; font-size: 14.5px; color: var(--ink-2); }
.guide a { color: var(--ink); text-decoration: underline; }
.guide b { color: var(--ink); }
.copy-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.copy-line code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; color: var(--ink); }
.file-in { padding-top: 11px; font-size: 14px; }
.bank-list { display: grid; gap: 4px; max-height: 52vh; overflow-y: auto; margin: 0 -6px; }
.bank-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 6px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; }
.bank-opt:hover { background: var(--surface-2); }
.bank-opt.busy { opacity: .5; }
.bank-logo { width: 32px; height: 32px; border-radius: 9px; object-fit: contain; background: #fff; border: 1px solid var(--line); flex: none; }
.bank-name { flex: 1; font-weight: 550; display: flex; gap: 8px; align-items: center; }
.guide > li, .setup, .bank-card, .card { min-width: 0; }
.guide > li { overflow-wrap: anywhere; }
