/* Carnet de bord : sable, lagon, corail. Mobile d'abord, une colonne de lecture. */
:root {
  --bg: #f4ede1; --bg2: #ebe2d2; --card: #fffaf2; --ink: #17302b; --muted: #6c7a72; --line: #e0d5c2;
  --lagon: #0f6b5c; --lagon-soft: #d6ebe4; --coral: #e2603f; --coral-soft: #f8dcd1;
  --besoin: #0f6b5c; --lifestyle: #e2603f; --pro: #c79a2b; --impots: #7d8a99; --a_confirmer: #b9b0a0;
  --shadow: 0 1px 0 rgba(23, 48, 43, .04), 0 8px 24px -12px rgba(23, 48, 43, .18);
  --f-display: "Fraunces", Georgia, serif; --f-body: "Work Sans", -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1f1c; --bg2: #132824; --card: #16302b; --ink: #ecf1ea; --muted: #94a8a0; --line: #24423b;
    --lagon: #4cc2a7; --lagon-soft: #173f37; --coral: #ff8a6a; --coral-soft: #4a2a22;
    --besoin: #4cc2a7; --lifestyle: #ff8a6a; --pro: #e4bb55; --impots: #9aa8b7; --a_confirmer: #6f7d76;
    --shadow: 0 10px 30px -14px rgba(0, 0, 0, .6); color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--f-body); }
body { background: radial-gradient(120% 60% at 100% 0%, var(--lagon-soft) 0%, transparent 55%), var(--bg); min-height: 100dvh; }
[hidden] { display: none !important; }
h1, h2, .big { font-family: var(--f-display); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 19px; font-weight: 600; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.eyebrow { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0; }
.num, .big, .amt { font-variant-numeric: tabular-nums; }

main { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 110px); }
.view { display: flex; flex-direction: column; gap: 14px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view, .hero, .card { animation: none !important; } }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.title { font-size: 34px; font-weight: 700; line-height: 1.05; }
select, input[type=search] {
  font: 500 15px var(--f-body); color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; appearance: none; box-shadow: var(--shadow);
}
.search input { width: 100%; border-radius: 14px; padding: 12px 14px; }

.card, .hero { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); }
.card { display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.hero { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--lagon) 0%, #0b4f44 100%); color: #f4ede1; border: 0; }
.hero .eyebrow { color: rgba(244, 237, 225, .75); }
.hero { --h-besoin: #9ad8c6; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 96, 63, .55), transparent 70%); }
.big { font-size: 52px; font-weight: 700; line-height: 1; margin: 8px 0 14px; position: relative; z-index: 1; }
.big small { font-size: 22px; font-weight: 400; opacity: .8; }
.split-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, .15); position: relative; z-index: 1; }
.split-bar span { height: 100%; transition: width .5s ease; }
.legend { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 14px; position: relative; z-index: 1; }
.legend li { display: flex; align-items: center; gap: 7px; }
.legend b { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.hero .dot { outline: 1.5px solid rgba(255, 255, 255, .6); }

.chart { width: 100%; height: auto; }
.chart text { font: 10.5px var(--f-body); fill: var(--muted); }
.chart .sel { fill: var(--ink); font-weight: 600; }

.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.insight { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.insight .v { font: 700 24px var(--f-display); font-variant-numeric: tabular-nums; }
.insight .l { font-size: 13px; color: var(--muted); }
.insight.warn { background: var(--coral-soft); border-color: transparent; }
.insight.wide { grid-column: 1 / -1; }

.cats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.cats li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.cats li:first-child { border-top: 0; }
.cats .name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.cats .amt { font-weight: 600; }
.cats .meter { grid-column: 1 / -1; height: 5px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.cats .meter i { display: block; height: 100%; border-radius: 99px; }
.cats .trend { font-size: 12px; color: var(--muted); font-weight: 500; }
.trend.up { color: var(--coral); } .trend.down { color: var(--lagon); }

.tx-list { list-style: none; padding: 0; margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
.tx-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.tx-list li:first-child { border-top: 0; }
.tx-list .day { grid-column: 1 / -1; background: var(--bg2); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 7px 16px; cursor: default; }
.tx-list .lbl { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-list .meta { font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.tx-list .amt { font-weight: 600; text-align: right; }
.tx-list .orig { font-size: 12px; color: var(--muted); text-align: right; }

.todo { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; animation: rise .3s ease both; }
.todo.gone { animation: out .25s ease forwards; }
@keyframes out { to { opacity: 0; transform: translateX(40px); height: 0; padding: 0; margin: 0; } }
.todo .row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.todo .lbl { font-weight: 600; }
.todo .amt { font: 700 20px var(--f-display); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font: 500 14px var(--f-body); color: var(--ink); background: var(--bg2); border: 1px solid transparent; border-radius: 99px; padding: 8px 12px; cursor: pointer; }
.chip.more { background: transparent; border-color: var(--line); }
.chip:active { transform: scale(.96); }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { color: var(--lagon); font-size: 40px; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; font: 600 15px var(--f-body); color: var(--ink); background: var(--bg2); border: 0; border-radius: 14px; padding: 13px 16px; cursor: pointer; }
.btn.primary { background: var(--lagon); color: #fff; width: 100%; padding: 16px; font-size: 16px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
code { font: 13px ui-monospace, Menlo, monospace; background: var(--bg2); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
#token { display: block; padding: 10px; font-size: 14px; }
.steps { padding-left: 20px; margin: 6px 0 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.banks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.banks li { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; }
.err { color: var(--coral); font-size: 14px; min-height: 1em; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
  padding: 8px 8px calc(env(safe-area-inset-bottom) + 8px); background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
.tabs button { position: relative; background: none; border: 0; color: var(--muted); font: 500 11px var(--f-body); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; cursor: pointer; }
.tabs button.on { color: var(--lagon); }
.snap { justify-self: center; width: 64px; height: 64px; margin-top: -26px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center;
  box-shadow: 0 10px 24px -8px rgba(226, 96, 63, .7); cursor: pointer; transition: transform .15s; }
.snap:active { transform: scale(.92); }
.snap.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .75; } }
.badge { position: absolute; top: -2px; right: calc(50% - 22px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--coral); color: #fff; font-size: 11px; line-height: 18px; }

.ico { width: 24px; height: 24px; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.snap .ico { width: 30px; height: 30px; }
.i-home { --m: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/></svg>'); }
.i-list { --m: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round"><path d="M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01"/></svg>'); }
.i-cam { --m: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14.5 4h-5L7.5 6.5H4a1 1 0 0 0-1 1V19a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V7.5a1 1 0 0 0-1-1h-3.5z"/><circle cx="12" cy="13" r="3.5"/></svg>'); }
.i-check { --m: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 11l3 3 8-8"/><path d="M20 12v7a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11"/></svg>'); }
.i-gear { --m: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg>'); }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(10, 20, 18, .45); display: flex; align-items: flex-end; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet-body { width: 100%; max-width: 640px; margin: 0 auto; max-height: 86dvh; overflow: auto; background: var(--card); border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(env(safe-area-inset-bottom) + 22px); display: flex; flex-direction: column; gap: 12px; animation: up .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes up { from { transform: translateY(40%); } }
.sheet-body::before { content: ""; width: 40px; height: 5px; border-radius: 9px; background: var(--line); align-self: center; }
.sheet h2 { font-size: 24px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 500; }
.receipt-img { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; }
.items { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.items li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 30; max-width: 600px; margin: 0 auto;
  background: var(--ink); color: var(--bg); padding: 13px 16px; border-radius: 16px; font-size: 14px; opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: none; }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.login h1 { font-size: 44px; }
.mark { width: 72px; height: 72px; border-radius: 22px; background: linear-gradient(160deg, var(--lagon), #0b4f44); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.mark::after { content: ""; position: absolute; width: 46px; height: 46px; right: -12px; top: -12px; border-radius: 50%; background: var(--coral); }

.chart .val { font: 600 11px var(--f-body); fill: var(--ink); }
.chart-split { margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 12px; }
.chart-split .split-bar { background: var(--bg2); height: 10px; }
.cs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.cs-head > span:last-child { display: flex; flex-direction: column; align-items: flex-end; }
.cs-total { font: 700 22px var(--f-display); font-variant-numeric: tabular-nums; }
.cs-head .trend { font-size: 12px; color: var(--muted); }
.cs-row { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.cs-row .pct { color: var(--muted); font-size: 13px; }
.cs-row .amt { margin-left: auto; font-variant-numeric: tabular-nums; }
.cs-cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0 17px; }
.cs-cats button { font: 13px var(--f-body); color: var(--ink); background: var(--bg2); border: 0; border-radius: 99px; padding: 5px 10px; cursor: pointer; }
.cs-cats button b { font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 3px; }

.who { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--bg2); border-radius: 14px; font-size: 14px; }
.who p { margin: 0; }
.who-sum { line-height: 1.4; }
.who .kind { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; margin-right: 7px; background: var(--card); color: var(--muted); vertical-align: 1px; }
.who .kind.entreprise, .who .kind.professionnel { background: var(--besoin); color: #fff; }
.who .conf { color: var(--muted); font-size: 12px; margin-left: 4px; white-space: nowrap; }
.who-src { display: flex; flex-wrap: wrap; gap: 10px; }
.who a, .who .link { color: var(--besoin); font: 600 13px var(--f-body); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.who .link:disabled { color: var(--muted); }
.who-raw { font: 12px ui-monospace, Menlo, monospace; color: var(--muted); word-break: break-word; }
.who-hist { font-size: 13px; color: var(--muted); }
.who-act { display: flex; gap: 16px; }
.chip.sug { background: var(--besoin); color: #fff; }
.chip.sug::after { content: " · suggéré"; font-size: 12px; opacity: .85; }
